|
@@ -389,64 +389,89 @@
|
|
|
const appType = uni.getSystemInfoSync().platform;
|
|
|
if (plus != null) {
|
|
|
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
|
|
|
+ let versionCode = wgtinfo.versionCode;
|
|
|
if (appType == "ios") {
|
|
|
+ const getIosUpAppUrl = 'https://itunes.apple.com/cn/lookup?id=6474850968'
|
|
|
+ const iosAppStroeUrl ='https://apps.apple.com/cn/app/%E6%98%93%E8%B6%A3cbb/id6474850968';
|
|
|
uni.setStorageSync("showData", true)
|
|
|
- } else {
|
|
|
- uni.setStorageSync("showData", false)
|
|
|
- }
|
|
|
- let versionCode = wgtinfo.versionCode;
|
|
|
- this
|
|
|
- .request
|
|
|
- .post("sysInit", {
|
|
|
- code: versionCode
|
|
|
- })
|
|
|
- .then(res => {
|
|
|
- console.log(res, 'res')
|
|
|
- if (res.code == 200) {
|
|
|
-
|
|
|
- this.setSys(res.data);
|
|
|
-
|
|
|
- if (wgtinfo.versionCode < res.data.app_code) {
|
|
|
- uni.setStorageSync("showData", true)
|
|
|
- const upDater = uni.requireNativePlugin("CL-UpDater");
|
|
|
- let options = {
|
|
|
- title: "升级",
|
|
|
- con: res.data.app_update,
|
|
|
- downUrl: this.$device.platform == 'ios' ? encodeURI(res
|
|
|
- .data.ios_url) : encodeURI(res.data.android_url), //必填
|
|
|
- hidCancelbtn: true, //是否隐藏取消按钮;
|
|
|
- btnBgColor: "#ff3300", //设置按钮背景色颜色
|
|
|
- updateBtnText: "升级", //升级按钮文字,默认为立即升级
|
|
|
- topImgBg: "", //非必填,用于自定义;自定义方法请参考demo,
|
|
|
- hidBackBtn: true, //可选 默认为false(即会显示后台更新按钮), 设置android 整包更新弹框是否显示后台更新按钮,这个只有android整包更新才有这个参数,热更新是是无法设置的。
|
|
|
- verCode: res.data
|
|
|
- .app_version, //最新apk版本号 可选 用于Android整包升级,避免用户取消安装apk时,重复下载问题,如果不传的话,apk将会重新下载,
|
|
|
- downMsgTip: "资源下载中,请稍后...", //可选(android)
|
|
|
- goBackBtnText: "进入后台", //可选(android)
|
|
|
- };
|
|
|
- //必需提供下载地址;
|
|
|
- upDater.startUpdate(options, () => {});
|
|
|
- } else if (wgtinfo.versionCode > res.data.app_code) {
|
|
|
+ uni.request({
|
|
|
+ url: getIosUpAppUrl,
|
|
|
+ method: 'POST',
|
|
|
+ data: {},
|
|
|
+ success: res => {
|
|
|
+ let version = res.data.results[0].version;
|
|
|
+ if (wgtinfo.versionCode < version) {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '请更新应用',
|
|
|
+ showCancel: false,
|
|
|
+ success(e) {
|
|
|
+ plus.runtime.openURL(
|
|
|
+ iosAppStroeUrl
|
|
|
+ );
|
|
|
+ }
|
|
|
+ });
|
|
|
+ } else if (wgtinfo.versionCode > version) {
|
|
|
uni.setStorageSync("showData", false)
|
|
|
} else {
|
|
|
uni.setStorageSync("showData", true)
|
|
|
}
|
|
|
-
|
|
|
- if (res.data.is_audit == 0) {
|
|
|
- this.getGps({
|
|
|
- page: this,
|
|
|
- fn: (res) => {
|
|
|
- console.log(res);
|
|
|
- this.getData(true);
|
|
|
- },
|
|
|
- err: (err) => {
|
|
|
- this.getData(true);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
+ },
|
|
|
+ fail: res => {
|
|
|
+ // store.commit('changeState', true);
|
|
|
+ console.log(res, 'shib');
|
|
|
}
|
|
|
});
|
|
|
+ } else {
|
|
|
+ uni.setStorageSync("showData", false)
|
|
|
+ this.request.post("sysInit", {
|
|
|
+ code: versionCode
|
|
|
+ })
|
|
|
+ .then(res => {
|
|
|
+ console.log(res, 'res')
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.setSys(res.data);
|
|
|
+ if (wgtinfo.versionCode < res.data.app_code) {
|
|
|
+ uni.setStorageSync("showData", true)
|
|
|
+ const upDater = uni.requireNativePlugin("CL-UpDater");
|
|
|
+ let options = {
|
|
|
+ title: "升级",
|
|
|
+ con: res.data.app_update,
|
|
|
+ downUrl: this.$device.platform == 'ios' ? encodeURI(res
|
|
|
+ .data.ios_url) : encodeURI(res.data.android_url), //必填
|
|
|
+ hidCancelbtn: true, //是否隐藏取消按钮;
|
|
|
+ btnBgColor: "#ff3300", //设置按钮背景色颜色
|
|
|
+ updateBtnText: "升级", //升级按钮文字,默认为立即升级
|
|
|
+ topImgBg: "", //非必填,用于自定义;自定义方法请参考demo,
|
|
|
+ hidBackBtn: true, //可选 默认为false(即会显示后台更新按钮), 设置android 整包更新弹框是否显示后台更新按钮,这个只有android整包更新才有这个参数,热更新是是无法设置的。
|
|
|
+ verCode: res.data
|
|
|
+ .app_version, //最新apk版本号 可选 用于Android整包升级,避免用户取消安装apk时,重复下载问题,如果不传的话,apk将会重新下载,
|
|
|
+ downMsgTip: "资源下载中,请稍后...", //可选(android)
|
|
|
+ goBackBtnText: "进入后台", //可选(android)
|
|
|
+ };
|
|
|
+ //必需提供下载地址;
|
|
|
+ upDater.startUpdate(options, () => {});
|
|
|
+ } else if (wgtinfo.versionCode > res.data.app_code) {
|
|
|
+ uni.setStorageSync("showData", false)
|
|
|
+ } else {
|
|
|
+ uni.setStorageSync("showData", true)
|
|
|
+ }
|
|
|
+ if (res.data.is_audit == 0) {
|
|
|
+ this.getGps({
|
|
|
+ page: this,
|
|
|
+ fn: (res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.getData(true);
|
|
|
+ },
|
|
|
+ err: (err) => {
|
|
|
+ this.getData(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
});
|
|
|
}
|