103 lines
3.1 KiB
XML
103 lines
3.1 KiB
XML
<import name="title-bar" src="@components/TitleBar/TitleBar.ux"></import>
|
|
|
|
<template>
|
|
<div class="page">
|
|
<scroll scroll-y="true" class="scroll {{scrclass}}" bounces="true">
|
|
<title-bar title="replytools.title"></title-bar>
|
|
<div class="toolbtn" style="margin-top: 30px" @click="LikeReply()">
|
|
<div class="dataicon" style="margin-left: 25px">
|
|
<image class="toolicon" src="/common/replytools_like.png"></image>
|
|
</div>
|
|
<text class="toolname" style="margin-left: 92px; position: absolute">{{ $t("replytools.like") }}</text>
|
|
</div>
|
|
<div class="toolbtn" style="margin-top: 10px" @click="ShowSecReplies()">
|
|
<div class="dataicon" style="margin-left: 25px">
|
|
<image class="toolicon" src="/common/replytools_showreplies.png"></image>
|
|
</div>
|
|
<text class="toolname" style="margin-left: 92px; position: absolute">{{ $t("replytools.showReply") }}</text>
|
|
</div>
|
|
<div class="toolbtn" style="margin-top: 10px" @click="ShowDetail()">
|
|
<div class="dataicon" style="margin-left: 25px">
|
|
<image class="toolicon" src="/common/replytools_showdetail.png"></image>
|
|
</div>
|
|
<text class="toolname" style="margin-left: 92px; position: absolute">{{ $t("replytools.showDetail") }}</text>
|
|
</div>
|
|
</scroll>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import router from "@system.router"
|
|
import prompt from "@system.prompt"
|
|
export default {
|
|
public: {
|
|
type: 0,
|
|
oid: "",
|
|
reply: null
|
|
},
|
|
private: {
|
|
replymessage: "",
|
|
reply_clone: null,
|
|
scrclass: ""
|
|
},
|
|
async LikeReply() {
|
|
var result = await global.biliclient.LikeReply(
|
|
this.type,
|
|
this.oid,
|
|
this.reply_clone.rpid,
|
|
1
|
|
)
|
|
global.logger.log(result)
|
|
if (result.code == 0) {
|
|
prompt.showToast({
|
|
message: "点赞成功!"
|
|
})
|
|
} else {
|
|
prompt.showToast({
|
|
message: "点赞失败...错误代码:" + result.code + " 报错信息:" + result.message,
|
|
duration: 4000
|
|
})
|
|
}
|
|
},
|
|
ShowDetail() {
|
|
router.push({
|
|
uri: "pages/tools/textdetail",
|
|
params: {
|
|
text: this.replymessage
|
|
}
|
|
})
|
|
},
|
|
ShowSecReplies() {
|
|
if (this.reply_clone.rcount > 0) {
|
|
router.push({
|
|
uri: "pages/reply/replys",
|
|
params: {
|
|
type: this.type,
|
|
oid: this.oid,
|
|
replycount: this.reply_clone.rcount,
|
|
rootrpid: this.reply_clone.rpid,
|
|
secmode: true
|
|
}
|
|
})
|
|
} else {
|
|
prompt.showToast({
|
|
message: "没人回复这条评论哦!"
|
|
})
|
|
}
|
|
},
|
|
onInit() {
|
|
// 经观察,在某些情况下(如内存不足或切换页面触发GC)时,传入的reply大概率会变成string
|
|
// 因此进行判断,将其parse一下
|
|
if (typeof this.reply === "string") {
|
|
this.reply = JSON.parse(this.reply)
|
|
}
|
|
this.replymessage = this.reply.content.message
|
|
this.reply_clone = this.reply // 对reply进行一个克隆,防止router back后被GC清理
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="less">
|
|
@import '@less/global.less';
|
|
@import './replytools.less';
|
|
</style> |