1058 lines
36 KiB
JavaScript
1058 lines
36 KiB
JavaScript
"use strict";
|
||
const common_vendor = require("../../common/vendor.js");
|
||
const common_assets = require("../../common/assets.js");
|
||
const api_api = require("../../api/api.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) {
|
||
(backNav + _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 backNav = () => "../../components/backNav/backNav.js";
|
||
const _sfc_main = {
|
||
__name: "detail",
|
||
setup(__props) {
|
||
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(false);
|
||
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 confirmGive = () => {
|
||
showGive.value = false;
|
||
givePoint();
|
||
};
|
||
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 inputPoint = () => {
|
||
if (givePointValue.value < 5) {
|
||
givePointValue.value = 5;
|
||
common_vendor.index.showToast({
|
||
icon: "none",
|
||
title: "每次打赏范围5~100积分"
|
||
});
|
||
}
|
||
if (givePointValue.value > 100) {
|
||
givePointValue.value = 100;
|
||
common_vendor.index.showToast({
|
||
icon: "none",
|
||
title: "每次打赏范围5~100积分"
|
||
});
|
||
}
|
||
};
|
||
const changePoint = (type2) => {
|
||
if (type2 == "minus") {
|
||
if (givePointValue.value > 5) {
|
||
givePointValue.value = givePointValue.value - 5;
|
||
} else {
|
||
common_vendor.index.showToast({
|
||
icon: "none",
|
||
title: "每次打赏范围5~100积分"
|
||
});
|
||
}
|
||
} else {
|
||
if (givePointValue.value <= 95) {
|
||
givePointValue.value = givePointValue.value + 5;
|
||
} else {
|
||
common_vendor.index.showToast({
|
||
icon: "none",
|
||
title: "每次打赏范围5~100积分"
|
||
});
|
||
}
|
||
}
|
||
};
|
||
const openMorePop = (obj, list, index) => {
|
||
showMore.value = true;
|
||
childList.value = list;
|
||
Object.assign(mainCommentObj, obj);
|
||
clickIndex.value = index;
|
||
};
|
||
const getArticleDetail = (id2) => {
|
||
api_api.api.getArticleDetail(id2).then((res) => {
|
||
let result = res.data.data;
|
||
Object.assign(info, result);
|
||
});
|
||
};
|
||
const getVideoDetail = (id2) => {
|
||
api_api.api.getVideoDetail(id2).then((res) => {
|
||
let result = res.data.data;
|
||
Object.assign(info, result);
|
||
});
|
||
};
|
||
const getExchangeDetail = (id2) => {
|
||
api_api.api.getExchangeDetail(id2).then((res) => {
|
||
let result = res.data.data;
|
||
Object.assign(info, result);
|
||
});
|
||
};
|
||
const getUserPoint = () => {
|
||
api_api.api.getUserPoint().then((res) => {
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:660", res.data.data);
|
||
point.value = res.data.data;
|
||
});
|
||
};
|
||
const givePoint = () => {
|
||
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: "打赏成功!"
|
||
});
|
||
showGive.value = false;
|
||
});
|
||
};
|
||
common_vendor.onLoad((options) => {
|
||
id.value = options.id;
|
||
type.value = options.type;
|
||
if (type.value == "article") {
|
||
getArticleDetail(options.id);
|
||
} else if (type.value == "video") {
|
||
getVideoDetail(options.id);
|
||
} else {
|
||
getExchangeDetail(options.id);
|
||
}
|
||
readRecord();
|
||
});
|
||
const clearComment = () => {
|
||
parent_id.value = null;
|
||
imgList.value = [];
|
||
content.value = "";
|
||
root_id.value = null;
|
||
is_author.value = false;
|
||
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, isAuthor, name, top, commentLevel) => {
|
||
parent_id.value = parentId;
|
||
root_id.value = rootId;
|
||
is_author.value = isAuthor == 1 ? true : false;
|
||
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) => {
|
||
const form = {
|
||
article_id: id.value,
|
||
is_have_sub_comment: 1
|
||
};
|
||
api_api.api.getArticleComment({
|
||
...form,
|
||
...params
|
||
}).then((res) => {
|
||
paging.value.complete(res.data.data.data);
|
||
total.value = res.data.data.total;
|
||
setTimeout(() => {
|
||
if (showMore.value) {
|
||
openMorePop(
|
||
mainCommentObj,
|
||
dataList.value[clickIndex.value].sub_comment,
|
||
clickIndex.value
|
||
);
|
||
}
|
||
}, 1500);
|
||
}).catch((res) => {
|
||
paging.value.complete(false);
|
||
});
|
||
};
|
||
const getVideoComment = (params) => {
|
||
const form = {
|
||
video_id: id.value,
|
||
is_have_sub_comment: 1
|
||
};
|
||
api_api.api.getVideoComment({
|
||
...form,
|
||
...params
|
||
}).then((res) => {
|
||
paging.value.complete(res.data.data.data);
|
||
total.value = res.data.data.total;
|
||
setTimeout(() => {
|
||
if (showMore.value) {
|
||
openMorePop(
|
||
mainCommentObj,
|
||
dataList.value[clickIndex.value].sub_comment,
|
||
clickIndex.value
|
||
);
|
||
}
|
||
}, 1500);
|
||
}).catch((res) => {
|
||
paging.value.complete(false);
|
||
});
|
||
};
|
||
const getExchangeComment = (params) => {
|
||
const form = {
|
||
exchange_id: id.value,
|
||
is_have_sub_comment: 1
|
||
};
|
||
api_api.api.getExchangeComment({
|
||
...form,
|
||
...params
|
||
}).then((res) => {
|
||
paging.value.complete(res.data.data.data);
|
||
total.value = res.data.data.total;
|
||
setTimeout(() => {
|
||
if (showMore.value) {
|
||
openMorePop(
|
||
mainCommentObj,
|
||
dataList.value[clickIndex.value].sub_comment,
|
||
clickIndex.value
|
||
);
|
||
}
|
||
}, 1500);
|
||
}).catch((res) => {
|
||
paging.value.complete(false);
|
||
});
|
||
};
|
||
const open = () => {
|
||
showCommentDialog.value = true;
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:845", "open");
|
||
};
|
||
const close = () => {
|
||
showCommentDialog.value = false;
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:849", "close");
|
||
};
|
||
const openDeal = () => {
|
||
showDeal.value = true;
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:854", "open");
|
||
};
|
||
const closeDeal = () => {
|
||
showDeal.value = false;
|
||
};
|
||
const openMore = () => {
|
||
showMore.value = true;
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:862", "open");
|
||
};
|
||
const closeMore = () => {
|
||
showMore.value = false;
|
||
};
|
||
const previewImg = (url) => {
|
||
common_vendor.index.previewImage({
|
||
current: url,
|
||
urls: [url]
|
||
});
|
||
};
|
||
const handleUpload = (file) => {
|
||
let File = file.file;
|
||
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(File[0].url);
|
||
return new Promise((resolve, reject) => {
|
||
common_vendor.index.uploadFile({
|
||
url: host,
|
||
// 仅为示例,非真实的接口地址
|
||
filePath: File[0].url,
|
||
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;
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:1213", url);
|
||
imgList.value = [url];
|
||
}
|
||
},
|
||
fail: (err) => {
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:1218", err);
|
||
}
|
||
});
|
||
});
|
||
}
|
||
});
|
||
};
|
||
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) => {
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:1237", lists);
|
||
common_vendor.index.__f__("log", "at pages/detail/detail.vue:1238", 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.collectExchange(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 = () => {
|
||
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) => {
|
||
common_vendor.index.showToast({
|
||
icon: "none",
|
||
title: "评论成功"
|
||
});
|
||
clearComment();
|
||
showCommentDialog.value = false;
|
||
paging.value.refresh();
|
||
});
|
||
};
|
||
const addVideoComment = (id2, data) => {
|
||
api_api.api.addVideoComment(id2, data).then((res) => {
|
||
common_vendor.index.showToast({
|
||
icon: "none",
|
||
title: "评论成功"
|
||
});
|
||
clearComment();
|
||
showCommentDialog.value = false;
|
||
paging.value.refresh();
|
||
});
|
||
};
|
||
const addExchangeComment = (id2, data) => {
|
||
api_api.api.addExchangeComment(id2, data).then((res) => {
|
||
common_vendor.index.showToast({
|
||
icon: "none",
|
||
title: "评论成功"
|
||
});
|
||
clearComment();
|
||
showCommentDialog.value = false;
|
||
paging.value.refresh();
|
||
});
|
||
};
|
||
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) => {
|
||
return val.replace(/\<img/gi, '<img style="width:100%"');
|
||
};
|
||
const delExchangeComment = (id2) => {
|
||
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 = () => {
|
||
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(
|
||
/[^回复]([^:]+)/,
|
||
`<font style="color:#3CC7C0">$&</font>`
|
||
);
|
||
}
|
||
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 = () => {
|
||
let flag = 1;
|
||
if (type.value == "article") {
|
||
flag = 1;
|
||
} else if (type.value == "video") {
|
||
flag = 1;
|
||
} else {
|
||
flag = 3;
|
||
}
|
||
api_api.api.readRecord({
|
||
type: flag,
|
||
id: id.value
|
||
}).then((res) => {
|
||
});
|
||
};
|
||
return (_ctx, _cache) => {
|
||
return common_vendor.e({
|
||
a: common_vendor.p({
|
||
navName: "肝胆相照临床病例库"
|
||
}),
|
||
b: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.chatImg),
|
||
mode: "widthFix",
|
||
width: "46rpx",
|
||
radius: "50%"
|
||
}),
|
||
c: common_vendor.o(open),
|
||
d: common_vendor.p({
|
||
type: "text",
|
||
placeholderClass: "placeholderClass",
|
||
placeholder: "对病例发表您的看法"
|
||
}),
|
||
e: common_vendor.o(toggleCollect),
|
||
f: common_vendor.p({
|
||
src: info.is_collect ? common_vendor.unref(common_assets.collectonImg) : common_vendor.unref(common_assets.collectImg),
|
||
mode: "widthFix",
|
||
width: "38rpx"
|
||
}),
|
||
g: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.shangImg),
|
||
mode: "widthFix",
|
||
width: "169rpx",
|
||
height: "77rpx"
|
||
}),
|
||
h: common_vendor.o(openGivePop),
|
||
i: type.value == "video"
|
||
}, type.value == "video" ? {
|
||
j: common_vendor.t(info.video_title)
|
||
} : type.value == "article" ? {
|
||
l: common_vendor.t(info.article_title)
|
||
} : {
|
||
m: common_vendor.t(info.exchange_title)
|
||
}, {
|
||
k: type.value == "article",
|
||
n: common_vendor.f(info.author, (item, k0, i0) => {
|
||
return {
|
||
a: "eca06f3c-6-" + i0 + ",eca06f3c-0",
|
||
b: common_vendor.t(item.doctor_name),
|
||
c: common_vendor.t(item.hospital_name)
|
||
};
|
||
}),
|
||
o: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.headImg),
|
||
mode: "widthFix",
|
||
width: "46rpx",
|
||
height: "46rpx",
|
||
radius: "50%"
|
||
}),
|
||
p: common_vendor.p({
|
||
name: "eye",
|
||
color: "#6B7280",
|
||
size: "28rpx"
|
||
}),
|
||
q: common_vendor.t(info.read_num),
|
||
r: common_vendor.p({
|
||
name: info.is_collect ? "heart-fill" : "heart",
|
||
color: info.is_collect ? "red" : "#6B7280",
|
||
size: "28rpx"
|
||
}),
|
||
s: common_vendor.t(info.collect_num),
|
||
t: common_vendor.p({
|
||
name: "clock",
|
||
color: "#6B7280",
|
||
size: "28rpx"
|
||
}),
|
||
v: common_vendor.t(formatDay(info.push_date)),
|
||
w: showCanvas.value
|
||
}, showCanvas.value ? {} : {}, {
|
||
x: type.value == "video"
|
||
}, type.value == "video" ? {} : type.value == "article" ? {
|
||
z: info.article_content
|
||
} : common_vendor.e({
|
||
A: info.exchange_content
|
||
}, info.exchange_content ? {
|
||
B: common_vendor.p({
|
||
content: fromatImg(info.exchange_content)
|
||
})
|
||
} : {}, {
|
||
C: info.exchange_summary
|
||
}, info.exchange_summary ? {
|
||
D: common_vendor.p({
|
||
content: fromatImg(info.exchange_summary)
|
||
})
|
||
} : {}, {
|
||
E: info.case_exchange_vote && info.case_exchange_vote.vote_title
|
||
}, info.case_exchange_vote && info.case_exchange_vote.vote_title ? common_vendor.e({
|
||
F: info.case_exchange_vote.is_have_voted != 1
|
||
}, info.case_exchange_vote.is_have_voted != 1 ? {
|
||
G: common_vendor.t(info.case_exchange_vote.vote_title),
|
||
H: common_vendor.f(info.case_exchange_vote.case_exchange_vote_option, (item, k0, i0) => {
|
||
return {
|
||
a: "eca06f3c-14-" + i0 + ",eca06f3c-13",
|
||
b: common_vendor.p({
|
||
activeColor: "#3CC7C0",
|
||
label: item.option_value,
|
||
name: item.option_id
|
||
}),
|
||
c: item.option_id
|
||
};
|
||
}),
|
||
I: common_vendor.o(($event) => option_id.value = $event),
|
||
J: common_vendor.p({
|
||
placement: "column",
|
||
modelValue: option_id.value
|
||
}),
|
||
K: common_vendor.o(addVote)
|
||
} : {
|
||
L: common_vendor.t(info.case_exchange_vote.vote_title),
|
||
M: common_vendor.f(info.case_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
|
||
};
|
||
}),
|
||
N: _ctx.proportion / 100
|
||
}) : {}), {
|
||
y: type.value == "article",
|
||
O: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.commentImg),
|
||
mode: "widthFix",
|
||
width: "50rpx"
|
||
}),
|
||
P: common_vendor.t(total.value),
|
||
Q: common_vendor.f(dataList.value, (item, index, i0) => {
|
||
return common_vendor.e({
|
||
a: "eca06f3c-16-" + i0 + ",eca06f3c-0",
|
||
b: common_vendor.t(item.user_name),
|
||
c: common_vendor.o(($event) => alertDeal(item.comment_id, item.comment_id, item.is_author, item.user_name, item.is_top, 2), item.comment_id),
|
||
d: common_vendor.t(item.content),
|
||
e: item.comment_image
|
||
}, item.comment_image ? {
|
||
f: common_vendor.o(($event) => previewImg(item.comment_image), item.comment_id),
|
||
g: "eca06f3c-17-" + i0 + ",eca06f3c-0",
|
||
h: common_vendor.p({
|
||
src: item.comment_image,
|
||
radius: "16rpx",
|
||
width: "150rpx",
|
||
height: "150rpx"
|
||
})
|
||
} : {}, {
|
||
i: common_vendor.t(formatDate(item.created_at)),
|
||
j: item.sub_comment && item.sub_comment.length > 0
|
||
}, item.sub_comment && item.sub_comment.length > 0 ? {
|
||
k: common_vendor.f(item.sub_comment.slice(0, 3), (cell, index2, i1) => {
|
||
return common_vendor.e({
|
||
a: "eca06f3c-18-" + i0 + "-" + i1 + ",eca06f3c-0",
|
||
b: common_vendor.t(cell.user_name),
|
||
c: common_vendor.o(($event) => alertDeal(cell.comment_id, cell.root_id, cell.is_author, cell.user_name, cell.is_top, 3), cell.comment_id),
|
||
d: formatHtml(cell.content),
|
||
e: cell.comment_image
|
||
}, cell.comment_image ? {
|
||
f: common_vendor.o(($event) => previewImg(cell.comment_image), cell.comment_id),
|
||
g: "eca06f3c-19-" + i0 + "-" + i1 + ",eca06f3c-0",
|
||
h: common_vendor.p({
|
||
src: cell.comment_image,
|
||
radius: "16rpx",
|
||
width: "150rpx",
|
||
height: "150rpx"
|
||
})
|
||
} : {}, {
|
||
i: common_vendor.t(formatDate(cell.created_at)),
|
||
j: cell.comment_id
|
||
});
|
||
}),
|
||
l: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.headImg),
|
||
width: "86rpx",
|
||
height: "86rpx",
|
||
radius: "50%"
|
||
})
|
||
} : {}, {
|
||
m: item.sub_comment.length > 3
|
||
}, item.sub_comment.length > 3 ? {
|
||
n: common_vendor.o(($event) => openMorePop(item, item.sub_comment, index), item.comment_id)
|
||
} : {}, {
|
||
o: item.comment_id
|
||
});
|
||
}),
|
||
R: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.headImg),
|
||
width: "86rpx",
|
||
height: "86rpx",
|
||
radius: "50%"
|
||
}),
|
||
S: common_vendor.sr(paging, "eca06f3c-0", {
|
||
"k": "paging"
|
||
}),
|
||
T: common_vendor.o(queryList),
|
||
U: common_vendor.o(($event) => dataList.value = $event),
|
||
V: common_vendor.p({
|
||
["inside-more"]: true,
|
||
["loading-more-no-more-text"]: "咱也是有底线的!",
|
||
["auto-show-back-to-top"]: false,
|
||
modelValue: dataList.value
|
||
}),
|
||
W: common_vendor.o(($event) => content.value = $event),
|
||
X: common_vendor.p({
|
||
height: "200",
|
||
placeholder: placeholder.value,
|
||
modelValue: content.value
|
||
}),
|
||
Y: imgList.value.length > 0
|
||
}, imgList.value.length > 0 ? {
|
||
Z: common_vendor.o(($event) => previewImg(imgList.value[0])),
|
||
aa: common_vendor.p({
|
||
src: imgList.value[0],
|
||
radius: "6",
|
||
width: "150rpx",
|
||
height: "150rpx"
|
||
}),
|
||
ab: common_vendor.p({
|
||
name: "close-circle",
|
||
color: "#666",
|
||
size: "16"
|
||
}),
|
||
ac: common_vendor.o(delImg)
|
||
} : {}, {
|
||
ad: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.uploadImg),
|
||
mode: "widthFix",
|
||
width: "40rpx",
|
||
height: "77rpx"
|
||
}),
|
||
ae: common_vendor.o(afterRead),
|
||
af: common_vendor.p({
|
||
["show-upload-list"]: false,
|
||
name: "imgupload",
|
||
multiple: true,
|
||
maxCount: 1,
|
||
width: "40rpx",
|
||
height: "77rpx"
|
||
}),
|
||
ag: common_vendor.o(sendComment),
|
||
ah: common_vendor.o(close),
|
||
ai: common_vendor.o(open),
|
||
aj: common_vendor.p({
|
||
zIndex: 99,
|
||
overlayStyle: {
|
||
zIndex: 98
|
||
},
|
||
closeOnClickOverlay: false,
|
||
show: showCommentDialog.value,
|
||
round: 10,
|
||
closeable: true,
|
||
mode: "bottom"
|
||
}),
|
||
ak: level.value == 2
|
||
}, level.value == 2 ? {
|
||
al: common_vendor.t(is_top.value ? "取消置顶" : "置顶"),
|
||
am: common_vendor.o(toggleTop)
|
||
} : {}, {
|
||
an: common_vendor.o(openCommentDialog),
|
||
ao: is_author.value
|
||
}, is_author.value ? {
|
||
ap: common_vendor.o(delComment)
|
||
} : {}, {
|
||
aq: common_vendor.o(closeDealPop),
|
||
ar: common_vendor.o(closeDeal),
|
||
as: common_vendor.o(openDeal),
|
||
at: common_vendor.p({
|
||
zIndex: 60,
|
||
overlayStyle: {
|
||
zIndex: 59
|
||
},
|
||
closeOnClickOverlay: false,
|
||
show: showDeal.value,
|
||
round: 10,
|
||
mode: "bottom"
|
||
}),
|
||
av: common_vendor.p({
|
||
name: "close",
|
||
color: "#666",
|
||
size: "20"
|
||
}),
|
||
aw: common_vendor.o(closeMore),
|
||
ax: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.headImg),
|
||
width: "86rpx",
|
||
height: "86rpx",
|
||
radius: "50%"
|
||
}),
|
||
ay: common_vendor.t(mainCommentObj.user_name),
|
||
az: common_vendor.o(($event) => alertDeal(mainCommentObj.comment_id, mainCommentObj.comment_id, mainCommentObj.is_author, mainCommentObj.user_name, mainCommentObj.is_top, 2)),
|
||
aA: common_vendor.t(mainCommentObj.content),
|
||
aB: mainCommentObj.comment_image
|
||
}, mainCommentObj.comment_image ? {
|
||
aC: common_vendor.o(($event) => previewImg(mainCommentObj.comment_image)),
|
||
aD: common_vendor.p({
|
||
src: mainCommentObj.comment_image,
|
||
radius: "16rpx",
|
||
width: "150rpx",
|
||
height: "150rpx"
|
||
})
|
||
} : {}, {
|
||
aE: common_vendor.t(formatDate(mainCommentObj.created_at)),
|
||
aF: common_vendor.f(childList.value, (cell, index, i0) => {
|
||
return common_vendor.e({
|
||
a: "eca06f3c-31-" + i0 + ",eca06f3c-27",
|
||
b: common_vendor.t(cell.user_name),
|
||
c: common_vendor.o(($event) => alertDeal(cell.comment_id, cell.root_id, cell.is_author, cell.user_name, cell.is_top, 3), cell.comment_id),
|
||
d: formatHtml(cell.content),
|
||
e: cell.comment_image
|
||
}, cell.comment_image ? {
|
||
f: common_vendor.o(($event) => previewImg(cell.comment_image), cell.comment_id),
|
||
g: "eca06f3c-32-" + i0 + ",eca06f3c-27",
|
||
h: common_vendor.p({
|
||
src: cell.comment_image,
|
||
radius: "16rpx",
|
||
width: "150rpx",
|
||
height: "150rpx"
|
||
})
|
||
} : {}, {
|
||
i: common_vendor.t(formatDate(cell.created_at)),
|
||
j: cell.comment_id
|
||
});
|
||
}),
|
||
aG: common_vendor.p({
|
||
src: common_vendor.unref(common_assets.headImg),
|
||
width: "86rpx",
|
||
height: "86rpx",
|
||
radius: "50%"
|
||
}),
|
||
aH: common_vendor.o(($event) => _ctx.value = $event),
|
||
aI: common_vendor.p({
|
||
readonly: true,
|
||
placeholder: "@" + mainCommentObj.user_name + ":",
|
||
border: "surround",
|
||
modelValue: _ctx.value
|
||
}),
|
||
aJ: common_vendor.o(showReplyPop),
|
||
aK: common_vendor.o(closeMore),
|
||
aL: common_vendor.o(openMore),
|
||
aM: common_vendor.p({
|
||
zIndex: 10,
|
||
overlayStyle: {
|
||
zIndex: 9
|
||
},
|
||
closeOnClickOverlay: false,
|
||
show: showMore.value,
|
||
round: 10,
|
||
mode: "bottom"
|
||
}),
|
||
aN: common_vendor.t(point.value),
|
||
aO: common_vendor.o(($event) => changePoint("minus")),
|
||
aP: common_vendor.o(inputPoint),
|
||
aQ: common_vendor.o(($event) => givePointValue.value = $event),
|
||
aR: common_vendor.p({
|
||
placeholder: "请输入打赏积分",
|
||
type: "number",
|
||
border: "surround",
|
||
modelValue: givePointValue.value
|
||
}),
|
||
aS: common_vendor.o(($event) => changePoint("add")),
|
||
aT: common_vendor.o(($event) => showGive.value = false),
|
||
aU: common_vendor.o(confirmGive),
|
||
aV: common_vendor.p({
|
||
show: showGive.value,
|
||
["mask-click-able"]: true
|
||
}),
|
||
aW: common_vendor.o(($event) => showModal.value = false),
|
||
aX: common_vendor.o(confirmDel),
|
||
aY: 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
|