钱包,验证密码
This commit is contained in:
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
import { request } from '../index'
|
import { request } from '../index'
|
||||||
|
|
||||||
|
// 设置密码
|
||||||
const security = data => {
|
const security = data => {
|
||||||
return request({
|
return request({
|
||||||
url: 'chain/safe/security',
|
url: 'chain/safe/security',
|
||||||
@@ -15,6 +16,7 @@ const security = data => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 获取助记词
|
||||||
const seed = data => {
|
const seed = data => {
|
||||||
return request({
|
return request({
|
||||||
url: 'chain/safe/seed',
|
url: 'chain/safe/seed',
|
||||||
@@ -22,7 +24,36 @@ const seed = data => {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 余额
|
||||||
|
const sum = () => {
|
||||||
|
return request({
|
||||||
|
url: 'chain/account/balance'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 账户记录
|
||||||
|
const logs = data => {
|
||||||
|
return request({
|
||||||
|
url: 'chain/account/logs',
|
||||||
|
data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 验证密码
|
||||||
|
const securityCheck = (password) => {
|
||||||
|
return request({
|
||||||
|
url : "chain/safe/security/check",
|
||||||
|
method: 'POST',
|
||||||
|
data:{
|
||||||
|
code : password,
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export {
|
export {
|
||||||
security,
|
security,
|
||||||
seed
|
seed,
|
||||||
|
sum,
|
||||||
|
logs,
|
||||||
|
securityCheck
|
||||||
}
|
}
|
||||||
|
|||||||
91
components/property/record.vue
Normal file
91
components/property/record.vue
Normal file
@@ -0,0 +1,91 @@
|
|||||||
|
<template>
|
||||||
|
<view>
|
||||||
|
<block v-if="list.length > 0">
|
||||||
|
<view class="record--item" v-for="(item, index) in list" :key="index">
|
||||||
|
<view class="title ellipsis">{{item.hash || '-'}}</view>
|
||||||
|
<view class="time ellipsis">{{item.block_time || '-'}}</view>
|
||||||
|
<view class="webkit-box variation">
|
||||||
|
<view class="ellipsis" :class="item.is_in ? 'add': 'remove'">{{item.is_in ? '+': '-'}}{{item.amount}}</view>
|
||||||
|
<view class="symbol">{{item.assets.symbol}}</view>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
<block v-else>
|
||||||
|
<view class="record--null webkit-box">
|
||||||
|
<image src="@/static/icon/logs-null.png" mode="widthFix" />
|
||||||
|
<view>没有相关数据~</view>
|
||||||
|
</view>
|
||||||
|
</block>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name:"property",
|
||||||
|
props:{
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default: () => {
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.record--item{
|
||||||
|
padding: $padding 320rpx $padding 0;
|
||||||
|
border-bottom: solid 1rpx $border-color;
|
||||||
|
position: relative;
|
||||||
|
min-height: 50rpx;
|
||||||
|
.variation{
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
top: $margin;
|
||||||
|
bottom: $margin;
|
||||||
|
width: 300rpx;
|
||||||
|
text-align: right;
|
||||||
|
font-weight: bold;
|
||||||
|
&>label{
|
||||||
|
font-size: 80%;
|
||||||
|
}
|
||||||
|
.symbol{
|
||||||
|
color: $text-gray;
|
||||||
|
font-weight: normal;
|
||||||
|
font-size: $title-size-m;
|
||||||
|
}
|
||||||
|
.add{
|
||||||
|
color: $text-price;
|
||||||
|
}
|
||||||
|
.remove{
|
||||||
|
color: $main-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.title{
|
||||||
|
line-height: 50rpx;
|
||||||
|
}
|
||||||
|
.time{
|
||||||
|
font-size: $title-size-m;
|
||||||
|
color: $text-gray;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 数据空
|
||||||
|
.record--null{
|
||||||
|
padding-top: $padding * 3;
|
||||||
|
text-align: center;
|
||||||
|
color: $text-gray;
|
||||||
|
font-size: $title-size;
|
||||||
|
height: 50vh;
|
||||||
|
box-sizing: border-box;
|
||||||
|
line-height: 60rpx;
|
||||||
|
image{
|
||||||
|
width: 168rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
24
pages.json
24
pages.json
@@ -262,6 +262,30 @@
|
|||||||
"navigationBarBackgroundColor":"#FFFFFF",
|
"navigationBarBackgroundColor":"#FFFFFF",
|
||||||
"enablePullDownRefresh": false
|
"enablePullDownRefresh": false
|
||||||
}
|
}
|
||||||
|
},{
|
||||||
|
"path": "pages/wallet/property",
|
||||||
|
"name": "WalletProperty",
|
||||||
|
"style": {
|
||||||
|
"navigationBarTitleText": "ZH钱包",
|
||||||
|
"navigationBarTextStyle":"white",
|
||||||
|
"app-plus": {
|
||||||
|
"titleNView": {
|
||||||
|
"backgroundImage": "linear-gradient(to right, #34ce98, #22aa98)",
|
||||||
|
"type": "transparent",
|
||||||
|
"buttons": [{
|
||||||
|
"float": "right",
|
||||||
|
"text": "\ue607",
|
||||||
|
"fontSrc": "/static/iconfont.ttf",
|
||||||
|
"color": "#FFF",
|
||||||
|
"fontSize": "20px",
|
||||||
|
"background": "rgba(0,0,0,0)"
|
||||||
|
}],
|
||||||
|
"backButton":{
|
||||||
|
"background": "rgba(0,0,0,0)"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}],
|
}],
|
||||||
"tabBar": {
|
"tabBar": {
|
||||||
"borderStyle": "white",
|
"borderStyle": "white",
|
||||||
|
|||||||
@@ -86,7 +86,12 @@
|
|||||||
<view class="btns-box">
|
<view class="btns-box">
|
||||||
<view class="btns-box-item" @click="$Router.push({name: 'WalletAdd'})">
|
<view class="btns-box-item" @click="$Router.push({name: 'WalletAdd'})">
|
||||||
<image class="icon" src="@/static/user/icon_00.png" mode="widthFix"></image>
|
<image class="icon" src="@/static/user/icon_00.png" mode="widthFix"></image>
|
||||||
ZH钱包
|
ZH钱包(首次)
|
||||||
|
<uni-icons class="forward" type="forward" color="#999"></uni-icons>
|
||||||
|
</view>
|
||||||
|
<view class="btns-box-item" @click="$Router.push({name: 'WalletProperty'})">
|
||||||
|
<image class="icon" src="@/static/user/icon_00.png" mode="widthFix"></image>
|
||||||
|
ZH钱包(钱包)
|
||||||
<uni-icons class="forward" type="forward" color="#999"></uni-icons>
|
<uni-icons class="forward" type="forward" color="#999"></uni-icons>
|
||||||
</view>
|
</view>
|
||||||
<view class="btns-box-item">
|
<view class="btns-box-item">
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<view>
|
<view>
|
||||||
<view class="propery">
|
<view class="propery">
|
||||||
<view class="propery-content">
|
<view class="propery-content">
|
||||||
<view class="currency">原石 (≈ {{ price || '0' }} CNY)</view>
|
<view class="currency">钱包余额</view>
|
||||||
<view class="balance">{{ balance.balance || '0' }}</view>
|
<view class="balance">{{ balance.balance || '0' }}</view>
|
||||||
<view class="frozen">{{ balance.frozen || '0' }} 冻结中</view>
|
<view class="frozen">{{ balance.frozen || '0' }} 冻结中</view>
|
||||||
<view class="balance-flex">
|
<view class="balance-flex">
|
||||||
@@ -22,57 +22,45 @@
|
|||||||
<!-- ios安全距离 -->
|
<!-- ios安全距离 -->
|
||||||
<view class="ios-bottom"></view>
|
<view class="ios-bottom"></view>
|
||||||
</view>
|
</view>
|
||||||
<!-- 支付密码 -->
|
<!-- 钱包密码 -->
|
||||||
<uni-popup ref="showPassword">
|
<u-popup :show="passwordShow" @close="resetPassword" closeable borderRadius="10">
|
||||||
<view class="validationPassword">
|
<view class="validationPassword">
|
||||||
<view class="from">
|
<view class="from">
|
||||||
<view class="title">验证密码</view>
|
<view class="title">钱包密码</view>
|
||||||
<input class="input" v-model="password" password placeholder="请验证安全密码"/>
|
<input type="number" v-model="password" maxlength="6" placeholder="请输入钱包密码" />
|
||||||
</view>
|
</view>
|
||||||
<view class="buttons">
|
<view class="buttons">
|
||||||
<view class="button cancel" @click="payPassword('cancel', passwordPages)">取消</view>
|
|
||||||
<view class="button confirm" @click="payPassword('confirm', passwordPages)">验证</view>
|
<view class="button confirm" @click="payPassword('confirm', passwordPages)">验证</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</uni-popup>
|
</u-popup>
|
||||||
<!-- 原密码弹窗 -->
|
|
||||||
<!-- <number-jpan :length="6" @closeChange="closeChange($event)" ref="numberPad"></number-jpan> -->
|
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import record from '@/components/property/record'
|
import record from '@/components/property/record'
|
||||||
import {
|
import { sum, logs, securityCheck } from '@/apis/interfaces/wallet'
|
||||||
sum,
|
|
||||||
price,
|
|
||||||
logs,
|
|
||||||
code,
|
|
||||||
securityCheck // 输入旧密码是否正确
|
|
||||||
} from '@/apis/interfaces/wallet'
|
|
||||||
import numberJpan from "@/components/numberJpan/numberJpan.vue";
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
record
|
record
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
balance: {},
|
balance : {},
|
||||||
price: '0.00',
|
logs : [],
|
||||||
logs: [],
|
logsType : 0,
|
||||||
logsType: 0,
|
password : '',
|
||||||
password: '',
|
passwordShow : true,
|
||||||
passwordPages: ''
|
passwordPages: ''
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
onShow() {
|
onShow() {
|
||||||
Promise.all([
|
Promise.all([
|
||||||
sum(),
|
sum(),
|
||||||
price(),
|
|
||||||
logs()
|
logs()
|
||||||
]).then(res => {
|
]).then(res => {
|
||||||
this.balance = res[0]
|
this.balance = res[0]
|
||||||
this.price = res[1]
|
this.logs = res[1]
|
||||||
this.logs = res[2]
|
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
icon: 'none',
|
icon: 'none',
|
||||||
@@ -83,8 +71,13 @@
|
|||||||
methods: {
|
methods: {
|
||||||
// 弹出私钥
|
// 弹出私钥
|
||||||
showPrivatekey(pages){
|
showPrivatekey(pages){
|
||||||
|
this.passwordShow = true
|
||||||
this.passwordPages = pages
|
this.passwordPages = pages
|
||||||
this.$refs.showPassword.open('center')
|
},
|
||||||
|
// 重置密码
|
||||||
|
resetPassword(){
|
||||||
|
this.passwordShow = false
|
||||||
|
this.password = ''
|
||||||
},
|
},
|
||||||
// 验证私钥
|
// 验证私钥
|
||||||
payPassword(type){
|
payPassword(type){
|
||||||
@@ -97,16 +90,17 @@
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
securityCheck(this.password).then(res => {
|
securityCheck(this.password).then(res => {
|
||||||
this.$refs.showPassword.close()
|
this.resetPassword()
|
||||||
switch (this.passwordPages){
|
console.log("密码验证通过")
|
||||||
case 'privatekey':
|
|
||||||
this.$Router.push({name:'Privatekey', params: {password: this.password}})
|
// switch (this.passwordPages){
|
||||||
break;
|
// case 'privatekey':
|
||||||
case 'resetPassword':
|
// this.$Router.push({name:'Privatekey', params: {password: this.password}})
|
||||||
this.$Router.push({name:'ResetPassword', params: {password: this.password}})
|
// break;
|
||||||
break;
|
// case 'resetPassword':
|
||||||
}
|
// this.$Router.push({name:'ResetPassword', params: {password: this.password}})
|
||||||
this.password = ''
|
// break;
|
||||||
|
// }
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
uni.showToast({
|
uni.showToast({
|
||||||
title: err.message,
|
title: err.message,
|
||||||
@@ -132,7 +126,7 @@
|
|||||||
showAddress() {
|
showAddress() {
|
||||||
uni.showModal({
|
uni.showModal({
|
||||||
title: '我的区块链地址',
|
title: '我的区块链地址',
|
||||||
content: '\n地址可以理解为银行卡卡号,与他人转账时是区块链上的两个地址间的交易行为\n\n' + this.balance.address,
|
content: this.balance.address,
|
||||||
cancelText: '复制',
|
cancelText: '复制',
|
||||||
cancelColor: '#009B69',
|
cancelColor: '#009B69',
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
@@ -148,7 +142,7 @@
|
|||||||
onNavigationBarButtonTap(e) {
|
onNavigationBarButtonTap(e) {
|
||||||
if (e.index === 0) {
|
if (e.index === 0) {
|
||||||
uni.showActionSheet({
|
uni.showActionSheet({
|
||||||
itemList: ['转账', '收款', '提币', '修改密码'],
|
itemList: ['导出助记词', '修改密码'],
|
||||||
success: (res) => {
|
success: (res) => {
|
||||||
switch (res.tapIndex) {
|
switch (res.tapIndex) {
|
||||||
case 0:
|
case 0:
|
||||||
@@ -161,11 +155,6 @@
|
|||||||
name: 'WalletCode'
|
name: 'WalletCode'
|
||||||
})
|
})
|
||||||
break;
|
break;
|
||||||
case 2:
|
|
||||||
this.$Router.push({
|
|
||||||
name: 'Extract'
|
|
||||||
})
|
|
||||||
break;
|
|
||||||
case 3:
|
case 3:
|
||||||
this.showPrivatekey('resetPassword')
|
this.showPrivatekey('resetPassword')
|
||||||
break;
|
break;
|
||||||
@@ -181,69 +170,51 @@
|
|||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
// 验证密码弹出层
|
// 验证密码弹出层
|
||||||
.validationPassword{
|
.validationPassword{
|
||||||
background-color: white;
|
|
||||||
border-radius: $radius-m;
|
|
||||||
width: 70vw;
|
|
||||||
.from{
|
.from{
|
||||||
padding: $padding*2;
|
padding: $padding*2;
|
||||||
|
text-align: center;
|
||||||
.title{
|
.title{
|
||||||
text-align: center;
|
display: flex;
|
||||||
font-size: $title-size;
|
flex-direction: column;
|
||||||
padding-bottom: $padding*2;
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
color: $mian-color;
|
|
||||||
}
|
|
||||||
.input{
|
|
||||||
text-align: center;
|
|
||||||
height: 90rpx;
|
|
||||||
font-size: $title-size;
|
font-size: $title-size;
|
||||||
border-radius: $radius-m;
|
padding-bottom: $padding;
|
||||||
background: $border-color-lg;
|
}
|
||||||
padding: 0 ($padding*2);
|
input{
|
||||||
|
background: $window-color;
|
||||||
|
height: 90rpx;
|
||||||
|
left: 90rpx;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
border-radius: 45rpx;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.buttons{
|
.buttons{
|
||||||
display: flex;
|
text-align: center;
|
||||||
border-top: solid 1rpx $border-color;
|
padding: 0 $padding*2;
|
||||||
.button{
|
.button{
|
||||||
width: 50%;
|
|
||||||
font-size: $title-size;
|
|
||||||
line-height: 90rpx;
|
|
||||||
height: 90rpx;
|
height: 90rpx;
|
||||||
text-align: center;
|
line-height: 90rpx;
|
||||||
box-sizing: border-box;
|
margin-bottom: $margin;
|
||||||
&.cancel{
|
&.cancel{
|
||||||
border-right: solid 1rpx $border-color;
|
|
||||||
color: $text-gray;
|
color: $text-gray;
|
||||||
}
|
}
|
||||||
&.confirm{
|
&.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 {
|
.propery {
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: var(--status-bar-height);
|
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 {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -252,7 +223,7 @@
|
|||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
content: " ";
|
content: " ";
|
||||||
background-image: url(@/static/background/wallet-back.png);
|
// background-image: url(@/static/background/wallet-back.png);
|
||||||
background-size: 100%;
|
background-size: 100%;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
@@ -296,7 +267,7 @@
|
|||||||
width: 200rpx;
|
width: 200rpx;
|
||||||
height: 75rpx;
|
height: 75rpx;
|
||||||
line-height: 75rpx;
|
line-height: 75rpx;
|
||||||
color: $mian-color;
|
color: $main-color;
|
||||||
margin: 0 $margin;
|
margin: 0 $margin;
|
||||||
border-radius: $radius-m;
|
border-radius: $radius-m;
|
||||||
font-size: $title-size;
|
font-size: $title-size;
|
||||||
@@ -328,7 +299,7 @@
|
|||||||
padding: 0 $padding;
|
padding: 0 $padding;
|
||||||
|
|
||||||
&.show {
|
&.show {
|
||||||
color: $mian-color;
|
color: $main-color;
|
||||||
|
|
||||||
&::before {
|
&::before {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
@@ -337,7 +308,7 @@
|
|||||||
right: $padding;
|
right: $padding;
|
||||||
height: 4rpx;
|
height: 4rpx;
|
||||||
content: " ";
|
content: " ";
|
||||||
background-color: $mian-color;
|
background-color: $main-color;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
BIN
static/icon/logs-null.png
Normal file
BIN
static/icon/logs-null.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.5 KiB |
@@ -11,6 +11,10 @@
|
|||||||
-moz-osx-font-smoothing: grayscale;
|
-moz-osx-font-smoothing: grayscale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.icon-gengduo:before {
|
||||||
|
content: "\e607";
|
||||||
|
}
|
||||||
|
|
||||||
.icon-saoma:before {
|
.icon-saoma:before {
|
||||||
content: "\e605";
|
content: "\e605";
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Reference in New Issue
Block a user