提交修改

This commit is contained in:
daihh
2022-05-30 23:03:25 +08:00
parent faa7afb65f
commit ab382aca7b
18 changed files with 539 additions and 401 deletions

View File

@@ -37,91 +37,90 @@
</view>
<view class="comments-items">
<!--内容确定了这部分样式要移到class中-->
<view v-for="(an, anidx) in answerList" :key="anidx" class="comments-item">
<view style="display: flex;justify-content: space-between;align-items: center;">
<view class="one-wrap">
<view v-for="(an, anidx) in answerList" :key="anidx" class="comment">
<view class="comment-top">
<view style="display: flex;">
<author v-if="an" :showInfo="true" :data="an"></author>
<view v-if="detailData.isResolve" style="margin-left: auto"><text v-if="an.isBest" style="color:#FFB30F;">最佳答案</text></view>
<view v-if="userInfo.aid==an.sysCreateAid" style="display: flex;"><u-icon @click="openBtns(an,anidx)" name="more-dot-fill" color="#979797" size="20"></u-icon></view>
<!-- <author-info :name="an.sysCreateBy" :avatar="an.avatar" :info="an.orgInfo" :showInfo="true"></author-info> -->
</view>
<view v-if="!detailData.isResolve && userInfo.aid==detailData.sysCreateAid">
<!-- <u-button v-if="!detailData.isResolve" text="设为最佳" @click="setBest(an)" type="warning" size="small"></u-button> -->
<view class="comment-time">
<view style="display: flex;">
<view v-if="detailData.isResolve">
<text v-if="an.isBest" style="color:#FFB30F;">最佳答案</text>
</view>
<view style="margin-left: 10px"><time-show :time="an.sysCreateTime"></time-show></view>
</view>
</view>
</view>
<view style="padding: 20upx 0upx 10upx 50upx;color: #4e4e4e;word-break: break-all;white-space: pre-wrap;">
{{ displayAll(an) }}
<text style="color: #00aaff; " v-if="an.content.length>minTextLen" @click="changeIsAll(an)">{{an.isAll?' 收起':' 全文'}}</text>
</view>
<view style="display: flex;justify-content: space-between;color: rgb(153, 153, 153);padding-left: 50upx;">
<time-show :time="an.sysCreateTime"></time-show>
<!-- <view style="padding-left: 50upx;padding-top: 20upx;color: #878787;font-size: 0.9em;">{{ an.sysCreateTime }}</view> -->
<view>
<!-- <view class="interact-bar-icon" v-if="isPraise"><image style="width:40upx;height: 40upx;" src="/static/images/icon/artice-praise-active.png" alt="" ></view> -->
<image @click="openReply(an,{})" style="width:30upx;height: 30upx;margin-right: 40upx;" src="/static/images/icon/comment.png" alt=""/>
<image v-if="an.isPraise" @click="removePraise(anidx)" style="width:30upx;height: 30upx;" src="/static/images/icon/artice-praise-active.png" alt=""/>
<image v-else @click="addPraise(anidx)" style="width:30upx;height: 30upx;" src="/static/images/icon/artice-praise.png" alt=""/>
<!-- <view class="interact-bar-txt">0</view> -->
<text style="margin-left: 8upx">{{an.praises}}</text>
<view class="comment-body" style="word-break: break-all;white-space: pre-wrap;">
<view class="comment-content">
{{ displayAll(an) }}
<text style="color: #00aaff;word-break: normal; " v-if="an.content.length>minTextLen" @click="changeIsAll(an)">{{an.isAll?' 收起':' 全文'}}</text>
</view>
</view>
<view class="twoLevelReply" v-if="an.answers && an.answers.length!=0">
<view v-for="(ele, replyIndex) in an.answers" :key="replyIndex" class="comments-item" style="border-bottom: 1px solid #e9e9e9; ">
<view style="display: flex;justify-content: space-between;align-items: center;">
<view class="one-wrap">
<view class="comment-btns">
<view style="display: flex;">
<u-icon style="margin-right: 15px;" @click="openReply(an,{})" name="chat" color="#979797" size="18" label="回复"></u-icon>
<u-icon v-if="an.isPraise" style="margin-right: 10px;" @click="removePraise(anidx)" name="thumb-up-fill" color="#979797" size="18" :label="an.praises"></u-icon>
<u-icon v-if="!an.isPraise" style="margin-right: 10px;" @click="addPraise(anidx)" name="thumb-up" color="#979797" size="18" :label="an.praises"></u-icon>
</view>
<view>
<u-icon v-if="userInfo.aid==an.sysCreateAid" @click="openBtns(an,anidx)" name="more-dot-fill" size="20"></u-icon>
</view>
</view>
<!--一级评论二级数据-->
<view v-if="an.answers && an.answers.length!=0" class="comment-replys">
<view v-for="(ele, replyIndex) in an.answers" :key="replyIndex" class="comment">
<view class="comment-top">
<view style="display: flex;">
<author v-if="ele" :showInfo="true" :data="ele"></author>
<text style="padding-left: 16upx;padding-top: 6upx;color: #979797;">评论</text>
<text style="padding-left: 16upx;padding-top: 6upx;color: #979797;">回复</text>
<text style="padding-left: 16upx;padding-top: 6upx;font-size: 26upx;">{{ele.replayName}}</text>
</view>
<view v-if="userInfo.aid==ele.sysCreateAid" style="display: flex;"><u-icon @click="openBtns(ele,replyIndex)" name="more-dot-fill" color="#979797" size="20"></u-icon></view>
<!-- <author-info :name="an.sysCreateBy" :avatar="an.avatar" :info="an.orgInfo" :showInfo="true"></author-info> -->
</view>
<!-- <view v-if="detailData.isResolve"><text v-if="an.isBest" style="color:#FFB30F;">最佳答案</text></view> -->
<!-- <view v-if="!detailData.isResolve && userInfo.aid==detailData.sysCreateAid">
<u-button v-if="!detailData.isResolve" text="设为最佳" @click="setBest(an)" type="warning" size="small"></u-button>
</view> -->
</view>
<view style="padding: 20upx 0upx 10upx 50upx;color: #4e4e4e;word-break: break-all;white-space: pre-wrap;">
{{ displayAll(ele) }}
<text style="color: #00aaff; white-space: nowrap;" v-if="ele.content.length>minTextLen" @click="changeIsAll(ele)">{{ele.isAll?' 收起':' 全文'}}</text>
</view>
<view style="display: flex;justify-content: space-between;color: rgb(153, 153, 153);padding-left: 50upx;">
<time-show :time="an.sysCreateTime"></time-show>
<!-- <view style="padding-left: 50upx;padding-top: 20upx;color: #878787;font-size: 0.9em;">{{ an.sysCreateTime }}</view> -->
<view>
<!-- <view class="interact-bar-icon" v-if="isPraise"><image style="width:40upx;height: 40upx;" src="/static/images/icon/artice-praise-active.png" alt="" ></view> -->
<image @click="openReply(ele,an)" style="width:30upx;height: 30upx;margin-right: 40upx;" src="/static/images/icon/comment.png" alt=""/>
<!-- <image v-if="an.isPraise" style="width:30upx;height: 30upx;" src="/static/images/icon/artice-praise-active.png" alt=""/>
<image v-else style="width:30upx;height: 30upx;" src="/static/images/icon/artice-praise.png" alt=""/> -->
<!-- <view class="interact-bar-txt">0</view> -->
<!-- <text style="margin-left: 8upx">{{an.praises}}</text> -->
</view>
</view>
<!--评论的二级显示-->
<view class="twoLevelReply" v-if="ele.answers && ele.answers.length!=0">
<view v-for="(row, rowIdx) in ele.answers" :key="rowIdx" class="comments-item">
<view style="display: flex;justify-content: space-between;align-items: center;">
<view class="one-wrap">
<view style="display: flex;">
<author v-if="row" :showInfo="true" :data="row"></author>
<text style="padding-left: 16upx;padding-top: 6upx;color: #979797;">评论</text>
<text style="padding-left: 16upx;padding-top: 6upx;font-size: 26upx;">{{row.replayName}}</text>
</view>
<view v-if="userInfo.aid==row.sysCreateAid" style="display: flex;"><u-icon @click="openBtns(row,rowIdx)" name="more-dot-fill" color="#979797" size="20"></u-icon></view>
</view>
<view class="comment-time">
<time-show :time="ele.sysCreateTime"></time-show>
</view>
<view style="padding: 20upx 0upx 10upx 50upx;color: #4e4e4e;word-break: break-all;white-space: pre-wrap;">
{{ displayAll(row) }}
<text style="color: #00aaff; white-space: nowrap;" v-if="row.content.length>minTextLen" @click="changeIsAll(row)">{{row.isAll?' 收起':' 全文'}}</text>
</view>
<view class="comment-body">
<view class="comment-content" style="word-break: break-all;white-space: pre-wrap;">
{{ displayAll(ele) }}
<text style="color: #00aaff; white-space: nowrap;" v-if="ele.content.length>minTextLen" @click="changeIsAll(ele)">{{ele.isAll?' 收起':' 全文'}}</text>
</view>
<view style="display: flex;justify-content: space-between;color: rgb(153, 153, 153);padding-left: 50upx;">
<time-show :time="an.sysCreateTime"></time-show>
<view class="comment-btns">
<view>
<image @click="openReply(row,ele)" style="width:30upx;height: 30upx;margin-right: 40upx;" src="/static/images/icon/comment.png" alt=""/>
<u-icon @click="openReply(ele,an)" name="chat" color="#979797" size="18" label="回复"></u-icon>
</view>
<view>
<u-icon v-if="userInfo.aid==ele.sysCreateAid" @click="openBtns(ele,replyIndex)" name="more-dot-fill" size="20"></u-icon>
</view>
</view>
<!--评论的二级显示-->
<view v-if="ele.answers && ele.answers.length!=0" class="comment-replys">
<view v-for="(row, rowIdx) in ele.answers" :key="rowIdx" class="comment">
<view class="comment-top">
<view style="display: flex;">
<author v-if="row" :showInfo="true" :data="row"></author>
<text style="padding-left: 16upx;padding-top: 6upx;color: #979797;">回复</text>
<text style="padding-left: 16upx;padding-top: 6upx;font-size: 26upx;">{{row.replayName}}</text>
</view>
<view class="comment-time">
<time-show :time="row.sysCreateTime"></time-show>
</view>
</view>
<view class="comment-body">
<view class="comment-content" style="word-break: break-all;white-space: pre-wrap;">
{{ displayAll(row) }}
<text style="color: #00aaff; white-space: nowrap;" v-if="row.content.length>minTextLen" @click="changeIsAll(row)">{{row.isAll?' 收起':' 全文'}}</text>
</view>
<view class="comment-btns">
<view>
<u-icon @click="openReply(row,ele)" name="chat" color="#979797" size="18" label="回复"></u-icon>
</view>
<view>
<u-icon v-if="userInfo.aid==row.sysCreateAid" @click="openBtns(row,rowIdx)" name="more-dot-fill" size="20"></u-icon>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
@@ -143,11 +142,13 @@
<view>
<view style="display: flex;justify-content: space-around;">
<view style="padding: 20rpx;flex: 1; white-space: pre-wrap; word-break: break-all;">
<u--textarea :height="120" v-model="answercontent" placeholder="请写下您的答案(200字以内),可以@提问者哦~" count maxlength="200"></u--textarea>
<u--textarea :height="120" v-model="answercontent" :placeholder="placeholder" count maxlength="200"></u--textarea>
</view>
<view style="padding: 20px 10px">
<view style="line-height: 82upx;text-align: center;margin-bottom: 20upx" @click="askQuestioner">@</view>
<u-button style="height: 60px;" @click="submitReply" type="primary" size="small" text="提交回答"></u-button>
<view style="line-height: 82upx;text-align: center;margin-bottom: 20upx" @click="askQuestioner">
<text v-if="replyLevel=='one'">@</text>
</view>
<u-button style="height: 60px;" @click="submitReply" type="primary" size="small" :text="replyLevel=='one'? '提交回答':'提交回复'"></u-button>
</view>
</view>
</view>
@@ -165,9 +166,9 @@
<!--编辑处理-->
<u-popup :show="btnsShow" @close="closeBtns">
<view>
<view class="big-button" v-if="!detailData.isResolve" @click="setBest()">设置为最佳答案</view>
<view @click="editAnswer()" class="big-button">编辑</view>
<view @click="delAnswer()" class="big-button" style="color: #db0000;">删除</view>
<view class="big-button" v-if="userInfo.aid==detailData.sysCreateAid && !detailData.isResolve && curItem.id && curItem.clevel==1" @click="setBest()">设置为最佳答案</view>
<view @click="editAnswer()" v-if="userInfo.aid==curItem.sysCreateAid && curItem.id && curItem.clevel==1" class="big-button">编辑</view>
<view @click="delAnswer()" v-if="userInfo.aid==curItem.sysCreateAid" class="big-button" style="color: #db0000;">删除</view>
<view @click="closeBtns()" class="big-button">取消</view>
</view>
</u-popup>
@@ -218,7 +219,18 @@ export default {
this.getData(this.questionId);
},
computed: {
...mapGetters(['userInfo'])
...mapGetters(['userInfo']),
placeholder(){
let txt='请写下您的答案(200字以内),可以@提问者哦~';
console.log(this.curItem.clevel,'this.curItem.clevel');
if(this.curItem && this.curItem.id){
//if(this.curItem.clevel>1){
txt='请写下您的回复(200字以内)';
//}
}
return txt;
}
},
onReachBottom(){
this.loadStatus='loading';
@@ -560,6 +572,7 @@ export default {
this.curParentId=item.id;//回复的parentId
this.curParent=parent;//回复的上级数据用于追加answers
this.curItem=item;
},
closeReply() {
this.answercontent='';
@@ -576,6 +589,7 @@ export default {
this.publishAnswer();
return;
}
let answercontent=''
if (this.answercontent.length < 1 ||this.answercontent.trim()=='@'+this.curItem.sysCreateBy) {
return uni.showToast({icon: 'none',title:"请输入回答"});
@@ -602,9 +616,11 @@ export default {
res.result.sex = null;
res.result.isAll = false;
this.curParentId='';
this.curParent={};
this.answercontent='';
this.loadUserInfos([res.result],[res.result.sysCreateAid]);
//console.log(this.curItem,'this.curItem');
//console.log(this.curParent,'this.curParent');
//if(this.curItem.id)
if(this.curItem.clevel<3){
if(!this.curItem.answers){
this.curItem.answers=[];
@@ -615,6 +631,9 @@ export default {
}
uni.showToast({icon: 'none',title:"回复成功"});
this.replyShow = false;
}else{
uni.showToast({icon: 'none',title:"回复失败"});
this.replyShow = false;
}
})
@@ -639,19 +658,17 @@ export default {
title:'',
}
apiPraises.save(postData).then(res=>{
this.loading=false;
if(res.status==200){
// if(res.result){
this.answerList[index].praises++;
if(res.status==200){
this.answerList[index].isPraise=true;
this.answerList[index].praises++;
this.$refs.interactToast.show({message:'点赞成功',type:'success'});
console.log(this.answerList[index],'content)')
//console.log(this.answerList[index],'content)')
this.messageSave(this.answerList[index].id,this.answerList[index].content,this.userInfo.name,this.answerList[index].sysCreateBy,this.answerList[index].sysCreateAid,'点赞了我的');
// }
}else{
this.$refs.interactToast.show({message:'点赞失败',type:'error'});
}
}else{
this.$refs.interactToast.show({message:'点赞失败',type:'error'});
}
this.loading=false;
})
},
removePraise(index){
@@ -660,17 +677,16 @@ export default {
}
this.loading=true;
apiPraises.remove(5,this.answerList[index].id).then(res=>{
if(res.status==200){
this.answerList[index].isPraise=false
if(this.answerList[index].praises>0){
this.answerList[index].praises--;
}
this.$refs.interactToast.show({message:'取消点赞成功',type:'success'});
}else{
this.$refs.interactToast.show({message:'取消点赞失败',type:'error'});
}
this.loading=false;
if(res.status==200){
// if(res.result){
this.answerList[index].praises--;
this.answerList[index].isPraise=false
this.$refs.interactToast.show({message:'取消点赞成功',type:'success'});
// }
// this.messageSave(this.answerList[index].id,this.answerList[index].title,this.userInfo.name,this.answerList[index].sysCreateBy,this.answerList[index].sysCreateAid,'点赞了我的');
}else{
this.$refs.interactToast.show({message:'取消点赞失败',type:'error'});
}
})
}
}
@@ -774,6 +790,38 @@ export default {
}
}
}
.comment{
padding-top: 20upx;
.comment-top{
display: flex;
justify-content: space-between;
line-height: 50upx;
.comment-avatar{
height: 50upx;
width: 50upx;
border-radius: 10%;
border: 1px solid #f3f3f3;
}
.comment-time{
color: #696969;font-size: 0.9em;
}
}
.comment-body{
padding: 6upx 0upx 0upx 60upx;
color: #373737;
.comment-content{
word-break:break-all;
padding: 0upx 10upx 10upx 0upx;
font-size: 28upx;
color: #333333;
}
.comment-btns{
display: flex;
justify-content: space-between;
padding-top: 10upx;
}
}
}
.big-button {
text-align: center;
line-height: 80upx;

View File

@@ -538,7 +538,8 @@
if(rs.status==200){
//let userIds=[];
//let userIds=[];
let courseIds=[];
rs.result.list.forEach(item=>{
item.name = this.$keywordActiveShow(item.name,this.course.params.keyword);
item.authorInfo={avatar:'',code:'',name:'',sex: null
@@ -668,7 +669,7 @@
//查询问答
let $this=this;
apiQa.pageList(this.qa.params).then(rs=>{
setTimeout(function(){ uni.hideLoading();},100);
setTimeout(function(){ uni.hideLoading();},100);
if(rs.status==200){
let userIds=[];
rs.result.list.forEach(item=>{
@@ -704,6 +705,7 @@
list.forEach(item=>{
res.result.some(author=>{
if(author.aid==item.sysCreateAid){
item.authorInfo={
avatar:author.avatar,
code:author.code,
name:author.name,