修复更新弹窗无法关闭的bug
This commit is contained in:
parent
829f8ed9da
commit
594fabc243
@ -25,7 +25,8 @@ function compareVersions(version1, version2) {
|
|||||||
const state = {
|
const state = {
|
||||||
eyeType: Cache.get('eyeType') || true, // 小眼睛
|
eyeType: Cache.get('eyeType') || true, // 小眼睛
|
||||||
request: Cache.get('request') || true, // 网络请求
|
request: Cache.get('request') || true, // 网络请求
|
||||||
config: JSON.parse(Cache.get('config')||'{}')
|
config: JSON.parse(Cache.get('config')||'{}'),
|
||||||
|
updateFlag: true
|
||||||
};
|
};
|
||||||
|
|
||||||
const mutations = {
|
const mutations = {
|
||||||
@ -40,7 +41,10 @@ const mutations = {
|
|||||||
SET_CONFIG(state, data){
|
SET_CONFIG(state, data){
|
||||||
state.config = {...data};
|
state.config = {...data};
|
||||||
Cache.set('config', JSON.stringify(state.config));
|
Cache.set('config', JSON.stringify(state.config));
|
||||||
}
|
},
|
||||||
|
SET_UPDATEFLAG(state, data){
|
||||||
|
state.updateFlag = data;
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const actions = {
|
const actions = {
|
||||||
@ -48,7 +52,7 @@ const actions = {
|
|||||||
let res = await getConfig();
|
let res = await getConfig();
|
||||||
commit('SET_CONFIG', res.data);
|
commit('SET_CONFIG', res.data);
|
||||||
// console.log(compareVersions(res.data.version, '1.0.0')==1&&compareVersions(res.data.version, Cache.get('wgt_version'))==1);
|
// 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();
|
let os = uni.getSystemInfoSync();
|
||||||
// uni.showModal({
|
// uni.showModal({
|
||||||
// title: `当前:${os.appVersion},WGT:${Cache.get('wgt_version')},返回:${res.data.version}`
|
// title: `当前:${os.appVersion},WGT:${Cache.get('wgt_version')},返回:${res.data.version}`
|
||||||
@ -58,6 +62,7 @@ const actions = {
|
|||||||
title: '检查更新中'
|
title: '检查更新中'
|
||||||
})
|
})
|
||||||
const wgt_v = uni.getStorageSync('wgt_version')||'1.0.0';
|
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){
|
if(compareVersions(res.data.version, os.appWgtVersion||wgt_v)==1&&compareVersions(res.data.version, wgt_v)==1){
|
||||||
try{
|
try{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user