|
@@ -1,13 +1,15 @@
|
|
|
"use strict";
|
|
"use strict";
|
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const common_vendor = require("../../common/vendor.js");
|
|
|
|
|
+const utils_api = require("../../utils/api.js");
|
|
|
if (!Array) {
|
|
if (!Array) {
|
|
|
const _easycom_uv_qrcode2 = common_vendor.resolveComponent("uv-qrcode");
|
|
const _easycom_uv_qrcode2 = common_vendor.resolveComponent("uv-qrcode");
|
|
|
_easycom_uv_qrcode2();
|
|
_easycom_uv_qrcode2();
|
|
|
}
|
|
}
|
|
|
const _easycom_uv_qrcode = () => "../../uni_modules/uv-qrcode/components/uv-qrcode/uv-qrcode.js";
|
|
const _easycom_uv_qrcode = () => "../../uni_modules/uv-qrcode/components/uv-qrcode/uv-qrcode.js";
|
|
|
if (!Math) {
|
|
if (!Math) {
|
|
|
- _easycom_uv_qrcode();
|
|
|
|
|
|
|
+ (_easycom_uv_qrcode + NoData)();
|
|
|
}
|
|
}
|
|
|
|
|
+const NoData = () => "../../components/noData.js";
|
|
|
const _sfc_main = {
|
|
const _sfc_main = {
|
|
|
__name: "home",
|
|
__name: "home",
|
|
|
setup(__props) {
|
|
setup(__props) {
|
|
@@ -22,15 +24,23 @@ const _sfc_main = {
|
|
|
customBarH.value = custom.height;
|
|
customBarH.value = custom.height;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- userType.value = common_vendor.index.getStorageSync("userType");
|
|
|
|
|
- console.log("身份类型", userType.value);
|
|
|
|
|
- const appList = common_vendor.index.getStorageSync("appList");
|
|
|
|
|
- if (appList) {
|
|
|
|
|
- useAppList.value = filterApp(list.value, appList);
|
|
|
|
|
|
|
+ userInfo.value = common_vendor.index.getStorageSync("userInfo");
|
|
|
|
|
+ if (userInfo.value.identityId == 1) {
|
|
|
|
|
+ getChildMsg();
|
|
|
}
|
|
}
|
|
|
|
|
+ getUseAppList();
|
|
|
|
|
+ common_vendor.index.$on("updateObj", updateObj);
|
|
|
|
|
+ });
|
|
|
|
|
+ common_vendor.onShow(() => {
|
|
|
|
|
+ getQrcode();
|
|
|
});
|
|
});
|
|
|
common_vendor.onPullDownRefresh(() => {
|
|
common_vendor.onPullDownRefresh(() => {
|
|
|
|
|
+ getQrcode();
|
|
|
qrcodeRef.value.remake();
|
|
qrcodeRef.value.remake();
|
|
|
|
|
+ if (userInfo.value.identityId == 1) {
|
|
|
|
|
+ getChildMsg();
|
|
|
|
|
+ }
|
|
|
|
|
+ getUseAppList();
|
|
|
setTimeout(() => {
|
|
setTimeout(() => {
|
|
|
common_vendor.index.stopPullDownRefresh();
|
|
common_vendor.index.stopPullDownRefresh();
|
|
|
}, 1500);
|
|
}, 1500);
|
|
@@ -42,53 +52,86 @@ const _sfc_main = {
|
|
|
showHeader.value = false;
|
|
showHeader.value = false;
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
- const userType = common_vendor.ref();
|
|
|
|
|
|
|
+ const userInfo = common_vendor.ref({});
|
|
|
|
|
+ const childMsgList = common_vendor.ref([]);
|
|
|
|
|
+ const currentChild = common_vendor.ref({});
|
|
|
const showHeader = common_vendor.ref(false);
|
|
const showHeader = common_vendor.ref(false);
|
|
|
const statusBarH = common_vendor.ref(0);
|
|
const statusBarH = common_vendor.ref(0);
|
|
|
const customBarH = common_vendor.ref(0);
|
|
const customBarH = common_vendor.ref(0);
|
|
|
const qrcodeRef = common_vendor.ref(null);
|
|
const qrcodeRef = common_vendor.ref(null);
|
|
|
- const list = common_vendor.ref([
|
|
|
|
|
|
|
+ common_vendor.ref([
|
|
|
{
|
|
{
|
|
|
id: 3,
|
|
id: 3,
|
|
|
title: "学生轨迹",
|
|
title: "学生轨迹",
|
|
|
- url: "../../static/images/icon.png",
|
|
|
|
|
path: "/pages/track/track"
|
|
path: "/pages/track/track"
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
id: 7,
|
|
id: 7,
|
|
|
title: "消息通知",
|
|
title: "消息通知",
|
|
|
- url: "../../static/images/icon.png",
|
|
|
|
|
path: "/pages/msgWarn/msgWarn"
|
|
path: "/pages/msgWarn/msgWarn"
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
id: 8,
|
|
id: 8,
|
|
|
title: "访客预约",
|
|
title: "访客预约",
|
|
|
- url: "../../static/images/icon.png",
|
|
|
|
|
path: "/pagesReservation/reservation/reservation"
|
|
path: "/pagesReservation/reservation/reservation"
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
id: 10,
|
|
id: 10,
|
|
|
title: "校园预警",
|
|
title: "校园预警",
|
|
|
- url: "../../static/images/icon.png",
|
|
|
|
|
path: "/pagesWarning/home/home"
|
|
path: "/pagesWarning/home/home"
|
|
|
},
|
|
},
|
|
|
{
|
|
{
|
|
|
id: 11,
|
|
id: 11,
|
|
|
title: "通讯录",
|
|
title: "通讯录",
|
|
|
- url: "../../static/images/icon.png",
|
|
|
|
|
- path: "/pages/grade/grade?type=通讯录"
|
|
|
|
|
|
|
+ path: "/pages/grade/grade"
|
|
|
}
|
|
}
|
|
|
]);
|
|
]);
|
|
|
const useAppList = common_vendor.ref([]);
|
|
const useAppList = common_vendor.ref([]);
|
|
|
- const QRCodeUrl = common_vendor.ref("123");
|
|
|
|
|
|
|
+ const QRCodeUrl = common_vendor.ref("");
|
|
|
const options = {
|
|
const options = {
|
|
|
- typeNumber: 4,
|
|
|
|
|
|
|
+ typeNumber: -1,
|
|
|
foregroundImageBorderRadius: 5,
|
|
foregroundImageBorderRadius: 5,
|
|
|
foregroundImageSrc: "/static/images/school-logo.jpg"
|
|
foregroundImageSrc: "/static/images/school-logo.jpg"
|
|
|
};
|
|
};
|
|
|
|
|
+ const getQrcode = async () => {
|
|
|
|
|
+ const res = await utils_api.myRequest({
|
|
|
|
|
+ url: "/wanzai/api/smartQrcode/generateQrcode",
|
|
|
|
|
+ data: {
|
|
|
|
|
+ userId: common_vendor.index.getStorageSync("userInfo").id
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ QRCodeUrl.value = res.data.qrcode;
|
|
|
|
|
+ };
|
|
|
|
|
+ const getChildMsg = async () => {
|
|
|
|
|
+ const res = await utils_api.myRequest({
|
|
|
|
|
+ url: "/wanzai/api/smartUser/queryAffiliateUserById",
|
|
|
|
|
+ data: {
|
|
|
|
|
+ id: common_vendor.index.getStorageSync("userInfo").id
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ childMsgList.value = res.data;
|
|
|
|
|
+ if (childMsgList.value.length) {
|
|
|
|
|
+ currentChild.value = childMsgList.value[0];
|
|
|
|
|
+ }
|
|
|
|
|
+ };
|
|
|
|
|
+ const getUseAppList = async () => {
|
|
|
|
|
+ const res = await utils_api.myRequest({
|
|
|
|
|
+ url: "/wanzai/api/smartIdentity/queryIdentityApplyById",
|
|
|
|
|
+ data: {
|
|
|
|
|
+ id: common_vendor.index.getStorageSync("userInfo").identityId
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ useAppList.value = res.data;
|
|
|
|
|
+ };
|
|
|
const goPage = (url) => {
|
|
const goPage = (url) => {
|
|
|
if (url === "/pages/track/track") {
|
|
if (url === "/pages/track/track") {
|
|
|
- if (userType.value == 1) {
|
|
|
|
|
|
|
+ if (userInfo.value.identityId == 1) {
|
|
|
|
|
+ common_vendor.index.navigateTo({
|
|
|
|
|
+ url: `/pages/track/track?id=${currentChild.value.id}`
|
|
|
|
|
+ });
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (userInfo.value.identityId == 3) {
|
|
|
common_vendor.index.navigateTo({
|
|
common_vendor.index.navigateTo({
|
|
|
url: "/pages/grade/grade?type=学生轨迹"
|
|
url: "/pages/grade/grade?type=学生轨迹"
|
|
|
});
|
|
});
|
|
@@ -107,10 +150,8 @@ const _sfc_main = {
|
|
|
url: `/pages/quickMark/quickMark?value=${QRCodeUrl.value}`
|
|
url: `/pages/quickMark/quickMark?value=${QRCodeUrl.value}`
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
- const filterApp = (arr1, arr2) => {
|
|
|
|
|
- return arr1.filter((item) => {
|
|
|
|
|
- return arr2.includes(item.title);
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ const updateObj = (data) => {
|
|
|
|
|
+ currentChild.value = data;
|
|
|
};
|
|
};
|
|
|
return (_ctx, _cache) => {
|
|
return (_ctx, _cache) => {
|
|
|
return common_vendor.e({
|
|
return common_vendor.e({
|
|
@@ -121,32 +162,57 @@ const _sfc_main = {
|
|
|
e: customBarH.value * 2 + "rpx",
|
|
e: customBarH.value * 2 + "rpx",
|
|
|
f: statusBarH.value * 2 + "rpx",
|
|
f: statusBarH.value * 2 + "rpx",
|
|
|
g: showHeader.value,
|
|
g: showHeader.value,
|
|
|
- h: common_vendor.t(userType.value === 0 ? "家长" : "教师"),
|
|
|
|
|
- i: common_vendor.sr(qrcodeRef, "07e72d3c-0", {
|
|
|
|
|
|
|
+ h: common_vendor.t(userInfo.value.name),
|
|
|
|
|
+ i: userInfo.value.identityId == 1
|
|
|
|
|
+ }, userInfo.value.identityId == 1 ? {} : {}, {
|
|
|
|
|
+ j: userInfo.value.identityId == 2
|
|
|
|
|
+ }, userInfo.value.identityId == 2 ? {} : {}, {
|
|
|
|
|
+ k: userInfo.value.identityId == 3
|
|
|
|
|
+ }, userInfo.value.identityId == 3 ? {} : {}, {
|
|
|
|
|
+ l: common_vendor.sr(qrcodeRef, "07e72d3c-0", {
|
|
|
"k": "qrcodeRef"
|
|
"k": "qrcodeRef"
|
|
|
}),
|
|
}),
|
|
|
- j: common_vendor.o(handleClickCode),
|
|
|
|
|
- k: common_vendor.p({
|
|
|
|
|
|
|
+ m: common_vendor.o(handleClickCode),
|
|
|
|
|
+ n: common_vendor.p({
|
|
|
size: "82rpx",
|
|
size: "82rpx",
|
|
|
value: QRCodeUrl.value,
|
|
value: QRCodeUrl.value,
|
|
|
options
|
|
options
|
|
|
}),
|
|
}),
|
|
|
- l: userType.value == 0
|
|
|
|
|
- }, userType.value == 0 ? {
|
|
|
|
|
- m: common_vendor.o(($event) => goPage("/pages/myMsg/myMsg")),
|
|
|
|
|
- n: common_vendor.o(($event) => goPage("/pages/change/change")),
|
|
|
|
|
- o: common_vendor.o(($event) => goPage("/pages/bind/bind")),
|
|
|
|
|
- p: common_vendor.o(($event) => goPage("/pages/bind/bind"))
|
|
|
|
|
|
|
+ o: userInfo.value.identityId == 1
|
|
|
|
|
+ }, userInfo.value.identityId == 1 ? common_vendor.e({
|
|
|
|
|
+ p: childMsgList.value.length
|
|
|
|
|
+ }, childMsgList.value.length ? {
|
|
|
|
|
+ q: currentChild.value.headImage || "../../static/images/user-photo.png"
|
|
|
} : {}, {
|
|
} : {}, {
|
|
|
- q: common_vendor.f(useAppList.value, (item, k0, i0) => {
|
|
|
|
|
|
|
+ r: childMsgList.value.length
|
|
|
|
|
+ }, childMsgList.value.length ? {
|
|
|
|
|
+ s: common_vendor.t(currentChild.value.name)
|
|
|
|
|
+ } : {}, {
|
|
|
|
|
+ t: childMsgList.value.length
|
|
|
|
|
+ }, childMsgList.value.length ? {
|
|
|
|
|
+ v: common_vendor.o(($event) => goPage(`/pages/myMsg/myMsg?id=${currentChild.value.id}`))
|
|
|
|
|
+ } : {}, {
|
|
|
|
|
+ w: childMsgList.value.length > 1
|
|
|
|
|
+ }, childMsgList.value.length > 1 ? {
|
|
|
|
|
+ x: common_vendor.o(($event) => goPage(`/pages/change/change?list=${JSON.stringify(childMsgList.value)}&id=${currentChild.value.id}`))
|
|
|
|
|
+ } : {}, {
|
|
|
|
|
+ y: common_vendor.o(($event) => goPage("/pages/bind/bind")),
|
|
|
|
|
+ z: common_vendor.o(($event) => goPage("/pages/bind/bind"))
|
|
|
|
|
+ }) : {}, {
|
|
|
|
|
+ A: useAppList.value.length
|
|
|
|
|
+ }, useAppList.value.length ? {
|
|
|
|
|
+ B: common_vendor.f(useAppList.value, (item, k0, i0) => {
|
|
|
return {
|
|
return {
|
|
|
a: item.url,
|
|
a: item.url,
|
|
|
b: common_vendor.t(item.title),
|
|
b: common_vendor.t(item.title),
|
|
|
c: item.id,
|
|
c: item.id,
|
|
|
d: common_vendor.o(($event) => goPage(item.path), item.id)
|
|
d: common_vendor.o(($event) => goPage(item.path), item.id)
|
|
|
};
|
|
};
|
|
|
- }),
|
|
|
|
|
- r: common_vendor.s(_ctx.__cssVars())
|
|
|
|
|
|
|
+ })
|
|
|
|
|
+ } : {}, {
|
|
|
|
|
+ C: !useAppList.value.length
|
|
|
|
|
+ }, !useAppList.value.length ? {} : {}, {
|
|
|
|
|
+ D: common_vendor.s(_ctx.__cssVars())
|
|
|
});
|
|
});
|
|
|
};
|
|
};
|
|
|
}
|
|
}
|