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{