"use strict"; const common_vendor = require("../../common/vendor.js"); const common_assets = require("../../common/assets.js"); const api_api = require("../../api/api.js"); const utils_throttle = require("../../utils/throttle.js"); if (!Array) { const _easycom_up__image2 = common_vendor.resolveComponent("up--image"); const _easycom_up_input2 = common_vendor.resolveComponent("up-input"); const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon"); const _component_polyv_player = common_vendor.resolveComponent("polyv-player"); const _easycom_up_parse2 = common_vendor.resolveComponent("up-parse"); const _easycom_up_radio2 = common_vendor.resolveComponent("up-radio"); const _easycom_up_radio_group2 = common_vendor.resolveComponent("up-radio-group"); const _easycom_up_image2 = common_vendor.resolveComponent("up-image"); const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging"); const _easycom_up__textarea2 = common_vendor.resolveComponent("up--textarea"); const _easycom_up_upload2 = common_vendor.resolveComponent("up-upload"); const _easycom_up_popup2 = common_vendor.resolveComponent("up-popup"); const _easycom_up_overlay2 = common_vendor.resolveComponent("up-overlay"); (_easycom_up__image2 + _easycom_up_input2 + _easycom_up_icon2 + _component_polyv_player + _easycom_up_parse2 + _easycom_up_radio2 + _easycom_up_radio_group2 + _easycom_up_image2 + _easycom_z_paging2 + _easycom_up__textarea2 + _easycom_up_upload2 + _easycom_up_popup2 + _easycom_up_overlay2)(); } const _easycom_up__image = () => "../../node-modules/uview-plus/components/u--image/u--image.js"; const _easycom_up_input = () => "../../node-modules/uview-plus/components/u-input/u-input.js"; const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js"; const _easycom_up_parse = () => "../../node-modules/uview-plus/components/u-parse/u-parse.js"; const _easycom_up_radio = () => "../../node-modules/uview-plus/components/u-radio/u-radio.js"; const _easycom_up_radio_group = () => "../../node-modules/uview-plus/components/u-radio-group/u-radio-group.js"; const _easycom_up_image = () => "../../node-modules/uview-plus/components/u-image/u-image.js"; const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js"; const _easycom_up__textarea = () => "../../node-modules/uview-plus/components/u--textarea/u--textarea.js"; const _easycom_up_upload = () => "../../node-modules/uview-plus/components/u-upload/u-upload.js"; const _easycom_up_popup = () => "../../node-modules/uview-plus/components/u-popup/u-popup.js"; const _easycom_up_overlay = () => "../../node-modules/uview-plus/components/u-overlay/u-overlay.js"; if (!Math) { (backDetailNav + _easycom_up__image + _easycom_up_input + _easycom_up_icon + _easycom_up_parse + _easycom_up_radio + _easycom_up_radio_group + _easycom_up_image + _easycom_z_paging + _easycom_up__textarea + _easycom_up_upload + _easycom_up_popup + _easycom_up_overlay)(); } const backDetailNav = () => "../../components/backDetailNav/backDetailNav.js"; const _sfc_main = { __name: "detail", setup(__props) { const value = common_vendor.ref(""); const isArticleAuthor = common_vendor.ref(false); const isH5 = common_vendor.ref(false); const doctor_id = common_vendor.ref(""); const paging = common_vendor.ref(null); const dataList = common_vendor.ref([]); const total = common_vendor.ref(0); const imgList = common_vendor.ref([]); const showCanvas = common_vendor.ref(true); const showCommentDialog = common_vendor.ref(false); const givePointValue = common_vendor.ref(5); common_vendor.ref(0); common_vendor.ref(0); const showModal = common_vendor.ref(false); const content = common_vendor.ref(""); const type = common_vendor.ref(""); const info = common_vendor.reactive({}); const showDeal = common_vendor.ref(false); const showMore = common_vendor.ref(false); const showGive = common_vendor.ref(false); const id = common_vendor.ref(""); const parent_id = common_vendor.ref(null); const root_id = common_vendor.ref(null); const is_author = common_vendor.ref(false); const reply_name = common_vendor.ref(""); const level = common_vendor.ref(1); const placeholder = common_vendor.ref("请输入评论内容"); const mainCommentObj = common_vendor.reactive({}); const childList = common_vendor.ref([]); const clickIndex = common_vendor.ref(0); const is_top = common_vendor.ref(false); const option_id = common_vendor.ref(""); const point = common_vendor.ref(0); const comment_doctorId = common_vendor.ref(""); const commentTextarea = common_vendor.ref(null); const isLock = common_vendor.ref(false); const confirmGive = () => { givePoint(); }; const oldScrollTop = common_vendor.ref(0); const scrollTop = common_vendor.ref(0); const scroll = (e) => { oldScrollTop.value = e.detail.scrollTop; }; const toTop = () => { scrollTop.value = oldScrollTop.value; common_vendor.nextTick$1(() => { scrollTop.value = 0; }); }; const openGivePop = () => { showGive.value = true; getUserPoint(); }; const formatDay = (date) => { return common_vendor.dayjs(date).format("YYYY-MM-DD"); }; const formatDate = (date) => { return common_vendor.dayjs(date).format("YYYY-MM-DD HH:mm"); }; const scrolltolower = (rootId) => { common_vendor.index.__f__("log", "at pages/detail/detail.vue:693", isLock.value); if (!isLock.value) { let page = mainCommentObj.sub_page + 1; mainCommentObj.sub_page = page; let params = { page, page_size: 5 }; if (type.value == "article") { getArticleComment(params, rootId); } else if (type.value == "video") { getVideoComment(params, rootId); } else { getExchangeComment(params, rootId); } } }; const changePoint = (type2) => { if (type2 == "minus") { if (givePointValue.value > 5) { givePointValue.value = givePointValue.value - 5; } else { common_vendor.index.showToast({ icon: "none", title: "每次打赏积分必须大于0" }); givePointValue.value = 1; } } else { givePointValue.value = givePointValue.value + 5; } }; const openMorePop = (obj, list2, index) => { showMore.value = true; childList.value = list2; isLock.value = false; Object.assign(mainCommentObj, obj); clickIndex.value = index; mainCommentObj.sub_page = 1; }; const getArticleDetail = (id2) => { api_api.api.getArticleDetail(id2).then((res) => { let result = res.data.data; Object.assign(info, result); for (let i = 0; i < info.author.length; i++) { if (info.author[i].doctor_id == doctor_id.value) { isArticleAuthor.value = true; } } }); }; const getVideoDetail = (id2) => { api_api.api.getVideoDetail(id2).then((res) => { let result = res.data.data; Object.assign(info, result); for (let i = 0; i < info.author.length; i++) { if (info.author[i].doctor_id == doctor_id.value) { isArticleAuthor.value = true; } } }); }; const getExchangeDetail = (id2) => { api_api.api.getExchangeDetail(id2).then((res) => { let result = res.data.data; Object.assign(info, result); if (info.doctor_id == doctor_id.value) { isArticleAuthor.value = true; } }); }; const getUserPoint = () => { api_api.api.getUserPoint().then((res) => { point.value = res.data.data; }); }; const givePoint = () => { if (givePointValue.value == null) { common_vendor.index.showToast({ icon: "none", title: "每次打赏积分必须大于0" }); return false; } if (givePointValue.value <= 1) { givePointValue.value = 1; common_vendor.index.showToast({ icon: "none", title: "每次打赏积分必须大于0" }); return false; } if (!/^[1-9]\d*$/.test(givePointValue.value)) { common_vendor.index.showToast({ icon: "none", title: "每次打赏积分必须是大于0的整数" }); givePointValue.value = null; return false; } if (point.value < givePointValue.value) { common_vendor.index.showToast({ icon: "none", title: "积分不足!" }); return false; } let giveType = 1; if (type.value == "article") { giveType = 1; } else if (type.value == "video") { giveType = 2; } else { giveType = 3; } api_api.api.givePoint({ id: id.value, type: giveType, point: givePointValue.value }).then((res) => { common_vendor.index.showToast({ icon: "none", title: "打赏成功!" }); givePointValue.value = 5; showGive.value = false; }); }; const getQueryParam = (param, link) => { const url = link; const regex = new RegExp("[?&]" + param + "=([^&#]*)", "i"); const result = regex.exec(url); return result ? decodeURIComponent(result[1]) : null; }; common_vendor.onLoad((options) => { if (options.scene) { var decodedURL = decodeURIComponent(options.scene); let idStr = getQueryParam("id", decodedURL); let typeStr = getQueryParam("type", decodedURL); if (idStr) { id.value = idStr; } if (typeStr) { if (typeStr == 1) { type.value = "article"; } else if (typeStr == 2) { type.value = "video"; } } } else { id.value = options.id; type.value = options.type; } readRecord(); let userInfo = common_vendor.index.getStorageSync("userInfo"); if (userInfo.doctor_id) { doctor_id.value = userInfo.doctor_id; } }); const clearComment = () => { parent_id.value = null; imgList.value = []; content.value = ""; root_id.value = null; placeholder.value = "请输入评论内容"; reply_name.value = ""; level.value = 1; }; const closeDealPop = () => { showDeal.value = false; clearComment(); }; const showReplyPop = () => { parent_id.value = mainCommentObj.comment_id; root_id.value = mainCommentObj.comment_id; is_author.value = mainCommentObj.is_author == 1 ? true : false; reply_name.value = mainCommentObj.user_name; level.value = 2; if (level.value == 2 || level.value == 3) { placeholder.value = "回复" + reply_name.value + ":"; } showCommentDialog.value = true; }; const alertDeal = (parentId, rootId, name, top, commentLevel, userId) => { parent_id.value = parentId; comment_doctorId.value = userId; root_id.value = rootId; reply_name.value = name; level.value = commentLevel; is_top.value = top == 1 ? true : false; if (level.value == 2 || level.value == 3) { placeholder.value = "回复" + name + ":"; } showDeal.value = true; }; const openCommentDialog = () => { showCommentDialog.value = true; showDeal.value = false; }; const queryList = (pageNo, pageSize) => { const params = { page: pageNo, page_size: pageSize }; if (type.value == "article") { getArticleComment(params); } else if (type.value == "video") { getVideoComment(params); } else { getExchangeComment(params); } }; const getArticleComment = (params, rootId = "") => { const form = { article_id: id.value, root_id: rootId, is_have_sub_comment: 1 }; api_api.api.getArticleComment({ ...form, ...params }).then((res) => { if (!rootId) { paging.value.complete(res.data.data.data); total.value = res.data.data.total; is_author.value = res.data.data.is_author == 1 ? true : false; setTimeout(() => { if (showMore.value) { childList.value = []; openMorePop( dataList.value[clickIndex.value], dataList.value[clickIndex.value].sub_comment, clickIndex.value ); toTop(); } }, 1500); } else { if (res.data.data.data.length > 0) { mainCommentObj.sub_comment; mainCommentObj.sub_comment = mainCommentObj.sub_comment.concat(res.data.data.data); childList.value = mainCommentObj.sub_comment; if (res.data.data.data.length < 5) { isLock.value = true; } } } }).catch((res) => { paging.value.complete(false); }); }; common_vendor.ref([]); const getVideoComment = (params, rootId = "") => { const form = { video_id: id.value, root_id: rootId, is_have_sub_comment: 1 }; api_api.api.getVideoComment({ ...form, ...params }).then((res) => { if (!rootId) { paging.value.complete(res.data.data.data); total.value = res.data.data.total; is_author.value = res.data.data.is_author == 1 ? true : false; setTimeout(() => { if (showMore.value) { childList.value = []; openMorePop( dataList.value[clickIndex.value], dataList.value[clickIndex.value].sub_comment, clickIndex.value ); toTop(); } }, 1500); } else { if (res.data.data.data.length > 0) { mainCommentObj.sub_comment; mainCommentObj.sub_comment = mainCommentObj.sub_comment.concat(res.data.data.data); childList.value = mainCommentObj.sub_comment; if (res.data.data.data.length < 5) { isLock.value = true; } } } }).catch((res) => { paging.value.complete(false); }); }; const getExchangeComment = (params, rootId = "") => { const form = { exchange_id: id.value, root_id: rootId, is_have_sub_comment: 1 }; api_api.api.getExchangeComment({ ...form, ...params }).then((res) => { if (!rootId) { paging.value.complete(res.data.data.data); total.value = res.data.data.total; is_author.value = res.data.data.is_author == 1 ? true : false; setTimeout(() => { if (showMore.value) { childList.value = []; openMorePop( dataList.value[clickIndex.value], dataList.value[clickIndex.value].sub_comment, clickIndex.value ); toTop(); } }, 1500); } else { if (res.data.data.data.length > 0) { mainCommentObj.sub_comment; mainCommentObj.sub_comment = mainCommentObj.sub_comment.concat(res.data.data.data); childList.value = mainCommentObj.sub_comment; if (res.data.data.data.length < 5) { isLock.value = true; } } } }).catch((res) => { paging.value.complete(false); }); }; const open = () => { showCommentDialog.value = true; }; const close = () => { showCommentDialog.value = false; clearComment(); }; const openDeal = () => { showDeal.value = true; }; const closeDeal = () => { showDeal.value = false; }; const openMore = () => { showMore.value = true; }; const closeMore = () => { showMore.value = false; paging.value.refresh(); }; const previewImg = (url) => { common_vendor.index.previewImage({ current: url, urls: [url] }); }; const fillTextToImgWx = (base64) => { let maskText = "@肝胆相照临床病例库"; return new Promise((resolve, reject) => { common_vendor.wx$1.createSelectorQuery().select("#watermarkCanvas").fields({ node: true, size: true }).exec((res) => { const canvas = res[0].node; const ctx = canvas.getContext("2d"); let textMetrics = ctx.measureText(maskText); let { width: textWidth, actualBoundingBoxAscent, actualBoundingBoxDescent } = textMetrics; let textHeight = actualBoundingBoxAscent ? actualBoundingBoxAscent + actualBoundingBoxDescent : textMetrics.fontBoundingBoxAscent + textMetrics.fontBoundingBoxDescent; let imgHeight, imgWidth; let font = ""; let fontColor = "#fff"; let strokeWidth = 10; common_vendor.index.getImageInfo({ src: base64, success: (imageRes) => { let scale = imageRes.width / 800 * 30 > 12 ? imageRes.width / 800 * 30 : 12; font = scale + "px Arial"; canvas.width = imageRes.width; canvas.height = imageRes.height; imgHeight = imageRes.height; imgWidth = imageRes.width; const image = canvas.createImage(); image.src = ""; image.src = base64; image.onload = () => { ctx.drawImage(image, 0, 0, canvas.width, canvas.height); let posXmargin = 20; let posYmargin = 20; let randomNumber = 3; switch (randomNumber) { case 0: let lt_x = posXmargin; let lt_y = posYmargin + textHeight; ctx.font = font; ctx.storkStyle = "#000"; ctx.strokeWidth = strokeWidth; ctx.fillStyle = "#fff"; ctx.fillText(maskText, lt_x, lt_y); break; case 1: let lb_x = posXmargin; let lb_y = imgHeight - posYmargin; ctx.font = font; ctx.fillStyle = fontColor; ctx.strokeStyle = "black"; ctx.strokeWidth = strokeWidth; ctx.fillStyle = "#fff"; ctx.fillText(maskText, lb_x, lb_y); break; case 2: let rt_x = imgWidth - textWidth * 2.9 - posXmargin <= 0 ? 10 : imgWidth - textWidth * 2.9 - posXmargin; let rt_y = posYmargin + textHeight * 2; ctx.font = font; ctx.fillStyle = fontColor; ctx.strokeStyle = "#000"; ctx.strokeWidth = strokeWidth; ctx.fillStyle = "#fff"; ctx.fillText(maskText, rt_x, rt_y); ctx.restore(); ctx.save(); break; case 3: let rb_x = imgWidth - scale * 10 - posXmargin <= 0 ? 10 : imgWidth - scale * 10 - posXmargin; let rb_y = imgHeight - posYmargin; ctx.font = font; ctx.fillStyle = fontColor; ctx.strokeStyle = "#000"; ctx.fillStyle = "#fff"; ctx.strokeText(maskText, rb_x, rb_y); ctx.fillText(maskText, rb_x, rb_y); break; } common_vendor.wx$1.canvasToTempFilePath({ canvas, success: function(res2) { resolve(res2.tempFilePath); }, fail: function(res2) { common_vendor.index.__f__("error", "at pages/detail/detail.vue:1230", res2); } }); }; } }); }); }); }; const readImages = async (localIds) => { let promiseFun = []; for (var i = 0; i < localIds.length; i++) { let img = null; img = await fillTextToImgWx(localIds[i].url); promiseFun.push(getOss(img)); } Promise.all(promiseFun).then((res) => { common_vendor.index.showToast({ title: "上传成功", icon: "none" }); }); }; const getOss = (temurl) => { api_api.api.getOss({ scene: 1 }).then((rep) => { let result = rep.data; if (result.code == 200) { let { access_id, dir, policy, signature, host } = result.data; let time = common_vendor.dayjs().format("YYYYMMDDHHmmss"); let random = generateRandomNumber(); let filename = time + random; let imgType = "." + getImageFormat(temurl); return new Promise((resolve, reject) => { common_vendor.index.uploadFile({ url: host, // 仅为示例,非真实的接口地址 filePath: temurl, name: "file", formData: { OSSAccessKeyId: access_id, policy, key: dir + time + random + imgType, signature }, success(res) { if (res.statusCode === 204) { let url = host + "/" + dir + filename + imgType; imgList.value = [url]; } }, fail: (err) => { } }); }); } }); }; const handleUpload = (file) => { let File2 = file.file; readImages(File2); }; const generateRandomNumber = () => { let randomNumber = Math.floor(1e3 + Math.random() * 9e3); return randomNumber; }; const getImageFormat = (imageUrl) => { const lastDotIndex = imageUrl.lastIndexOf("."); if (lastDotIndex !== -1) { return imageUrl.substring(lastDotIndex + 1); } return "unknown"; }; const afterRead = (file, lists, name) => { handleUpload(file); }; const delImg = (index) => { imgList.value = []; }; const collectArticle = (id2) => { api_api.api.collectArticle(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "收藏成功" }); getArticleDetail(id2); }); }; const collectVideo = (id2) => { api_api.api.collectVideo(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "收藏成功" }); getVideoDetail(id2); }); }; const collectExchange = (id2) => { api_api.api.exchangeCollect(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "收藏成功" }); getExchangeDetail(id2); }); }; const cancelCollectArticle = (id2) => { api_api.api.cancelCollectArticle(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "已取消收藏" }); getArticleDetail(id2); }); }; const cancelCollectVideo = (id2) => { api_api.api.cancelCollectVideo(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "已取消收藏" }); getVideoDetail(id2); }); }; const cancelCollectExchange = (id2) => { api_api.api.cancelCollectExchange(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "已取消收藏" }); getExchangeDetail(id2); }); }; const toggleCollect = utils_throttle.throttle(() => { if (type.value == "video") { info.is_collect ? cancelCollectVideo(id.value) : collectVideo(id.value); } else if (type.value == "article") { info.is_collect ? cancelCollectArticle(id.value) : collectArticle(id.value); } else { info.is_collect ? cancelCollectExchange(id.value) : collectExchange(id.value); } }); const addArticleComment = (id2, data) => { api_api.api.addArticleComment(id2, data).then((res) => { if (res.data.data.status == 1) { common_vendor.index.showToast({ icon: "none", title: "评论成功" }); clearComment(); showCommentDialog.value = false; paging.value.refresh(); } else if (res.data.data.status == 2) { common_vendor.index.showToast({ icon: "none", title: "评论成功,积分+5" }); clearComment(); showCommentDialog.value = false; paging.value.refresh(); } else if (res.data.data.status == 0) { common_vendor.index.showToast({ icon: "none", title: "评论失败" }); } }); }; const addVideoComment = (id2, data) => { api_api.api.addVideoComment(id2, data).then((res) => { if (res.data.data.status == 1) { common_vendor.index.showToast({ icon: "none", title: "评论成功" }); clearComment(); showCommentDialog.value = false; paging.value.refresh(); } else if (res.data.data.status == 2) { common_vendor.index.showToast({ icon: "none", title: "评论成功,积分+5" }); clearComment(); showCommentDialog.value = false; paging.value.refresh(); } else if (res.data.data.status == 0) { common_vendor.index.showToast({ icon: "none", title: "评论失败" }); } }); }; const addExchangeComment = (id2, data) => { api_api.api.addExchangeComment(id2, data).then((res) => { if (res.data.data.status == 1) { common_vendor.index.showToast({ icon: "none", title: "评论成功" }); clearComment(); showCommentDialog.value = false; paging.value.refresh(); } else if (res.data.data.status == 2) { common_vendor.index.showToast({ icon: "none", title: "评论成功,积分+5" }); clearComment(); showCommentDialog.value = false; paging.value.refresh(); } else if (res.data.data.status == 0) { common_vendor.index.showToast({ icon: "none", title: "评论失败" }); } }); }; const delArticleComment = (id2) => { api_api.api.delArticleComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "删除成功" }); paging.value.refresh(); }); }; const delVideoComment = (id2) => { api_api.api.delVideoComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "删除成功" }); paging.value.refresh(); }); }; const fromatImg = (val) => { if (val) { return val.replace(/\ { api_api.api.delExchangeComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "删除成功" }); paging.value.refresh(); }); }; const topArticleComment = (id2) => { api_api.api.topArticleComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "置顶成功" }); showDeal.value = false; paging.value.refresh(); }); }; const topVideoComment = (id2) => { api_api.api.topVideoComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "置顶成功" }); showDeal.value = false; paging.value.refresh(); }); }; const topExchangeComment = (id2) => { api_api.api.topExchangeComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "置顶成功" }); showDeal.value = false; paging.value.refresh(); }); }; const cancelTopArticleComment = (id2) => { api_api.api.cancelTopArticleComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "取消置顶成功" }); showDeal.value = false; paging.value.refresh(); }); }; const cancelTopVideoComment = (id2) => { api_api.api.cancelTopArticleComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "取消置顶成功" }); showDeal.value = false; paging.value.refresh(); }); }; const cancelTopExchangeComment = (id2) => { api_api.api.cancelTopExchangeComment(id2).then((res) => { common_vendor.index.showToast({ icon: "none", title: "取消置顶成功" }); showDeal.value = false; paging.value.refresh(); }); }; const delComment = () => { showModal.value = true; showDeal.value = false; }; const confirmDel = () => { if (type.value == "article") { delArticleComment(parent_id.value); } else if (type.value == "video") { delVideoComment(parent_id.value); } else { delExchangeComment(parent_id.value); } showModal.value = false; }; const toggleTop = () => { if (type.value == "article") { is_top.value ? cancelTopArticleComment(parent_id.value) : topArticleComment(parent_id.value); } else if (type.value == "video") { is_top.value ? cancelTopVideoComment(parent_id.value) : topVideoComment(parent_id.value); } else { is_top.value ? cancelTopExchangeComment(parent_id.value) : topExchangeComment(parent_id.value); } }; const sendComment = utils_throttle.throttle(() => { if (!content.value) { common_vendor.index.showToast({ icon: "none", title: "请输入评论内容" }); return false; } const postData = { content: level.value == 3 ? "回复" + reply_name.value + ":" + content.value : content.value }; if (imgList.value.length > 0) { postData.comment_image = imgList.value[0]; } if (parent_id.value !== null) { postData.parent_id = parent_id.value; } if (root_id.value !== null) { postData.root_id = root_id.value; } if (type.value == "article") { addArticleComment(id.value, postData); } else if (type.value == "video") { addVideoComment(id.value, postData); } else { addExchangeComment(id.value, postData); } }); const formatHtml = (val) => { if (/^回复.+:/.test(val)) { return val.replace( /[^回复]([^:]+)/, `$&` ); } return val; }; const addVote = () => { if (!option_id.value) { common_vendor.index.showToast({ icon: "none", title: "请选择投票选项!" }); return false; } api_api.api.addVote(id.value, { option_id: option_id.value }).then((res) => { common_vendor.index.showToast({ icon: "none", title: "投票成功!" }); getExchangeDetail(id.value); }); }; const readRecord = async () => { let flag = 1; if (type.value == "article") { flag = 1; } else if (type.value == "video") { flag = 2; } else { flag = 3; } const res = api_api.api.readRecord({ type: flag, id: id.value }); if (res) { if (type.value == "article") { getArticleDetail(id.value); } else if (type.value == "video") { getVideoDetail(id.value); } else { getExchangeDetail(id.value); } } }; return (_ctx, _cache) => { return common_vendor.e({ a: common_vendor.p({ navName: type.value == "exchange" ? "肝胆相照病例交流园地" : "肝胆相照临床病例库" }), b: common_vendor.p({ src: common_vendor.unref(common_assets.chatImg), width: "46rpx", height: "46rpx", radius: "50%" }), c: common_vendor.o(open), d: common_vendor.o(open), e: common_vendor.p({ disabled: true, focus: false, type: "text", placeholderClass: "placeholderClass", placeholder: "对病例发表您的看法" }), f: common_vendor.o(open), g: common_vendor.o(open), h: common_vendor.o(common_vendor.unref(toggleCollect)), i: common_vendor.p({ src: info.is_collect ? common_vendor.unref(common_assets.collectonImg) : common_vendor.unref(common_assets.collectImg), width: "70rpx", height: "70rpx" }), j: common_vendor.p({ src: common_vendor.unref(common_assets.shangImg), mode: "widthFix", width: "169rpx", height: "77rpx" }), k: common_vendor.o(openGivePop), l: type.value == "video" }, type.value == "video" ? { m: common_vendor.t(info.video_title) } : type.value == "article" ? { o: common_vendor.t(info.article_title) } : { p: common_vendor.t(info.exchange_title) }, { n: type.value == "article", q: type.value == "video" || type.value == "article" }, type.value == "video" || type.value == "article" ? { r: common_vendor.f(info.author, (item, k0, i0) => { return { a: "eca06f3c-6-" + i0 + ",eca06f3c-0", b: common_vendor.p({ src: item.avatar ? item.avatar : common_vendor.unref(common_assets.headImg), width: "46rpx", height: "46rpx", radius: "50%" }), c: common_vendor.t(item.doctor_name), d: common_vendor.t(item.hospital_name), e: item }; }) } : { s: common_vendor.p({ src: info.avatar ? info.avatar : common_vendor.unref(common_assets.headImg), width: "46rpx", height: "46rpx", radius: "50%" }), t: common_vendor.t(info.user_name), v: common_vendor.t(info.hospital_name) }, { w: common_vendor.p({ name: "eye", color: "#6B7280", size: "28rpx" }), x: common_vendor.t(info.read_num), y: common_vendor.p({ name: info.is_collect ? "heart-fill" : "heart", color: info.is_collect ? "red" : "#6B7280", size: "28rpx" }), z: common_vendor.t(info.collect_num), A: common_vendor.p({ name: "clock", color: "#6B7280", size: "28rpx" }), B: common_vendor.t(formatDay(info.push_date)), C: showCanvas.value }, showCanvas.value ? {} : {}, { D: type.value == "video" && !isH5.value }, type.value == "video" && !isH5.value ? common_vendor.e({ E: info.video_no }, info.video_no ? { F: "playerContext" + info.video_no, G: "playerId" + info.video_no, H: info.video_no } : {}) : {}, { I: type.value == "video" && isH5.value }, type.value == "video" && isH5.value ? {} : type.value == "article" ? { K: common_vendor.p({ content: fromatImg(info.article_content) }) } : common_vendor.e({ L: info.exchange_content }, info.exchange_content ? { M: common_vendor.p({ content: fromatImg(info.exchange_content) }) } : {}, { N: info.exchange_summary }, info.exchange_summary ? { O: common_vendor.p({ content: fromatImg(info.exchange_summary) }) } : {}, { P: info.exchange_vote && info.exchange_vote.vote_title }, info.exchange_vote && info.exchange_vote.vote_title ? common_vendor.e({ Q: info.exchange_vote.is_have_voted == 0 }, info.exchange_vote.is_have_voted == 0 ? { R: common_vendor.t(info.exchange_vote.vote_title), S: common_vendor.f(info.exchange_vote.case_exchange_vote_option, (item, k0, i0) => { return { a: "eca06f3c-16-" + i0 + ",eca06f3c-15", b: common_vendor.p({ activeColor: "#3CC7C0", label: item.option_value, name: item.option_id }), c: item.option_id }; }), T: common_vendor.o(($event) => option_id.value = $event), U: common_vendor.p({ placement: "column", modelValue: option_id.value }), V: common_vendor.o(($event) => addVote()) } : {}, { W: info.exchange_vote.is_enabled == 0 || info.exchange_vote.is_have_voted == 1 }, info.exchange_vote.is_enabled == 0 || info.exchange_vote.is_have_voted == 1 ? { X: common_vendor.t(info.exchange_vote.vote_title), Y: common_vendor.f(info.exchange_vote.case_exchange_vote_option, (item, k0, i0) => { return { a: common_vendor.t(item.option_value), b: common_vendor.t(item.proportion), c: item.option_id }; }), Z: _ctx.proportion / 100 } : {}) : {}), { J: type.value == "article", aa: common_vendor.p({ src: common_vendor.unref(common_assets.commentImg), mode: "widthFix", width: "50rpx", height: "50rpx" }), ab: common_vendor.t(total.value), ac: common_vendor.f(dataList.value, (item, index, i0) => { return common_vendor.e({ a: "eca06f3c-18-" + i0 + ",eca06f3c-0", b: common_vendor.p({ src: item.avatar ? item.avatar : common_vendor.unref(common_assets.headImg), width: "86rpx", height: "86rpx", radius: "50%" }), c: common_vendor.t(item.user_name), d: doctor_id.value == item.doctor_id }, doctor_id.value == item.doctor_id ? { e: "eca06f3c-19-" + i0 + ",eca06f3c-0", f: common_vendor.p({ src: common_vendor.unref(common_assets.selfImg), width: "69rpx", height: "31rpx" }) } : {}, { g: common_vendor.o(($event) => alertDeal(item.comment_id, item.comment_id, item.user_name, item.is_top, 2, item.doctor_id), item.comment_id), h: common_vendor.t(item.content), i: item.comment_image }, item.comment_image ? { j: common_vendor.o(($event) => previewImg(item.comment_image), item.comment_id), k: "eca06f3c-20-" + i0 + ",eca06f3c-0", l: common_vendor.p({ src: item.comment_image, radius: "16rpx", width: "150rpx", height: "150rpx" }) } : {}, { m: common_vendor.t(formatDate(item.created_at)), n: item.sub_comment && item.sub_comment.length > 0 }, item.sub_comment && item.sub_comment.length > 0 ? { o: common_vendor.f(item.sub_comment.slice(0, 3), (cell, index2, i1) => { return common_vendor.e({ a: "eca06f3c-21-" + i0 + "-" + i1 + ",eca06f3c-0", b: common_vendor.p({ src: cell.avatar ? cell.avatar : common_vendor.unref(common_assets.headImg), width: "86rpx", height: "86rpx", radius: "50%" }), c: common_vendor.t(cell.user_name), d: doctor_id.value == cell.doctor_id }, doctor_id.value == cell.doctor_id ? { e: "eca06f3c-22-" + i0 + "-" + i1 + ",eca06f3c-0", f: common_vendor.p({ src: common_vendor.unref(common_assets.selfImg), width: "69rpx", height: "31rpx" }) } : {}, { g: common_vendor.o(($event) => alertDeal(cell.comment_id, cell.root_id, cell.user_name, cell.is_top, 3, cell.doctor_id), cell.comment_id), h: formatHtml(cell.content), i: cell.comment_image }, cell.comment_image ? { j: common_vendor.o(($event) => previewImg(cell.comment_image), cell.comment_id), k: "eca06f3c-23-" + i0 + "-" + i1 + ",eca06f3c-0", l: common_vendor.p({ src: cell.comment_image, radius: "16rpx", width: "150rpx", height: "150rpx" }) } : {}, { m: common_vendor.t(formatDate(cell.created_at)), n: cell.comment_id }); }) } : {}, { p: item.sub_comment.length > 3 }, item.sub_comment.length > 3 ? { q: "eca06f3c-24-" + i0 + ",eca06f3c-0", r: common_vendor.p({ name: "arrow-down", color: "#3cc7c0", size: "38rpx" }), s: common_vendor.o(($event) => openMorePop(item, item.sub_comment, index), item.comment_id) } : {}, { t: item.comment_id }); }), ad: common_vendor.sr(paging, "eca06f3c-0", { "k": "paging" }), ae: common_vendor.o(queryList), af: common_vendor.o(($event) => dataList.value = $event), ag: common_vendor.p({ ["inside-more"]: true, ["loading-more-no-more-text"]: "咱也是有底线的!", ["auto-show-back-to-top"]: false, ["refresher-out-rate"]: 0.8, ["empty-view-super-style"]: { "paddingBottom": "140rpx" }, ["refresher-title-style"]: { "paddingBottom": "60rpx", "paddingTop": "10rpx" }, ["refresher-img-style"]: { "paddingBottom": "60rpx", "paddingTop": "10rpx" }, modelValue: dataList.value }), ah: common_vendor.sr(commentTextarea, "eca06f3c-26,eca06f3c-25", { "k": "commentTextarea" }), ai: common_vendor.o(($event) => content.value = $event), aj: common_vendor.p({ focus: false, height: "200", cursorSpacing: 240, adjustPosition: true, ["adjust-keyboard-to"]: "bottom", placeholder: placeholder.value, modelValue: content.value }), ak: imgList.value.length > 0 }, imgList.value.length > 0 ? { al: common_vendor.o(($event) => previewImg(imgList.value[0])), am: common_vendor.p({ src: imgList.value[0], radius: "6", width: "150rpx", height: "150rpx" }), an: common_vendor.p({ name: "close-circle", color: "#666", size: "16" }), ao: common_vendor.o(delImg) } : {}, { ap: common_vendor.p({ src: common_vendor.unref(common_assets.uploadImg), mode: "widthFix", width: "40rpx", height: "77rpx" }), aq: common_vendor.o(afterRead), ar: common_vendor.p({ disabled: imgList.value.length >= 1, ["show-upload-list"]: false, name: "imgupload", multiple: true, maxCount: 1, width: "40rpx", height: "77rpx" }), as: imgList.value.length >= 1 ? 1 : "", at: common_vendor.o((...args) => common_vendor.unref(sendComment) && common_vendor.unref(sendComment)(...args)), av: common_vendor.o(close), aw: common_vendor.o(open), ax: common_vendor.p({ zIndex: 99, overlayStyle: { zIndex: 98 }, closeOnClickOverlay: false, show: showCommentDialog.value, round: 10, closeable: true, mode: "bottom" }), ay: level.value == 2 && isArticleAuthor.value }, level.value == 2 && isArticleAuthor.value ? { az: common_vendor.t(is_top.value ? "取消置顶" : "置顶"), aA: common_vendor.o(toggleTop) } : {}, { aB: common_vendor.o(openCommentDialog), aC: isArticleAuthor.value || doctor_id.value == comment_doctorId.value }, isArticleAuthor.value || doctor_id.value == comment_doctorId.value ? { aD: common_vendor.o(delComment) } : {}, { aE: common_vendor.o(closeDealPop), aF: common_vendor.o(closeDeal), aG: common_vendor.o(openDeal), aH: common_vendor.p({ zIndex: 60, overlayStyle: { zIndex: 59 }, closeOnClickOverlay: false, show: showDeal.value, round: 10, mode: "bottom" }), aI: common_vendor.p({ name: "close", color: "#666", size: "20" }), aJ: common_vendor.o(closeMore), aK: common_vendor.p({ src: mainCommentObj.avatar ? mainCommentObj.avatar : common_vendor.unref(common_assets.headImg), width: "86rpx", height: "86rpx", radius: "50%" }), aL: common_vendor.t(mainCommentObj.user_name), aM: doctor_id.value == mainCommentObj.doctor_id }, doctor_id.value == mainCommentObj.doctor_id ? { aN: common_vendor.p({ src: common_vendor.unref(common_assets.selfImg), width: "69rpx", height: "31rpx" }) } : {}, { aO: common_vendor.o(($event) => alertDeal(mainCommentObj.comment_id, mainCommentObj.comment_id, mainCommentObj.user_name, mainCommentObj.is_top, 2, mainCommentObj.doctor_id)), aP: common_vendor.t(mainCommentObj.content), aQ: mainCommentObj.comment_image }, mainCommentObj.comment_image ? { aR: common_vendor.o(($event) => previewImg(mainCommentObj.comment_image)), aS: common_vendor.p({ src: mainCommentObj.comment_image, radius: "16rpx", width: "150rpx", height: "150rpx" }) } : {}, { aT: common_vendor.t(formatDate(mainCommentObj.created_at)), aU: common_vendor.f(childList.value, (cell, index, i0) => { return common_vendor.e({ a: "eca06f3c-37-" + i0 + ",eca06f3c-32", b: common_vendor.p({ src: cell.avatar ? cell.avatar : common_vendor.unref(common_assets.headImg), width: "86rpx", height: "86rpx", radius: "50%" }), c: common_vendor.t(cell.user_name), d: doctor_id.value == cell.doctor_id }, doctor_id.value == cell.doctor_id ? { e: "eca06f3c-38-" + i0 + ",eca06f3c-32", f: common_vendor.p({ src: common_vendor.unref(common_assets.selfImg), width: "69rpx", height: "31rpx" }) } : {}, { g: common_vendor.o(($event) => alertDeal(cell.comment_id, cell.root_id, cell.user_name, cell.is_top, 3, cell.doctor_id), cell.comment_id), h: formatHtml(cell.content), i: cell.comment_image }, cell.comment_image ? { j: common_vendor.o(($event) => previewImg(cell.comment_image), cell.comment_id), k: "eca06f3c-39-" + i0 + ",eca06f3c-32", l: common_vendor.p({ src: cell.comment_image, radius: "16rpx", width: "150rpx", height: "150rpx" }) } : {}, { m: common_vendor.t(formatDate(cell.created_at)), n: cell.comment_id }); }), aV: scrollTop.value, aW: common_vendor.o(scroll), aX: common_vendor.o(($event) => scrolltolower(mainCommentObj.comment_id)), aY: common_vendor.o(($event) => value.value = $event), aZ: common_vendor.p({ readonly: true, placeholder: "@" + mainCommentObj.user_name + ":", border: "surround", modelValue: value.value }), ba: common_vendor.o(showReplyPop), bb: common_vendor.o(closeMore), bc: common_vendor.o(openMore), bd: common_vendor.p({ zIndex: 10, overlayStyle: { zIndex: 9 }, closeOnClickOverlay: false, show: showMore.value, round: 10, mode: "bottom" }), be: common_vendor.t(point.value), bf: common_vendor.o(($event) => changePoint("minus")), bg: common_vendor.o(($event) => givePointValue.value = $event), bh: common_vendor.p({ placeholder: "请输入打赏积分", type: "number", border: "surround", modelValue: givePointValue.value }), bi: common_vendor.o(($event) => changePoint("add")), bj: common_vendor.o(($event) => showGive.value = false), bk: common_vendor.o(confirmGive), bl: common_vendor.p({ show: showGive.value, ["mask-click-able"]: true }), bm: common_vendor.o(($event) => showModal.value = false), bn: common_vendor.o(confirmDel), bo: common_vendor.p({ show: showModal.value, ["mask-click-able"]: true }) }); }; } }; const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-eca06f3c"]]); wx.createPage(MiniProgramPage); //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/detail/detail.js.map