Files
dvcp_v2_wechat_app/src/mods/AppVillager/detail.vue
花有清香月有阴 b0c57fbc6e 优化
2022-02-18 18:34:57 +08:00

479 lines
12 KiB
Vue

<template>
<div class="Page">
<div class="top" v-if="detail.status == 2">
<div class="tops">{{ detail.auditOpinion }}</div>
</div>
<div class="middle">
<div class="cardTop">
<img :src="avatarUrl || user.avatarUrl" alt="" />
<div class="rightTop">
<div class="leftStaus">
<span class="names">{{ detail.createUserName || detail.replyUserName }}</span>
<span class="titless">
<span class="topics" v-if="detail.topic"> {{ $dict.getLabel('villagerCircleTopic', detail.topic) }} |</span>
<span> {{ detail.createTime }}</span>
</span>
</div>
<div class="statusDele">
<div class="status status0" :class="detail.auditStatus == 0 ? 'status0' : detail.auditStatus == 1 ? 'status1' : 'status2'">{{ $dict.getLabel('auditStatus', detail.status) }}</div>
<div class="dels" @click.stop=";(modalShow = true), (deleId = detail.id)">删除</div>
<!-- <img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/4.png" alt="" @click.stop="delShow = true" class="dels" /> -->
</div>
</div>
</div>
<div class="cardConts">{{ detail.content }}</div>
<div class="cardImg">
<img :src="item.url" alt="" v-for="(items, i) in detail.pictures" :key="i" @click.stop="previewImage(detail.pictures, item.url)" />
</div>
<div class="cardBot">
<div class="icons">
<u-icon name="map-fill"></u-icon>
<span>{{ detail.gpsDesc }}</span>
</div>
<div class="icones">
<div class="img1">
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/1.png" alt="" class="img11" />
</div>
<div class="rightFlex">
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/2.png" alt="" class="img2" @click="poupShow = true" />
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/3.png" alt="" class="img3" @click="like" v-if="detail.upFlag == 0" />
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/33.png" alt="" class="img3" @click="like" v-if="detail.upFlag == 1" />
</div>
</div>
</div>
<div class="reply" v-if="tabCurrent1 == 0">
<div class="replyTop" @click="deleShowBtn(item)">
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/3.png" alt="" />
<span class="people">
<span v-for="(items, index) in detail.comments" :key="index" v-if="index < 3">{{ items.replyUserName }}</span>
{{ detail.comments.length }}</span
>
</div>
<div class="replyCont" @click="deleShowBtn(item)" v-for="(item, i) in detail.comments" :key="i">
<span class="nameLeft">{{ item.replyUserName }} : </span>
<span class="contRight"> {{ item.content }}</span>
</div>
</div>
<div class="reply" v-if="tabCurrent1 == 1">
<div class="replyTop" @click="deleShowBtn(item)">
<img src="https://cdn.cunwuyun.cn/dvcp/AppVillager/3.png" alt="" />
<span class="people">
<span v-for="(items, index) in detail.villagerCircleInfo.comments" :key="index" v-if="index < 3">{{ items.replyUserName }}</span>
{{ detail.villagerCircleInfo.comments.length }}</span
>
</div>
<div class="replyCont" @click="deleShowBtn(item)" v-for="(item, i) in detail.villagerCircleInfo.comments" :key="i">
<span class="nameLeft">{{ item.replyUserName }} : </span>
<span class="contRight"> {{ item.content }}</span>
</div>
</div>
</div>
<u-popup v-model="poupShow" height="auto" mode="bottom" @close="close">
<div class="comments-wrapper">
<u-input v-model="content" placeholder="写下你的想法" type="textarea" auto-height :clearable="false" height="180" maxlength="140"> </u-input>
<div class="words">字数{{ content.length }}/140</div>
<div class="bottombtn">
<div class="emptys" @click="content = ''">清空内容</div>
<div class="publishs" @click="send">发送</div>
</div>
</div>
</u-popup>
<u-popup v-model="deleShow" mode="bottom" class="popupdele">
<div class="hint">删除评论</div>
<div class="dele" @click="modalShow = true">删除</div>
<div class="liness"></div>
<div class="cancel" @click="deleShow = false">取消</div>
</u-popup>
<u-modal v-model="modalShow" content="确定删除该留言" :mask-close-able="true" @confirm="confirmDelete"></u-modal>
</div>
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'detail',
components: {},
props: {},
data() {
return {
id: '',
avatarUrl: '',
detail: {},
poupShow: false,
content: '',
flag: false,
pageShow: false,
deleShow: false,
modalShow: false,
deleId: '',
flagLike: false,
tabCurrent1: '',
delAndEdit: '',
}
},
computed: { ...mapState(['user']) },
watch: {},
onLoad(o) {
this.$dict.load('villagerCircleTopic').then(() => {
console.log(o)
this.id = o.id
this.avatarUrl = o.avatarUrl
this.tabCurrent1 = o.tabCurrent1
this.getDetail()
})
},
onShow() {},
methods: {
getDetail() {
this.$instance
.post(this.tabCurrent1 == 0 ? '/app/appvillagercircleinfo/queryDetailById' : '/app/appvillagercirclecomment/queryDetailById', null, {
params: {
id: this.id,
},
})
.then((res) => {
if (res.code == 0) {
this.detail = res.data
}
})
},
send() {
if (this.flag) return
if (!this.content) {
return this.$u.toast('请输入你的想法')
}
this.$instance
.post(`/app/appvillagercirclecomment/addOrUpdate`, {
content: this.content,
replyUserResidentId: this.user.id,
replyUserName: this.user.name,
areaId: this.$areaId,
vcId: this.detail.id,
})
.then((res) => {
if (res?.code == 0) {
this.$u.toast('发送成功')
this.flag = false
this.content = ''
this.poupShow = false
this.getDetail()
}
})
},
like() {
if (this.flagLike) return
this.flagLike = true
this.$instance
.post(`/app/appvillagercircleinfo/up?id=${this.detail.id}&userId=${this.user.id}`)
.then((res) => {
this.$hideLoading()
if (res.code === 0) {
this.$u.toast(this.detail.upFlag == 0 ? '点赞成功' : '取消点赞成功')
this.getDetail()
setTimeout(() => {
this.flagLike = false
}, 600)
}
})
.catch((err) => {
this.$u.toast(err)
this.flagLike = false
})
},
confirmDelete() {
this.$instance
.post(`/app/appvillagercirclecomment/delete?ids=${this.deleId}`)
.then((res) => {
if (res.code == 0) {
this.deleShow = false
this.deleId = ''
this.modalShow = false
this.$u.toast('删除成功')
this.getDetail()
}
})
.catch((e) => {
this.$hideLoading()
this.$u.toast(e)
})
},
deleShowBtn(item) {
this.deleId = item.id
this.deleShow = true
},
previewImage(images, img) {
uni.previewImage({
urls: images.map((v) => v.url),
current: img,
})
},
},
onShareAppMessage() {
return {
// title: this.info.title,
// path: `/mods/AppActivityList/AppActivityList?id=${this.id}`,
}
},
}
</script>
<style scoped lang="scss">
.Page {
background: #fff;
padding: 0 32px;
.top {
padding-top: 32px;
.tops {
padding: 24px;
font-size: 26px;
color: #ff4466;
background: #fff5f7;
border-radius: 16px;
}
}
.middle {
padding: 32px 0 48px 0;
.cardTop {
display: flex;
img {
width: 96px;
height: 96px;
border-radius: 50%;
}
.rightTop {
display: flex;
justify-content: space-between;
align-items: center;
width: 100%;
.leftStaus {
display: flex;
flex-direction: column;
margin-left: 16px;
.names {
font-size: 32px;
font-weight: 500;
}
.titless {
font-size: 26px;
color: #6e727a;
margin-top: 6px;
.topics {
margin-right: 8px;
}
}
}
.statusDele {
display: flex;
align-items: center;
.status {
font-size: 28px;
}
.status0 {
color: #42d784;
}
.status1 {
color: #ff4466;
}
.status2 {
color: #ff883c;
}
.dels {
margin-left: 20px;
width: 68px;
// height: 68px;
}
}
}
}
.cardConts {
margin-top: 24px;
font-size: 32px;
}
.cardImg {
margin-top: 24px;
img {
width: 226px;
height: 226px;
margin-right: 4px;
}
img:nth-child(3n + 0) {
margin-right: 0;
}
}
.cardBot {
margin-top: 24px;
.icons {
padding: 8px 32px 8px 16px;
background: #eff1f3;
border-radius: 28px;
}
.icones {
display: flex;
justify-content: space-between;
margin-top: 24px;
.img1 {
width: 60%;
.img11 {
width: 48px;
height: 48px;
}
}
.rightFlex {
display: flex;
justify-content: space-between;
width: 27%;
.img2,
.img3 {
width: 48px;
height: 48px;
}
}
}
}
.reply {
margin-top: 32px;
padding: 0 24px 24px 24px;
background: #f7f8f9;
border-radius: 16px;
.replyTop {
padding: 20px 0;
margin-bottom: 18px;
img {
width: 40px;
height: 40px;
vertical-align: bottom;
}
.people {
font-size: 28px;
font-weight: 500;
color: #485d87;
margin-left: 8px;
}
}
.replyCont {
margin-top: 8px;
font-size: 28px;
font-weight: 500;
.nameLeft {
color: #485d87;
margin-right: 12px;
}
.contRight {
color: #485d87;
}
}
}
}
.comments-wrapper {
padding: 20px 0;
background: #f7f7f7;
.u-input {
background: #fff;
border-radius: 8px 8px 0 0;
padding: 10px !important;
margin: 0 30px 0 30px;
.uni-textarea-placeholder {
padding: 16px 0 0 16px;
}
.uni-textarea-textarea {
padding: 16px 0 0 16px;
}
}
.words {
background: #f7f7f7;
border-radius: 0 0 8px 8px;
margin: 0 30px;
padding: 10px;
text-align: right;
font-size: 26px;
color: #999999;
}
.bottombtn {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 30px;
padding: 20px 0 0;
.emptys {
font-size: 26px;
color: #666666;
}
.publishs {
width: 144px;
height: 64px;
line-height: 64px;
text-align: center;
background: #1365dd;
border-radius: 32px;
color: #fff;
}
}
}
.popupdele {
::v-deep .u-drawer-content {
border-radius: 24px 24px 0px 0px;
text-align: center;
.hint {
padding: 40px 0 44px 0;
border-bottom: 1px solid #e7e8e9;
font-size: 24px;
color: #666666;
font-size: 24px;
color: #666666;
}
.dele {
padding: 24px 0 28px 0;
font-size: 32px;
color: #c25450;
}
.liness {
height: 12px;
background: #f6f7f8;
}
.cancel {
padding: 24px 0 62px 0;
font-size: 32px;
color: #333333;
}
}
}
}
</style>