优化代码,并去掉分享朋友圈

This commit is contained in:
aixianling
2023-10-26 14:56:18 +08:00
parent 631ac14395
commit 7e10885ecd

View File

@@ -2,12 +2,14 @@
<div class="Detail" v-if="pageShow">
<div class="top">
<div class="item-top">
<image :src="info.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
<image :src="info.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right">
<h3>{{ info.createUserName }}</h3>
<span v-if="info.publishDepartName">{{ info.publishDepartName }}</span>
</div>
<div class="top-btn" v-if="info.integralTaskId && info.integralTaskInfo.status != 2 && info.showSignBtn" @click="toTask">去参与</div>
<div class="top-btn" v-if="info.integralTaskId && info.integralTaskInfo.status != 2 && info.showSignBtn"
@click="toTask">去参与
</div>
</div>
<div class="item-content">
<span v-if="name" @click="toTopic('./TopicDetail?themeId=' + themeId + '&name=' + name)">#{{ name }}</span>
@@ -24,7 +26,9 @@
<div class="value">{{ info.integralTaskInfo.type == 1 ? '报名得积分' : '打卡得积分' }}</div>
</div>
<div class="info-flex">
<div class="label"><img src="https://cdn.cunwuyun.cn/fengdu/time-icon.png" alt="">{{ info.integralTaskInfo.type == 1 ? '报名时间:' : '进场时间:'}}</div>
<div class="label"><img src="https://cdn.cunwuyun.cn/fengdu/time-icon.png"
alt="">{{ info.integralTaskInfo.type == 1 ? '报名时间:' : '进场时间:' }}
</div>
<div class="value">{{ info.integralTaskInfo.intoBegintime }}{{ info.integralTaskInfo.intoEndtime }}</div>
</div>
<div class="info-flex" v-if="info.integralTaskInfo.type != 1">
@@ -34,20 +38,23 @@
</div>
<div class="item-imgs" v-if="info.files && info.files.length">
<image mode="aspectFill" @click="previewImage(item.url, info.files)" 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">
<button open-type="share">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" />
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png"/>
<i>{{ info.sharedCount }}</i>
</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"/>
<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>
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png" />
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png"/>
<i>{{ info.commentCount }}</i>
</div>
</div>
@@ -56,7 +63,7 @@
<h2>评论</h2>
<div class="comment-wrapper">
<div class="comment-item" v-for="(item, index) in list" :key="index">
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="right">
<h3>{{ item.createUserName }}</h3>
<p>{{ item.content }}</p>
@@ -66,7 +73,7 @@
</div>
<div class="replay-list" v-if="item.replyList.length">
<div class="replay-item" v-for="replay in item.replyList" :key="replay.id">
<image :src="replay.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
<image :src="replay.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'"/>
<div class="replay-item__right">
<div class="top">
<div class="replay-left">
@@ -93,11 +100,11 @@
<div class="popup">
<div class="popup-title">
<h2>请选择</h2>
<image @click="isShow = false" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-guanbi.png" />
<image @click="isShow = false" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-guanbi.png"/>
</div>
<div class="popup-list">
<button open-type="share">
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-wechat.png" />
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-wechat.png"/>
<span>微信</span>
</button>
<!-- <button open-type="share">
@@ -115,10 +122,12 @@
<div class="popup">
<div class="popup-title">
<h2>评论</h2>
<image @click="isShowComment = false, focus = false" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-guanbi.png" />
<image @click="isShowComment = false, focus = false" src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-guanbi.png"/>
</div>
<div class="form">
<textarea :maxlength="100" :cursor-spacing="10" :placeholder="commentId ? '回复' + replyName : '请输入评论内容'" :focus="focus" v-model="content"></textarea>
<textarea :maxlength="100" :cursor-spacing="10"
:placeholder="commentId ? '回复' + replyName : '请输入评论内容'" :focus="focus"
v-model="content"></textarea>
<div>
<div class="send-btn" hover-class="hover-class" @click="send">发送</div>
</div>
@@ -129,12 +138,13 @@
</template>
<script>
import { mapActions, mapState } from 'vuex'
export default {
import {mapActions, mapState} from 'vuex'
export default {
name: 'Detail',
appName: '详情',
data () {
data() {
return {
id: '',
isShow: false,
@@ -158,24 +168,19 @@
...mapState(['user', 'token'])
},
onLoad (query) {
onLoad(query) {
this.isFrom = query.isFrom
this.id = query.id
this.themeId = query.themeId
this.name = query.name || ''
this.$loading()
if (!this.token) {
this.autoLogin().then(() => {
this.getInfo(query.id)
Promise.resolve(this.token || this.autoLogin()).then(() =>
Promise.all([
this.getInfo(query.id),
this.getCommontList(query.id)
})
} else {
this.getInfo(query.id)
this.getCommontList(query.id)
}
])
).finally(() => this.$hideLoading())
},
methods: {
...mapActions(['autoLogin']),
@@ -192,14 +197,14 @@
this.$linkTo(`/mods/AppNewFarmerBank/taskDetail?id=${this.info.integralTaskId}`)
},
previewImage (url, files) {
previewImage(url, files) {
uni.previewImage({
current: url,
urls: files.map(v => v.url)
})
},
showComment () {
showComment() {
if (!this.user.areaId) {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
@@ -223,7 +228,7 @@
})
},
replay (item) {
replay(item) {
if (!this.user.areaId) {
this.$dialog.confirm({
content: '您只有完成信息认证后,才可进行相关操作。',
@@ -248,9 +253,9 @@
})
},
getInfo (id) {
getInfo(id) {
this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`, null, {
withoutToken: this.token ? false : true,
withoutToken: !this.token,
}).then(res => {
if (res.code === 0) {
this.info = res.data
@@ -261,7 +266,7 @@
})
},
reciate () {
reciate() {
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${this.id}`).then(res => {
if (res.code === 0) {
@@ -273,7 +278,7 @@
})
},
send () {
send() {
if (!this.content) {
return this.$toast('内容不能为空')
}
@@ -304,7 +309,7 @@
})
},
toTopic (url) {
toTopic(url) {
if (this.isFrom === 'topic') {
uni.navigateBack({
delta: 1
@@ -314,12 +319,12 @@
}
},
getCommontList (id) {
getCommontList(id) {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
withoutToken: this.token ? false : true,
withoutToken: !this.token,
params: {
id,
current: this.current,
@@ -333,14 +338,12 @@
} else {
this.list = res.data.records
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
this.current++
} else {
this.isMore = true
}
@@ -350,17 +353,17 @@
}
},
onReachBottom () {
onReachBottom() {
this.getCommontList()
},
onShareTimeline () {
return {
title: this.info.content,
// path: `/mods/AppCircle/Detail?id=${this.id}&themeId=${this.themeId}&name=${this.name}`
}
},
onShareAppMessage () {
// onShareTimeline() {
// return {
// title: this.info.content,
// // path: `/mods/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')
@@ -373,11 +376,11 @@
}
},
}
}
</script>
<style scoped lang="scss">
.Detail {
.Detail {
padding-top: 24px;
padding-bottom: 130px;
@@ -472,6 +475,7 @@
}
}
}
.footer {
display: flex;
align-items: center;
@@ -749,8 +753,10 @@
font-family: "PingFang SC";
line-height: 30px;
margin-bottom: 16px;
.label {
width: 160px;
img {
width: 30px;
height: 30px;
@@ -758,6 +764,7 @@
vertical-align: bottom;
}
}
.value {
width: calc(100% - 160px);
color: #333;
@@ -780,5 +787,5 @@
right: 32px;
}
}
}
}
</style>