This commit is contained in:
yanran200730
2023-03-20 14:34:31 +08:00
parent 599c10cd7d
commit 42e406ff82
4 changed files with 92 additions and 21 deletions

View File

@@ -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()) {

View File

@@ -24,7 +24,12 @@
</div>
</div>
<div class="AppCircle-list">
<div class="item" v-for="(item, index) in list" :key="index" @click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item"
v-for="(item, index) in list"
:key="index"
hover-class="text-hover"
hover-stop-propagation
@click="$linkTo('./Detail?id=' + item.id + '&name=' + item.topicName + '&themeId=' + item.themeId)">
<div class="item-top">
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
<div class="right">
@@ -33,7 +38,7 @@
</div>
</div>
<div class="item-content">
<span v-if="item.themeId" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
<span hover-stop-propagation v-if="item.themeId" @click.stop="$linkTo('./TopicDetail?themeId=' + item.themeId + '&name=' + item.topicName)">#{{ item.topicName }}</span>
<text>{{ item.content }}</text>
</div>
<div class="item-imgs" v-if="item.files.length">
@@ -41,11 +46,11 @@
</div>
<p>{{ item.createTime }}</p>
<div class="item-bottom">
<button @click.stop="onBtnClick" open-type="share" :data-themeid="item.themeId" :data-id="item.id" :data-name="item.topicName">
<button hover-stop-propagation @click.stop="onBtnClick" open-type="share" :data-content="item.content" :data-themeid="item.themeId" :data-id="item.id" :data-name="item.topicName">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" />
<i>{{ item.sharedCount }}</i>
</button>
<div>
<div hover-stop-propagation @click.stop="reciate(item.id, item.appreciateStatus)">
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'" />
<i>{{ item.appreciateCount }}</i>
</div>
@@ -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}`
}
}
}

View File

@@ -13,14 +13,14 @@
<text>{{ info.content }}</text>
</div>
<div class="item-imgs" v-if="info.files && info.files.length">
<image mode="aspectFill" v-for="(item, index) in info.files" :key="index" :src="item.url" />
<image mode="aspectFill" @click="previewImage(item.url, info.files)" v-for="(item, index) in info.files" :key="index" :src="item.url" />
</div>
<p>{{ info.createTime }}</p>
<div class="item-bottom">
<div @click="isShow = true">
<button open-type="share">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" />
<i>{{ info.sharedCount }}</i>
</div>
</button>
<div>
<image :src="info.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'" @click="reciate"/>
<i>{{ info.appreciateCount }}</i>
@@ -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;

View File

@@ -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)">
<div class="item-top">
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
@@ -23,15 +24,22 @@
<text>{{ item.content }}</text>
</div>
<div class="item-imgs" v-if="item.files.length">
<image mode="aspectFill" v-for="(item, index) in item.files" :key="index" :src="item.url" />
<image mode="aspectFill" @click.stop="previewImage(e.url, item.files)" v-for="(item, index) in item.files" :key="index" :src="item.url" />
</div>
<p>{{ item.createTime }}</p>
<div class="item-bottom">
<div>
<button
hover-stop-propagation
@click.stop=""
open-type="share"
:data-content="item.content"
:data-themeid="item.themeId"
:data-id="item.id"
:data-name="item.topicName">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" />
<i>{{ item.sharedCount }}</i>
</div>
<div>
</button>
<div hover-stop-propagation @click.stop="reciate(item.id, item.appreciateStatus)">
<image :src="item.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'" />
<i>{{ item.appreciateCount }}</i>
</div>
@@ -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}`
}
}
}
</script>
@@ -223,7 +261,7 @@
height: 88px;
border-top: 1px solid #eeeeee;
div {
div, button {
display: flex;
align-items: center;
justify-content: center;