This commit is contained in:
liuye
2022-01-07 13:58:30 +08:00

View File

@@ -50,7 +50,8 @@
<div class="leftInput" @click="showBottomInput = true">我来说两句...</div>
<div class="righticon">
<u-icon name="thumb-up"></u-icon>
<u-icon name="thumb-up" @click="praise"></u-icon>
<span class="icontext"></span>
</div>
</div>
@@ -73,6 +74,8 @@
</template>
<script>
import { mapState } from 'vuex'
export default {
name: 'Detail',
props: {},
@@ -83,15 +86,19 @@ export default {
timestamp: '',
showBottomInput: false,
content: '',
flag: false,
}
},
computed: {
...mapState(['user']),
commentCount() {
return this.data.messages?.length || 0
},
},
watch: {},
onLoad(o) {
console.log(this.user)
this.id = o.id
this.getDetail()
this.$dict.load('discussStatus')
@@ -119,7 +126,43 @@ export default {
})
},
publish() {},
publish() {
if (this.flag) return
if (!this.content) {
return this.$u.toast('请输入你的想法')
}
this.$http
.post(`/app/appvillagediscussmessage/addOrUpdate`, {
content: this.content,
avatar: this.user.avatar,
createUserId: this.user.id,
createUserName: this.user.name,
discussId: this.id,
})
.then((res) => {
if (res?.code == 0) {
this.$u.toast('留言成功')
this.flag = true
this.showBottomInput = false
this.getDetail()
}
})
},
praise() {
console.log('点赞')
this.$http.post(`/app/appvillagediscussmessage/suport?id=${this.id}&userId=${this.user.id}`).then((res) => {
if (res?.code == 0) {
this.$u.toast('点赞成功!')
this.getDetail()
}
})
},
a() {
console.log(aa)
},
previewImage(images, img) {
uni.previewImage({
@@ -326,6 +369,9 @@ export default {
.uni-textarea-placeholder {
padding: 16px 0 0 16px;
}
.uni-textarea-textarea {
padding: 16px 0 0 16px;
}
}
.words {
background: #f7f7f7;