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="leftInput" @click="showBottomInput = true">我来说两句...</div>
<div class="righticon"> <div class="righticon">
<u-icon name="thumb-up"></u-icon> <u-icon name="thumb-up" @click="praise"></u-icon>
<span class="icontext"></span> <span class="icontext"></span>
</div> </div>
</div> </div>
@@ -73,6 +74,8 @@
</template> </template>
<script> <script>
import { mapState } from 'vuex'
export default { export default {
name: 'Detail', name: 'Detail',
props: {}, props: {},
@@ -83,15 +86,19 @@ export default {
timestamp: '', timestamp: '',
showBottomInput: false, showBottomInput: false,
content: '', content: '',
flag: false,
} }
}, },
computed: { computed: {
...mapState(['user']),
commentCount() { commentCount() {
return this.data.messages?.length || 0 return this.data.messages?.length || 0
}, },
}, },
watch: {}, watch: {},
onLoad(o) { onLoad(o) {
console.log(this.user)
this.id = o.id this.id = o.id
this.getDetail() this.getDetail()
this.$dict.load('discussStatus') 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) { previewImage(images, img) {
uni.previewImage({ uni.previewImage({
@@ -326,6 +369,9 @@ export default {
.uni-textarea-placeholder { .uni-textarea-placeholder {
padding: 16px 0 0 16px; padding: 16px 0 0 16px;
} }
.uni-textarea-textarea {
padding: 16px 0 0 16px;
}
} }
.words { .words {
background: #f7f7f7; background: #f7f7f7;