From 594fabc243b9de59fd9c9a4ca52521a10aac857c Mon Sep 17 00:00:00 2001 From: weipengfei <2187978347@qq.com> Date: Sat, 23 Sep 2023 17:53:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=9B=B4=E6=96=B0=E5=BC=B9?= =?UTF-8?q?=E7=AA=97=E6=97=A0=E6=B3=95=E5=85=B3=E9=97=AD=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- store/modules/config.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/store/modules/config.js b/store/modules/config.js index 0fbafae..c486d32 100644 --- a/store/modules/config.js +++ b/store/modules/config.js @@ -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{