修复更新弹窗无法关闭的bug

This commit is contained in:
weipengfei 2023-09-23 17:53:36 +08:00
parent 829f8ed9da
commit 594fabc243

View File

@ -25,7 +25,8 @@ function compareVersions(version1, version2) {
const state = {
eyeType: Cache.get('eyeType') || true, // 小眼睛
request: Cache.get('request') || true, // 网络请求
config: JSON.parse(Cache.get('config')||'{}')
config: JSON.parse(Cache.get('config')||'{}'),
updateFlag: true
};
const mutations = {
@ -40,7 +41,10 @@ const mutations = {
SET_CONFIG(state, data){
state.config = {...data};
Cache.set('config', JSON.stringify(state.config));
}
},
SET_UPDATEFLAG(state, data){
state.updateFlag = data;
},
};
const actions = {
@ -48,7 +52,7 @@ const actions = {
let res = await getConfig();
commit('SET_CONFIG', res.data);
// console.log(compareVersions(res.data.version, '1.0.0')==1&&compareVersions(res.data.version, Cache.get('wgt_version'))==1);
if(uni.getStorageSync('uniMP')) return ;//是小程序环境时不进行更新
if(uni.getStorageSync('uniMP')||!state.updateFlag) return ;//是小程序环境时不进行更新
let os = uni.getSystemInfoSync();
// uni.showModal({
// title: `当前:${os.appVersion},WGT:${Cache.get('wgt_version')},返回:${res.data.version}`
@ -58,6 +62,7 @@ const actions = {
title: '检查更新中'
})
const wgt_v = uni.getStorageSync('wgt_version')||'1.0.0';
commit('SET_UPDATEFLAG', false);
// 版本更新
if(compareVersions(res.data.version, os.appWgtVersion||wgt_v)==1&&compareVersions(res.data.version, wgt_v)==1){
try{