Commit f9b24111 by yanju

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

parents b94d61ca e80cc168
module.exports = { module.exports = {
server:{ server:{
port:3010, port: process.env.NODE_ENV === 'production' ? 3011 : 3010,
host:'0.0.0.0' host:'0.0.0.0'
}, },
...@@ -57,6 +57,13 @@ module.exports = { ...@@ -57,6 +57,13 @@ module.exports = {
modules: [ modules: [
'@nuxtjs/axios', '@nuxtjs/axios',
], ],
/**
* axios options
*/
axios: {
baseURL: process.env.NODE_ENV === 'production' ? 'http://localhost:8080' : 'http://opensource.yundingshuyuan.com',
browserBaseURL: 'http://opensource.yundingshuyuan.com'
},
router: { router: {
scrollBehavior (to, from, savedPosition) { scrollBehavior (to, from, savedPosition) {
......
...@@ -5,7 +5,14 @@ ...@@ -5,7 +5,14 @@
title="以发布的问题" title="以发布的问题"
width="302px" width="302px"
height="270px" 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 <card-container
title="问题草稿箱" title="问题草稿箱"
width="302px" width="302px"
...@@ -66,6 +73,12 @@ ...@@ -66,6 +73,12 @@
import config from "../../../action/config"; import config from "../../../action/config";
export default { export default {
async asyncData({$axios, query}) { 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); const questionClass = await $axios.$get(config.api.get.QuestionCategory.list);
let classList = []; let classList = [];
questionClass.data.forEach(item => { questionClass.data.forEach(item => {
...@@ -74,16 +87,21 @@ ...@@ -74,16 +87,21 @@
tagId: item.categoryId tagId: item.categoryId
}) })
}); });
console.log(classList) //console.log(classList);
if (query.hasOwnProperty('id')) { if (query.hasOwnProperty('id')) {
const response = await $axios.$get(config.api.get.Question.detail + query.id); const response = await $axios.$get(config.api.get.Question.detail + query.id);
console.log(response); console.log(response);
return { return {
questionList: questionListRes.data.dataList,
response:response, response:response,
classList classList
} }
}else{ return {classList}} }else{
return {classList,
questionList: questionListRes.data.dataList,}
}
}, },
mounted(){ mounted(){
...@@ -153,6 +171,9 @@ ...@@ -153,6 +171,9 @@
} }
}, },
methods: { methods: {
toDetail(path) {
this.$router.push(`/answer/detail/${path}`);
},
handleClass(value) { handleClass(value) {
this.blogClass = value.tagId; this.blogClass = value.tagId;
}, },
...@@ -340,6 +361,25 @@ ...@@ -340,6 +361,25 @@
align-items: start; align-items: start;
.answer-release-container__l { .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 { .answer-release-container__r {
......
...@@ -154,8 +154,6 @@ ...@@ -154,8 +154,6 @@
}) })
}, },
dataPostSaveUserInfo(type){ dataPostSaveUserInfo(type){
let userInfo1 = { let userInfo1 = {
gender:this.gender, gender:this.gender,
nickName:this.nickName, nickName:this.nickName,
...@@ -167,7 +165,11 @@ ...@@ -167,7 +165,11 @@
if (this.wxNumber) userInfo2.wxNumber =this.wxNumber; if (this.wxNumber) userInfo2.wxNumber =this.wxNumber;
this.$axios.$put(config.api.put.User.reviseInfo,type===1?userInfo1:userInfo2).then((response)=>{ this.$axios.$put(config.api.put.User.reviseInfo,type===1?userInfo1:userInfo2).then((response)=>{
if(response.code===0){ 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.$store.commit('userProfile/setUser', user);
this.getDataUserInfo(); this.getDataUserInfo();
this.isEdit = false; this.isEdit = false;
......
...@@ -5,7 +5,14 @@ ...@@ -5,7 +5,14 @@
title="已发布项目" title="已发布项目"
width="302px" width="302px"
height="400px" 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 <card-container
title="项目草稿箱" title="项目草稿箱"
width="302px" width="302px"
...@@ -157,6 +164,12 @@ import config from '../../../action/config'; ...@@ -157,6 +164,12 @@ import config from '../../../action/config';
export default { export default {
async asyncData({$axios, query}) { 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); const projectCategory = await $axios.$get(config.api.get.ProjectCategory.list);
let classList=[]; let classList=[];
projectCategory.data.forEach(item=>{ projectCategory.data.forEach(item=>{
...@@ -170,11 +183,15 @@ export default { ...@@ -170,11 +183,15 @@ export default {
const response = await $axios.$get(config.api.get.Project.detail + query.id); const response = await $axios.$get(config.api.get.Project.detail + query.id);
console.log(response); console.log(response);
return { return {
projectList: projectListRes.data.dataList,
response:response, response:response,
classList classList
} }
}else{ }else{
return {classList} return {
classList,
projectList: projectListRes.data.dataList,
}
} }
}, },
mounted() { mounted() {
...@@ -250,6 +267,9 @@ export default { ...@@ -250,6 +267,9 @@ export default {
} }
}, },
methods: { methods: {
toDetail(path) {
this.$router.push(`/project/detail/${path}`);
},
imgAdd(pos, file) { imgAdd(pos, file) {
// filename: 写在md中的文件名, File: File Object // filename: 写在md中的文件名, File: File Object
// 第一步.将图片上传到服务器. // 第一步.将图片上传到服务器.
...@@ -481,6 +501,26 @@ export default { ...@@ -481,6 +501,26 @@ export default {
align-items: start; align-items: start;
.project-release-container__l { .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 { .project-release-container__r {
......
export default function ({ store, redirect, app: { $axios } }) { export default function ({ store, redirect, app: { $axios } }) {
// 数据访问前缀
$axios.defaults.baseURL = 'http://opensource.yundingshuyuan.com';
$axios.defaults.browserBaseURL = 'http://opensource.yundingshuyuan.com';
// request拦截器,我这里设置了一个token,当然你可以不要 // request拦截器,我这里设置了一个token,当然你可以不要
$axios.onRequest((config) => { $axios.onRequest((config) => {
const auth = store.state.auth; const auth = store.state.auth;
......
...@@ -17,7 +17,6 @@ export const actions = { ...@@ -17,7 +17,6 @@ export const actions = {
} catch (e) { } catch (e) {
// 请求出错,删除认证信息 // 请求出错,删除认证信息
commit('auth/logout') commit('auth/logout')
console.log(e)
} }
} }
} }
......
...@@ -3,27 +3,21 @@ const defaultUser = { ...@@ -3,27 +3,21 @@ const defaultUser = {
nickName: null, nickName: null,
avatar: null avatar: null
} }
export const state = () => defaultUser export const state = () => ({
... defaultUser
})
export const mutations = { export const mutations = {
setUser (state, user) { setUser (state, user) {
if(user.userId){
Object.assign(state, { Object.assign(state, {
userId: user.userId, 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) { 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