This commit is contained in:
2023-03-31 17:42:39 +08:00
parent f5af987589
commit 097981fcc5
5 changed files with 267 additions and 66 deletions

View File

@@ -21,9 +21,10 @@
<view class="submit">
<button class="primary-button" :disabled="disabled" @click="toLogin">&nbsp;&nbsp;</button>
</view>
<view class="scanBox" @tap="checkMpaasScan">
<view class="iconfont scan_icon"></view>
<text class="san_text">扫码登录</text>
<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">
@@ -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,70 +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;
isUpdate () {
this._pdaUpdate()
},
async _pdaUpdate () {
let res = await pdaUpdate()
if (res.versionName === this.version) {
uni.showToast({
title: '当前为最新版本',
icon: 'none'
})
} else {
uni.showModal({
content: "需要相机权限",
confirmText: "设置",
success: function(res) {
if (res.confirm) {
permision.gotoAppSetting();
}
}
})
this.grade = true
this.androidUrl = res.url
}
return status;
}
// #endif
// #ifdef APP-PLUS
,
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: "确定"
})
})
}
// #endif
}
}
</script>
@@ -277,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>