diff --git a/src/api/phase2/guestbook.js b/src/api/phase2/guestbook.js index d17663ad..6b256a9b 100644 --- a/src/api/phase2/guestbook.js +++ b/src/api/phase2/guestbook.js @@ -12,14 +12,14 @@ const baseURL = process.env.VUE_APP_CESOURCE_BASE_API; * } * */ const save=function (data){ - return ajax.postJson('/xboe/subgroup/m/guest/save',data); + return ajax.postJson(baseURL,'/xboe/subgroup/m/guest/save',data); } /** * 删除留言 * */ const del=function (id){ - return ajax.get('/xboe/subgroup/m/guest/delete?id='+id); + return ajax.get(baseURL,'/xboe/subgroup/m/guest/delete?id='+id); } /** @@ -30,7 +30,7 @@ const del=function (id){ * } * */ const answer=function (data){ - return ajax.post('/xboe/subgroup/m/guest/answer',data); + return ajax.post(baseURL,'/xboe/subgroup/m/guest/answer',data); } /** @@ -42,7 +42,7 @@ const answer=function (data){ * } * */ const givelist=function (query){ - return ajax.post('/xboe/subgroup/m/guest/givelist',query); + return ajax.post(baseURL,'/xboe/subgroup/m/guest/givelist',query); } /** @@ -54,7 +54,7 @@ const givelist=function (query){ * } * */ const mylist=function (query){ - return ajax.post('/xboe/subgroup/m/guest/mylist',query); + return ajax.post(baseURL,'/xboe/subgroup/m/guest/mylist',query); } export default { diff --git a/src/api/phase2/userfollow.js b/src/api/phase2/userfollow.js index 11f23aeb..50e14e3a 100644 --- a/src/api/phase2/userfollow.js +++ b/src/api/phase2/userfollow.js @@ -69,7 +69,7 @@ const counts=function (aid){ * } * */ const has=function (followId){ - return ajax.get('/xboe/subgroup/m/userfollow/has?followId='+followId); + return ajax.get(baseURL,'/xboe/subgroup/m/userfollow/has?followId='+followId); } export default { diff --git a/src/components/HomePage/followList.vue b/src/components/HomePage/followList.vue index e54c8f35..240bb9a1 100644 --- a/src/components/HomePage/followList.vue +++ b/src/components/HomePage/followList.vue @@ -1,19 +1,32 @@ @@ -42,7 +61,8 @@ import showTime from '@/components/Portal/datetimeShow.vue' import apiComment from '@/api/modules/comments.js' import apiUser from '@/api/system/user.js' - import authorInfo from '@/components/Portal/authorInfo.vue'; + import apiGuestbook from '@/api/phase2/guestbook.js' + import authorImg from '@/components/Portal/authorImg.vue'; // import author from '@/components/Portal/author.vue'; import interactBar from "@/components/Portal/interactBar.vue"; import { mapGetters } from 'vuex'; @@ -50,13 +70,25 @@ props:{ }, - components:{showTime,authorInfo,interactBar}, + components:{showTime,authorImg,interactBar}, computed: { ...mapGetters(['userInfo']) }, data() { return { textarea:'', + replysContent:'', + leavingList:[], + count:0, + page:{ + pageIndex:1, + pageSize:10, + aid:'' + }, + replys:{ + id:'', + reply:[], + } } }, watch:{ @@ -64,11 +96,87 @@ }, mounted() { - + this.pageId = this.$route.query.id; + this.getList(); }, - methods: { - - } + methods: { + isReplys(item,idx) { + item.isReplys = true; + this.replys.id = item.id; + }, + addReplys() { + this.replys.reply.content = this.replysContent; + this.replys.reply.push({ + content: this.replysContent, + aid:this.userInfo.aid + }) + this.replys.reply = JSON.stringify(this.replys.reply); + apiGuestbook.answer(this.replys).then(res=>{ + + }) + }, + getList() { + this.page.aid = this.pageId; + apiGuestbook.givelist(this.page).then(res=>{ + if(res.status == 200) { + this.count = res.result.count; + res.result.list.forEach(item=>{ + // item.replysList = []; + // item.replys = JSON.parse(item.replys); + item.isReplys = false; + item.authorInfo = { aid: "",name: "",orgInfo: "",avatar: "",sex: null } + }) + this.leavingList = res.result.list; + this.getUserData(res.result.list); + console.log(this.leavingList,'this.leavingList '); + } + }) + }, + add() { + let data = { + content:this.textarea,//留言内容 + aid:this.pageId,// 要留言的人的id + } + apiGuestbook.save(data).then(res=>{ + if(res.status == 200) { + this.textarea = ''; + this.leavingList.push(res.result); + this.$message.success('留言发布成功'); + } else { + this.$message.error(res.message); + } + }) + }, + getUserData(list) { + let ids = list.map(item=> item.aid); + const noReapetIds = [...new Set(ids)]; + apiUser.getByIds(noReapetIds).then(res => { + if (res.status == 200) { + list.forEach((item, index) => { + res.result.some(author => { + if (author.aid == item.aid) { + item.authorInfo = author; + return true; + } else { + return false; + } + }); + }); + } else { + this.$message.error(res.message); + } + }); + }, + handleSizeChange(val) { + this.page.pageSize = val; + this.page.pageIndex = 1; + this.getList(); + }, + handleCurrentChange(val) { + this.page.pageIndex = val; + this.getList(); + }, + } } @@ -124,8 +232,23 @@ color: #333333; } } + .replys-input{ + padding-left: 50px; + // display: flex; + // .el-textarea{ + // width: 80%; + // } + } .li-right{ - margin-top: 40px; + display: flex; + margin-top: 40px; + .replys-icon{ + width: 50px; + color: #6E7B84; + font-size: 12px; + margin-right: 22px; + margin-top: 8px; + } } } } diff --git a/src/views/homepage/page.vue b/src/views/homepage/page.vue index 3b143cb3..8e7f50b8 100644 --- a/src/views/homepage/page.vue +++ b/src/views/homepage/page.vue @@ -44,7 +44,7 @@ 关注 - + 书籍 @@ -125,7 +125,6 @@ } this.loadMajorType(); this.loadOrgDomain(); - console.log(this.orgDomainMap,'orgDomainMap'); }, methods:{ ...mapActions({ @@ -426,7 +425,18 @@ } }) }, - handleClick(e) { + handleClick() { + if(this.activeName == '7') { + this.$refs.followList.getPage(); + this.page.count = 0; + return + } + if(this.activeName == '8') { + this.page.count = 0; + // console.log(this.$refs.followList,'this.$refs.followList'); + // this.$refs.followList.getPage(); + return + } this.getList(); } }, diff --git a/src/views/medal/Index.vue b/src/views/medal/Index.vue index ca3ea63b..96d49724 100644 --- a/src/views/medal/Index.vue +++ b/src/views/medal/Index.vue @@ -125,6 +125,9 @@ let data = this.medalConfig.find(it=>it.id ==item.medalId); this.rules = JSON.parse(data.rules); console.log(data,'data'); + apiStat.userMedalLevelInfo(item.id).then(res=>{ + + }) }, getMedal() { apiStat.userMedal(this.userInfo.aid).then(res=>{ diff --git a/src/views/portal/article/Index.vue b/src/views/portal/article/Index.vue index e7f23db6..aa7d37b2 100644 --- a/src/views/portal/article/Index.vue +++ b/src/views/portal/article/Index.vue @@ -70,7 +70,7 @@
- +