This commit is contained in:
Gdpao
2020-08-12 22:00:01 +08:00
parent 529325e203
commit 6d4d8c5675
5 changed files with 609 additions and 565 deletions

View File

@@ -66,7 +66,7 @@
<!-- 评论box -->
<u-popup v-model="is_edit" mode="bottom" border-radius="10" height="100rpx">
<view class="edit-box">
<input type="text" focus :placeholder="edit_text_other" @focus="focus" v-model="send_value">
<input type="text" :focus="is_focus" :placeholder="edit_text_other" @focus="focus" v-model="send_value">
<text @click="sendComment">发送</text>
</view>
</u-popup>
@@ -419,7 +419,7 @@ export default {
edit_text: "有爱评论,说点好听的 ~",
edit_text_other: "有爱评论,说点好听的 ~",
commentList: [], // 评论
allList: [], // 全部子评论
allList: {}, // 全部子评论
status: 'loadmore',
iconType: 'circle',
loadText: {
@@ -433,6 +433,7 @@ export default {
onLoad(option){
this.article_id = option.id;
this.articleInfo(this.article_id);
this.allList = {};
},
// 监听返回按钮
onBackPress() {
@@ -491,18 +492,28 @@ export default {
this.commentList = this.commentList.concat(res.data);
}
this.page++;
let list = this.commentList;
// list.forEach((item,index) => {
// console.log(item);
// })
}
})
},
// 打开评论输入
openKeyInput(data,index) {
// console.log(data);
let me = this;
console.log(data);
this.is_edit = true;
setTimeout(() => {
this.is_focus = true;
}, 200)
uni.onKeyboardHeightChange(function(res){
if (res.height == 0) {
me.is_focus = false;
}
})
this.comment_id = index;
if (data.id) {
if (data.content) {
this.edit_text_other = "回复@" + data.member_nickname;
this.pid = data.id;
this.reply_id = data.member_id;
@@ -525,7 +536,7 @@ export default {
pid: this.pid,
reply_id: this.reply_id,
}).then(res => {
// console.log(res.data.data);
// console.log(res.data);
if (res.errCode == 0) {
this.send_value = "";
this.comment_num = res.data.num;
@@ -533,9 +544,11 @@ export default {
this.is_edit = false;
console.log(res.data.data.reply_id);
if (res.data.data.reply_id) {
console.log(this.allList);
this.commentList[this.comment_id].reply_count = true;
this.allList[this.comment_id].unshift(res.data.data);
console.log(this.allList,111);
this.allList[this.comment_id] = [];
this.allList[this.comment_id].push(res.data.data);
console.log(this.allList);
} else {
this.commentList.unshift(res.data.data);
}
@@ -546,14 +559,14 @@ export default {
},
// 发现回复列表
getReplyList(id) {
this.page_[id] = 0;
if (!this.page_[id] === 0) {
}
console.log(this.page_[id]);
this.$u.post("article/articleReplyList", {id: id, page: this.page_[id]}).then(res => {
console.log(this.page_);
console.log(res);
if (res.errCode == 0) {
this.page_[id]++;
console.log(this.page_[id]);
this.allList[id] = res.data;
}
})
@@ -585,7 +598,7 @@ export default {
delta: 1
})
},
focus() {
focus(e) {
setTimeout(function(){
uni.showSoftKeybord;
}, 200)