From 2aa0baf1ebbd7eeca67b8982031a4700eb9033d8 Mon Sep 17 00:00:00 2001 From: zhaofang <752743406@qq.com> Date: Thu, 10 Nov 2022 13:48:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E7=9A=84=E5=9B=9E=E7=AD=94-=E5=9B=9E?= =?UTF-8?q?=E7=AD=94?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pages/my/myAnswers.vue | 7 -- pages/my/myQa.vue | 228 +++++++++++++++++++++++++++++++++++++++-- 2 files changed, 218 insertions(+), 17 deletions(-) diff --git a/pages/my/myAnswers.vue b/pages/my/myAnswers.vue index 48f90e1..f7229e9 100644 --- a/pages/my/myAnswers.vue +++ b/pages/my/myAnswers.vue @@ -34,9 +34,6 @@ - 我的回答:{{ item.answercontent }} - - 回复时间:{{ item.sysCreateTimeA }} @@ -74,8 +69,6 @@ - - diff --git a/pages/my/myQa.vue b/pages/my/myQa.vue index 397cc8b..9d602b2 100644 --- a/pages/my/myQa.vue +++ b/pages/my/myQa.vue @@ -56,6 +56,66 @@ + + + + + + + + 【已解决】 + 【待解决】 + {{item.title}} + + + + 我的回答: + {{ item.answercontent }} + + + + + {{ item.sysCreateTimeA }} + + + 编辑 + + + 删除 + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -72,9 +132,11 @@ }, data() { return { + inputShow:false, loadStatus:'more', active:1, keyword:'', + inputValue: '', uCoinRecord:[], uinfo: { uCurrency: 0 ,// 用户累计U币 @@ -85,6 +147,13 @@ pageSize:10, list:[], count:0, + }, + reply: {}, + answerList:{ + pageIndex:1, + pageSize:10, + list:[], + count:0, } } }, @@ -92,20 +161,88 @@ this.onReachBottom(); }, async onReachBottom() { - if (this.putList.list.length < this.putList.count) { - this.loadStatus = 'loading'; //more,loading,noMore - this.putList.pageIndex++; - await this.findData(false); - this.loadStatus = 'more'; - } else { - this.loadStatus = 'noMore'; - } + if(this.active == 1) { + if (this.putList.list.length < this.putList.count) { + this.loadStatus = 'loading'; //more,loading,noMore + this.putList.pageIndex++; + await this.findData(false); + this.loadStatus = 'more'; + } else { + this.loadStatus = 'noMore'; + } + } else { + if (this.answerList.list.length < this.answerList.count) { + this.loadStatus = 'loading'; //more,loading,noMore + this.answerList.pageIndex++; + await this.findAnData(false); + this.loadStatus = 'more'; + } else { + this.loadStatus = 'noMore'; + } + } + }, mounted() { - this.findData(true) + this.findData(true); + this.findAnData(true); }, methods:{ + publishReply() { + const $this=this; + let {answerid,content,sysCreateAid,favorites,praises,shares}=this.reply; + apiQa + .updateAnswer({id:answerid,sysCreateAid,content:$this.inputValue}) + .then(res => { + if (res.status == 200) { + $this.$refs.articleToast.show({message:'修改成功',type:'success'}); + $this.closeInput(); + $this.findAnData(true); + } else { + $this.$refs.articleToast.show({message:'修改失败',type:'error'}); + } + }) + + }, + openInput() { + this.inputShow = true; + }, + closeInput() { + this.inputShow = false; + }, + delItem(item) { + const $this=this + uni.showModal({ + title: '提示', + content: '您确定要删除此回答吗?', + success: function (res) { + if (res.confirm) { + apiQa + .delAnswer(item.answerid) + .then(res => { + if (res.status == 200) { + $this.$refs.articleToast.show({message:'删除成功',type:'success'}); + $this.findAnData(true); + } else { + $this.$refs.articleToast.show({message:'删除失败,请稍后再试',type:'error'}); + } + }) + } + } + }); + }, + editItem(item){ + this.reply = item; + this.inputValue = item.answercontent; + this.inputShow=true + }, + toanDetail(item) { + uni.navigateTo({ + url: '/pages/resource/qaDetail?id=' + item.answerqid + + }); + }, toDetail(item) { + console.log(item,'item') uni.navigateTo({ url: '/pages/resource/qaDetail?id=' + item.id }); @@ -137,7 +274,42 @@ } }); }, - findData(flag) { + findAnData(flag) {// 回答 + uni.showLoading({ title: '加载中...' }); + if (flag) { + this.answerList.list = []; + } + // const { pageIndex, pageSize, keyWord,isResolve } = this.qaList; + let params = { + pageIndex:this.answerList.pageIndex, + pageSize:this.answerList.pageSize, + isResolve:this.answerList.isResolve, + }; + if (this.answerList.keyWord) { + params.keyWord = this.answerList.keyWord; + } + let $this=this; + apiQa.queryAnswer(params).then(async res => { + if (res.status == 200) { + this.answerList.count = res.result.count; + let userIds = []; + res.result.list.forEach(item => { + item.avatar=''; + item.name='', + item.orgInfo=''; + item.sex = null; + userIds.push(item.sysCreateAid); + $this.answerList.list.push(item); + }); + this.loadUserInfos(res.result.list, userIds); + }else{ + //加载数据列表错误 + this.$refs.messager.show({message:'加载数据失败:'+res.message,type:'error'}); + } + setTimeout(function(){uni.hideLoading();},100); + }); + }, + findData(flag) {// 提问 //是否重置列表 if (flag) { this.putList.list = []; @@ -158,6 +330,10 @@ this.putList.count = rs.result.count; let userIds = []; rs.result.list.forEach(item => { + item.avatar=''; + item.name='', + item.orgInfo=''; + item.sex = null; this.putList.list.push(item); userIds.push(item.sysCreateAid); }); @@ -311,5 +487,37 @@ color: #999999; } } + .artical-box { + // margin-top: 20upx; + color: #151515; + padding: 36rpx 0 26rpx 0; + background-color: #ffffff; + .artical-box-top { + font-weight: 500; + font-size: 30rpx; + // line-height: 60rpx; + // margin-top: 10rpx; + } + .articl-box-cont { + font-size: 28rpx; + // line-height: 50rpx; + color: #454545; + margin-top: 30upx; + // margin: 0upx 10upx; + overflow: hidden; + text-overflow: ellipsis; + -webkit-box-orient: vertical; + display: -webkit-box;-webkit-line-clamp: 2; + word-break:break-all; + } + .articl-box-time { + margin-top: 10upx; + font-size: 26rpx; + color: #999999; + // padding: 20rpx 0; + display: flex; + justify-content: space-between; + } + } }