评论组件完成
This commit is contained in:
@@ -1,207 +1,178 @@
|
|||||||
<template>
|
<template>
|
||||||
<div class="AiComment">
|
<div class="AiComment">
|
||||||
<div class="comments flex-row">
|
<div class="pageTitle flex">
|
||||||
<div class="comments-box" @click="showCommentBox">{{ boxContent }}</div>
|
评论
|
||||||
<img src="./static/comment.svg" @click="showCommentList" alt=""/>
|
<div class="mar-l16" v-text="total"/>
|
||||||
<text>{{ commentCount || 0 }}</text>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="modalWrapper" v-if="commentBoxPopup" :class="{clickClose:!modelClickClose}"
|
<div class="flex item" v-for="row in list" :key="row.id">
|
||||||
@click="commentBoxPopup=false"/>
|
<img :src="row.avatar"/>
|
||||||
<div class="commentBox" v-if="commentBoxPopup" :style="{bottom:marginBottom+ 'px'}">
|
<div class="fill">
|
||||||
<textarea v-model="content" placeholder="写下你的想法…" maxlength="300" :focus="focus" @focus="getMarginBottom"
|
<div class="flex font-32">
|
||||||
@blur="marginBottom=0" :adjust-position="false" fixed/>
|
<div class="fill font600 font-28" v-text="row.name"/>
|
||||||
<view class="flex-row form-submit">
|
<AiThumbsUp :bid="row.id" type="comment" :count.sync="row.hotCount"/>
|
||||||
<div>{{ `字数 ${wordCount || 0} / 300` }}</div>
|
</div>
|
||||||
<button @click="submitComment" :disabled="wordCount == 0">发布</button>
|
<div class="font-32 mar-t8 mar-b24" v-text="row.content"/>
|
||||||
</view>
|
<div class="flex mar-b24">
|
||||||
|
<div class="color-999" v-text="[row.areaName,row.commentTime].join(' ')"/>
|
||||||
|
<comment-editor class="mar-l16" :bid="row.id" type="2">回复TA</comment-editor>
|
||||||
|
</div>
|
||||||
|
<div v-if="getArrayLength(row.replyList)>0" class="replyList">
|
||||||
|
<div v-if="row.showAllReply">
|
||||||
|
<div class="flex color-666 mar-t8" v-for="reply in row.replyList" :key="reply.id">
|
||||||
|
<div class="font600" v-text="reply.name+':'"/>
|
||||||
|
<div v-text="reply.content"/>
|
||||||
|
</div>
|
||||||
|
<div v-if="getArrayLength(row.replyList)>2" class="color-687DA6 mar-t8" v-text="`收起`" @click="handleExpand(row)"/>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
<div class="flex color-666 mar-t8" v-for="reply in getReplies(row.replyList)" :key="reply.id">
|
||||||
|
<div class="font600" v-text="reply.name+':'"/>
|
||||||
|
<div v-text="reply.content"/>
|
||||||
|
</div>
|
||||||
|
<div v-if="getArrayLength(row.replyList)>2" class="color-687DA6 mar-t8" v-text="`查看全部${getArrayLength(row.replyList)}条回复 >`"
|
||||||
|
@click="handleExpand(row)"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<comment-editor class="fixedBottom" :bid="bid" :comment-count="total"/>
|
||||||
|
<u-gap height="128"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
import CommentEditor from "./commentEditor";
|
||||||
|
import AiThumbsUp from "../AiThumbsUp/AiThumbsUp";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "AiComment",
|
name: "AiComment",
|
||||||
|
components: {AiThumbsUp, CommentEditor},
|
||||||
props: {
|
props: {
|
||||||
needLogin: Boolean,
|
bid: {default: ""}
|
||||||
customLogin: Boolean,
|
|
||||||
commentCount: Number,
|
|
||||||
modelClickClose: {type: Boolean, default: true}
|
|
||||||
},
|
|
||||||
computed: {
|
|
||||||
wordCount() {
|
|
||||||
return this.content.length || 0
|
|
||||||
},
|
|
||||||
boxContent() {
|
|
||||||
return this.content || "我也说两句..."
|
|
||||||
},
|
|
||||||
isLogin() {
|
|
||||||
return Boolean(uni.getStorageSync('token'))
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
content: "",
|
list: [],
|
||||||
marginBottom: 0,
|
current: 1,
|
||||||
commentBoxPopup: false,
|
total: 0
|
||||||
focus: false
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showCommentBox() {
|
getComments() {
|
||||||
if (this.customLogin) {
|
let {current, total, bid: contentId} = this
|
||||||
this.$emit("login", flag => this.commentBoxPopup = flag)
|
if (!total || this.list.length < total) {
|
||||||
} else if (this.needLogin) {
|
this.$instance.post("/app/appcontentcomment/list", null, {
|
||||||
if (this.isLogin) {
|
params: {current, contentId}
|
||||||
this.commentBoxPopup = true
|
}).then(res => {
|
||||||
} else {
|
if (res?.data) {
|
||||||
this.$dialog.confirm({
|
res.data.records.map(e => e.showAllReply = false)
|
||||||
content: '您还未登陆',
|
this.list = [current == 1 ? [] : this.list, res.data.records].flat()
|
||||||
confirmText: '去登录'
|
this.total = res.data.total
|
||||||
}).then(() => {
|
}
|
||||||
uni.switchTab({url: '/pages/mine/mine'})
|
})
|
||||||
}).catch(() => {
|
|
||||||
})
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.commentBoxPopup = true
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
submitComment() {
|
getReplies(list, showAll) {
|
||||||
this.commentBoxPopup = false
|
return list?.slice(0, showAll ? this.getArrayLength(list) : 2) || []
|
||||||
this.$emit("submitComment", this.content)
|
|
||||||
this.content = ""
|
|
||||||
},
|
},
|
||||||
showCommentList() {
|
getArrayLength(list) {
|
||||||
this.commentBoxPopup = false
|
return list?.length || 0
|
||||||
this.$emit("showCommentList")
|
|
||||||
},
|
},
|
||||||
getMarginBottom({detail}) {
|
handleExpand(row) {
|
||||||
this.marginBottom = detail.height
|
console.log(row)
|
||||||
this.focus = true
|
row.showAllReply = !row.showAllReply
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getComments()
|
||||||
|
uni.$on("moreComments", flag => {
|
||||||
|
flag ? this.current = 1 : this.current++
|
||||||
|
this.getComments()
|
||||||
|
})
|
||||||
|
},
|
||||||
|
destroyed() {
|
||||||
|
uni.$off("moreComments")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
|
||||||
.AiComment {
|
.AiComment {
|
||||||
.comments {
|
background: #fff;
|
||||||
width: 100%;
|
|
||||||
height: 112px;
|
.item {
|
||||||
padding: 24px 32px;
|
padding: 24px 32px;
|
||||||
box-sizing: border-box;
|
align-items: flex-start;
|
||||||
position: fixed;
|
color: #333;
|
||||||
bottom: 0;
|
font-size: 26px;
|
||||||
background: #f7f7f7;
|
|
||||||
|
|
||||||
.comments-box {
|
& > img {
|
||||||
width: 580px;
|
|
||||||
height: 64px;
|
height: 64px;
|
||||||
line-height: 64px;
|
width: 64px;
|
||||||
background-color: #fff;
|
border-radius: 50%;
|
||||||
color: #666;
|
margin-right: 16px;
|
||||||
font-size: 26px;
|
|
||||||
padding-left: 16px;
|
|
||||||
white-space: nowrap;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
image {
|
.content {
|
||||||
width: 52px;
|
margin: 8px 0 24px;
|
||||||
height: 52px;
|
|
||||||
margin-left: 16px;
|
|
||||||
vertical-align: middle;
|
|
||||||
}
|
|
||||||
|
|
||||||
text {
|
|
||||||
color: #666666;
|
|
||||||
font-size: 28px;
|
|
||||||
line-height: 60px;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.modalWrapper {
|
.font600 {
|
||||||
position: fixed;
|
font-weight: 600;
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
background: rgba(0, 0, 0, .6);
|
|
||||||
z-index: 9;
|
|
||||||
|
|
||||||
&.clickClose {
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.commentBox {
|
.font-32 {
|
||||||
width: 100%;
|
font-size: 32px;
|
||||||
height: 288px;
|
|
||||||
background-color: #fff;
|
|
||||||
padding: 32px 32px 24px 26px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
position: fixed;
|
|
||||||
bottom: 0;
|
|
||||||
z-index: 99;
|
|
||||||
|
|
||||||
textarea {
|
|
||||||
width: 100%;
|
|
||||||
height: 144px;
|
|
||||||
color: #666;
|
|
||||||
font-size: 26px;
|
|
||||||
background: #F7F7F7;
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 16px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
|
|
||||||
&::placeholder {
|
|
||||||
font-size: inherit;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.form-submit {
|
|
||||||
margin-top: 24px;
|
|
||||||
height: 64px;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
color: #999;
|
|
||||||
font-size: 24px;
|
|
||||||
|
|
||||||
button {
|
|
||||||
width: 144px;
|
|
||||||
height: 64px;
|
|
||||||
background-color: #135AB8;
|
|
||||||
color: #fff;
|
|
||||||
font-size: 24px;
|
|
||||||
border-radius: 32px;
|
|
||||||
line-height: 64px;
|
|
||||||
text-align: center;
|
|
||||||
margin: unset;
|
|
||||||
|
|
||||||
&[disabled] {
|
|
||||||
color: #999;
|
|
||||||
background-color: #f7f7f7;
|
|
||||||
font-size: 28px;
|
|
||||||
border: 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:active {
|
|
||||||
opacity: .8;
|
|
||||||
}
|
|
||||||
|
|
||||||
&:after {
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.flex-row {
|
.font-28 {
|
||||||
display: flex;
|
font-size: 28px;
|
||||||
flex-direction: row;
|
}
|
||||||
|
|
||||||
|
.mar-t8 {
|
||||||
|
margin-top: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mar-b24 {
|
||||||
|
margin-bottom: 24px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mar-r16 {
|
||||||
|
margin-right: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mar-l16 {
|
||||||
|
margin-left: 16px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-999 {
|
||||||
|
color: #999;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-666 {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
|
||||||
|
.color-687DA6 {
|
||||||
|
color: #687DA6;
|
||||||
|
}
|
||||||
|
|
||||||
|
.replyList {
|
||||||
|
padding: 8px 16px 16px;
|
||||||
|
background: #F4F5FA;
|
||||||
|
border-radius: 8px;
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pageTitle {
|
||||||
|
height: 100px;
|
||||||
|
padding: 0 32px;
|
||||||
|
font-size: 34px;
|
||||||
|
font-family: PingFangSC-Semibold, PingFang SC;
|
||||||
|
font-weight: 600;
|
||||||
|
color: #333333;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
217
src/components/AiComment/commentEditor.vue
Normal file
217
src/components/AiComment/commentEditor.vue
Normal file
@@ -0,0 +1,217 @@
|
|||||||
|
<template>
|
||||||
|
<section class="commentEditor">
|
||||||
|
<div v-if="$slots.default" @click="showCommentBox">
|
||||||
|
<slot/>
|
||||||
|
</div>
|
||||||
|
<div v-else class="comments flex-row">
|
||||||
|
<div class="comments-box" @click="showCommentBox">{{ boxContent }}</div>
|
||||||
|
<img src="./static/comment.svg" alt=""/>
|
||||||
|
<text>{{ commentCount || 0 }}</text>
|
||||||
|
</div>
|
||||||
|
<div class="modalWrapper" v-if="commentBoxPopup" :class="{clickClose:!modelClickClose}"
|
||||||
|
@click="commentBoxPopup=false"/>
|
||||||
|
<div class="commentBox" v-if="commentBoxPopup" :style="{bottom:marginBottom+ 'px'}">
|
||||||
|
<textarea v-model="content" placeholder="写下你的想法…" maxlength="300" :focus="focus" @focus="getMarginBottom"
|
||||||
|
@blur="marginBottom=0" :adjust-position="false" fixed/>
|
||||||
|
<view class="flex-row form-submit">
|
||||||
|
<div>{{ `字数 ${wordCount || 0} / 300` }}</div>
|
||||||
|
<button @click="submitComment" :disabled="wordCount == 0">发布</button>
|
||||||
|
</view>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "commentEditor",
|
||||||
|
props: {
|
||||||
|
bid: {default: ""},
|
||||||
|
type: {default: 1},
|
||||||
|
needLogin: Boolean,
|
||||||
|
customLogin: Boolean,
|
||||||
|
commentCount: Number,
|
||||||
|
modelClickClose: {type: Boolean, default: true}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
wordCount() {
|
||||||
|
return this.content.length || 0
|
||||||
|
},
|
||||||
|
boxContent() {
|
||||||
|
return this.content || "我也说两句..."
|
||||||
|
},
|
||||||
|
isLogin() {
|
||||||
|
return Boolean(uni.getStorageSync('token'))
|
||||||
|
},
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
content: "",
|
||||||
|
marginBottom: 0,
|
||||||
|
commentBoxPopup: false,
|
||||||
|
focus: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
showCommentBox() {
|
||||||
|
if (this.customLogin) {
|
||||||
|
this.$emit("login", flag => this.commentBoxPopup = flag)
|
||||||
|
} else if (this.needLogin) {
|
||||||
|
if (this.isLogin) {
|
||||||
|
this.commentBoxPopup = true
|
||||||
|
} else {
|
||||||
|
this.$dialog.confirm({
|
||||||
|
content: '您还未登陆',
|
||||||
|
confirmText: '去登录'
|
||||||
|
}).then(() => {
|
||||||
|
uni.switchTab({url: '/pages/mine/mine'})
|
||||||
|
}).catch(() => {
|
||||||
|
})
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
this.commentBoxPopup = true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
submitComment() {
|
||||||
|
let {content, type, bid: contentId} = this
|
||||||
|
this.$instance.post("/app/appcontentcomment/addByApplet", {content, type, contentId}).then(res => {
|
||||||
|
if (res?.code == 0) {
|
||||||
|
this.$u.toast("提交成功!")
|
||||||
|
this.commentBoxPopup = false
|
||||||
|
this.content = ""
|
||||||
|
uni.$emit("moreComments", 1)//刷新评论列表
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
getMarginBottom({detail}) {
|
||||||
|
this.marginBottom = detail.height
|
||||||
|
this.focus = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.commentEditor {
|
||||||
|
font-family: PingFangSC-Regular, PingFang SC;
|
||||||
|
|
||||||
|
.comments {
|
||||||
|
width: 100%;
|
||||||
|
height: 128px;
|
||||||
|
padding: 24px 32px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: fixed;
|
||||||
|
bottom: 0;
|
||||||
|
background: #fff;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
|
||||||
|
.comments-box {
|
||||||
|
width: 580px;
|
||||||
|
height: 80px;
|
||||||
|
line-height: 80px;
|
||||||
|
background-color: #F4F5FA;
|
||||||
|
color: #666;
|
||||||
|
font-size: 32px;
|
||||||
|
padding-left: 32px;
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
border-radius: 44px;
|
||||||
|
}
|
||||||
|
|
||||||
|
image {
|
||||||
|
width: 52px;
|
||||||
|
height: 52px;
|
||||||
|
margin-left: 16px;
|
||||||
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
text {
|
||||||
|
color: #666666;
|
||||||
|
font-size: 28px;
|
||||||
|
line-height: 60px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.modalWrapper {
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
background: rgba(0, 0, 0, .6);
|
||||||
|
z-index: 9;
|
||||||
|
|
||||||
|
&.clickClose {
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.commentBox {
|
||||||
|
width: 100vw;
|
||||||
|
height: 288px;
|
||||||
|
background-color: #fff;
|
||||||
|
padding: 32px 32px 24px 26px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: fixed;
|
||||||
|
left: 0;
|
||||||
|
bottom: 0;
|
||||||
|
z-index: 99;
|
||||||
|
|
||||||
|
textarea {
|
||||||
|
width: 100%;
|
||||||
|
height: 144px;
|
||||||
|
color: #666;
|
||||||
|
font-size: 26px;
|
||||||
|
background: #F7F7F7;
|
||||||
|
border-radius: 16px;
|
||||||
|
padding: 16px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
|
||||||
|
&::placeholder {
|
||||||
|
font-size: inherit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.form-submit {
|
||||||
|
margin-top: 24px;
|
||||||
|
height: 64px;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
color: #999;
|
||||||
|
font-size: 24px;
|
||||||
|
|
||||||
|
button {
|
||||||
|
width: 144px;
|
||||||
|
height: 64px;
|
||||||
|
background-color: #135AB8;
|
||||||
|
color: #fff;
|
||||||
|
font-size: 24px;
|
||||||
|
border-radius: 32px;
|
||||||
|
line-height: 64px;
|
||||||
|
text-align: center;
|
||||||
|
margin: unset;
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
color: #999;
|
||||||
|
background-color: #f7f7f7;
|
||||||
|
font-size: 28px;
|
||||||
|
border: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:active {
|
||||||
|
opacity: .8;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.flex-row {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -18,8 +18,6 @@
|
|||||||
<div class="files" v-if="detail.contentType==1 && detail.files && detail.files.length">
|
<div class="files" v-if="detail.contentType==1 && detail.files && detail.files.length">
|
||||||
<video class="file-img" :src="file.url" v-for="(file,index) in detail.files" :key="index"/>
|
<video class="file-img" :src="file.url" v-for="(file,index) in detail.files" :key="index"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div v-if="comment" class="comments"/>
|
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -30,7 +28,6 @@ export default {
|
|||||||
props: {
|
props: {
|
||||||
title: {default: ""},
|
title: {default: ""},
|
||||||
detail: {default: () => ({})},
|
detail: {default: () => ({})},
|
||||||
comment: Boolean
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
preview(index) {
|
preview(index) {
|
||||||
@@ -42,8 +39,8 @@ export default {
|
|||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.AiDetail {
|
.AiDetail {
|
||||||
min-height: 100vh;
|
padding-bottom: 80px;
|
||||||
background: #ffffff;
|
background: #fff;
|
||||||
|
|
||||||
.header {
|
.header {
|
||||||
.title {
|
.title {
|
||||||
|
|||||||
62
src/components/AiThumbsUp/AiThumbsUp.vue
Normal file
62
src/components/AiThumbsUp/AiThumbsUp.vue
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
<template>
|
||||||
|
<section class="AiThumbsUp flex" :class="{checked}" @click.native="handleClick">
|
||||||
|
<div class="count" v-text="count||0"/>
|
||||||
|
<u-icon :name="thumbIcon"/>
|
||||||
|
</section>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: "AiThumbsUp",
|
||||||
|
props: {
|
||||||
|
bid: {default: ""},
|
||||||
|
count: {default: 0},
|
||||||
|
btn: Boolean,
|
||||||
|
type: {default: "content"},
|
||||||
|
action: {default: ""}
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
thumbIcon() {
|
||||||
|
return this.checked ? "thumb-up-fill" : "thumb-up"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
checked: false,
|
||||||
|
actions: {
|
||||||
|
content: "/app/appcontentinfo/supportById",
|
||||||
|
comment: "/app/appcontentcomment/supportById",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
handleClick() {
|
||||||
|
if (!this.checked) {
|
||||||
|
let {action, type, actions, bid: id} = this
|
||||||
|
this.$instance.post(action || actions[type], null, {
|
||||||
|
params: {id}
|
||||||
|
}).then(res => {
|
||||||
|
if (res?.code == 0) {
|
||||||
|
this.checked = true
|
||||||
|
this.$emit("update:count", ++this.count)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.AiThumbsUp {
|
||||||
|
color: #666;
|
||||||
|
|
||||||
|
&.checked {
|
||||||
|
color: #2D7DFF;
|
||||||
|
}
|
||||||
|
|
||||||
|
.count {
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -1,14 +1,19 @@
|
|||||||
<template>
|
<template>
|
||||||
<section class="contentDetail">
|
<section class="contentDetail">
|
||||||
<AiDetail :detail="detail" :props="props"/>
|
<AiDetail :detail="detail" :props="props"/>
|
||||||
|
<u-gap height="16"/>
|
||||||
|
<AiComment v-if="detail.id" :bid="detail.id"/>
|
||||||
</section>
|
</section>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
|
import AiComment from "dvcp-wui/AiComment/AiComment";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "contentDetail",
|
name: "contentDetail",
|
||||||
appName:"内容详情",
|
components: {AiComment},
|
||||||
|
appName: "内容详情",
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
detail: {title: "内容详情"},
|
detail: {title: "内容详情"},
|
||||||
@@ -35,12 +40,14 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
onShareAppMessage() {
|
onShareAppMessage() {
|
||||||
return {
|
return {
|
||||||
title: this.detail.title,
|
title: this.detail.title,
|
||||||
path: '/mods/AppContent/contentDetail?id=' + this.id
|
path: '/mods/AppContent/contentDetail?id=' + this.id
|
||||||
};
|
};
|
||||||
|
},
|
||||||
|
onReachBottom() {
|
||||||
|
uni.$emit("moreComments")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user