From e0aafebcdc0fe90cf8bb8ed26e21a68b2dc2f229 Mon Sep 17 00:00:00 2001 From: Gdpao <1341331954@qq.com> Date: Fri, 21 Aug 2020 16:05:09 +0800 Subject: [PATCH] gdpao --- pageB/photo/index.vue | 33 +++++++++++++++++++-------------- pageB/video/video.nvue | 28 ++++++++++++++++++++++------ pages/mine/index.vue | 5 +++-- 3 files changed, 44 insertions(+), 22 deletions(-) diff --git a/pageB/photo/index.vue b/pageB/photo/index.vue index 6a483ae..336725f 100644 --- a/pageB/photo/index.vue +++ b/pageB/photo/index.vue @@ -29,7 +29,7 @@ 评论 - + @@ -52,7 +52,10 @@ {{ child.content }} - 展开更多回复 + + {{ child_end[item.id] ? "暂无更多回复" : "展开更多回复" }} + + 还没有评论,快来评论吧! @@ -442,6 +445,7 @@ export default { edit_text_other: "有爱评论,说点好听的 ~", commentList: [], // 评论 allList: {}, // 全部子评论 + child_end: {}, status: 'loadmore', iconType: 'circle', loadText: { @@ -519,6 +523,8 @@ export default { // console.log(item); item.page = 0; item.commentList = []; + this.page_[item.id] = 0; + this.child_end[item.id] = false; }) this.commentList = list; } @@ -572,14 +578,14 @@ export default { // console.log(p_id); if (res.data.data.pid) { this.commentList[this.comment_id].reply_count = true; - console.log(this.allList[p_id]); + // console.log(this.allList[p_id]); if (this.allList[p_id]) { this.allList[p_id].push(res.data.data); } else { this.allList[p_id] = []; this.allList[p_id].push(res.data.data); } - console.log(this.allList); + // console.log(this.allList); } else { this.commentList.unshift(res.data.data); } @@ -593,18 +599,20 @@ export default { uni.showLoading({ title: "loading..." }) - if (!this.page_[id] === 0) { - } this.$u.post("article/articleReplyList", {id: id, page: this.page_[id]}).then(res => { uni.hideLoading(); if (res.errCode == 0) { - // if (res.data.length < 10) { - // this.is_more = false; - // } + if (this.page_[id] == 0) { + this.allList[id] = res.data; + } else { + this.allList[id] = this.allList[id].concat(res.data); + } this.page_[id]++; - this.allList[id] = res.data; this.$forceUpdate(); - console.log(this.allList); + // console.log(this.allList); + } else if (res.errCode == 1) { + this.child_end[id] = true; + this.$forceUpdate(); } }) }, @@ -623,9 +631,6 @@ export default { scrollBottom(e) { console.log(1); this.getComment(); - }, - changeComment(e) { - console.log(e); }, // 跳转到商品 gotoInfo(id) { diff --git a/pageB/video/video.nvue b/pageB/video/video.nvue index c1bc76d..e11d412 100644 --- a/pageB/video/video.nvue +++ b/pageB/video/video.nvue @@ -72,7 +72,9 @@ {{ child.content }} - 展开更多回复 + + {{ child_end[item.id] ? "暂无更多回复" : "展开更多回复" }} + @@ -167,6 +169,7 @@ time_count: 0, linear: null, loadinging: false, + child_end: {}, }; }, onLoad(option) { @@ -246,6 +249,16 @@ // console.log(res.data); this.commentList = res.data.data; } + let list = this.commentList; + list.forEach((item,index) => { + console.log(item); + item.page = 0; + item.commentList = []; + this.page_[item.id] = 0; + this.child_end[item.id] = false; + }) + console.log(list); + this.commentList = list; } }) }, @@ -317,7 +330,6 @@ uni.showLoading({ title: "loading..." }) - if (!this.page_[id] === 0) {} uni.request({ url: temp_url + "article/articleReplyList", method: "POST", @@ -332,14 +344,18 @@ uni.hideLoading(); console.log(this.page_); if (res.data.errCode == 0) { - if (res.data.data.length < 10) { - this.is_more = false; + if (this.page_[id] == 0) { + this.allList[id] = res.data.data; + } else { + this.allList[id] = this.allList[id].concat(res.data.data); } this.page_[id]++; - console.log(this.page_); - this.allList[id] = res.data.data; + this.$forceUpdate(); + } else if (res.data.errCode == 1) { + this.child_end[id] = true; this.$forceUpdate(); } + console.log(this.allList); } }) }, diff --git a/pages/mine/index.vue b/pages/mine/index.vue index ab2048c..f1cfcec 100644 --- a/pages/mine/index.vue +++ b/pages/mine/index.vue @@ -177,9 +177,10 @@ export default { uni.navigateTo({ url: "../../pageA/login/login" }) - } + } else { + this.getOrderNumber(); + } this.getUserInfo(); - this.getOrderNumber(); }, onNavigationBarButtonTap(e) { // console.log(e);