no message

This commit is contained in:
A1300399510 2024-02-28 19:09:34 +08:00
parent e0af963c4a
commit 46a14bea6c
2 changed files with 48 additions and 21 deletions

View File

@ -32,7 +32,7 @@ service.interceptors.request.use(config => {
// config['headers']['authorization'] = "661aiz52k5e6vqgmkxnz0wvbv8nciz8h"
// if (process.env.NODE_ENV == "development") config['headers']['authorization'] = "0h870ovk2xckoqfsh8a3t3sg4sg5z7eg"
if (process.env.NODE_ENV == "development") config['headers']['authorization'] = "1723258c5fdf64c7720a6a04b1c6c8a9"
if (process.env.NODE_ENV == "development") config['headers']['authorization'] = "thocmlg8r2s4ft47989le9qc0"
return config
}, error => {

View File

@ -88,10 +88,10 @@
<template v-for="(item, index) in interviewKey">
<div class="offer-content-item flexacenter" :key="index" v-if="info[item.key]">
<div class="offer-content-key" v-if="info[item.key]">{{ item.name }}</div>
<div class="offer-content-value" :class="{isvisiblereply: info['isvisiblereply'] == 1 && !info['isreply']}" v-html="info[item.key]"></div>
<div class="offer-content-value" :class="{ isvisiblereply: info['isvisiblereply'] == 1 && !info['isreply'] }" v-html="info[item.key]"></div>
</div>
<template v-if="item.key == 'message' && info['isvisiblereply'] == 1 && !info['isreply']">
<div :key="item.key" class="flexcenter content-unlock content-unlock-no" :class="{replyVisible: islogin, registerVisible: !islogin}" @click="islogin ? (popState = 'discussionSingle') : (isloginBtnState = true)">
<div :key="item.key" class="flexcenter content-unlock content-unlock-no" :class="{ replyVisible: islogin, registerVisible: !islogin }" @click="islogin ? (popState = 'discussionSingle') : (isloginBtnState = true)">
<img class="unlock-icom" :src="`${$baseURL}/img/unlock.png`" />
详细内容回复可见
</div>
@ -173,8 +173,8 @@
<div class="bottom-operation-box flex1 flexacenter">
<div class="bottom-operation-item flex1 flexcolumn flexcenter" @click="info.islike == 0 ? tapOperate('like') : ''">
<div class="loginBtn" v-if="!islogin" @click.stop="setValue('isloginBtnState', true, 'boolean')"></div>
<img v-if="info.islike == 0" class="bottom-operation-icom" :class="{prepareLiskeAnimateState: prepareLiskeAnimateState}" src="@/assets/img/detail/like.png" />
<img v-else class="bottom-operation-icom" :class="{prepareLiskeAnimateState: prepareLiskeAnimateState}" src="@/assets/img/icon/like-o.png" />
<img v-if="info.islike == 0" class="bottom-operation-icom" :class="{ prepareLiskeAnimateState: prepareLiskeAnimateState }" src="@/assets/img/detail/like.png" />
<img v-else class="bottom-operation-icom" :class="{ prepareLiskeAnimateState: prepareLiskeAnimateState }" src="@/assets/img/icon/like-o.png" />
<div class="bottom-operation-text">{{ info.recommend_add == 0 ? "" : info.recommend_add }}</div>
</div>
<div class="bottom-operation-item flex1 flexcolumn flexcenter" @click="tapOperate(info.isfav == 0 ? 'collect' : 'uncollect')">
@ -195,7 +195,7 @@
<coins :coin-config="coinConfig" :mybalance="mybalance" :pop-state="popState" :info="info"></coins>
<div class="alert" v-show="alert.state" :class="{alertState: alert.state}">
<div class="alert" v-show="alert.state" :class="{ alertState: alert.state }">
<el-alert :title="alert.message" type="info" center show-icon :closable="false"></el-alert>
</div>
</div>
@ -204,7 +204,7 @@
<script>
import DetailReply from "@/components/DetailReply"
import Coins from "@/components/unlock/Coins"
import {coinNo} from "@/utils/bizarreUrl"
import { coinNo } from "@/utils/bizarreUrl"
import emojiList from "@/assets/emojiList.json"
export default {
name: "detailIndex",
@ -434,7 +434,6 @@ export default {
})
// html
// let replyVisibleHtml = `<div class="flexcenter content-unlock content-unlock-no replyVisible" @click="setValue('popState', 'discussionSingle')"><img class="unlock-icom" src="./img/unlock.png"/>${this.islogin ? '' : ''}</div>`
let replyVisibleHtml = `<div class="flexcenter content-unlock content-unlock-no ${this.islogin ? "replyVisible" : "registerVisible"} " @click="setValue('popState', ${this.islogin ? "discussionSingle" : "isloginBtnState"})"><img class="unlock-icom" src="${this.$baseURL}/img/unlock.png"/>作者设置了${this.islogin ? "回复" : "登录"}可见</div>`
let coinVisibleHtml = `<div class="flexcenter content-unlock content-unlock-no coinVisible"><img class="unlock-icom" src="${this.$baseURL}/img/unlock.png"/>作者设置了投币可见</div>`
@ -448,7 +447,6 @@ export default {
if (price > 0 && isbuy == 0 && isauthor != 1) {
let message = info["message"]
// if (message.indexOf("[free]") != -1) {
info["message"] = ""
const regex = /\[(free|hide)\]([^[]+)\[\/(free|hide)\]/g
let result = message.match(regex) || []
@ -514,11 +512,9 @@ export default {
const regex1 = /\[hide(?:=[0-9]+)?\]/
if (regex1.test(info["message"])) {
// if (info['message'].indexOf("[hide]") != -1) {
const regex = /\[hide\].*?\[\/hide\]/g // [hide]
if (ispost == 0 && isauthor != 1) info["message"] = info["message"].replace(regex, replyVisibleHtml)
if (ispost == 1 || isauthor == 1) {
// info['message'] = info['message'].replaceAll("[hide]", `<div class="content-unlock content-already"><div class="content-already-header flexflex">- -</div><div class="content-unlock-wenzi">`)
var pattern = /\[hide(=\d+)?\]/g
info["message"] = info["message"].replaceAll(pattern, `<div class="content-unlock content-already"><div class="content-already-header flexflex">- 本内容回复可见 -</div><div class="content-unlock-wenzi">`)
info["message"] = info["message"].replaceAll("[/hide]", `</div></div>`)
@ -555,6 +551,7 @@ export default {
this.popState = data.mybalance > price ? "coindisplayuser" : "coinNo"
})
}
let registerVisibleList = document.getElementsByClassName("registerVisible")
if (!Array.isArray(registerVisibleList)) {
for (let i = 0; i < registerVisibleList.length; i++) {
@ -642,7 +639,7 @@ export default {
el["useperformanceStr"] = useperformanceStr
})
this.info = {...this.info, ...data.info}
this.info = { ...this.info, ...data.info }
this.collegelist = collegelist
this.shareurl = data.shareurl
})
@ -662,7 +659,7 @@ export default {
if (res.code == 201) this.tenementInfoState = true
let tenementKey = this.tenementKey
let info = {...this.info, ...res.info}
let info = { ...this.info, ...res.info }
info["typeText"] = info.gptype + ">>" + info.type
@ -703,7 +700,7 @@ export default {
.then(res => {
if (res.code != 200) return
let data = res.data
this.info = {...this.info, ...data}
this.info = { ...this.info, ...data }
// console.log("data", data["isreply"])
if (data["isvisiblereply"] == 1 && !data["isreply"]) {
console.log("需要回复看详情")
@ -716,7 +713,7 @@ export default {
getPostList() {
this.$startupUnderLoading(this)
let {page, limit} = this.postList
let { page, limit } = this.postList
this.$http
.post("/api/thread/postList", {
token: this.token,
@ -728,9 +725,37 @@ export default {
let data = res.data
data.data.forEach(el => {
for (const key in emojiList) {
el.message = el.message.replaceAll(key, `<img class="gif" src="${emojiList[key]}" />`)
el["message"] = el["message"].trim()
const reg = new RegExp("\r\n", "g")
el["message"] = el["message"].replaceAll(reg, "<br/>")
el["message"] = el["message"].replace(/<img[^>]*>/g, match => {
return match.replace(/width="[^"]*"/g, "").replace(/height="[^"]*"/g, "")
})
// html
let replyVisibleHtml = `<div class="flexcenter content-unlock content-unlock-no ${this.islogin ? "replyVisible" : "registerVisible"} " @click="setValue('popState', ${this.islogin ? "discussionSingle" : "isloginBtnState"})"><img class="unlock-icom" src="${this.$baseURL}/img/unlock.png"/>作者设置了${this.islogin ? "回复" : "登录"}可见</div>`
const regex1 = /\[hide(?:=[0-9]+)?\]/
if (regex1.test(el["message"])) {
const regex = /\[hide\].*?\[\/hide\]/g // [hide]
if (this.islogin) {
var pattern = /\[hide(=\d+)?\]/g
el["message"] = el["message"].replaceAll(pattern, `<div class="content-unlock content-already"><div class="content-already-header flexflex">- 本内容登录可见 -</div><div class="content-unlock-wenzi">`)
el["message"] = el["message"].replaceAll("[/hide]", `</div></div>`)
} else el["message"] = el["message"].replace(regex, replyVisibleHtml)
}
if (!this.islogin) {
el["message"] = el["message"].replaceAll("[free]", "")
el["message"] = el["message"].replaceAll("[/free]", "")
}
// for (const key in emojiList) {
// el.message = el.message.replaceAll(key, `<img class="gif" src="${emojiList[key]}" />`)
// }
})
this.postList.list = data.data
@ -759,6 +784,8 @@ export default {
//
handleReplyPop(item) {
if (!this.islogin) this.isloginBtnState = true
let message = item.message
// message = message.replace(/<(*?)[^>]*>[\s\S]*?<\/(*?)>/gi, ''); //
message = message.replace(/<[^>]*>/g, "") //
@ -803,7 +830,7 @@ export default {
this.editCommentPid = null
let {count, limit} = this.postList
let { count, limit } = this.postList
let page = Math.ceil((count + 1) / limit)
@ -819,7 +846,7 @@ export default {
tid: this.tid,
}
this.$router.push({path: `/detailIndex`, query})
this.$router.push({ path: `/detailIndex`, query })
}, 800)
})
},
@ -850,7 +877,7 @@ export default {
else if (key == "uncollect") url = "/api/operation/threadunFav"
this.$http
.post(url, {tid: this.tid})
.post(url, { tid: this.tid })
.then(res => {
if (res.code != 200) return
if (key == "like") (this.info.islike = 1), this.info.recommends + 1
@ -877,7 +904,7 @@ export default {
//
toAllSection() {
this.$router.push({path: `/allSections`, query: {fid: this.info.fid}})
this.$router.push({ path: `/allSections`, query: { fid: this.info.fid } })
},
//