Files
dvcp_v2_wechat_app/src/project/fengdu/AppCircle/Detail.vue

580 lines
14 KiB
Vue
Raw Normal View History

2023-03-16 17:11:40 +08:00
<template>
2023-03-17 17:51:10 +08:00
<div class="Detail" v-if="pageShow">
2023-03-16 17:41:40 +08:00
<div class="top">
<div class="item-top">
2023-03-17 15:47:31 +08:00
<image :src="info.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
2023-03-16 17:41:40 +08:00
<div class="right">
2023-03-17 14:10:05 +08:00
<h3>{{ info.createUserName }}</h3>
2023-03-20 09:08:49 +08:00
<span v-if="item.publishDepartName">{{ info.publishDepartName }}</span>
2023-03-16 17:41:40 +08:00
</div>
</div>
<div class="item-content">
2023-03-17 14:10:05 +08:00
<span v-if="name" @click="toTopic('./TopicDetail?themeId=' + themeId + '&name=' + name)">#{{ name }}</span>
<text>{{ info.content }}</text>
2023-03-16 17:41:40 +08:00
</div>
2023-03-17 14:10:05 +08:00
<div class="item-imgs" v-if="info.files && info.files.length">
<image mode="aspectFill" v-for="(item, index) in item.files" :key="index" :src="item.url" />
2023-03-16 17:41:40 +08:00
</div>
2023-03-17 14:10:05 +08:00
<p>{{ info.createTime }}</p>
2023-03-16 17:41:40 +08:00
<div class="item-bottom">
2023-03-17 17:51:10 +08:00
<div @click="isShow = true">
2023-03-16 17:41:40 +08:00
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-zhuanfa.png" />
2023-03-17 14:10:05 +08:00
<i>{{ info.sharedCount }}</i>
2023-03-16 17:41:40 +08:00
</div>
<div>
2023-03-17 17:01:20 +08:00
<image :src="info.appreciateStatus ? 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan-active.png' : 'https://cdn.cunwuyun.cn/wxmp/fengdu/zan.png'" @click="reciate"/>
2023-03-17 14:10:05 +08:00
<i>{{ info.appreciateCount }}</i>
2023-03-16 17:41:40 +08:00
</div>
<div>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pinglun.png" />
2023-03-17 14:10:05 +08:00
<i>{{ info.commentCount }}</i>
2023-03-16 17:41:40 +08:00
</div>
</div>
</div>
<div class="comment">
<h2>评论</h2>
2023-03-17 09:35:55 +08:00
<div class="comment-wrapper">
2023-03-17 17:01:20 +08:00
<div class="comment-item" v-for="(item, index) in list" :key="index">
<image :src="item.createUserAvatar || 'https://cdn.cunwuyun.cn/wxmp/fengdu/avatar.png'" />
2023-03-17 09:35:55 +08:00
<div class="right">
2023-03-17 17:01:20 +08:00
<h3>{{ item.createUserName }}</h3>
<p>{{ item.content }}</p>
2023-03-17 09:35:55 +08:00
<div class="bottom">
2023-03-17 17:01:20 +08:00
<span>{{ item.createTime }}</span>
<div hover-class="text-hover" @click="commentId = item.id, replyName = item.createUserName, focus = true">回复</div>
</div>
2023-03-17 17:51:10 +08:00
<div class="replay-list" v-if="item.replyList.length">
2023-03-17 17:01:20 +08:00
<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'" />
<div class="replay-item__right">
<div class="top">
<div class="replay-left">
<h3>{{ replay.createUserName }}</h3>
<span>回复</span>
<h3>{{ item.createUserName }}</h3>
</div>
<p>{{ replay.createTime }}</p>
</div>
<p>{{ replay.content }}</p>
</div>
</div>
2023-03-17 09:35:55 +08:00
</div>
2023-03-16 17:41:40 +08:00
</div>
</div>
2023-03-17 17:01:20 +08:00
<AiEmpty v-if="!list.length"></AiEmpty>
2023-03-16 17:41:40 +08:00
</div>
</div>
2023-03-17 09:35:55 +08:00
<div class="footer">
2023-03-17 17:01:20 +08:00
<input :placeholder="commentId ? '回复' + replyName : '请输入'" :focus="focus" v-model="content">
<div hover-class="hover-class" @click="send">发送</div>
2023-03-17 09:35:55 +08:00
</div>
2023-03-17 17:51:10 +08:00
<u-popup v-model="isShow" mode="bottom" hidden height="350rpx" border-radius="30">
<div class="popup">
<div class="popup-title">
<h2>请选择</h2>
<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" />
<span>微信</span>
</button>
2023-03-20 09:08:49 +08:00
<!-- <button open-type="share">
2023-03-17 17:51:10 +08:00
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-pyq.png" />
<span>朋友圈</span>
</button>
<button>
<image src="https://cdn.cunwuyun.cn/wxmp/fengdu/ic-link.png" />
<span>复制链接</span>
2023-03-20 09:08:49 +08:00
</button> -->
2023-03-17 17:51:10 +08:00
</div>
</div>
</u-popup>
2023-03-16 17:11:40 +08:00
<AiLogin ref="login"/>
</div>
</template>
2023-03-17 17:51:10 +08:00
2023-03-16 17:11:40 +08:00
<script>
export default {
name: 'Detail',
appName: '详情',
data () {
return {
2023-03-17 14:10:05 +08:00
id: '',
isShow: false,
info: {},
name: '',
themeId: '',
2023-03-17 17:01:20 +08:00
isFrom: '',
list: [],
isMore: false,
current: 1,
content: '',
focus: false,
2023-03-17 17:51:10 +08:00
pageShow: false,
2023-03-17 17:01:20 +08:00
commentId: '',
replyName: ''
2023-03-16 17:11:40 +08:00
}
},
2023-03-17 14:10:05 +08:00
onLoad (query) {
this.isFrom = query.isFrom
this.id = query.id
this.themeId = query.themeId
this.name = query.name || ''
2023-03-17 17:01:20 +08:00
this.$loading()
this.getInfo(query.id)
this.getCommontList(query.id)
2023-03-16 17:11:40 +08:00
},
methods: {
2023-03-17 14:10:05 +08:00
getInfo (id) {
this.$instance.post(`/app/appneighborhoodassistance/queryDetailById?id=${id}`).then(res => {
if (res.code === 0) {
this.info = res.data
2023-03-17 17:51:10 +08:00
this.pageShow = true
2023-03-17 14:10:05 +08:00
}
uni.hideLoading()
})
},
2023-03-17 17:01:20 +08:00
reciate () {
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/appreciate?id=${this.id}`).then(res => {
if (res.code === 0) {
this.$toast(this.info.appreciateStatus ? '取消点赞' : '点赞成功')
this.getInfo(this.id)
}
uni.hideLoading()
})
},
send () {
if (!this.content) {
return this.$toast('内容不能为空')
}
this.$loading()
this.$instance.post(!this.commentId ? `/app/appneighborhoodassistance/addComment` : `/app/appneighborhoodassistance/addReply`, {
content: this.content,
naId: this.id,
type: this.commentId ? 1 : 0,
commentId: this.commentId || ''
}).then(res => {
uni.hideLoading()
if (res.code === 0) {
this.$toast('提交成功')
this.content = ''
this.replyName = ''
this.commentId = ''
this.focus = false
this.isMore = false
this.current = 1
this.$nextTick(() => {
this.getCommontList(this.id)
})
}
})
},
2023-03-17 14:10:05 +08:00
toTopic (url) {
if (this.isFrom === 'topic') {
uni.navigateBack({
delta: 1
})
} else {
this.$linkTo(url)
}
2023-03-17 17:01:20 +08:00
},
getCommontList (id) {
if (this.isMore) return
this.$loading()
this.$instance.post(`/app/appneighborhoodassistance/commontList`, null, {
params: {
withoutToken: this.token ? false : true,
id,
current: this.current,
size: 10
}
}).then(res => {
if (res.code === 0) {
this.$hideLoading()
if (this.current > 1) {
this.list = [...this.list, ...res.data.records]
} else {
this.list = res.data.records
}
if (res.data.records.length < 10) {
this.isMore = true
return false
}
this.current = this.current + 1
} else {
this.isMore = true
}
}).catch(() => {
this.$hideLoading()
})
2023-03-17 14:10:05 +08:00
}
2023-03-17 17:01:20 +08:00
},
onReachBottom () {
this.getCommontList()
2023-03-17 17:51:10 +08:00
},
onShareTimeline () {
return {
title: this.title,
path: `/pages/AppCircle/Detail?id=${this.id}`
}
},
onShareAppMessage () {
return {
title: this.title,
path: `/pages/AppCircle/Detail?id=${this.id}`
}
},
2023-03-16 17:11:40 +08:00
}
</script>
<style scoped lang="scss">
.Detail {
2023-03-16 17:41:40 +08:00
padding-top: 24px;
2023-03-17 09:35:55 +08:00
padding-bottom: 100px;
2023-03-16 17:41:40 +08:00
2023-03-16 17:11:40 +08:00
div {
box-sizing: border-box;
}
2023-03-16 17:41:40 +08:00
2023-03-17 17:51:10 +08:00
.popup {
height: 700px;
border-radius: 20px 20px 0 0;
.popup-title {
position: relative;
height: 98px;
line-height: 98px;
text-align: center;
image {
position: absolute;
right: 40px;
top: 50%;
z-index: 1;
width: 32px;
height: 32px;
transform: translateY(-50%);
}
h2 {
color: #333333;
font-size: 34px;
font-weight: 600;
}
}
.popup-list {
display: flex;
align-items: center;
margin-top: 30px;
button {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
flex-direction: column;
image {
width: 94px;
height: 94px;
margin-bottom: 8px;
}
span {
font-size: 26px;
color: #1D2229;
}
}
}
}
2023-03-17 09:35:55 +08:00
.footer {
display: flex;
align-items: center;
position: fixed;
left: 0;
bottom: 0;
z-index: 111;
width: 100%;
padding: 14px 32px;
background: #fff;
input {
flex: 1;
height: 60px;
margin-right: 16px;
padding: 0 24px;
border-radius: 30px;
font-size: 26px;
color: #333;
box-sizing: border-box;
background: #eeeeeeff;
}
div {
width: 100px;
height: 60px;
line-height: 60px;
text-align: center;
font-size: 26px;
color: #fff;
border-radius: 30px;
background: #2d7dffff;
}
}
2023-03-16 17:41:40 +08:00
.comment {
margin-top: 24px;
2023-03-17 17:01:20 +08:00
padding: 32px 32px 26px;
2023-03-16 17:41:40 +08:00
background: #fff;
2023-03-17 09:35:55 +08:00
.comment-wrapper {
.comment-item {
display: flex;
padding: 26px 0;
2023-03-16 17:41:40 +08:00
2023-03-17 09:35:55 +08:00
&:first-child {
padding-top: 0;
}
2023-03-16 17:41:40 +08:00
2023-03-17 17:01:20 +08:00
&:last-child {
padding-bottom: 0;
}
2023-03-17 09:35:55 +08:00
& > image {
width: 72px;
height: 72px;
margin-right: 16px;
border-radius: 50%;
}
2023-03-16 17:41:40 +08:00
2023-03-17 17:01:20 +08:00
.replay-list {
margin-top: 32px;
.replay-item {
display: flex;
margin-bottom: 32px;
&:last-child {
margin-bottom: 0;
}
image {
width: 48px;
height: 48px;
margin-right: 16px;
border-radius: 50%;
}
.replay-item__right {
flex: 1;
.top {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 6px;
.replay-left {
display: flex;
align-items: center;
}
h3 {
color: #666666;
font-size: 24px;
}
span {
margin: 0 8px;
font-size: 24px;
color: #687DA6;
}
p {
color: #999999;
font-size: 24px;
}
}
& > p {
line-height: 1.3;
color: #333333;
font-size: 24px;
}
}
}
}
& > .right {
2023-03-17 09:35:55 +08:00
flex: 1;
padding-bottom: 32px;
border-bottom: 1px solid #EEEEEE;
2023-03-16 17:41:40 +08:00
2023-03-17 17:01:20 +08:00
& > h3 {
2023-03-17 09:35:55 +08:00
line-height: 40px;
margin-bottom: 8px;
color: #666666;
font-size: 28px;
}
2023-03-16 17:41:40 +08:00
2023-03-17 17:01:20 +08:00
& > p {
2023-03-17 09:35:55 +08:00
line-height: 42px;
margin-bottom: 24px;
color: #333;
font-size: 28px;
}
2023-03-16 17:41:40 +08:00
2023-03-17 09:35:55 +08:00
.bottom {
display: flex;
align-items: center;
justify-content: space-between;
2023-03-16 17:41:40 +08:00
2023-03-17 09:35:55 +08:00
span {
color: #999999;
font-size: 24px;
}
div {
color: #687DA6;
font-size: 24px;
}
2023-03-16 17:41:40 +08:00
}
2023-03-17 09:35:55 +08:00
}
&:last-child {
padding-bottom: 0;
2023-03-16 17:41:40 +08:00
2023-03-17 09:35:55 +08:00
.right {
2023-03-17 17:01:20 +08:00
padding-bottom: 0;
2023-03-17 09:35:55 +08:00
border-bottom: none;
2023-03-16 17:41:40 +08:00
}
}
}
}
& > h2 {
margin-bottom: 32px;
color: #3d3d3d;
font-size: 38px;
font-weight: 600;
}
}
2023-03-17 17:01:20 +08:00
& > .top {
padding: 32px 32px 0;
2023-03-16 17:41:40 +08:00
background: #ffffff;
.item-top {
display: flex;
align-items: center;
image {
width: 96px;
height: 96px;
margin-right: 16px;
border-radius: 50%;
}
h3 {
color: #333333;
text-align: left;
font-size: 34px;
font-weight: 500;
}
span {
2023-03-20 09:08:49 +08:00
margin-top: 12px;
2023-03-16 17:41:40 +08:00
color: #999999;
font-size: 28px;
}
}
.item-imgs {
display: flex;
align-items: center;
image {
flex: 1;
height: 202px;
margin-right: 12px;
&:nth-of-type(3n) {
margin-right: 0;
}
}
}
& > p {
margin: 24px 0;
font-size: 28px;
color: #333333;
}
.item-bottom {
display: flex;
align-items: center;
height: 88px;
border-top: 1px solid #eeeeee;
div {
display: flex;
align-items: center;
justify-content: center;
flex: 1;
image {
width: 40px;
height: 40px;
margin: 16px;
}
i {
color: #687DA6;
font-size: 28px;
}
}
}
.item-content {
2023-03-17 17:01:20 +08:00
margin: 16px 0;
2023-03-16 17:41:40 +08:00
line-height: 1.3;
2023-03-17 17:01:20 +08:00
text-align: justify;
2023-03-16 17:41:40 +08:00
span {
font-size: 28px;
color: #4181FF;
}
text {
font-size: 28px;
color: #333333;
}
}
}
2023-03-16 17:11:40 +08:00
}
</style>