This commit is contained in:
2023-02-14 17:02:23 +08:00
parent 4a6f02a310
commit 266da57366
3 changed files with 52 additions and 16 deletions

View File

@@ -19,30 +19,45 @@
</view>
<button class="login-btn" :disabled="disabled" @tap="toLogin">确认登录</button>
<!-- <button class="login-btn" @tap="test">打印</button> -->
<Up-grade v-if="grade === true" @closeUpdate="closeUpdate" :androidUrl="androidUrl"></up-grade>
</view>
</template>
<script>
import {getCLodop, getPrinterList} from "@/utils/CLodopfuncs.js"
import { RSAencrypt } from '@/utils/jsencrypt.js'
import {handLogin} from '@/utils/getData2.js'
import {handLogin, pdaUpdate} from '@/utils/getData2.js'
import UpGrade from './upgrade.vue'
export default {
components: {
UpGrade
},
data() {
return {
user: this.$store.getters.loginName ? this.$store.getters.loginName : '',
password: '',
showPassword: false,
saveUser: this.$store.getters.loginName ? true : false,
disabled: false
disabled: false,
version: '',
versionCode: '',
grade: false,
androidUrl: ''
}
},
created () {
//#ifdef APP-PLUS
// 获取本地应用资源版本号
plus.runtime.getProperty(plus.runtime.appid, (info) => {
console.log(JSON.stringify(info));
this.version = info.version;
this.versionCode = info.versionCode ;
})
//#endif
},
methods: {
isUpdate () {
uni.navigateTo({
url: `/pages/login/upgrade`
})
this._pdaUpdate()
},
test() {
let LODOP = getCLodop();
@@ -104,6 +119,21 @@
} catch (e) {
this.disabled = false
}
},
async _pdaUpdate () {
let res = await pdaUpdate()
if (res.versionName === this.version) {
uni.showToast({
title: '当前为最新版本',
icon: 'none'
})
} else {
this.grade = true
this.androidUrl = res.url
}
},
closeUpdate () {
this.grade = false
}
}
}

View File

@@ -2,14 +2,14 @@
<view class="mask flex-center">
<view class="content botton-radius">
<view class="content-top">
<text class="content-top-text">升级版本</text>
<text class="content-top-text">发现新版本</text>
<image class="content-top" style="top: 0;" width="100%" height="100%" src="../../static/image/bg_top.png">
</image>
</view>
<view class="content-header"></view>
<view class="content-body">
<view class="title">
<text>是否升级到最新版本</text>
<text>海亮铜箔又有新版本了升级到最新版本享受更丰富稳定快速的功能和体验</text>
</view>
<view class="footer flex-center">
<template>
@@ -21,7 +21,7 @@
<text>({{downloadedSize}}/{{packageFileSize}}M)</text>
</view>
</view>
<button v-else class="content-button" style="border: none;color: #fff;" plain @click="updateApp">立即下载更新</button>
<button v-else class="content-button" style="border: none;color: #fff;" plain @click="updateApp">立即升级</button>
</template>
</template>
</view>
@@ -43,12 +43,14 @@
is_mandatory: true
}
},
props: {
androidUrl: String
},
methods: {
updateApp() {
this.is_mandatory = false
this.downloading = true
let androidUrl = `http://192.168.81.187:8012/file/其他/hht-tongbo.apk`
this.doUpData(androidUrl);
this.doUpData(this.androidUrl);
},
doUpData(Url) {
const downloadTask = uni.downloadFile({
@@ -83,7 +85,7 @@
});
},
closeUpdate () {
uni.navigateBack()
this.$emit('closeUpdate')
}
}
}
@@ -154,14 +156,15 @@
}
.content-header {
height: 70rpx;
height: 80rpx;
}
.title {
font-size: 33rpx;
font-weight: bold;
color: #3DA7FF;
line-height: 38px;
line-height: 38rpx;
color: #333;
}
.footer {

View File

@@ -2,10 +2,13 @@ import request from './request.js'
import request1 from './request1.js'
// 版本更新测试
// export const getAppInfo = () => {
export const pdaUpdate = () => request({
url:'api/pda/update'
})
// export const pdaUpdate = () => {
// let res = {
// versionName: '1.0.2',
// url: ''
// versionName: '1.0.1',
// url: 'https://mp-e979e0eb-882b-42b3-a4a1-923ad08ea194.cdn.bspapp.com/cloudstorage/f72ec59f-7b25-487d-a034-fead1b6654c6.apk'
// }
// return res
// }