缓存线详情

This commit is contained in:
2023-03-25 10:30:26 +08:00
parent 5b6b94fcc4
commit e7ab90e5cb
3 changed files with 55 additions and 3 deletions

View File

@@ -21,7 +21,7 @@
<view class="submit">
<button class="primary-button" :disabled="disabled" @click="toLogin">&nbsp;&nbsp;</button>
</view>
<view class="scanBox">
<view class="scanBox" @tap="toScan">
<view class="iconfont scan_icon"></view>
<text class="san_text">扫码登录</text>
</view>
@@ -49,6 +49,7 @@
<script>
import { RSAencrypt } from '@/utils/jsencrypt.js'
import {handLogin} from '@/utils/getData2.js'
import permision from "@/utils/permission.js"
export default {
data() {
return {
@@ -138,7 +139,48 @@
} catch (e) {
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();
}
}
})
}
return status;
}
// #endif
}
}
</script>