From 42e406ff82ba21354239b7f871aec38a8ee7a4f2 Mon Sep 17 00:00:00 2001 From: yanran200730 Date: Mon, 20 Mar 2023 14:34:31 +0800 Subject: [PATCH] bug --- src/components/utils/http.js | 1 - src/project/fengdu/AppCircle/AppCircle.vue | 33 +++++++++++--- src/project/fengdu/AppCircle/Detail.vue | 31 +++++++++---- src/project/fengdu/AppCircle/TopicDetail.vue | 48 ++++++++++++++++++-- 4 files changed, 92 insertions(+), 21 deletions(-) diff --git a/src/components/utils/http.js b/src/components/utils/http.js index b15592a..6e85df0 100644 --- a/src/components/utils/http.js +++ b/src/components/utils/http.js @@ -12,7 +12,6 @@ const getToken = () => { } const source = axios.CancelToken.source(); instance.interceptors.request.use(config => { - console.log(config) if (config.withoutToken) { return config } else if (getToken()) { diff --git a/src/project/fengdu/AppCircle/AppCircle.vue b/src/project/fengdu/AppCircle/AppCircle.vue index b1653b7..8857f77 100644 --- a/src/project/fengdu/AppCircle/AppCircle.vue +++ b/src/project/fengdu/AppCircle/AppCircle.vue @@ -24,7 +24,12 @@
-
+
@@ -33,7 +38,7 @@
- #【{{ item.topicName }}】 + #【{{ item.topicName }}】 {{ item.content }}
@@ -41,11 +46,11 @@

{{ item.createTime }}

- -
+
{{ item.appreciateCount }}
@@ -118,6 +123,16 @@ onBtnClick (e) { }, + reciate (id, appreciateStatus) { + this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${id}`).then(res => { + if (res.code === 0) { + this.$toast(appreciateStatus ? '取消点赞' : '点赞成功') + + this.changeTab(this.currIndex) + } + }) + }, + getMyPublishCount () { this.$instance.post(`/app/appneighborhoodassistance/list`, null, { params: { @@ -215,9 +230,15 @@ }, onShareAppMessage (e) { + this.$instance.post(`/app/appneighborhoodassistance/share?id=${e.target.dataset.id}`).then(res => { + if (res.code === 0) { + this.changeTab(this.currIndex) + } + }) + return { - title: this.title, - path: `/pages/AppCircle/Detail?id=${this.id}&themeId=${e.themeid}&name=${e.name}` + title: e.target.dataset.content.substr(0, 20), + path: `/pages/AppCircle/Detail?id=${e.target.dataset.id}&themeId=${e.target.dataset.themeid}&name=${e.target.dataset.name}` } } } diff --git a/src/project/fengdu/AppCircle/Detail.vue b/src/project/fengdu/AppCircle/Detail.vue index 875a06b..400bcea 100644 --- a/src/project/fengdu/AppCircle/Detail.vue +++ b/src/project/fengdu/AppCircle/Detail.vue @@ -13,14 +13,14 @@ {{ info.content }}
- +

{{ info.createTime }}

-
+
+
{{ info.appreciateCount }} @@ -144,6 +144,13 @@ methods: { ...mapActions(['autoLogin']), + previewImage (url, files) { + uni.previewImage({ + current: url, + urls: files.map(v => v.url) + }) + }, + getInfo (id) { this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, { withoutToken: this.token ? false : true, @@ -163,7 +170,7 @@ this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${this.id}`).then(res => { if (res.code === 0) { this.$toast(this.info.appreciateStatus ? '取消点赞' : '点赞成功') - + uni.$emit('updateList') this.getInfo(this.id) } uni.hideLoading() @@ -252,15 +259,21 @@ onShareTimeline () { return { - title: this.title, - path: `/pages/AppCircle/Detail?id=${this.id}` + title: this.info.content, + path: `/pages/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}` } }, onShareAppMessage () { + this.$instance.post(`/app/appneighborhoodassistance/share?id=${this.id}`).then(res => { + if (res.code === 0) { + uni.$emit('updateList') + this.getInfo(this.id) + } + }) return { - title: this.title, - path: `/pages/AppCircle/Detail?id=${this.id}` + title: this.info.content, + path: `/pages/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}` } }, } @@ -559,7 +572,7 @@ height: 88px; border-top: 1px solid #eeeeee; - div { + div, button { display: flex; align-items: center; justify-content: center; diff --git a/src/project/fengdu/AppCircle/TopicDetail.vue b/src/project/fengdu/AppCircle/TopicDetail.vue index 7d77f21..79ee166 100644 --- a/src/project/fengdu/AppCircle/TopicDetail.vue +++ b/src/project/fengdu/AppCircle/TopicDetail.vue @@ -11,6 +11,7 @@ class="item" v-for="(item, index) in list" :key="index" + hover-class="text-hover" @click="$linkTo('./Detail?isFrom=topic&id=' + item.id + '&name=' + name + '&themeId=' + themeId)">
@@ -23,15 +24,22 @@ {{ item.content }}
- +

{{ item.createTime }}

-
+
-
+ +
{{ item.appreciateCount }}
@@ -91,6 +99,23 @@ }) }, + reciate (id, appreciateStatus) { + this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${id}`).then(res => { + if (res.code === 0) { + this.$toast(appreciateStatus ? '取消点赞' : '点赞成功') + + this.changeTab(this.currIndex) + } + }) + }, + + previewImage (url, files) { + uni.previewImage({ + current: url, + urls: files.map(v => v.url) + }) + }, + getList () { if (this.isMore) return @@ -131,6 +156,19 @@ onReachBottom () { this.getList() + }, + + onShareAppMessage (e) { + this.$instance.post(`/app/appneighborhoodassistance/share?id=${e.target.dataset.id}`).then(res => { + if (res.code === 0) { + this.changeTab(this.currIndex) + } + }) + + return { + title: e.target.dataset.content, + path: `/pages/AppCircle/Detail?id=${e.target.dataset.id}&themeId=${e.target.dataset.themeid}&name=${e.target.dataset.name}` + } } } @@ -223,7 +261,7 @@ height: 88px; border-top: 1px solid #eeeeee; - div { + div, button { display: flex; align-items: center; justify-content: center;