This commit is contained in:
weipengfei 2024-03-18 18:02:31 +08:00
parent a3e20397f9
commit 952aae5266
4 changed files with 89 additions and 4 deletions

View File

@ -78,6 +78,7 @@
// #ifdef APP-PLUS
//uniMP
initEvent();
this.$store.dispatch('INIT_CONFIG');
// #endif
//#ifdef APP-PLUS

View File

@ -8,7 +8,15 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import request from "@/utils/request.js";
import Cache from '@/utils/cache'
import Cache from '@/utils/cache';
/**
* 获取版本信息
*/
export function Appversion(data) {
return request.get(`app/version`, data, {
noAuth: true
});
}
/**
* 获取用户信息
*

View File

@ -191,7 +191,7 @@
</view>
</view>
<!--商品关联系统表单-->
<view v-if="order_form.length>0" class="wrapper virtual_form">
<view v-if="order_form.length>0&&false" class="wrapper virtual_form">
<view class='item acea-row row-between-wrapper'
:class="{on:(item.name=='radios' || item.name=='checkboxs'),on2:item.name == 'dateranges',on3:item.name == 'citys',pd0:item.name == 'uploadPicture'}"
v-for="(item,index) in order_form" :key="index">
@ -1679,6 +1679,7 @@
});
}
}
this.order_form = []; //
for (var i = 0; i < that.order_form.length; i++) {
let curdata = that.order_form[i]
if (['radios'].indexOf(curdata.name) == -1 && (curdata.titleShow.val || (['uploadPicture',

View File

@ -8,7 +8,8 @@
// | Author: CRMEB Team <admin@crmeb.com>
// +----------------------------------------------------------------------
import {
getUserInfo
getUserInfo,
Appversion
} from "../../api/user.js";
import {
LOGIN_STATUS,
@ -114,7 +115,81 @@ const actions = {
}).catch(() => {
});
}
},
async INIT_CONFIG({
state,
commit
}, data = false) {
if(data) {
uni.showLoading({
title: '加载中'
})
await uni.$u.sleep(500)
}
const wgt_v = uni.getStorageSync('wgt_version') || '1.0.0';
// #ifdef APP-PLUS
let os = uni.getSystemInfoSync();
let apptype;
if (os.osName == 'ios') {
apptype = 2
} else {
apptype = 1
}
console.log({
version: os.appWgtVersion,
type: apptype,
phone_brand:os.brand
});
Appversion({
version: os.appWgtVersion,
type: apptype,
phone_brand:os.brand
}).then((res) => {
console.log(res);
if(data) uni.hideLoading()
if (Object.keys(res.data.appInfo).length > 0) {
// if(res.data.appInfo.version) uni.showLoading({
// title: '检查更新中'
// })
// 版本更新
if (compareVersions(res.data.appInfo.version, os.appWgtVersion || wgt_v) == 1 &&
compareVersions(res.data.appInfo.version,
wgt_v) == 1) {
try {
let info = res.data.appInfo || {};
let version = {
title: info.title || '发现新版本',
content: info.content || '修复了部分BUG',
versionName: info.version || '1.0.1',
brand:res.data.appInfo.phone_brand,
downUrl: info.dow_url || '',
force: info.force == 1 ? true : false, // 是否强制更新
quiet: info.quiet == 1 ? true : false // 是否静默更新
}
Updater.update(version,res.data.appInfo);
} catch (e) {
console.log(e);
Toast(e)
}
// uni.hideLoading();
}
else {
if(data) Toast('已经是最新版本了')
}
} else {
if(data) Toast('已经是最新版本了')
}
}).catch((err) => {
if(data) uni.hideLoading()
Toast(err.msg||err.message||err)
// console.log(err)
})
// #endif
}
};
export default {