You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
307 lines
8.3 KiB
307 lines
8.3 KiB
<template>
|
|
<view class="">
|
|
<navigation :showBack="true" :bgnum="true">
|
|
Settings
|
|
</navigation>
|
|
<view class="main">
|
|
<view class="main_con">
|
|
<view class="item flex">
|
|
<view class="text1">
|
|
Payment password
|
|
</view>
|
|
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
|
|
</view>
|
|
<view class="item flex">
|
|
<view class="text1">
|
|
Fingerprint password
|
|
</view>
|
|
<u-switch v-model="checked" active-color="#5B53FF" @change="fingerPass()"></u-switch>
|
|
</view>
|
|
<view class="item flex">
|
|
<view class="text1">
|
|
Language settings
|
|
</view>
|
|
<view class="">
|
|
<text class="text2">English</text>
|
|
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
|
|
</view>
|
|
</view>
|
|
<view class="item flex">
|
|
<view class="text1">
|
|
Currency
|
|
</view>
|
|
<view class="">
|
|
<text class="text2">USD</text>
|
|
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
|
|
</view>
|
|
</view>
|
|
<view class="item flex">
|
|
<view class="text1">
|
|
Node settings
|
|
</view>
|
|
|
|
<image src="../../../static/tongyonh/chevron_right_24px.png" mode="aspectFit" class="img1"></image>
|
|
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<u-mask z-index="10" :show="show"></u-mask>
|
|
<view class="zhiwen_con" v-if="showFinger">
|
|
<view class="tiao" @click="cancel">
|
|
</view>
|
|
<view class="bigtitle">
|
|
Fingerprint password
|
|
</view>
|
|
<view class="bottom_con">
|
|
<image src="../../../static/tongyonh/zhiwen.png" mode="aspectFit" class="img1"></image>
|
|
<view class="text1">
|
|
Touch the fingerprint sensor
|
|
</view>
|
|
<view class="flex con">
|
|
|
|
<view class="textt2" @click="cancel">
|
|
Cancel
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="zhiwen_con" v-if="fingerFail">
|
|
<view class="tiao">
|
|
</view>
|
|
<view class="bigtitle">
|
|
Fingerprint password
|
|
</view>
|
|
<view class="bottom_con">
|
|
<image src="../../../static/tongyonh/alert-circle.png" mode="aspectFit" class="img1"></image>
|
|
<view class="text1 red">
|
|
Fingerprint not recognized. <br><text @click="fingerPass('try')">Try again.</text>
|
|
</view>
|
|
<view class="flex con">
|
|
<view class="textt2" @click="cancelFail">
|
|
Cancel
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="zhiwen_con" v-if="fingerSuccess">
|
|
<view class="tiao" @click="cancelSucc">
|
|
</view>
|
|
<view class="bigtitle">
|
|
Fingerprint password
|
|
</view>
|
|
<view class="bottom_con">
|
|
<image src="../../../static/tongyonh/x-circle.png" mode="aspectFit" class="img1"></image>
|
|
<view class="text1 green">
|
|
Fingerprint recognized.
|
|
</view>
|
|
<view class="flex con">
|
|
<view class="textt2" @click="cancelSucc">
|
|
Confirm
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
</view>
|
|
|
|
</template>
|
|
|
|
<script>
|
|
import cont from "@/components/navigation/navigation.vue"
|
|
export default {
|
|
data() {
|
|
return {
|
|
checked: false,
|
|
show:false,
|
|
showFinger:false,
|
|
fingerSuccess:false,
|
|
fingerFail:false,
|
|
};
|
|
},
|
|
methods: {
|
|
cancel(){
|
|
this.showFinger=false;
|
|
this.checked=false;
|
|
this.show=false;
|
|
this.$walletUtil.printCancel();
|
|
},
|
|
cancelSucc(){
|
|
this.fingerSuccess=false
|
|
this.show=false;
|
|
},
|
|
cancelFail(){
|
|
this.fingerFail=false
|
|
this.show=false;
|
|
},
|
|
fingerPass(test){
|
|
console.log(this.checked)
|
|
if(this.checked||test=='try'){
|
|
console.log(111)
|
|
this.show=true;
|
|
this.showFinger=true;
|
|
this.fingerprint(true);
|
|
}
|
|
|
|
if(!this.checked){
|
|
uni.setStorageSync('fingerPass',false)
|
|
}
|
|
|
|
},
|
|
fingerprint: function(sett) {
|
|
let bltype=true;
|
|
// #ifdef APP-PLUS
|
|
if (!plus.fingerprint.isSupport()) {
|
|
uni.showToast({
|
|
title: 'This device does not support fingerprint identification',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
// this.disabled = true;
|
|
} else if (!plus.fingerprint.isKeyguardSecure()) {
|
|
uni.showToast({
|
|
title: 'This device is not equipped with a password lock screen and cannot use fingerprint identification',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
|
|
} else if (!plus.fingerprint.isEnrolledFingerprints()) {
|
|
uni.showToast({
|
|
title: 'There is no fingerprint entered in this device. Please turn it on in the setting',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
// this.disabled = true;
|
|
} else {
|
|
// this.result = '此设备支持指纹识别';
|
|
// // this.disabled = false;
|
|
// #ifdef MP-WEIXIN
|
|
// this.disabled = false;
|
|
uni.showToast({
|
|
title: 'Please use it in wechat real machine. The simulator does not support it',
|
|
icon: 'none',
|
|
duration: 1500
|
|
})
|
|
// #endif
|
|
// #ifndef APP-PLUS || MP-WEIXIN
|
|
uni.showToast({
|
|
title: 'Fingerprint identification is not supported on this platform',
|
|
icon: 'none',
|
|
duration: 1500,
|
|
})
|
|
// #endif
|
|
|
|
|
|
let that=this;
|
|
// #ifdef APP-PLUS
|
|
plus.fingerprint.authenticate(function() {
|
|
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
|
|
// uni.showToast({
|
|
// title: 'Fingerprint identification succeeded',
|
|
// icon: 'none',
|
|
// duration: 1500,
|
|
// })
|
|
// 存储设置里开启指纹后的状态,隐藏使用密码
|
|
|
|
uni.setStorageSync('fingerPass',true)
|
|
console.log(that.showFinger,454545)
|
|
that.showFinger=false;
|
|
that.fingerSuccess=true;
|
|
console.log(that.showFinger,454545)
|
|
}, function(e) {
|
|
switch (e.code) {
|
|
case e.AUTHENTICATE_MISMATCH:
|
|
// plus.nativeUI.toast('Fingerprint matching failed, please re-enter');
|
|
uni.setStorageSync('fingerPass',false)
|
|
console.log(that.showFinger,454545)
|
|
that.showFinger=false;
|
|
that.fingerFail=true;
|
|
that.checked=false
|
|
console.log(that.fingerFail,454545)
|
|
break;
|
|
case e.AUTHENTICATE_OVERLIMIT:
|
|
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
|
|
// plus.nativeUI.alert('The number of fingerprint identification failures exceeds the limit. Please use other methods for authentication');
|
|
uni.setStorageSync('fingerPass',false)
|
|
console.log(that.showFinger,454545)
|
|
that.showFinger=false;
|
|
that.fingerFail=true;
|
|
that.checked=false
|
|
console.log(that.fingerFail,454545)
|
|
break;
|
|
case e.CANCEL:
|
|
plus.nativeUI.toast('Recognition has been cancelled');
|
|
uni.setStorageSync('fingerPass',false)
|
|
console.log(that.showFinger,454545)
|
|
that.showFinger=false;
|
|
that.checked=false
|
|
that.fingerFail=true;
|
|
console.log(that.fingerFail,454545)
|
|
break;
|
|
default:
|
|
plus.nativeUI.closeWaiting(); //兼容Android平台关闭等待框
|
|
uni.setStorageSync('fingerPass',false)
|
|
console.log(that.showFinger,454545)
|
|
that.showFinger=false;
|
|
that.checked=false
|
|
that.fingerFail=true;
|
|
console.log(that.fingerFail,454545)
|
|
plus.nativeUI.alert('Fingerprint identification failed, please try again');
|
|
break;
|
|
}
|
|
});
|
|
// Android平台手动弹出等待提示框
|
|
if ('Android' == plus.os.name) {
|
|
this.show=true;
|
|
/* plus.nativeUI.showWaiting('指纹识别中...').onclose = function() {
|
|
plus.fingerprint.cancel();
|
|
} */
|
|
}
|
|
// #endif
|
|
|
|
// #ifdef MP-WEIXIN
|
|
wx.startSoterAuthentication({
|
|
requestAuthModes: ['fingerPrint'],
|
|
challenge: '123456',
|
|
authContent: '请用指纹解锁',
|
|
success(res) {
|
|
uni.showToast({
|
|
title: '识别成功',
|
|
mask: false,
|
|
duration: 1500
|
|
});
|
|
}
|
|
})
|
|
// #endif
|
|
}
|
|
// #endif
|
|
|
|
|
|
},
|
|
change(status) {
|
|
// console.log(status);
|
|
},
|
|
|
|
},
|
|
onLoad() {
|
|
// 每次进来拿缓存里有没有指纹
|
|
if(uni.getStorageSync('fingerPass')){
|
|
this.checked=uni.getStorageSync('fingerPass')
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style scoped>
|
|
page {
|
|
background: #FAFAFA;
|
|
}
|
|
</style>
|
|
|
|
<style>
|
|
|
|
@import './index.css';
|
|
|
|
</style>
|
|
|