添加版本检查代码, 流程管理页面空数据处理
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
import { updateVersion } from './utils/util';
|
||||||
|
|
||||||
// app.ts
|
// app.ts
|
||||||
App<
|
App<
|
||||||
IAppOption & {
|
IAppOption & {
|
||||||
@@ -18,5 +20,8 @@ App<
|
|||||||
// },
|
// },
|
||||||
// });
|
// });
|
||||||
},
|
},
|
||||||
|
onShow() {
|
||||||
|
updateVersion();
|
||||||
|
},
|
||||||
// Storage: Storage, // 将 Storage 挂载到 App 实例上
|
// Storage: Storage, // 将 Storage 挂载到 App 实例上
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -107,9 +107,7 @@ Page({
|
|||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面加载
|
* 生命周期函数--监听页面加载
|
||||||
*/
|
*/
|
||||||
onLoad() {
|
onLoad() {},
|
||||||
loginStatusPage(this);
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生命周期函数--监听页面初次渲染完成
|
* 生命周期函数--监听页面初次渲染完成
|
||||||
@@ -120,6 +118,7 @@ Page({
|
|||||||
* 生命周期函数--监听页面显示
|
* 生命周期函数--监听页面显示
|
||||||
*/
|
*/
|
||||||
onShow() {
|
onShow() {
|
||||||
|
loginStatusPage(this);
|
||||||
wx.hideHomeButton();
|
wx.hideHomeButton();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -32,6 +32,14 @@ Page({
|
|||||||
encodeURIComponent('https://docs.qq.com/aio/DS2NCRFFseG9Ma3Ja?p=7umJTJ6bznQtaBK2RSLmPD'),
|
encodeURIComponent('https://docs.qq.com/aio/DS2NCRFFseG9Ma3Ja?p=7umJTJ6bznQtaBK2RSLmPD'),
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
txOfficialAccount() {
|
||||||
|
wx.openOfficialAccountChat({
|
||||||
|
username: 'gh_bc65d0d9f0a0',
|
||||||
|
fail: (res) => {
|
||||||
|
console.log(res);
|
||||||
|
},
|
||||||
|
});
|
||||||
|
},
|
||||||
handleLogin(e: any) {
|
handleLogin(e: any) {
|
||||||
this.setData({ isLogin: e.detail });
|
this.setData({ isLogin: e.detail });
|
||||||
if (e.detail) {
|
if (e.detail) {
|
||||||
|
|||||||
@@ -39,5 +39,6 @@
|
|||||||
</t-cell-group>
|
</t-cell-group>
|
||||||
<t-cell title="退出登录" bind:tap="loginOut" hover bordered arrow />
|
<t-cell title="退出登录" bind:tap="loginOut" hover bordered arrow />
|
||||||
<t-cell title="版本" note="{{version}}" hover bind:tap="txDoc" bordered arrow />
|
<t-cell title="版本" note="{{version}}" hover bind:tap="txDoc" bordered arrow />
|
||||||
|
<t-cell title="易宝赞普惠服务" note="留言反馈" hover bind:tap="txOfficialAccount" bordered arrow />
|
||||||
</page-plugin>
|
</page-plugin>
|
||||||
<tab-bar-plugin active="my" />
|
<tab-bar-plugin active="my" />
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
<page-plugin isAuth="{{authInfo['SF_ERP_PRODUCT_PROCESS_VIEW']}}" loading="{{loading}}"
|
<page-plugin isAuth="{{authInfo['SF_ERP_PRODUCT_PROCESS_VIEW']}}" loading="{{loading}}"
|
||||||
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
is-login="{{isLogin}}" bind:handleLogin="handleLogin">
|
||||||
|
<empty-plugin wx:if="{{process.length == 0}}" />
|
||||||
<block wx:for="{{ process }}" wx:key="parent_process_id">
|
<block wx:for="{{ process }}" wx:key="parent_process_id">
|
||||||
<view class="p_process_name-box">
|
<view class="p_process_name-box">
|
||||||
<view class="p_process_name">{{ item.p_process_name }}</view>
|
<view class="p_process_name">{{ item.p_process_name }}</view>
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ const request = (url: string, options: any, config = { showLoading: true, showEr
|
|||||||
if (request.data?.err_code === 0) {
|
if (request.data?.err_code === 0) {
|
||||||
//
|
//
|
||||||
resolve(request.data);
|
resolve(request.data);
|
||||||
return;
|
|
||||||
} else {
|
} else {
|
||||||
if (config.showError != false) {
|
if (config.showError != false) {
|
||||||
wx.showToast({
|
wx.showToast({
|
||||||
@@ -60,8 +59,8 @@ const request = (url: string, options: any, config = { showLoading: true, showEr
|
|||||||
goIndexPage();
|
goIndexPage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
reject(request.data);
|
||||||
}
|
}
|
||||||
reject();
|
|
||||||
},
|
},
|
||||||
fail(error: any) {
|
fail(error: any) {
|
||||||
if (config.showLoading != false) {
|
if (config.showLoading != false) {
|
||||||
@@ -239,12 +238,9 @@ export const login = (encryptedData: any, iv: any, type?: any, company_id?: any)
|
|||||||
// wx.removeStorageSync("loginExp");
|
// wx.removeStorageSync("loginExp");
|
||||||
if (type == 4) {
|
if (type == 4) {
|
||||||
checkSesskey()
|
checkSesskey()
|
||||||
.then((res) => {
|
.then(() => {})
|
||||||
resolve(res);
|
.catch(() => {});
|
||||||
})
|
reject(err);
|
||||||
.catch(() => {
|
|
||||||
reject(err);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
reject(err);
|
reject(err);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -389,3 +389,33 @@ export const getDay = (option?: { value: number; unit: 'day' | 'month' | 'year'
|
|||||||
const { value = 0, unit = 'day' } = option || {};
|
const { value = 0, unit = 'day' } = option || {};
|
||||||
return dayjs().subtract(value, unit).format('YYYY-MM-DD');
|
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: '请删除当前小程序,重新搜索打开...' });
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user