2025-08-05 13:50:21 +08:00

231 lines
8.1 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const common_assets = require("../../common/assets.js");
const utils_navTo = require("../../utils/navTo.js");
const api_api = require("../../api/api.js");
if (!Array) {
const _easycom_u_icon2 = common_vendor.resolveComponent("u-icon");
const _easycom_up__image2 = common_vendor.resolveComponent("up--image");
const _easycom_up_icon2 = common_vendor.resolveComponent("up-icon");
(_easycom_u_icon2 + _easycom_up__image2 + _easycom_up_icon2)();
}
const _easycom_u_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
const _easycom_up__image = () => "../../node-modules/uview-plus/components/u--image/u--image.js";
const _easycom_up_icon = () => "../../node-modules/uview-plus/components/u-icon/u-icon.js";
if (!Math) {
(navBar + _easycom_u_icon + _easycom_up__image + _easycom_up_icon + tabBar)();
}
const navBar = () => "../../components/navBar/navBar.js";
const tabBar = () => "../../components/tabBar/tabBar.js";
const _sfc_main = {
__name: "caseTalk",
setup(__props) {
const numInfo = common_vendor.reactive({});
const most_read_articles = common_vendor.ref([]);
const new_articles = common_vendor.ref([]);
const formatdate = (date) => {
return common_vendor.dayjs(date).format("YYYY-MM-DD");
};
const goList = (type) => {
if (type == "read") {
utils_navTo.navTo({
url: "/pages/specialList/specialList?is_selected=1"
});
} else {
utils_navTo.navTo({
url: "/pages/specialList/specialList"
});
}
};
const getStatic = () => {
api_api.api.getExchangeStatic().then((res) => {
let result = res.data.data;
Object.assign(numInfo, result);
});
};
const goDetail = (id) => {
utils_navTo.navTo({
url: `/pages/detail/detail?id=${id}&type=exchange`
});
};
const videoErrorCallback = (e) => {
};
const searchList = async () => {
let searchForm = {
page: 1,
page_size: 10,
order: {
push_date: "desc"
}
};
api_api.api.searchExchage({
...searchForm
}).then((res) => {
new_articles.value = res.data.data.data;
}).catch((err) => {
});
};
const htmlToText = (html) => {
return html.replace(/<[^>]*>/g, "").replace(/&nbsp;/gi, " ").replace(/<br\s*\/?>/gi, "\n").replace(/<img\s[^>]*>/gi, "").replace(/<video[^>]*>[\s\S]*?/gi, "");
};
const goodList = () => {
api_api.api.searchExchageGood({
is_selected: 1,
order: {
push_date: "desc"
},
limit: 3
}).then((res) => {
most_read_articles.value = res.data.data;
});
};
const goPublish = () => {
utils_navTo.navTo({
url: "/pages/publish/publish"
});
};
common_vendor.onShow(() => {
getStatic();
goodList();
searchList();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.p({
navName: "肝胆相照病例交流园地",
type: "caseTalk"
}),
b: common_vendor.t(numInfo.exchange_num),
c: common_vendor.t(numInfo.exchange_comment_num),
d: common_vendor.t(numInfo.exchange_read_num),
e: most_read_articles.value.length > 0
}, most_read_articles.value.length > 0 ? {
f: common_vendor.p({
name: "arrow-right",
size: "16",
color: "#3CC7C0"
}),
g: common_vendor.o(($event) => goList("read")),
h: common_vendor.f(most_read_articles.value, (item, k0, i0) => {
return {
a: common_vendor.t(item.exchange_title),
b: item.exchange_id,
c: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id)
};
})
} : {}, {
i: common_vendor.p({
name: "arrow-right",
size: "16",
color: "#3CC7C0"
}),
j: common_vendor.o(($event) => goList("new")),
k: common_vendor.f(new_articles.value, (item, k0, i0) => {
return common_vendor.e({
a: common_vendor.t(item.exchange_title),
b: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
c: "4b2e7592-3-" + i0,
d: common_vendor.p({
src: item.avatar ? item.avatar : common_vendor.unref(common_assets.headImg),
width: "46rpx",
height: "46rpx",
radius: "50%"
}),
e: common_vendor.t(item.user_name),
f: common_vendor.t(item.hospital_name),
g: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
h: common_vendor.t(htmlToText(item.exchange_content)),
i: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
j: item.exchange_content_image && item.exchange_content_image.length > 0
}, item.exchange_content_image && item.exchange_content_image.length > 0 ? {
k: common_vendor.f(item.exchange_content_image.slice(0, 3), (unit, k1, i1) => {
return {
a: "4b2e7592-4-" + i0 + "-" + i1,
b: common_vendor.p({
src: unit,
radius: "10",
width: "220rpx",
height: "220rpx"
}),
c: unit
};
}),
l: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id)
} : {}, {
m: item.exchange_content_video && item.exchange_content_video.length > 0
}, item.exchange_content_video && item.exchange_content_video.length > 0 ? {
n: common_vendor.f(item.exchange_content_video.slice(0, 1), (videoCell, index, i1) => {
return {
a: index,
b: videoCell,
c: common_vendor.o(videoErrorCallback, index)
};
}),
o: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id)
} : {}, {
p: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
q: item.exchange_label
}, item.exchange_label ? {
r: common_vendor.f(item.exchange_label, (cell, k1, i1) => {
return {
a: common_vendor.t(cell.label_name),
b: cell.exchange_label_id
};
}),
s: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id)
} : {}, {
t: "4b2e7592-5-" + i0,
v: common_vendor.t(item.read_num),
w: item.collect_num > 0
}, item.collect_num > 0 ? {
x: "4b2e7592-6-" + i0,
y: common_vendor.p({
name: "heart",
color: "#4B5563",
size: "28rpx"
}),
z: common_vendor.t(item.collect_num)
} : {}, {
A: item.comment_num > 0
}, item.comment_num > 0 ? {
B: "4b2e7592-7-" + i0,
C: common_vendor.p({
name: "chat",
color: "#4B5563",
size: "28rpx"
}),
D: common_vendor.t(item.comment_num)
} : {}, {
E: "4b2e7592-8-" + i0,
F: common_vendor.t(formatdate(item.push_date)),
G: common_vendor.o(($event) => goDetail(item.exchange_id), item.exchange_id),
H: item.exchange_id
});
}),
l: common_vendor.p({
name: "eye",
color: "#4B5563",
size: "28rpx"
}),
m: common_vendor.p({
name: "clock",
color: "#4B5563",
size: "28rpx"
}),
n: common_vendor.p({
value: 2
}),
o: common_vendor.p({
name: "plus",
color: "#fff",
size: "18"
}),
p: common_vendor.o(goPublish)
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-4b2e7592"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/caseTalk/caseTalk.js.map