钱包,验证密码

This commit is contained in:
唐明明
2022-01-12 18:02:07 +08:00
parent 9507e3ab17
commit 3138894268
8 changed files with 219 additions and 93 deletions

View File

@@ -2,7 +2,7 @@
<view>
<view class="propery">
<view class="propery-content">
<view class="currency">原石 ( {{ price || '0' }} CNY)</view>
<view class="currency">钱包余额</view>
<view class="balance">{{ balance.balance || '0' }}</view>
<view class="frozen">{{ balance.frozen || '0' }} 冻结中</view>
<view class="balance-flex">
@@ -22,58 +22,46 @@
<!-- ios安全距离 -->
<view class="ios-bottom"></view>
</view>
<!-- 支付密码 -->
<uni-popup ref="showPassword">
<!-- 钱包密码 -->
<u-popup :show="passwordShow" @close="resetPassword" closeable borderRadius="10">
<view class="validationPassword">
<view class="from">
<view class="title">验证密码</view>
<input class="input" v-model="password" password placeholder="请验证安全密码"/>
<view class="title">钱包密码</view>
<input type="number" v-model="password" maxlength="6" placeholder="请输入钱包密码" />
</view>
<view class="buttons">
<view class="button cancel" @click="payPassword('cancel', passwordPages)">取消</view>
<view class="button confirm" @click="payPassword('confirm', passwordPages)">验证</view>
</view>
</view>
</uni-popup>
<!-- 原密码弹窗 -->
<!-- <number-jpan :length="6" @closeChange="closeChange($event)" ref="numberPad"></number-jpan> -->
</u-popup>
</view>
</template>
<script>
import record from '@/components/property/record'
import {
sum,
price,
logs,
code,
securityCheck // 输入旧密码是否正确
} from '@/apis/interfaces/wallet'
import numberJpan from "@/components/numberJpan/numberJpan.vue";
import { sum, logs, securityCheck } from '@/apis/interfaces/wallet'
export default {
components: {
record
},
data() {
return {
balance: {},
price: '0.00',
logs: [],
logsType: 0,
password: '',
balance : {},
logs : [],
logsType : 0,
password : '',
passwordShow : true,
passwordPages: ''
};
},
onShow() {
Promise.all([
sum(),
price(),
logs()
]).then(res => {
]).then(res => {
this.balance = res[0]
this.price = res[1]
this.logs = res[2]
}).catch(err => {
this.logs = res[1]
}).catch(err => {
uni.showToast({
icon: 'none',
title: err.message
@@ -83,8 +71,13 @@
methods: {
// 弹出私钥
showPrivatekey(pages){
this.passwordShow = true
this.passwordPages = pages
this.$refs.showPassword.open('center')
},
// 重置密码
resetPassword(){
this.passwordShow = false
this.password = ''
},
// 验证私钥
payPassword(type){
@@ -97,16 +90,17 @@
return
}
securityCheck(this.password).then(res => {
this.$refs.showPassword.close()
switch (this.passwordPages){
case 'privatekey':
this.$Router.push({name:'Privatekey', params: {password: this.password}})
break;
case 'resetPassword':
this.$Router.push({name:'ResetPassword', params: {password: this.password}})
break;
}
this.password = ''
this.resetPassword()
console.log("密码验证通过")
// switch (this.passwordPages){
// case 'privatekey':
// this.$Router.push({name:'Privatekey', params: {password: this.password}})
// break;
// case 'resetPassword':
// this.$Router.push({name:'ResetPassword', params: {password: this.password}})
// break;
// }
}).catch(err => {
uni.showToast({
title: err.message,
@@ -132,7 +126,7 @@
showAddress() {
uni.showModal({
title: '我的区块链地址',
content: '\n地址可以理解为银行卡卡号与他人转账时是区块链上的两个地址间的交易行为\n\n' + this.balance.address,
content: this.balance.address,
cancelText: '复制',
cancelColor: '#009B69',
success: (res) => {
@@ -148,7 +142,7 @@
onNavigationBarButtonTap(e) {
if (e.index === 0) {
uni.showActionSheet({
itemList: ['转账', '收款', '提币', '修改密码'],
itemList: ['导出助记词', '修改密码'],
success: (res) => {
switch (res.tapIndex) {
case 0:
@@ -161,11 +155,6 @@
name: 'WalletCode'
})
break;
case 2:
this.$Router.push({
name: 'Extract'
})
break;
case 3:
this.showPrivatekey('resetPassword')
break;
@@ -181,69 +170,51 @@
<style lang="scss" scoped>
// 验证密码弹出层
.validationPassword{
background-color: white;
border-radius: $radius-m;
width: 70vw;
.from{
padding: $padding*2;
text-align: center;
.title{
text-align: center;
font-size: $title-size;
padding-bottom: $padding*2;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-weight: bold;
color: $mian-color;
}
.input{
text-align: center;
height: 90rpx;
font-size: $title-size;
border-radius: $radius-m;
background: $border-color-lg;
padding: 0 ($padding*2);
padding-bottom: $padding;
}
input{
background: $window-color;
height: 90rpx;
left: 90rpx;
font-size: $title-size-lg;
border-radius: 45rpx;
}
}
.buttons{
display: flex;
border-top: solid 1rpx $border-color;
text-align: center;
padding: 0 $padding*2;
.button{
width: 50%;
font-size: $title-size;
line-height: 90rpx;
height: 90rpx;
text-align: center;
box-sizing: border-box;
line-height: 90rpx;
margin-bottom: $margin;
&.cancel{
border-right: solid 1rpx $border-color;
color: $text-gray;
}
&.confirm{
color: $mian-color;
color: white;
background: $main-color;
border-radius: 45rpx;
}
}
}
// .button{
// background-color: $mian-color;
// color: white;
// border-radius: $radius-m;
// border: none;
// margin-top: $margin*2;
// font-size: $title-size;
// height: 90rpx;
// line-height: 90rpx;
// }
// .close{
// @extend .button;
// text-align: center;
// color: $text-gray;
// margin-top: $margin;
// background-color: transparent;
// }
//
//
}
// 账户
.propery {
position: relative;
padding-top: var(--status-bar-height);
background-image: linear-gradient(to top right, $mian-color, $mian-color-deep);
background-image: linear-gradient(to right, $main-color, #22aa98);
&::before {
position: absolute;
@@ -252,7 +223,7 @@
width: 100%;
height: 100%;
content: " ";
background-image: url(@/static/background/wallet-back.png);
// background-image: url(@/static/background/wallet-back.png);
background-size: 100%;
background-repeat: no-repeat;
}
@@ -296,7 +267,7 @@
width: 200rpx;
height: 75rpx;
line-height: 75rpx;
color: $mian-color;
color: $main-color;
margin: 0 $margin;
border-radius: $radius-m;
font-size: $title-size;
@@ -328,7 +299,7 @@
padding: 0 $padding;
&.show {
color: $mian-color;
color: $main-color;
&::before {
position: absolute;
@@ -337,7 +308,7 @@
right: $padding;
height: 4rpx;
content: " ";
background-color: $mian-color;
background-color: $main-color;
}
}
}