新增点击检查版本更新
This commit is contained in:
parent
7eb567e1af
commit
61abdaa696
@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view :style="viewColor">
|
<view :style="viewColor" style="padding-bottom: 30rpx;">
|
||||||
<form>
|
<form>
|
||||||
<view class='personal-data'>
|
<view class='personal-data'>
|
||||||
<view class="wrapper" v-if="switchUserInfo.length>0">
|
<view class="wrapper" v-if="switchUserInfo.length>0">
|
||||||
@ -111,10 +111,11 @@
|
|||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!--#ifdef APP-PLUS-->
|
<!--#ifdef APP-PLUS-->
|
||||||
<view class='item acea-row row-between-wrapper'>
|
<view class='item acea-row row-between-wrapper' @click="$u.throttle(getVerion, 1500)">
|
||||||
<view>当前版本</view>
|
<view>当前版本</view>
|
||||||
<view class='input acea-row row-between-wrapper'>
|
<view class='input acea-row row-between-wrapper'>
|
||||||
<input type='text' :value='version' disabled='true' class='id'></input>
|
<input type='text' :value='version' disabled='true' class='id'></input>
|
||||||
|
<text class='iconfont icon-you'></text>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<!--#endif-->
|
<!--#endif-->
|
||||||
@ -368,6 +369,12 @@
|
|||||||
that.userAcc();
|
that.userAcc();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
},
|
||||||
|
/**
|
||||||
|
* 获取版本信息
|
||||||
|
*/
|
||||||
|
getVerion(){
|
||||||
|
this.$store.dispatch('INIT_CONFIG', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ import {
|
|||||||
import Cache from '../../utils/cache';
|
import Cache from '../../utils/cache';
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
import Updater from '@/uni_modules/guyue-updater/index';
|
import Updater from '@/uni_modules/guyue-updater/index';
|
||||||
|
import { Toast } from "../../libs/uniApi.js";
|
||||||
// #endif
|
// #endif
|
||||||
|
|
||||||
const state = {
|
const state = {
|
||||||
@ -110,6 +111,13 @@ const actions = {
|
|||||||
state,
|
state,
|
||||||
commit
|
commit
|
||||||
}, data = false) {
|
}, data = false) {
|
||||||
|
// console.log('版本', data);
|
||||||
|
if(data) {
|
||||||
|
uni.showLoading({
|
||||||
|
title: '加载中'
|
||||||
|
})
|
||||||
|
await uni.$u.sleep(500)
|
||||||
|
}
|
||||||
const wgt_v = uni.getStorageSync('wgt_version') || '1.0.0';
|
const wgt_v = uni.getStorageSync('wgt_version') || '1.0.0';
|
||||||
// #ifdef APP-PLUS
|
// #ifdef APP-PLUS
|
||||||
let os = uni.getSystemInfoSync();
|
let os = uni.getSystemInfoSync();
|
||||||
@ -125,7 +133,7 @@ const actions = {
|
|||||||
phone_brand:os.brand
|
phone_brand:os.brand
|
||||||
|
|
||||||
}).then((res) => {
|
}).then((res) => {
|
||||||
|
if(data) uni.hideLoading()
|
||||||
if (Object.keys(res.data.appInfo).length > 0) {
|
if (Object.keys(res.data.appInfo).length > 0) {
|
||||||
// if(res.data.appInfo.version) uni.showLoading({
|
// if(res.data.appInfo.version) uni.showLoading({
|
||||||
// title: '检查更新中'
|
// title: '检查更新中'
|
||||||
@ -150,12 +158,20 @@ const actions = {
|
|||||||
Updater.update(version,res.data.appInfo);
|
Updater.update(version,res.data.appInfo);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
Toast(e)
|
||||||
}
|
}
|
||||||
// uni.hideLoading();
|
// uni.hideLoading();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
if(data) Toast('已经是最新版本了')
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if(data) Toast('已经是最新版本了')
|
||||||
}
|
}
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
|
if(data) uni.hideLoading()
|
||||||
|
Toast(err.msg||err.message||err)
|
||||||
// console.log(err)
|
// console.log(err)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user