Files
ZhHealth/pages/wallet/create.vue
2022-01-12 16:50:50 +08:00

135 lines
2.5 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view>
<!-- 设置钱包密码 -->
<view class="password">
<view class="prompt">请设置6位数字密码建议不要使用连续的数字</view>
<view class="group">
<view class="inputs">
<input type="digit" password v-model="password" maxlength="6" placeholder="请设置密码" />
</view>
<view class="inputs">
<input type="digit" password v-model="verify" maxlength="6" placeholder="请确认密码" />
</view>
</view>
</view>
<!-- 按钮 -->
<view class="buttons">
<button type="default" form-type="submit" @click="createWallet">确认</button>
</view>
</view>
</template>
<script>
import { security } from '@/apis/interfaces/wallet';
export default {
data() {
return {
password: '',
verify : ''
};
},
methods: {
// 激活钱包
createWallet() {
if (this.password === '' || this.verify === '') {
uni.showToast({
icon: 'none',
title: '请设置密码'
});
return;
}
if (this.password !== this.verify) {
uni.showToast({
icon: 'none',
title: '两次输入密码不一致'
});
return;
}
security({
code: Number(this.password)
}).then(res => {
this.$Router.replace({
name: 'WalletMnemonic',
params: {
code: this.password
}
})
}).catch(err => {
uni.showToast({
icon: 'none',
title: err.message
});
});
}
}
};
</script>
<style lang="scss" scoped>
// 副标题
.sub-title {
color: $text-gray;
text-align: center;
margin: $margin * 2 $margin;
font-size: $title-size-m;
}
// 设置密码
.password {
padding: 0 $padding * 2;
.prompt {
margin-top: $margin * 2;
font-size: $title-size-m;
color: $main-color;
text-align: center;
}
.group {
padding-top: $padding;
.inputs {
padding: 10rpx $padding + 10;
margin-top: $margin;
border-radius: $radius-m;
background-color: $window-color;
&:last-child {
border-bottom: none;
}
input {
height: 70rpx;
line-height: 70rpx;
font-size: $title-size-lg;
text-align: center;
}
}
}
}
// 按钮
.buttons {
padding: $padding * 2;
.text {
text-align: center;
line-height: 90rpx;
height: 90rpx;
margin-bottom: $margin * 2;
font-size: $title-size-lg;
color: $main-color;
font-weight: bold;
}
button {
height: 90rpx;
line-height: 90rpx;
background-color: $main-color;
border-radius: $radius-m;
color: white;
font-weight: bold;
font-size: $title-size;
&::after{
display: none;
}
}
}
</style>