|
@@ -389,32 +389,41 @@
|
|
|
const appType = uni.getSystemInfoSync().platform;
|
|
|
if (plus != null) {
|
|
|
plus.runtime.getProperty(plus.runtime.appid, (wgtinfo) => {
|
|
|
- let versionCode = wgtinfo.versionCode;
|
|
|
+ //获取苹果当前系统版本号
|
|
|
+ let arr1 = wgtinfo.version.split('.');
|
|
|
+ uni.setStorageSync("showData", false)
|
|
|
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)
|
|
|
uni.request({
|
|
|
url: getIosUpAppUrl,
|
|
|
- method: 'POST',
|
|
|
+ method: 'get',
|
|
|
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)
|
|
|
+ //获取苹果商城系统版本号
|
|
|
+ let arr = r.results[0].version.split('.');
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ // 线上版本号
|
|
|
+ const x = +arr[i];
|
|
|
+ // 本地版本号
|
|
|
+ const y = +arr1[i];
|
|
|
+ if (x < y) {
|
|
|
+ uni.setStorageSync("showData", false)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ else if (x > y) {
|
|
|
+ uni.setStorageSync("showData", false)
|
|
|
+ plus.runtime.openURL(
|
|
|
+ iosAppStroeUrl
|
|
|
+ );
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 判断是否本地版本等于线上版本
|
|
|
+ else if (x == y && i == arr.length - 1) {
|
|
|
+ uni.setStorageSync("showData", true)
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
fail: res => {
|
|
@@ -423,16 +432,22 @@
|
|
|
}
|
|
|
});
|
|
|
} 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)
|
|
|
+ code: versionCode
|
|
|
+ }).then(res => {
|
|
|
+ console.log(res, 'res')
|
|
|
+ if (res.code == 200) {
|
|
|
+ this.setSys(res.data);
|
|
|
+ let arr = res.data.app_code.split('.');
|
|
|
+ for (let i = 0; i < arr.length; i++) {
|
|
|
+ const x = +arr[i];
|
|
|
+ const y = +arr1[i];
|
|
|
+ if (x < y) {
|
|
|
+ uni.setStorageSync("showData", false)
|
|
|
+ return
|
|
|
+ }
|
|
|
+ else if (x > y) {
|
|
|
+ uni.setStorageSync("showData", false)
|
|
|
const upDater = uni.requireNativePlugin("CL-UpDater");
|
|
|
let options = {
|
|
|
title: "升级",
|
|
@@ -451,28 +466,29 @@
|
|
|
};
|
|
|
//必需提供下载地址;
|
|
|
upDater.startUpdate(options, () => {});
|
|
|
- } else if (wgtinfo.versionCode > res.data.app_code) {
|
|
|
- uni.setStorageSync("showData", false)
|
|
|
- } else {
|
|
|
+ return
|
|
|
+ }
|
|
|
+ // 判断是否本地版本等于线上版本
|
|
|
+ else if (x == y && i == arr.length - 1) {
|
|
|
uni.setStorageSync("showData", true)
|
|
|
+ return
|
|
|
}
|
|
|
- if (res.data.is_audit == 0) {
|
|
|
- this.getGps({
|
|
|
- page: this,
|
|
|
- fn: (res) => {
|
|
|
- console.log(res);
|
|
|
- this.getData(true);
|
|
|
- },
|
|
|
- err: (err) => {
|
|
|
- this.getData(true);
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
}
|
|
|
- });
|
|
|
+ if (res.data.is_audit == 0) {
|
|
|
+ this.getGps({
|
|
|
+ page: this,
|
|
|
+ fn: (res) => {
|
|
|
+ console.log(res);
|
|
|
+ this.getData(true);
|
|
|
+ },
|
|
|
+ err: (err) => {
|
|
|
+ this.getData(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
});
|
|
|
}
|
|
|
},
|