From 816188c2bbe5683e5bc08a8649b158f4ede74cb1 Mon Sep 17 00:00:00 2001
From: zhengw <247276359@qq.com>
Date: Sat, 28 Feb 2026 11:15:31 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC=E6=A3=80?=
=?UTF-8?q?=E6=9F=A5=E4=BB=A3=E7=A0=81,=20=20=E6=B5=81=E7=A8=8B=E7=AE=A1?=
=?UTF-8?q?=E7=90=86=E9=A1=B5=E9=9D=A2=E7=A9=BA=E6=95=B0=E6=8D=AE=E5=A4=84?=
=?UTF-8?q?=E7=90=86?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
miniprogram/app.ts | 5 ++++
miniprogram/pages/index/index.ts | 5 ++--
miniprogram/pages/my/my.ts | 8 +++++
miniprogram/pages/my/my.wxml | 1 +
.../produce/processManage/processManage.wxml | 1 +
miniprogram/utils/https.ts | 12 +++-----
miniprogram/utils/util.ts | 30 +++++++++++++++++++
7 files changed, 51 insertions(+), 11 deletions(-)
diff --git a/miniprogram/app.ts b/miniprogram/app.ts
index a45a357..2b68a14 100644
--- a/miniprogram/app.ts
+++ b/miniprogram/app.ts
@@ -1,3 +1,5 @@
+import { updateVersion } from './utils/util';
+
// app.ts
App<
IAppOption & {
@@ -18,5 +20,8 @@ App<
// },
// });
},
+ onShow() {
+ updateVersion();
+ },
// Storage: Storage, // 将 Storage 挂载到 App 实例上
});
diff --git a/miniprogram/pages/index/index.ts b/miniprogram/pages/index/index.ts
index ee14f52..8fcd6ec 100644
--- a/miniprogram/pages/index/index.ts
+++ b/miniprogram/pages/index/index.ts
@@ -107,9 +107,7 @@ Page({
/**
* 生命周期函数--监听页面加载
*/
- onLoad() {
- loginStatusPage(this);
- },
+ onLoad() {},
/**
* 生命周期函数--监听页面初次渲染完成
@@ -120,6 +118,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
+ loginStatusPage(this);
wx.hideHomeButton();
},
diff --git a/miniprogram/pages/my/my.ts b/miniprogram/pages/my/my.ts
index 9cb13fb..edd8f3a 100644
--- a/miniprogram/pages/my/my.ts
+++ b/miniprogram/pages/my/my.ts
@@ -32,6 +32,14 @@ Page({
encodeURIComponent('https://docs.qq.com/aio/DS2NCRFFseG9Ma3Ja?p=7umJTJ6bznQtaBK2RSLmPD'),
});
},
+ txOfficialAccount() {
+ wx.openOfficialAccountChat({
+ username: 'gh_bc65d0d9f0a0',
+ fail: (res) => {
+ console.log(res);
+ },
+ });
+ },
handleLogin(e: any) {
this.setData({ isLogin: e.detail });
if (e.detail) {
diff --git a/miniprogram/pages/my/my.wxml b/miniprogram/pages/my/my.wxml
index 11b35c3..25e35c7 100644
--- a/miniprogram/pages/my/my.wxml
+++ b/miniprogram/pages/my/my.wxml
@@ -39,5 +39,6 @@
+
\ No newline at end of file
diff --git a/miniprogram/pages/produce/processManage/processManage.wxml b/miniprogram/pages/produce/processManage/processManage.wxml
index e335838..97d07d4 100644
--- a/miniprogram/pages/produce/processManage/processManage.wxml
+++ b/miniprogram/pages/produce/processManage/processManage.wxml
@@ -1,5 +1,6 @@
+
{{ item.p_process_name }}
diff --git a/miniprogram/utils/https.ts b/miniprogram/utils/https.ts
index 7f78d61..bc08970 100644
--- a/miniprogram/utils/https.ts
+++ b/miniprogram/utils/https.ts
@@ -42,7 +42,6 @@ const request = (url: string, options: any, config = { showLoading: true, showEr
if (request.data?.err_code === 0) {
//
resolve(request.data);
- return;
} else {
if (config.showError != false) {
wx.showToast({
@@ -60,8 +59,8 @@ const request = (url: string, options: any, config = { showLoading: true, showEr
goIndexPage();
}
}
+ reject(request.data);
}
- reject();
},
fail(error: any) {
if (config.showLoading != false) {
@@ -239,12 +238,9 @@ export const login = (encryptedData: any, iv: any, type?: any, company_id?: any)
// wx.removeStorageSync("loginExp");
if (type == 4) {
checkSesskey()
- .then((res) => {
- resolve(res);
- })
- .catch(() => {
- reject(err);
- });
+ .then(() => {})
+ .catch(() => {});
+ reject(err);
} else {
reject(err);
}
diff --git a/miniprogram/utils/util.ts b/miniprogram/utils/util.ts
index 6c18407..6c29dcb 100644
--- a/miniprogram/utils/util.ts
+++ b/miniprogram/utils/util.ts
@@ -389,3 +389,33 @@ export const getDay = (option?: { value: number; unit: 'day' | 'month' | 'year'
const { value = 0, unit = 'day' } = option || {};
return dayjs().subtract(value, unit).format('YYYY-MM-DD');
};
+
+/**
+ * 监听向微信后台请求检查更新结果事件
+ */
+export const updateVersion = () => {
+ const updateManager = wx.getUpdateManager();
+ // 监听向微信后台请求检查更新结果事件
+ updateManager.onCheckForUpdate((res) => {
+ if (res.hasUpdate) {
+ // 监听小程序有版本更新事件
+ updateManager.onUpdateReady(() => {
+ wx.showModal({
+ title: '更新提示',
+ content: '新版本已经准备好,是否重启当前应用?',
+ success(res) {
+ if (res.confirm) {
+ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
+ updateManager.applyUpdate();
+ }
+ },
+ });
+ });
+
+ // 监听小程序更新失败事件
+ updateManager.onUpdateFailed(function () {
+ wx.showModal({ title: '发现新版本', content: '请删除当前小程序,重新搜索打开...' });
+ });
+ }
+ });
+};