This commit is contained in:
花有清香月有阴
2022-01-07 17:06:23 +08:00
parent 9f2a655add
commit defba2d739

View File

@@ -38,7 +38,7 @@
</div> </div>
<u-icon name="thumb-up" :label="op.suport" :color="op.isSuport ? 'red' : '#ccc'" @click="like(op.id)" /> <u-icon name="thumb-up" :label="op.suport" :color="op.isSuport ? 'red' : '#ccc'" @click="like(op.id)" />
</div> </div>
<div class="content" v-text="op.content" /> <div class="content" v-text="op.content" @click="dele" />
<div class="content color-999" v-text="op.createTime" /> <div class="content color-999" v-text="op.createTime" />
</div> </div>
<AiEmpty v-if="!data.messages.length"></AiEmpty> <AiEmpty v-if="!data.messages.length"></AiEmpty>
@@ -98,7 +98,7 @@ export default {
content: '', content: '',
flag: false, flag: false,
pageShow: false, pageShow: false,
isAnnouncer: false isAnnouncer: false,
} }
}, },
computed: { computed: {
@@ -120,17 +120,21 @@ export default {
methods: { methods: {
getDetail() { getDetail() {
this.$loading() this.$loading()
this.$http.post(`/app/appvillagediscuss/queryDetailById?id=${this.id}`).then((res) => { this.$http
.post(`/app/appvillagediscuss/queryDetailById?id=${this.id}`)
.then((res) => {
if (res?.data) { if (res?.data) {
this.data = { this.data = {
...res.data, ...res.data,
avatar: res.data.createUserName?.substr(0, 2) || '游客', avatar: res.data.createUserName?.substr(0, 2) || '游客',
messages: res.data.messages ? res.data.messages.map(v => { messages: res.data.messages
? res.data.messages.map((v) => {
return { return {
...v, ...v,
isSuport: v.suportUser ? v.suportUser.indexOf(this.user.id) > -1 : false isSuport: v.suportUser ? v.suportUser.indexOf(this.user.id) > -1 : false,
} }
}) : [] })
: [],
} }
this.data.images = JSON.parse(res.data.images) this.data.images = JSON.parse(res.data.images)
this.isAnnouncer = this.user.id === res.data.createUserId this.isAnnouncer = this.user.id === res.data.createUserId
@@ -145,11 +149,11 @@ export default {
const total = Object.values(res.data.statistic).reduce((x, y) => { const total = Object.values(res.data.statistic).reduce((x, y) => {
return x + y return x + y
}) })
this.data.voteList = res.data.voteItems.map(v => { this.data.voteList = res.data.voteItems.map((v) => {
return { return {
...v, ...v,
count: res.data.statistic[v.item], count: res.data.statistic[v.item],
percentage: (res.data.statistic[v.item] / total) * 100 + '%' percentage: (res.data.statistic[v.item] / total) * 100 + '%',
} }
}) })
} }
@@ -159,14 +163,17 @@ export default {
} else { } else {
this.$hideLoading() this.$hideLoading()
} }
}).catch(() => { })
.catch(() => {
this.$hideLoading() this.$hideLoading()
}) })
}, },
like(id) { like(id) {
this.$loading() this.$loading()
this.$http.post(`/app/appvillagediscussmessage/suport?id=${id}&userId=${this.user.id}`).then(res => { this.$http
.post(`/app/appvillagediscussmessage/suport?id=${id}&userId=${this.user.id}`)
.then((res) => {
this.$hideLoading() this.$hideLoading()
if (res.code === 0) { if (res.code === 0) {
this.$u.toast('点赞成功') this.$u.toast('点赞成功')
@@ -177,13 +184,15 @@ export default {
} else { } else {
this.$u.toast(res.msg) this.$u.toast(res.msg)
} }
})
}).catch((e) => { .catch((e) => {
this.$hideLoading() this.$hideLoading()
this.$u.toast(e) this.$u.toast(e)
}) })
}, },
dele() {},
publish() { publish() {
if (this.flag) return if (this.flag) return
if (!this.content) { if (!this.content) {
@@ -251,10 +260,12 @@ export default {
handleComplete() { handleComplete() {
this.$confirm('是否要结束公示') this.$confirm('是否要结束公示')
.then(() => { .then(() => {
this.$http.post('/app/appvillagediscuss/finishPublic', { this.$http
.post('/app/appvillagediscuss/finishPublic', {
status: '2', status: '2',
id: this.id id: this.id,
}).then((res) => { })
.then((res) => {
if (res?.code == 0) { if (res?.code == 0) {
this.$u.toast('已结束公示!') this.$u.toast('已结束公示!')
this.getDetail() this.getDetail()
@@ -282,7 +293,7 @@ export default {
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 32px; font-size: 32px;
background: #1365DD; background: #1365dd;
} }
&.detail-active { &.detail-active {
@@ -377,7 +388,7 @@ export default {
text-align: center; text-align: center;
color: #fff; color: #fff;
font-size: 24px; font-size: 24px;
background: #1AAAFF; background: #1aaaff;
border-radius: 8px; border-radius: 8px;
} }
@@ -399,10 +410,10 @@ export default {
line-height: 64px; line-height: 64px;
margin-bottom: 16px; margin-bottom: 16px;
padding: 0 32px; padding: 0 32px;
background: #FFFFFF; background: #ffffff;
border-radius: 8px; border-radius: 8px;
overflow: hidden; overflow: hidden;
border: 1px solid #95CBFF; border: 1px solid #95cbff;
em { em {
position: absolute; position: absolute;
@@ -410,13 +421,13 @@ export default {
top: 0; top: 0;
z-index: 0; z-index: 0;
height: 100%; height: 100%;
background: #DCE8F4; background: #dce8f4;
} }
span { span {
position: relative; position: relative;
z-index: 1; z-index: 1;
color: #5B84B3; color: #5b84b3;
font-size: 28px; font-size: 28px;
} }
@@ -424,7 +435,7 @@ export default {
position: relative; position: relative;
z-index: 1; z-index: 1;
font-style: normal; font-style: normal;
color: #5B84B3; color: #5b84b3;
font-size: 28px; font-size: 28px;
} }
} }