From 41dc9d4e84632a0e8ff5568d735d2e9aeed3eaa8 Mon Sep 17 00:00:00 2001 From: wangxia <779219182@qq.com> Date: Mon, 10 Nov 2025 18:31:39 +0800 Subject: [PATCH] =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App.vue | 32 +++++++++++++++++++++++++++++++- main.js | 2 +- pages/workBench/index.vue | 9 +++++---- root/detail/fellow.vue | 2 +- root/home/editTownsman.vue | 2 +- root/home/quickApplication.vue | 9 ++++++--- utils/common.js | 8 +++++++- 7 files changed, 52 insertions(+), 12 deletions(-) diff --git a/App.vue b/App.vue index 9348e3a..66babae 100644 --- a/App.vue +++ b/App.vue @@ -42,7 +42,7 @@ export default { let that = this; console.log("show 项目init:", options, decodeURIComponent(options.query.scene)); let requestComeFrom = this.G.globalConstantData.requestComeFrom; - uni.setStorageSync("requestComeFrom", (requestComeFrom && (requestComeFrom == "assistant_miniapp" || requestComeFrom == "supply_chain_miniapp")) ? 'isToB' : 'isToC'); + uni.setStorageSync("requestComeFrom", requestComeFrom && (requestComeFrom == "assistant_miniapp" || requestComeFrom == "supply_chain_miniapp") ? "isToB" : "isToC"); // 清除扫码获取的id信息 uni.removeStorageSync("scene"); @@ -96,6 +96,36 @@ export default { // console.log("app.vue 检查IM连接状态"); that.checkAndReconnectIM(); } + const updateManager = uni.getUpdateManager(); + updateManager.onCheckForUpdate(function (res) { + console.log("检测是否有新版本:", res.hasUpdate); + }); + updateManager.onUpdateReady(function (res) { + uni.showModal({ + title: "更新提示", + content: "新版本已经准备好,需重启应用", + showCancel: false, + success(res) { + if (res.confirm) { + console.log("新版本已经准备好,需重启应用"); + updateManager.applyUpdate(); + } + }, + }); + }); + updateManager.onUpdateFailed(function (res) { + uni.showModal({ + title: "更新提示", + content: "新版本下载异常,需重启应用", + showCancel: false, + success(res) { + if (res.confirm) { + console.log("新版本下载异常,需重启应用"); + updateManager.applyUpdate(); + } + }, + }); + }); }, onHide: function () { // 应用进入后台时不清除定时器,保持心跳 diff --git a/main.js b/main.js index 4881722..c99c465 100644 --- a/main.js +++ b/main.js @@ -206,7 +206,7 @@ export function createApp () { }, $sourceType); }, /* 上传图片 - */ + */ uploadImgByAlbum (callback = () => { }, type = 'default', $num = 1, $sourceType = ['album']) { var that = this; G.uploadImage($num, (imgRes) => { diff --git a/pages/workBench/index.vue b/pages/workBench/index.vue index 2fd64b8..e1c8ede 100644 --- a/pages/workBench/index.vue +++ b/pages/workBench/index.vue @@ -201,10 +201,7 @@ export default { that.isLogin = uni.getStorageSync("apply-token") ? true : false; console.log("that.isLogin", that.isLogin); that.loginInfo = uni.getStorageSync("apply-userinfo"); - if (uni.getStorageSync("applyType") || uni.getStorageSync("applyType") === 0) { - that.menuActive = uni.getStorageSync("applyType"); - uni.removeStorageSync("applyType"); - } + this.getList(); if (!that.isLogin) { that.loading = false; @@ -220,6 +217,10 @@ export default { onShow() { let that = this; if (that.isLogin) { + if (uni.getStorageSync("applyType") || uni.getStorageSync("applyType") === 0) { + that.menuActive = uni.getStorageSync("applyType"); + uni.removeStorageSync("applyType"); + } this.getList(); } this.getGZHInfo(); diff --git a/root/detail/fellow.vue b/root/detail/fellow.vue index c4dec9c..2ba9217 100644 --- a/root/detail/fellow.vue +++ b/root/detail/fellow.vue @@ -374,7 +374,7 @@ export default { }, handleClickIDcard(e) { this.info.idCard = e; - if (this.info.idCard.length == 15 || this.info.idCard.length == 18) { + if (this.info.idCard && (this.info.idCard.length == 15 || this.info.idCard.length == 18)) { let info = this.G.getInfoByIDcard(this.info.idCard); this.info.age = info.age; this.info.sex = info.sex ? (info.sex == "男" ? 1 : 2) : ""; diff --git a/root/home/editTownsman.vue b/root/home/editTownsman.vue index 00908ff..d156f89 100644 --- a/root/home/editTownsman.vue +++ b/root/home/editTownsman.vue @@ -171,7 +171,7 @@ export default { watch: { "info.idCard"() { console.log("this.info.idCard", this.info.idCard); - if (this.info.idCard.length == 15 || this.info.idCard.length == 18) { + if (this.info.idCard && (this.info.idCard.length == 15 || this.info.idCard.length == 18)) { let info = this.G.getInfoByIDcard(this.info.idCard); console.log("info info info ", info); this.info.age = info.age; diff --git a/root/home/quickApplication.vue b/root/home/quickApplication.vue index d84bdc3..5970a0c 100644 --- a/root/home/quickApplication.vue +++ b/root/home/quickApplication.vue @@ -111,9 +111,12 @@ export default { let that = this; uni.$on("getTownsman", (data) => { console.log("getTownsman", data); - // 前端本地处理根据身份证号获取年龄 - let infoByIDcard = this.G.getInfoByIDcard(data.info.idCard); - data.info.age = infoByIDcard.age; + // 前端本地处理根据身份证号获取年龄 + if (data.info.idCard && (data.info.idCard.length == 15 || data.info.idCard.length == 18)) { + let infoByIDcard = this.G.getInfoByIDcard(data.info.idCard); + data.info.age = infoByIDcard.age; + } + if (that.persenInfo.length == 0) { that.persenInfo[0] = { ...data.info, diff --git a/utils/common.js b/utils/common.js index 12079f8..008a27e 100644 --- a/utils/common.js +++ b/utils/common.js @@ -1197,10 +1197,16 @@ let data = { getInfoByIDcard (idCard) { let info = {} let birthday + if (idCard.length !== 15 && idCard.length !== 18) { + return { + sex: '', + age: '', + } + } // 获取性别 if (idCard.length === 15) { info.sex = ['女', '男'][idCard.substr(14, 1) % 2] - birthday = Y + [idCard.substr(6, 2), idCard.substr(8, 2), idCard.substr(10, 2)].join('-') + birthday = [idCard.substr(6, 2), idCard.substr(8, 2), idCard.substr(10, 2)].join('-') } else if (idCard.length === 18) { info.sex = ['女', '男'][idCard.substr(16, 1) % 2] birthday = [idCard.substr(6, 4), idCard.substr(10, 2), idCard.substr(12, 2)].join('-')