hldy_xcx/unpackage/dist/dev/mp-weixin/pages/yuangongindex/message.js

92 lines
3.0 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const pages_yuangongindex_api = require("./api.js");
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
__name: "message",
setup(__props) {
const hulijigouArray = common_vendor.ref([]);
common_vendor.ref(false);
common_vendor.ref("");
const clickCard = (type) => {
if (type.izRead == "1") {
pages_yuangongindex_api.upRead({ id: type.id }).then((res) => {
if (res.success) {
search();
switch (type.type) {
case "emp_org_invited_emp_list":
common_vendor.index.navigateTo({
url: `/pages/yuangongindex/simpleyaoqing?extend=${type.extend}`
});
break;
}
}
});
} else {
switch (type.type) {
case "emp_org_invited_emp_list":
common_vendor.index.navigateTo({
url: `/pages/yuangongindex/simpleyaoqing?extend=${type.extend}`
});
break;
}
}
};
const checkRed = () => {
if (hulijigouArray.value.every((item) => item.izRead == `0`)) {
hong.value = false;
} else {
hong.value = true;
}
};
const goBack = () => {
if (common_vendor.index.getStorageSync("jumpIndex")) {
common_vendor.index.reLaunch({
url: "/pages/yuangongindex/index"
});
} else {
common_vendor.index.reLaunch({
url: "/pages/oldmanindex/index"
});
}
};
const search = () => {
pages_yuangongindex_api.getNotice().then((res) => {
if (res.success) {
hulijigouArray.value = res.result;
checkRed();
}
});
};
common_vendor.ref(false);
const hong = common_vendor.ref(false);
common_vendor.onShow(() => {
search();
});
return (_ctx, _cache) => {
return common_vendor.e({
a: common_vendor.o(goBack),
b: hulijigouArray.value.length
}, hulijigouArray.value.length ? common_vendor.e({
c: hong.value
}, hong.value ? {} : {}) : {}, {
d: !hulijigouArray.value.length
}, !hulijigouArray.value.length ? {} : {}, {
e: common_vendor.f(hulijigouArray.value, (item, index, i0) => {
return common_vendor.e({
a: common_vendor.t(item.title),
b: common_vendor.t(item.createTime.substring(item.createTime.indexOf("-") + 1, item.createTime.indexOf("-") + 6)),
c: item.izRead == `1`
}, item.izRead == `1` ? {} : {}, {
d: common_vendor.t(item.content),
e: index,
f: common_vendor.o(($event) => clickCard(item), index)
});
})
});
};
}
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-c24ad088"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/yuangongindex/message.js.map