This commit is contained in:
Gdpao
2020-08-03 19:51:05 +08:00
parent 51cd6f8261
commit 38f92c6766
6 changed files with 113 additions and 32 deletions

View File

@@ -37,15 +37,21 @@
<text>{{ item.member_nickname }}</text>
<text class="time">{{ item.create_time }}</text>
</view>
<text class="reply" @click="openKeyInput(item)">回复</text>
<text class="reply" @click="openKeyInput(item,index)">回复</text>
</view>
<view class="content">
{{ item.content }}
</view>
<view class="child-content">
<view>
</view>
<view class="more-reply" v-if="item.reply_count">展开更多回复<u-icon name="arrow-down"></u-icon></view>
</view>
</block>
<view class="no-data" v-else>111</view>
</scroll-view>
<view class="editing" @click="openKeyInput()">
<view class="editing" @click="openKeyInput">
<input type="text" value="" :placeholder="edit_text" disabled="disabled" />
<text>发送</text>
</view>
@@ -53,7 +59,7 @@
<!-- 评论box -->
<u-popup v-model="is_edit" mode="bottom" border-radius="10" height="100rpx">
<view class="edit-box">
<input type="text" :placeholder="edit_text" :focus="is_focus" @focus="focus" v-model="send_value">
<input type="text" :placeholder="edit_text_other" :focus="is_focus" @focus="focus" v-model="send_value">
<text @click="sendComment">发送</text>
</view>
</u-popup>
@@ -218,8 +224,14 @@
}
.content {
padding: 0 20rpx 10rpx 90rpx;
border-bottom: 1px solid #ececec;
}
.child-content {
margin: 6rpx 90rpx 6rpx;
.more-reply {
font-size: 22rpx;
color: #999;
}
}
}
.no-data {
margin-top: 100rpx;
@@ -372,13 +384,28 @@ export default {
cartList: [],
cart_len: 0,
edit_text: "有爱评论,说点好听的 ~",
edit_text_other: "有爱评论,说点好听的 ~",
commentList: [], // 评论
allList: {}, // 全部子评论
}
},
onLoad(option){
this.article_id = option.id;
this.articleInfo(this.article_id);
},
// 监听返回按钮
onBackPress() {
if (this.cart_type) {
this.cart_type = !this.cart_type;
} else if (this.is_comment) {
this.is_comment = !this.is_comment;
} else if (this.is_edit) {
this.is_edit = !this.is_edit;
} else {
return false;
}
return true;
},
methods:{
// 发现详情
articleInfo(article_id){
@@ -414,22 +441,39 @@ export default {
})
},
// 打开评论输入
openKeyInput(data) {
openKeyInput(data,index) {
console.log(data);
this.is_edit = true;
this.is_focus = true;
this.comment_id = index;
if (data.id) {
this.edit_text_other = "回复@" + data.member_nickname;
this.pid = data.id;
this.reply_id = data.member_id;
} else {
this.edit_text_other = "有爱评论,说点好听的 ~";
this.pid = "";
this.reply_id = "";
}
// console.log(this.pid, this.edit_text_other);
},
// 发布评论
sendComment(data) {
sendComment() {
this.$u.post("article/articleAddComment",{
article_id: this.article_id,
content: this.send_value,
pid: data.id,
reply_id: data.member_id,
pid: this.pid,
reply_id: this.reply_id,
}).then(res => {
console.log(res);
// console.log(res.data.data);
if (res.errCode == 0) {
this.is_edit = false;
if (res.data.data.pid) {
this.commentList[this.comment_id].reply_count = true;
this.allList[this.comment_id].unshift(res.data.data);
} else {
this.commentList.unshift(res.data.data);
}
} else {
this.$u.toast(res.message);
}

View File

@@ -396,7 +396,7 @@ export default {
if(type == 'involvement') {
Object.assign(params, {
pintuan_id: this.id,
pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id
pintuangroup_id: this.involvemenGroupInfo[0].pintuangroup_id,
})
} else {
const userId = uni.getStorageSync('user_info').member.member_id;