sov
This commit is contained in:
@@ -21,10 +21,11 @@
|
||||
<view class="submit">
|
||||
<button class="primary-button" :disabled="disabled" @click="toLogin">登 录</button>
|
||||
</view>
|
||||
<!-- <view class="scanBox" @tap="toScan">
|
||||
<view class="iconfont scan_icon"></view>
|
||||
<text class="san_text">扫码登录</text>
|
||||
</view> -->
|
||||
<view class="scanBox">
|
||||
<!-- <view class="iconfont scan_icon"></view> -->
|
||||
<!-- <text class="san_text">扫码登录</text> -->
|
||||
<text class="san_text" @tap="isUpdate">升级版本</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="login_card">
|
||||
<view class="card_wrap">
|
||||
@@ -43,14 +44,20 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view v-if="version !== ''" class="version-name">v{{version}}</view>
|
||||
<Up-grade v-if="grade === true" @closeUpdate="closeUpdate" :androidUrl="androidUrl"></up-grade>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { RSAencrypt } from '@/utils/jsencrypt.js'
|
||||
import {handLogin} from '@/utils/getData2.js'
|
||||
import {handLogin, pdaUpdate} from '@/utils/getData2.js'
|
||||
import permision from "@/utils/permission.js"
|
||||
import UpGrade from './upgrade.vue'
|
||||
export default {
|
||||
components: {
|
||||
UpGrade
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loginname: '',
|
||||
@@ -63,7 +70,11 @@
|
||||
disabled: false,
|
||||
jobnum: '',
|
||||
qrcode: '',
|
||||
logintype: ''
|
||||
logintype: '',
|
||||
version: '',
|
||||
versionCode: '',
|
||||
grade: false,
|
||||
androidUrl: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -140,68 +151,21 @@
|
||||
this.disabled = false
|
||||
}
|
||||
},
|
||||
async toScan() {
|
||||
// #ifdef APP-PLUS
|
||||
let status = await this.checkPermission();
|
||||
if (status !== 1) {
|
||||
return;
|
||||
}
|
||||
// #endif
|
||||
uni.scanCode({
|
||||
success: (res) => {
|
||||
console.log(res.result)
|
||||
},
|
||||
fail: (err) => {
|
||||
// uni.showToast({
|
||||
// title: '出错',
|
||||
// icon: 'none'
|
||||
// })
|
||||
}
|
||||
});
|
||||
}
|
||||
// #ifdef APP-PLUS
|
||||
,
|
||||
async checkPermission(code) {
|
||||
let status = permision.isIOS ? await permision.requestIOS('camera') :
|
||||
await permision.requestAndroid('android.permission.CAMERA');
|
||||
|
||||
if (status === null || status === 1) {
|
||||
status = 1;
|
||||
} else {
|
||||
uni.showModal({
|
||||
content: "需要相机权限",
|
||||
confirmText: "设置",
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
permision.gotoAppSetting();
|
||||
}
|
||||
}
|
||||
isUpdate () {
|
||||
this._pdaUpdate()
|
||||
},
|
||||
async _pdaUpdate () {
|
||||
let res = await pdaUpdate()
|
||||
if (res.versionName === this.version) {
|
||||
uni.showToast({
|
||||
title: '当前为最新版本',
|
||||
icon: 'none'
|
||||
})
|
||||
} else {
|
||||
this.grade = true
|
||||
this.androidUrl = res.url
|
||||
}
|
||||
return status;
|
||||
}
|
||||
// #endif
|
||||
// ,
|
||||
// async checkMpaasScan () {
|
||||
// var mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module")
|
||||
// mpaasScanModule.mpaasScan({
|
||||
// // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
|
||||
// 'scanType': ['qrCode','barCode'],
|
||||
// // 是否隐藏相册,默认false不隐藏
|
||||
// 'hideAlbum': false
|
||||
// },
|
||||
// (ret) => {
|
||||
// uni.showModal({
|
||||
// title: "弹窗标题",
|
||||
// // 返回值中,resp_code 表示返回结果值,10:用户取消,11:其他错误,1000:成功
|
||||
// // 返回值中,resp_message 表示返回结果信息
|
||||
// // 返回值中,resp_result 表示扫码结果,只有成功才会有返回
|
||||
// content: JSON.stringify(ret),
|
||||
// showCancel: false,
|
||||
// confirmText: "确定"
|
||||
// })
|
||||
// })
|
||||
// }
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@@ -275,4 +239,9 @@
|
||||
_font(16px,24px,#D7592F,,center)
|
||||
.drift
|
||||
transition left .3s linear
|
||||
.version-name
|
||||
width 100%
|
||||
position: absolute
|
||||
bottom: 15px
|
||||
_font(15px, 30px, #999,,center)
|
||||
</style>
|
||||
|
||||
229
pages/login/upgrade.vue
Normal file
229
pages/login/upgrade.vue
Normal file
@@ -0,0 +1,229 @@
|
||||
<template>
|
||||
<view class="mask flex-center">
|
||||
<view class="content-update botton-radius">
|
||||
<view class="content-top">
|
||||
<text class="content-top-text">发现新版本</text>
|
||||
<image class="content-top" style="top: 0;" width="100%" height="100%" src="../../static/images/bg_top.png">
|
||||
</image>
|
||||
</view>
|
||||
<view class="content-header"></view>
|
||||
<view class="content-body">
|
||||
<view class="title">
|
||||
<text>海亮缓存线又有新版本了,升级到最新版本,享受更丰富、稳定、快速的功能和体验!</text>
|
||||
</view>
|
||||
<view class="footer flex-center">
|
||||
<template>
|
||||
<template v-if="!downloadSuccess">
|
||||
<view class="progress-box flex-column" v-if="downloading">
|
||||
<progress class="progress" border-radius="35" :percent="downLoadPercent" activeColor="#3DA7FF" show-info stroke-width="10" />
|
||||
<view style="width:100%;font-size: 14px;display: flex;justify-content: space-around;">
|
||||
<text>安装包下载中,请稍后</text>
|
||||
<text>({{downloadedSize}}/{{packageFileSize}}M)</text>
|
||||
</view>
|
||||
</view>
|
||||
<button v-else class="content-button" style="border: none;color: #fff;" plain @click="updateApp">立即升级</button>
|
||||
</template>
|
||||
</template>
|
||||
</view>
|
||||
</view>
|
||||
<image v-if="is_mandatory" class="close-img" src="../../static/images/app_update_close.png" @click.stop="closeUpdate"></image>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data () {
|
||||
return {
|
||||
downloadSuccess: false,
|
||||
downloading: false,
|
||||
downLoadPercent: 0,
|
||||
downloadedSize: 0,
|
||||
packageFileSize: 0,
|
||||
is_mandatory: true
|
||||
}
|
||||
},
|
||||
props: {
|
||||
androidUrl: String
|
||||
},
|
||||
methods: {
|
||||
updateApp() {
|
||||
this.is_mandatory = false
|
||||
this.downloading = true
|
||||
this.doUpData(this.androidUrl);
|
||||
},
|
||||
doUpData(Url) {
|
||||
const downloadTask = uni.downloadFile({
|
||||
url: Url,
|
||||
success: downloadResult => {
|
||||
if (downloadResult.statusCode == 200) {
|
||||
this.downloadSuccess = true;
|
||||
plus.runtime.install(
|
||||
//安装软件
|
||||
downloadResult.tempFilePath,
|
||||
{
|
||||
force: true
|
||||
},
|
||||
function(res) {
|
||||
plus.runtime.restart();
|
||||
}
|
||||
);
|
||||
}
|
||||
},
|
||||
complete: () => {
|
||||
this.downloading = false;
|
||||
this.downLoadPercent = 0
|
||||
this.downloadedSize = 0
|
||||
this.packageFileSize = 0
|
||||
}
|
||||
});
|
||||
// 下载进度
|
||||
downloadTask.onProgressUpdate(res => {
|
||||
this.downLoadPercent = res.progress;
|
||||
this.downloadedSize = (res.totalBytesWritten / Math.pow(1024, 2)).toFixed(2);
|
||||
this.packageFileSize = (res.totalBytesExpectedToWrite / Math.pow(1024, 2)).toFixed(2);
|
||||
});
|
||||
},
|
||||
closeUpdate () {
|
||||
this.$emit('closeUpdate')
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background: transparent;
|
||||
}
|
||||
|
||||
.flex-center {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: flex;
|
||||
/* #endif */
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.mask {
|
||||
position: fixed;
|
||||
left: 0;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
background-color: rgba(0, 0, 0, .65);
|
||||
}
|
||||
|
||||
.botton-radius {
|
||||
border-bottom-left-radius: 15px;
|
||||
border-bottom-right-radius: 15px;
|
||||
}
|
||||
|
||||
.content-update {
|
||||
position: relative;
|
||||
top: 0;
|
||||
width: 300px;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
padding: 0 20px;
|
||||
font-family: Source Han Sans CN;
|
||||
}
|
||||
|
||||
.text {
|
||||
/* #ifndef APP-NVUE */
|
||||
display: block;
|
||||
/* #endif */
|
||||
line-height: 200px;
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.content-top {
|
||||
position: absolute;
|
||||
top: -97.5px;
|
||||
left: 0;
|
||||
width: 300px;
|
||||
height: 135px;
|
||||
}
|
||||
|
||||
.content-top-text {
|
||||
font-size: 22px;
|
||||
font-weight: bold;
|
||||
color: #F8F8FA;
|
||||
position: absolute;
|
||||
top: 60px;
|
||||
left: 25px;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.content-header {
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.title {
|
||||
font-size: 16px;
|
||||
font-weight: bold;
|
||||
color: #3DA7FF;
|
||||
line-height: 20px;
|
||||
color: #333;
|
||||
}
|
||||
|
||||
.footer {
|
||||
height: 75px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-around;
|
||||
}
|
||||
|
||||
.box-des-scroll {
|
||||
box-sizing: border-box;
|
||||
padding: 0 20px;
|
||||
height: 25px;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.box-des {
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
line-height: 50px;
|
||||
}
|
||||
|
||||
.progress-box {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.progress {
|
||||
width: 90%;
|
||||
height: 20px;
|
||||
border-radius: 13px;
|
||||
}
|
||||
|
||||
.close-img {
|
||||
width: 35px;
|
||||
height: 35px;
|
||||
z-index: 1000;
|
||||
position: absolute;
|
||||
bottom: -60px;
|
||||
left: calc(50% - 35px / 2);
|
||||
}
|
||||
|
||||
.content-button {
|
||||
text-align: center;
|
||||
flex: 1;
|
||||
font-size: 15px;
|
||||
font-weight: 400;
|
||||
color: #FFFFFF;
|
||||
border-radius: 20px;
|
||||
margin: 0 10px;
|
||||
|
||||
height: 40px;
|
||||
line-height: 40px;
|
||||
|
||||
background: linear-gradient(to right, #1785ff, #3DA7FF);
|
||||
}
|
||||
|
||||
.flex-column {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user