| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- "use strict";
- const common_vendor = require("../../../../common/vendor.js");
- const pagesCrm_business_schemeDetail_template_props = require("./props.js");
- require("../../../../config/globalData.js");
- const pagesCrm_service_schemeDetail_index = require("../../../service/schemeDetail/index.js");
- const pagesCrm_static_path = require("../../../static/path.js");
- const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
- __name: "health-education",
- props: pagesCrm_business_schemeDetail_template_props.props,
- setup(__props) {
- const props = __props;
- const list = common_vendor.ref([]);
- const option = common_vendor.ref({});
- const isAllRead = common_vendor.ref(0);
- const init = async (datas) => {
- if (datas && !datas.length)
- return;
- datas.forEach((item) => {
- try {
- if (typeof item.PushContent == "string") {
- item.PushContent = JSON.parse(item.PushContent);
- }
- } catch (e) {
- }
- });
- let isRead = 1;
- for (let i = 0; i < datas.length; i++) {
- if (!datas[i].IsRead) {
- isRead = 0;
- break;
- }
- }
- list.value = datas;
- option.value = datas[0];
- isAllRead.value = isRead;
- };
- const toArticle = async (row) => {
- const {
- PushContent: { Title, Id },
- Id: planid
- } = row;
- const index = list.value.findIndex((item) => item.Id == planid);
- const plan = list.value[index];
- let readRes = plan.IsRead;
- if (!plan.IsRead) {
- const resp = await pagesCrm_service_schemeDetail_index.PatientRead({
- Id: planid
- });
- readRes = !!resp;
- }
- list.value[index].IsRead = readRes;
- const isAllRead2 = list.value.reduce((res, item) => {
- return res && item.IsRead;
- }, true);
- let pages = getCurrentPages();
- let parentPage = pages[pages.length - 2];
- parentPage.$vm.changeItemReadStatus(props.date, props.index, isAllRead2);
- common_vendor.goToUrl(pagesCrm_static_path.path.article(Id));
- };
- common_vendor.watch(
- () => props.content,
- (v) => {
- init(v);
- },
- {
- immediate: true,
- deep: true
- }
- );
- return (_ctx, _cache) => {
- return common_vendor.e({
- a: common_vendor.t(_ctx.memberName),
- b: common_vendor.t(option.value.ExecDate),
- c: option.value.IsRead
- }, option.value.IsRead ? {
- d: common_vendor.t(isAllRead.value ? "完成" : "未完成")
- } : {}, {
- e: common_vendor.f(list.value, (item, index, i0) => {
- return {
- a: common_vendor.t(item.IsRead ? "已阅读" : "未阅读"),
- b: common_vendor.n(item.IsRead ? "read" : "unread"),
- c: common_vendor.t(index + 1),
- d: common_vendor.t(item.PushContent.Title),
- e: common_vendor.o(($event) => toArticle(item), index),
- f: index
- };
- })
- });
- };
- }
- });
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-6ca65693"]]);
- wx.createComponent(Component);
- //# sourceMappingURL=../../../../../.sourcemap/mp-weixin/pagesCrm/business/schemeDetail/template/health-education.js.map
|