更新
This commit is contained in:
parent
f644180b76
commit
c2666d2d56
@ -9,7 +9,6 @@ import Updater from '@/uni_modules/guyue-updater/index';
|
|||||||
function compareVersions(version1, version2) {
|
function compareVersions(version1, version2) {
|
||||||
const arr1 = version1.split('.').map(Number);
|
const arr1 = version1.split('.').map(Number);
|
||||||
const arr2 = version2.split('.').map(Number);
|
const arr2 = version2.split('.').map(Number);
|
||||||
|
|
||||||
for (let i = 0; i < Math.max(arr1.length, arr2.length); i++) {
|
for (let i = 0; i < Math.max(arr1.length, arr2.length); i++) {
|
||||||
const num1 = i < arr1.length ? arr1[i] : 0;
|
const num1 = i < arr1.length ? arr1[i] : 0;
|
||||||
const num2 = i < arr2.length ? arr2[i] : 0;
|
const num2 = i < arr2.length ? arr2[i] : 0;
|
||||||
@ -20,7 +19,6 @@ function compareVersions(version1, version2) {
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -58,8 +56,9 @@ const actions = {
|
|||||||
if(data) uni.showLoading({
|
if(data) uni.showLoading({
|
||||||
title: '检查更新中'
|
title: '检查更新中'
|
||||||
})
|
})
|
||||||
|
const wgt_v = uni.getStorageSync('wgt_version')||'1.0.0';
|
||||||
// 版本更新
|
// 版本更新
|
||||||
if(compareVersions(res.data.version, os.appVersion||Cache.get('wgt_version')||'1.0.0')==1&&compareVersions(res.data.version, Cache.get('wgt_version')||'1.0.0')==1){
|
if(compareVersions(res.data.version, os.appVersion||wgt_v)==1&&compareVersions(res.data.version, wgt_v)==1){
|
||||||
try{
|
try{
|
||||||
let info = res.data.version_info||{};
|
let info = res.data.version_info||{};
|
||||||
let version = {
|
let version = {
|
||||||
@ -70,8 +69,7 @@ const actions = {
|
|||||||
force: info.force==1?true:false, // 是否强制更新
|
force: info.force==1?true:false, // 是否强制更新
|
||||||
quiet: info.quiet==1?true:false // 是否静默更新
|
quiet: info.quiet==1?true:false // 是否静默更新
|
||||||
}
|
}
|
||||||
Updater.update(version);
|
Updater.update(version);;
|
||||||
Cache.set('wgt_version', info.version);
|
|
||||||
}catch(e){
|
}catch(e){
|
||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
@ -15,27 +15,27 @@
|
|||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="text">
|
<view class="text">
|
||||||
押金(元)
|
押金(元)
|
||||||
<view class="price">{{income}}</view>
|
<view class="price">{{extend.deposit.toFixed(2)}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tips">
|
<!-- <view class="tips">
|
||||||
押金:{{terraceIncome.count}}元({{terraceIncome.num}}笔)
|
押金:{{terraceIncome.count}}元({{terraceIncome.num}}笔)
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="item">
|
<view class="item">
|
||||||
<view class="text">
|
<view class="text">
|
||||||
个人收益金额(元)
|
个人收益金额(元)
|
||||||
<view class="price">{{disbursement}}</view>
|
<view class="price">{{extend.user_money.toFixed(2)}}</view>
|
||||||
</view>
|
</view>
|
||||||
<view class="tips">
|
<!-- <view class="tips">
|
||||||
收益:{{terraceIncome.count}}元({{terraceIncome.num}}笔)
|
收益:{{terraceIncome.count}}元({{terraceIncome.num}}笔)
|
||||||
</view>
|
</view> -->
|
||||||
</view>
|
</view>
|
||||||
<view class="all" style="justify-content: space-between;">
|
<view class="all" style="justify-content: space-between;">
|
||||||
<view></view>
|
<view></view>
|
||||||
<view style="display: flex;">
|
<view style="display: flex;">
|
||||||
<view>收益总金额(元):</view>
|
<view>收益总金额(元):</view>
|
||||||
<view class="price">
|
<view class="price">
|
||||||
{{aggregateAmount}}
|
{{(extend.deposit+extend.user_money).toFixed(2)}}
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
@ -99,6 +99,10 @@
|
|||||||
m: '',
|
m: '',
|
||||||
d: ''
|
d: ''
|
||||||
},
|
},
|
||||||
|
extend: {
|
||||||
|
deposit: 0,
|
||||||
|
user_money: 0
|
||||||
|
},
|
||||||
loadConfig: {
|
loadConfig: {
|
||||||
page: 1,
|
page: 1,
|
||||||
limit: 15,
|
limit: 15,
|
||||||
@ -197,6 +201,9 @@
|
|||||||
} else {
|
} else {
|
||||||
this.loadConfig.page++;
|
this.loadConfig.page++;
|
||||||
}
|
}
|
||||||
|
if(res.data?.extend?.deposit){
|
||||||
|
this.extend = res.data.extend;
|
||||||
|
}
|
||||||
this.billList = [...this.billList, ...res.data.lists];
|
this.billList = [...this.billList, ...res.data.lists];
|
||||||
},
|
},
|
||||||
initDate() {
|
initDate() {
|
||||||
@ -273,7 +280,7 @@
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
line-height: 39rpx;
|
line-height: 39rpx;
|
||||||
padding-bottom: 40rpx;
|
// padding-bottom: 40rpx;
|
||||||
|
|
||||||
.text {
|
.text {
|
||||||
font-size: 28rpx;
|
font-size: 28rpx;
|
||||||
|
@ -9,7 +9,7 @@ export default class Updater {
|
|||||||
download({
|
download({
|
||||||
url: options.downUrl,
|
url: options.downUrl,
|
||||||
onSuccess(filePath) {
|
onSuccess(filePath) {
|
||||||
install(filePath, false);
|
install(filePath, false, options.versionName);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
} else if (options.downUrl) {
|
} else if (options.downUrl) {
|
||||||
|
@ -16,11 +16,12 @@ export const download = ({ url, onProgress, onSuccess, onFail }) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const install = (filePath, restart = false) => {
|
export const install = (filePath, restart = false, version) => {
|
||||||
plus.runtime.install(filePath, {
|
plus.runtime.install(filePath, {
|
||||||
force: true
|
force: true
|
||||||
}, () => {
|
}, () => {
|
||||||
console.log('install success...');
|
console.log('install success...');
|
||||||
|
uni.setStorageSync('wgt_version', version);
|
||||||
if (restart) {
|
if (restart) {
|
||||||
plus.runtime.restart();
|
plus.runtime.restart();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user