|
@@ -257,12 +257,15 @@
|
|
|
import uParse from '@/components/gaoyia-parse/parse.vue';
|
|
|
import maoScroll from '@/components/mao-scroll/mao-scroll.vue';
|
|
|
import customerWiget from '@/components/ui-public/customer-wiget.vue';
|
|
|
+ // #ifdef APP
|
|
|
+ import upApp from "@/library/upapp.js"
|
|
|
+ // #endif
|
|
|
import {
|
|
|
mapState,
|
|
|
mapMutations
|
|
|
} from 'vuex';
|
|
|
export default {
|
|
|
- computed: mapState(['user', 'lbs', 'sysData']),
|
|
|
+ computed: mapState(['user', 'lbs', 'sysData','showData']),
|
|
|
components: {
|
|
|
uParse,
|
|
|
maoScroll,
|
|
@@ -296,12 +299,6 @@
|
|
|
},
|
|
|
wenAr: {},
|
|
|
isLoad: false,
|
|
|
- // #ifdef APP
|
|
|
- showData: false,
|
|
|
- // #endif
|
|
|
- // #ifndef APP
|
|
|
- showData: true,
|
|
|
- // #endif
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
|
@@ -309,6 +306,9 @@
|
|
|
// #ifdef APP
|
|
|
this.isShowInit(false);
|
|
|
// #endif
|
|
|
+ // #ifdef APP
|
|
|
+ upApp();
|
|
|
+ // #endif
|
|
|
},
|
|
|
onReachBottom() {
|
|
|
if (this.page.isFoot || this.page.isLoad) {
|
|
@@ -395,51 +395,15 @@
|
|
|
*/
|
|
|
initSys: function() {
|
|
|
const that = this;
|
|
|
- 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);
|
|
|
- that.showData = false;
|
|
|
-
|
|
|
this.request.post("sysInit", {
|
|
|
code: versionCode
|
|
|
})
|
|
|
.then(res => {
|
|
|
if (res.code == 200) {
|
|
|
this.setSys(res.data);
|
|
|
- if (appType != "ios") {
|
|
|
- if (wgtinfo.versionCode < res.data.app_code) {
|
|
|
- uni.setStorageSync("showData", true);
|
|
|
- that.showData = false;
|
|
|
- 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) {
|
|
|
- that.showData = false
|
|
|
- uni.setStorageSync("showData", false)
|
|
|
- } else {
|
|
|
- that.showData = true
|
|
|
- uni.setStorageSync("showData", true)
|
|
|
- }
|
|
|
- }
|
|
|
if (res.data.is_audit == 0) {
|
|
|
this.getGps({
|
|
|
page: this,
|
|
@@ -454,58 +418,6 @@
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
-
|
|
|
- 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.request({
|
|
|
- url: getIosUpAppUrl,
|
|
|
- method: 'POST',
|
|
|
- data: {},
|
|
|
- success: res => {
|
|
|
- let arr = res.data.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", true);
|
|
|
- that.showData = true
|
|
|
- return
|
|
|
- }
|
|
|
- // 判断线上版本是否大于本地版本
|
|
|
- else if (x > y) {
|
|
|
- uni.setStorageSync("showData", false);
|
|
|
- that.showData = false
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '请更新应用',
|
|
|
- showCancel: false,
|
|
|
- success(e) {
|
|
|
- plus.runtime.openURL(
|
|
|
- iosAppStroeUrl
|
|
|
- );
|
|
|
- }
|
|
|
- });
|
|
|
- return
|
|
|
- }
|
|
|
- // 判断是否本地版本等于线上版本
|
|
|
- else if (x == y && i == arr.length - 1) {
|
|
|
- that.showData = true
|
|
|
- uni.setStorageSync("showData", true)
|
|
|
- return
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
- fail: res => {
|
|
|
- console.log(res, 'shib');
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
});
|
|
|
}
|
|
|
},
|