Commit f9b24111 by yanju

Merge branch 'master' of coding.yundingshuyuan.com:pigbigbig/beyond-clouds-front

parents b94d61ca e80cc168
module.exports = {
server:{
port:3010,
port: process.env.NODE_ENV === 'production' ? 3011 : 3010,
host:'0.0.0.0'
},
......@@ -57,6 +57,13 @@ module.exports = {
modules: [
'@nuxtjs/axios',
],
/**
* axios options
*/
axios: {
baseURL: process.env.NODE_ENV === 'production' ? 'http://localhost:8080' : 'http://opensource.yundingshuyuan.com',
browserBaseURL: 'http://opensource.yundingshuyuan.com'
},
router: {
scrollBehavior (to, from, savedPosition) {
......
......@@ -5,7 +5,14 @@
title="以发布的问题"
width="302px"
height="270px"
></card-container>
>
<div class="answer-release_List" v-for="val in questionList" :key="val.questionId" :info="val">
<div class="answer-box" @click="toDetail(val.questionId)">
<p>{{val.questionTitle}}</p>
<p style="color: #999">{{val.category}}</p>
</div>
</div>
</card-container>
<card-container
title="问题草稿箱"
width="302px"
......@@ -66,6 +73,12 @@
import config from "../../../action/config";
export default {
async asyncData({$axios, query}) {
const questionListRes = await $axios.$get(config.api.get.Question.myCreated, {
params: {
page: 1,
size: 12,
}
});
const questionClass = await $axios.$get(config.api.get.QuestionCategory.list);
let classList = [];
questionClass.data.forEach(item => {
......@@ -74,16 +87,21 @@
tagId: item.categoryId
})
});
console.log(classList)
//console.log(classList);
if (query.hasOwnProperty('id')) {
const response = await $axios.$get(config.api.get.Question.detail + query.id);
console.log(response);
return {
questionList: questionListRes.data.dataList,
response:response,
classList
}
}else{ return {classList}}
}else{
return {classList,
questionList: questionListRes.data.dataList,}
}
},
mounted(){
......@@ -153,6 +171,9 @@
}
},
methods: {
toDetail(path) {
this.$router.push(`/answer/detail/${path}`);
},
handleClass(value) {
this.blogClass = value.tagId;
},
......@@ -340,6 +361,25 @@
align-items: start;
.answer-release-container__l {
.answer-release_List {
width: 266*$length;
padding: 0 18*$length;
.answer-box {
margin: 15*$length 0;
@extend %cursorPointer;
@include fontStyle(13,17,500,#333,left);
@extend %flex-row-spb;
@extend %cursorPointer;
.answer-box__title {
width: 60%;
@extend %nowrap;
}
&:hover {
color: #00AAE6;
}
}
}
}
.answer-release-container__r {
......
......@@ -154,8 +154,6 @@
})
},
dataPostSaveUserInfo(type){
let userInfo1 = {
gender:this.gender,
nickName:this.nickName,
......@@ -167,7 +165,11 @@
if (this.wxNumber) userInfo2.wxNumber =this.wxNumber;
this.$axios.$put(config.api.put.User.reviseInfo,type===1?userInfo1:userInfo2).then((response)=>{
if(response.code===0){
let user = {userAvatar:this.userAvatar}
let user = {
... this.$store.state.userProfile,
userAvatar:this.userAvatar,
nickName: this.nickName
}
this.$store.commit('userProfile/setUser', user);
this.getDataUserInfo();
this.isEdit = false;
......
......@@ -5,7 +5,14 @@
title="已发布项目"
width="302px"
height="400px"
></card-container>
>
<div class="project-release_List" v-for="val in projectList" :key="val.projectId" :info="val">
<div class="project-box" @click="toDetail(val.projectId)">
<p>{{val.projectName}}</p>
<p style="color: #999">{{val.category}}</p>
</div>
</div>
</card-container>
<card-container
title="项目草稿箱"
width="302px"
......@@ -157,6 +164,12 @@ import config from '../../../action/config';
export default {
async asyncData({$axios, query}) {
const projectListRes = await $axios.$get(config.api.get.Project.myList, {
params: {
page: 1,
size: 12,
}
});
const projectCategory = await $axios.$get(config.api.get.ProjectCategory.list);
let classList=[];
projectCategory.data.forEach(item=>{
......@@ -170,11 +183,15 @@ export default {
const response = await $axios.$get(config.api.get.Project.detail + query.id);
console.log(response);
return {
projectList: projectListRes.data.dataList,
response:response,
classList
}
}else{
return {classList}
return {
classList,
projectList: projectListRes.data.dataList,
}
}
},
mounted() {
......@@ -250,6 +267,9 @@ export default {
}
},
methods: {
toDetail(path) {
this.$router.push(`/project/detail/${path}`);
},
imgAdd(pos, file) {
// filename: 写在md中的文件名, File: File Object
// 第一步.将图片上传到服务器.
......@@ -481,6 +501,26 @@ export default {
align-items: start;
.project-release-container__l {
.project-release_List {
width: 266*$length;
padding: 0 18*$length;
.project-box {
margin: 15*$length 0;
@extend %cursorPointer;
@include fontStyle(13,17,500,#333,left);
@extend %flex-row-spb;
@extend %cursorPointer;
.project-box__title {
width: 60%;
@extend %nowrap;
}
&:hover {
color: #00AAE6;
}
}
}
}
.project-release-container__r {
......
export default function ({ store, redirect, app: { $axios } }) {
// 数据访问前缀
$axios.defaults.baseURL = 'http://opensource.yundingshuyuan.com';
$axios.defaults.browserBaseURL = 'http://opensource.yundingshuyuan.com';
// request拦截器,我这里设置了一个token,当然你可以不要
$axios.onRequest((config) => {
const auth = store.state.auth;
......
......@@ -17,7 +17,6 @@ export const actions = {
} catch (e) {
// 请求出错,删除认证信息
commit('auth/logout')
console.log(e)
}
}
}
......
......@@ -3,27 +3,21 @@ const defaultUser = {
nickName: null,
avatar: null
}
export const state = () => defaultUser
export const state = () => ({
... defaultUser
})
export const mutations = {
setUser (state, user) {
if(user.userId){
Object.assign(state, {
userId: user.userId,
nickName: user.nickName,
avatar: user.userAvatar
})
}
if(user.userAvatar){
Object.assign(state, {
avatar: user.userAvatar,
})
}
if(user.nickName){
Object.assign(state, {
nickName: user.nickName
})
}
},
removeUser (state) {
Object.assign(state, defaultUser)
Object.assign(state, {
... defaultUser
})
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment