[更新发现]
This commit is contained in:
@@ -196,6 +196,7 @@
|
||||
}
|
||||
// 登录按钮
|
||||
.btn {
|
||||
margin: 0;
|
||||
margin-top: $margin*2;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
|
||||
1208
pages/im/chat.nvue
Normal file
1208
pages/im/chat.nvue
Normal file
File diff suppressed because it is too large
Load Diff
19
pages/im/chum.vue
Normal file
19
pages/im/chum.vue
Normal file
@@ -0,0 +1,19 @@
|
||||
<template>
|
||||
<view>
|
||||
好友列表
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
|
||||
</style>
|
||||
148
pages/im/index.vue
Normal file
148
pages/im/index.vue
Normal file
@@ -0,0 +1,148 @@
|
||||
<template>
|
||||
<view class="content">
|
||||
<block v-if="messageArr.length >= 1">
|
||||
<view class="vertical null-list">
|
||||
<u-empty
|
||||
icon="http://cdn.uviewui.com/uview/empty/message.png"
|
||||
textColor="#999"
|
||||
text="暂无好友消息"
|
||||
>
|
||||
<template>
|
||||
<view class="null-list-btn" @click="openChum">开启聊天</view>
|
||||
</template>
|
||||
</u-empty>
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<!-- <button type="default">连接</button> -->
|
||||
<!-- <button type="default">发送</button> -->
|
||||
|
||||
<view v-for="item in 2" :key="item" class="mssage-box">
|
||||
<view class="mssage-action" @click="$Router.push({name: 'ImChat'})">
|
||||
<u-avatar
|
||||
clsss="mssage-action-cover"
|
||||
src="https://cdn.uviewui.com/uview/album/1.jpg"
|
||||
size="44"
|
||||
text="唐"
|
||||
font-size="14"
|
||||
randomBgColor
|
||||
></u-avatar>
|
||||
<view class="mssage-action-content">
|
||||
<view class="mssage-header">
|
||||
<view class="header-name">唐明明</view>
|
||||
<view class="header-time">2021/12/31</view>
|
||||
</view>
|
||||
<view class="mssage-msg">消息</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { init, connect } from '@rongcloud/imlib-uni'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
messageArr : [],
|
||||
optionsAction: [
|
||||
{
|
||||
text: '删除',
|
||||
style: {
|
||||
backgroundColor: '#e6576b'
|
||||
}
|
||||
}
|
||||
]
|
||||
};
|
||||
},
|
||||
methods:{
|
||||
openChum(){
|
||||
this.$Router.push({name: 'ImChum'})
|
||||
console.log("好友列表")
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
switch (e.index){
|
||||
case 1:
|
||||
this.openChum()
|
||||
break;
|
||||
case 0:
|
||||
console.log("扫码添加好友")
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
background-color: $window-color;
|
||||
min-height: 100vh;
|
||||
.null-list{
|
||||
height: 100vh;
|
||||
text-align: center;
|
||||
&-btn{
|
||||
margin-top: $margin * 2;
|
||||
line-height: 70rpx;
|
||||
color: $main-color;
|
||||
border:solid 1rpx $main-color;
|
||||
padding: 0 ($padding*3);
|
||||
font-size: $title-size-m;
|
||||
border-radius: 35rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
.mssage-box{
|
||||
background: white;
|
||||
.mssage-action{
|
||||
position: relative;
|
||||
padding: 20rpx $padding;
|
||||
&::after{
|
||||
position: absolute;
|
||||
left: $padding + 108;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
content: " ";
|
||||
height: 1rpx;
|
||||
background: $border-color;
|
||||
}
|
||||
&-content{
|
||||
position: absolute;
|
||||
top: 20rpx;
|
||||
height: 44px;
|
||||
left: $padding + 108;
|
||||
right: $margin;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
.mssage-header{
|
||||
display: flex;
|
||||
font-size: $title-size;
|
||||
line-height: 40rpx;
|
||||
justify-content: space-between;
|
||||
.header-name{
|
||||
flex: 1;
|
||||
@extend .nowrap;
|
||||
}
|
||||
.header-time{
|
||||
padding-left: $padding;
|
||||
font-size: $title-size-sm - 2;
|
||||
color: $text-gray;
|
||||
}
|
||||
}
|
||||
.mssage-msg{
|
||||
font-size: $title-size-sm - 2;
|
||||
color: $text-gray;
|
||||
@extend .nowrap;
|
||||
}
|
||||
}
|
||||
}
|
||||
&-item:last-child{
|
||||
.mssage-action::after{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
@@ -10,180 +10,92 @@
|
||||
sticky
|
||||
></u-tabs>
|
||||
</u-sticky>
|
||||
<!-- 订单列表 -->
|
||||
<oct-order
|
||||
v-for="(item, arrayIndex) in array"
|
||||
:key="arrayIndex"
|
||||
:order-info="item"
|
||||
@onBtn="onType"
|
||||
></oct-order>
|
||||
<!-- 加载更多 -->
|
||||
<view class="pages-load">
|
||||
<u-loadmore :status="status" />
|
||||
</view>
|
||||
<block v-if="array.length >= 1">
|
||||
<!-- 订单列表 -->
|
||||
<oct-order
|
||||
v-for="(item, arrayIndex) in array"
|
||||
:key="arrayIndex"
|
||||
:order-info="item"
|
||||
@onBtn="onType"
|
||||
></oct-order>
|
||||
<!-- 加载更多 -->
|
||||
<view class="pages-load">
|
||||
<u-loadmore :status="status" />
|
||||
</view>
|
||||
</block>
|
||||
<block v-else>
|
||||
<view class="vertical order-null">
|
||||
<u-empty
|
||||
mode="order"
|
||||
icon="http://cdn.uviewui.com/uview/empty/order.png"
|
||||
text="暂无相关订单"
|
||||
textColor="#999"
|
||||
></u-empty>
|
||||
</view>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { orders, del, cancel, sign } from '@/apis/interfaces/order'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
status: "loading",
|
||||
tabs: [
|
||||
{name: "全部"},
|
||||
{name: "待付款"},
|
||||
{name: "待发货"},
|
||||
{name: "待签收"},
|
||||
{name: "已完成"}
|
||||
],
|
||||
array: [
|
||||
{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/ef838761c8528888213766d3dcc50907.jpg",
|
||||
name : "秋冬潮湿多雨,便携迷你除湿器",
|
||||
price : "59.90",
|
||||
sum : 1,
|
||||
stateText : "已完成",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg",
|
||||
name : "稻纯贵州茅台镇新一代酱香型白酒 53度",
|
||||
price : "158.00",
|
||||
sum : 2,
|
||||
stateText : "待支付",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/ef838761c8528888213766d3dcc50907.jpg",
|
||||
name : "秋冬潮湿多雨,便携迷你除湿器",
|
||||
price : "59.90",
|
||||
sum : 1,
|
||||
stateText : "已完成",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg",
|
||||
name : "稻纯贵州茅台镇新一代酱香型白酒 53度",
|
||||
price : "158.00",
|
||||
sum : 2,
|
||||
stateText : "待支付",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/ef838761c8528888213766d3dcc50907.jpg",
|
||||
name : "秋冬潮湿多雨,便携迷你除湿器",
|
||||
price : "59.90",
|
||||
sum : 1,
|
||||
stateText : "已完成",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg",
|
||||
name : "稻纯贵州茅台镇新一代酱香型白酒 53度",
|
||||
price : "158.00",
|
||||
sum : 2,
|
||||
stateText : "待支付",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/ef838761c8528888213766d3dcc50907.jpg",
|
||||
name : "秋冬潮湿多雨,便携迷你除湿器",
|
||||
price : "59.90",
|
||||
sum : 1,
|
||||
stateText : "已完成",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg",
|
||||
name : "稻纯贵州茅台镇新一代酱香型白酒 53度",
|
||||
price : "158.00",
|
||||
sum : 2,
|
||||
stateText : "待支付",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/ef838761c8528888213766d3dcc50907.jpg",
|
||||
name : "秋冬潮湿多雨,便携迷你除湿器",
|
||||
price : "59.90",
|
||||
sum : 1,
|
||||
stateText : "已完成",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg",
|
||||
name : "稻纯贵州茅台镇新一代酱香型白酒 53度",
|
||||
price : "158.00",
|
||||
sum : 2,
|
||||
stateText : "待支付",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},
|
||||
{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/ef838761c8528888213766d3dcc50907.jpg",
|
||||
name : "秋冬潮湿多雨,便携迷你除湿器",
|
||||
price : "59.90",
|
||||
sum : 1,
|
||||
stateText : "已完成",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
},{
|
||||
no : "2261957223036048580",
|
||||
cover : "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg",
|
||||
name : "稻纯贵州茅台镇新一代酱香型白酒 53度",
|
||||
price : "158.00",
|
||||
sum : 2,
|
||||
stateText : "待支付",
|
||||
store : {
|
||||
name: "网易严选",
|
||||
logo: "https://yanxuan-item.nosdn.127.net/4ad8a83fa25e2aab8c05ade4c05e135f.jpg"
|
||||
}
|
||||
}
|
||||
{name: "全部", type: ""},
|
||||
{name: "待付款", type: "unpay"},
|
||||
{name: "待发货", type: "paid"},
|
||||
{name: "待签收", type: "delivered"},
|
||||
{name: "已完成", type: "completed"},
|
||||
],
|
||||
index: 0,
|
||||
array: [],
|
||||
page : 1
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
this.getOrder()
|
||||
},
|
||||
methods:{
|
||||
getOrder(){
|
||||
orders({
|
||||
state: this.tabs[this.index].type,
|
||||
page : this.page
|
||||
}).then(res => {
|
||||
if(res.page.current === 1){
|
||||
this.array = []
|
||||
}
|
||||
let ordersArr = res.data.map(val => {
|
||||
return {
|
||||
no : val.order_no,
|
||||
cover : val.items[0].sku.cover,
|
||||
name : val.items[0].sku.goods_name,
|
||||
price : val.items[0].price,
|
||||
sum : val.items[0].qty,
|
||||
stateText : val.state,
|
||||
cans : val.can
|
||||
}
|
||||
})
|
||||
this.array = this.array.concat(ordersArr)
|
||||
this.status = res.page.has_more ? 'loadmore' : 'nomore'
|
||||
})
|
||||
},
|
||||
onTabs(e){
|
||||
console.log(e.index)
|
||||
this.page = 1
|
||||
this.index = e.index
|
||||
this.getOrder()
|
||||
},
|
||||
onType(e){
|
||||
console.log(e)
|
||||
console.log(e.type)
|
||||
}
|
||||
},
|
||||
onReachBottom() {
|
||||
if(this.status === 'loadmore'){
|
||||
this.page += 1
|
||||
this.status = 'loading'
|
||||
this.getOrder()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -197,6 +109,10 @@
|
||||
.tabs{
|
||||
background: white;
|
||||
}
|
||||
// 数据列表空
|
||||
.order-null{
|
||||
height: 80vh;
|
||||
}
|
||||
// 加载分页
|
||||
.pages-load{
|
||||
padding-bottom: $padding;
|
||||
|
||||
@@ -69,7 +69,16 @@
|
||||
orderInfo,
|
||||
success: payRes => {
|
||||
console.log(payRes)
|
||||
|
||||
uni.showModal({
|
||||
title: '支付成功',
|
||||
content: '订单已支付,我们将尽快为您安排发货,可在订单管理查询订单动态',
|
||||
showCancel:false,
|
||||
success:onRes => {
|
||||
if(onRes.confirm){
|
||||
this.$Router.back()
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
fail: payErr => {
|
||||
console.log(payErr)
|
||||
|
||||
@@ -2,8 +2,12 @@
|
||||
<view class="content">
|
||||
<!-- banner -->
|
||||
<view class="banner">
|
||||
<image v-if="banner.length > 0" class="banner-cover" :src="banner[0].cover || ''" mode="aspectFill"></image>
|
||||
<image v-if="banner != ''" class="banner-cover" :src="banner" mode="aspectFill"></image>
|
||||
</view>
|
||||
<!-- 分类 -->
|
||||
<u-sticky bgColor="#fff" zIndex="99">
|
||||
<u-tabs :list="classify" lineColor="#34CE98" @click="onTabs"></u-tabs>
|
||||
</u-sticky>
|
||||
<!-- 套餐列表 -->
|
||||
<oct-goods
|
||||
:lists="goodsArr"
|
||||
@@ -18,8 +22,10 @@
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
banner : [],
|
||||
goodsArr: []
|
||||
banner : "",
|
||||
goodsArr : [],
|
||||
classify : [],
|
||||
categoryId : ""
|
||||
};
|
||||
},
|
||||
mounted(){
|
||||
@@ -27,18 +33,19 @@
|
||||
},
|
||||
methods:{
|
||||
getMeals(){
|
||||
meals(this.$Route.query.id).then(res => {
|
||||
meals(this.$Route.query.id, this.categoryId).then(res => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.meal.subtitle
|
||||
})
|
||||
console.log(res)
|
||||
this.banner = res.banners
|
||||
this.goodsArr = res.meal.goods
|
||||
this.banner = res.meal.banner
|
||||
this.goodsArr = res.goods
|
||||
this.classify = [{ name: "全部", category_id: "" }].concat(res.categories)
|
||||
uni.stopPullDownRefresh()
|
||||
})
|
||||
},
|
||||
click(){
|
||||
console.log('筛选')
|
||||
onTabs(e){
|
||||
this.categoryId = e.category_id
|
||||
this.getMeals()
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
|
||||
@@ -84,6 +84,16 @@
|
||||
</view>
|
||||
<!-- 功能块 -->
|
||||
<view class="btns-box">
|
||||
<view class="btns-box-item" @click="$Router.push({name: 'WalletAdd'})">
|
||||
<image class="icon" src="@/static/user/icon_00.png" mode="widthFix"></image>
|
||||
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>
|
||||
</view>
|
||||
<view class="btns-box-item">
|
||||
<image class="icon" src="@/static/user/icon_00.png" mode="widthFix"></image>
|
||||
健康档案
|
||||
@@ -132,7 +142,7 @@
|
||||
if(this.$store.state.token === '') return
|
||||
info().then(res => {
|
||||
uni.setNavigationBarTitle({
|
||||
title: res.nickName
|
||||
title: res.nickname
|
||||
})
|
||||
this.userInfo = res
|
||||
})
|
||||
|
||||
64
pages/wallet/add.vue
Normal file
64
pages/wallet/add.vue
Normal file
@@ -0,0 +1,64 @@
|
||||
<template>
|
||||
<view class="content vertical">
|
||||
<!-- logo -->
|
||||
<image class="logo" src="@/static/wallet/logo.png" mode="widthFix"></image>
|
||||
<!-- 副标题 -->
|
||||
<view class="sub-title">激活您的ZH健康钱包获取钱包地址,地址可以理解为您的个人银行卡卡号</view>
|
||||
<!-- 按钮 -->
|
||||
<view class="wallet-btn" @click="$Router.replace({name: 'WalletCreate'})">激活钱包</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
page {
|
||||
background-color: white;
|
||||
}
|
||||
</style>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.content{
|
||||
position: relative;
|
||||
height: 100vh;
|
||||
padding: 0 15vw;
|
||||
text-align: center;
|
||||
.logo{
|
||||
width: 138rpx;
|
||||
vertical-align: top;
|
||||
margin-bottom: 20vh;
|
||||
}
|
||||
.sub-title{
|
||||
font-size: $title-size-m;
|
||||
color: $text-gray;
|
||||
}
|
||||
.wallet-btn{
|
||||
width: 100%;
|
||||
background-color: $main-color;
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
margin-top: $margin * 2;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
&.hollow{
|
||||
background-color: white;
|
||||
color: $main-color;
|
||||
border:solid 2rpx $main-color;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
134
pages/wallet/create.vue
Normal file
134
pages/wallet/create.vue
Normal file
@@ -0,0 +1,134 @@
|
||||
<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>
|
||||
116
pages/wallet/mnemonic.vue
Normal file
116
pages/wallet/mnemonic.vue
Normal file
@@ -0,0 +1,116 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 提示信息 -->
|
||||
<view class="prompt">请按照顺序记录并确保正确备份助记词</view>
|
||||
<!-- 助记词 -->
|
||||
<ul class="mnemonic">
|
||||
<li v-for="(item, index) in mnemonic" :key="index">{{item}}</li>
|
||||
</ul>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<view class="text">注:助记词是用户账户的唯一标识,不能分享给他人,掌握该助记词即可控制该账户与钱包</view>
|
||||
<button type="default" @click="goto">验证助记词</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { seed } from "@/apis/interfaces/wallet"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
mnemonic: [], // 助记词
|
||||
sign : '' // 校验签名
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
// this.$Route.query.code
|
||||
seed({
|
||||
code: 123456
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
this.mnemonic = res.seed.split(' ')
|
||||
this.sign = res.sign
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
goto(){
|
||||
this.$Router.replace({
|
||||
name: 'WalletValidation',
|
||||
params: {
|
||||
seed: this.mnemonic,
|
||||
sign: this.sign
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 提示信息
|
||||
.prompt{
|
||||
color: $text-gray;
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
// 跳过
|
||||
.skip{
|
||||
padding: $padding * 2;
|
||||
text-align: center;
|
||||
color: $text-gray;
|
||||
navigator{
|
||||
color: $main-color;
|
||||
margin-left: $margin/2;
|
||||
display: inline-block;
|
||||
}
|
||||
}
|
||||
// 助记词
|
||||
.mnemonic{
|
||||
margin: $margin $margin * 2;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
padding: $padding;
|
||||
list-style: none;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
li{
|
||||
text-align: center;
|
||||
height: 58rpx;
|
||||
padding: 0 $padding/2;
|
||||
line-height: 58rpx;
|
||||
margin: $margin / 2;
|
||||
color: $text-color;
|
||||
background: rgba($color: $border-color, $alpha: .4);
|
||||
}
|
||||
}
|
||||
// 按钮
|
||||
.buttons{
|
||||
padding: $padding $padding * 2;
|
||||
.text{
|
||||
text-align: center;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-m;
|
||||
color: $text-price;
|
||||
}
|
||||
button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $main-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
&::after{
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
108
pages/wallet/privatekey.vue
Normal file
108
pages/wallet/privatekey.vue
Normal file
@@ -0,0 +1,108 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 私钥 -->
|
||||
<view class="keys">
|
||||
<view class="title">您已接收OC Chain托管</view>
|
||||
<view class="key">{{key || '-'}}</view>
|
||||
<view class="copykey" @click="copykey">复制我的私钥</view>
|
||||
</view>
|
||||
<!-- 疑问 -->
|
||||
<view class="doubt" v-if="rules.length > 0">
|
||||
<view class="doubt-item" v-for="(item, index) in rules" :key="index">
|
||||
<view class="title">{{item.title || '-'}}</view>
|
||||
<view class="content">{{item.description || '-'}}</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 免责说明 -->
|
||||
<view class="liability">
|
||||
<navigator url="/pages/wallet/cmsWithDraw">免责条款</navigator>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { privatekey, keyrules } from '@/apis/interfaces/wallet'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
key: "",
|
||||
rules: []
|
||||
};
|
||||
},
|
||||
mounted() {
|
||||
Promise.all([privatekey(this.$Route.query.password), keyrules()]).then(res => {
|
||||
let privatekey = res[0],
|
||||
keyrules = res[1]
|
||||
this.key = privatekey.private_key
|
||||
this.rules = keyrules
|
||||
})
|
||||
},
|
||||
methods:{
|
||||
copykey(){
|
||||
uni.setClipboardData({
|
||||
data: this.key
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
.keys{
|
||||
margin: $margin * 2;
|
||||
background: white;
|
||||
padding: $padding * 2;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
||||
border-radius: $radius;
|
||||
.title{
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
font-size: $title-size + 4;
|
||||
color: $text-color;
|
||||
}
|
||||
.key{
|
||||
padding: $padding * 2 0;
|
||||
text-align: center;
|
||||
color: $mian-color;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.copykey{
|
||||
background-color: $mian-color;
|
||||
color: white;
|
||||
height: 95rpx;
|
||||
line-height: 95rpx;
|
||||
text-align: center;
|
||||
font-size: $title-size;
|
||||
border-radius: $radius-m;
|
||||
font-weight: bold;
|
||||
}
|
||||
}
|
||||
.doubt{
|
||||
margin: $margin $margin * 2;
|
||||
.doubt-item{
|
||||
padding: $padding 0;
|
||||
.title{
|
||||
font-weight: bold;
|
||||
color: $text-color;
|
||||
line-height: 50rpx;
|
||||
font-size: $title-size + 2;
|
||||
}
|
||||
.content{
|
||||
color: $text-gray-lg;
|
||||
font-size: $title-size-m;
|
||||
line-height: 40rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
.liability{
|
||||
text-align: center;
|
||||
color: $text-gray;
|
||||
@extend .ios-bottom;
|
||||
navigator{
|
||||
font-size: $title-size-sm;
|
||||
display: inline-block;
|
||||
line-height: 90rpx;
|
||||
padding: 0 ($padding * 2);
|
||||
}
|
||||
}
|
||||
</style>
|
||||
317
pages/wallet/property.vue
Normal file
317
pages/wallet/property.vue
Normal file
@@ -0,0 +1,317 @@
|
||||
<template>
|
||||
<view>
|
||||
<view class="propery">
|
||||
<view class="propery-content">
|
||||
<view class="currency">钱包余额</view>
|
||||
<view class="balance">{{ balance.balance || '0' }}</view>
|
||||
<view class="frozen">{{ balance.frozen || '0' }} 冻结中</view>
|
||||
<view class="balance-flex">
|
||||
<view class="balance-flex-item" @click="showAddress">区块链地址</view>
|
||||
<view class="balance-flex-item" @click="showPrivatekey('privatekey')">我的私钥</view>
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 账户记录 -->
|
||||
<view class="record">
|
||||
<view class="record-tabs">
|
||||
<view class="tabs-item" :class="logsType === 0 ? 'show': ''" @click="onLogsType(0)">全部</view>
|
||||
<view class="tabs-item" :class="logsType === 2 ? 'show': ''" @click="onLogsType(2)">收入</view>
|
||||
<view class="tabs-item" :class="logsType === 1 ? 'show': ''" @click="onLogsType(1)">支出</view>
|
||||
</view>
|
||||
<record :list="logs" />
|
||||
<!-- ios安全距离 -->
|
||||
<view class="ios-bottom"></view>
|
||||
</view>
|
||||
<!-- 钱包密码 -->
|
||||
<u-popup :show="passwordShow" @close="resetPassword" closeable borderRadius="10">
|
||||
<view class="validationPassword">
|
||||
<view class="from">
|
||||
<view class="title">钱包密码</view>
|
||||
<input type="number" v-model="password" maxlength="6" placeholder="请输入钱包密码" />
|
||||
</view>
|
||||
<view class="buttons">
|
||||
<view class="button confirm" @click="payPassword('confirm', passwordPages)">验证</view>
|
||||
</view>
|
||||
</view>
|
||||
</u-popup>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import record from '@/components/property/record'
|
||||
import { sum, logs, securityCheck } from '@/apis/interfaces/wallet'
|
||||
export default {
|
||||
components: {
|
||||
record
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
balance : {},
|
||||
logs : [],
|
||||
logsType : 0,
|
||||
password : '',
|
||||
passwordShow : true,
|
||||
passwordPages: ''
|
||||
};
|
||||
},
|
||||
onShow() {
|
||||
Promise.all([
|
||||
sum(),
|
||||
logs()
|
||||
]).then(res => {
|
||||
this.balance = res[0]
|
||||
this.logs = res[1]
|
||||
}).catch(err => {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: err.message
|
||||
})
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// 弹出私钥
|
||||
showPrivatekey(pages){
|
||||
this.passwordShow = true
|
||||
this.passwordPages = pages
|
||||
},
|
||||
// 重置密码
|
||||
resetPassword(){
|
||||
this.passwordShow = false
|
||||
this.password = ''
|
||||
},
|
||||
// 验证私钥
|
||||
payPassword(type){
|
||||
if(type === 'confirm'){
|
||||
if(this.password === '') {
|
||||
uni.showToast({
|
||||
title: '请输入安全密码',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
securityCheck(this.password).then(res => {
|
||||
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,
|
||||
icon: 'none',
|
||||
})
|
||||
})
|
||||
return
|
||||
}
|
||||
this.$refs.showPassword.close()
|
||||
},
|
||||
// 交易记录
|
||||
onLogsType(index) {
|
||||
if (this.logsType === index) return
|
||||
this.logsType = index
|
||||
this.logs = []
|
||||
logs({
|
||||
flag: this.logsType
|
||||
}).then(res => {
|
||||
this.logs = res
|
||||
})
|
||||
},
|
||||
// 区块地址
|
||||
showAddress() {
|
||||
uni.showModal({
|
||||
title: '我的区块链地址',
|
||||
content: this.balance.address,
|
||||
cancelText: '复制',
|
||||
cancelColor: '#009B69',
|
||||
success: (res) => {
|
||||
if (res.cancel) {
|
||||
uni.setClipboardData({
|
||||
data: this.balance.address
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
onNavigationBarButtonTap(e) {
|
||||
if (e.index === 0) {
|
||||
uni.showActionSheet({
|
||||
itemList: ['导出助记词', '修改密码'],
|
||||
success: (res) => {
|
||||
switch (res.tapIndex) {
|
||||
case 0:
|
||||
this.$Router.push({
|
||||
name: 'Transfer'
|
||||
})
|
||||
break;
|
||||
case 1:
|
||||
this.$Router.push({
|
||||
name: 'WalletCode'
|
||||
})
|
||||
break;
|
||||
case 3:
|
||||
this.showPrivatekey('resetPassword')
|
||||
break;
|
||||
}
|
||||
uni.hideLoading()
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 验证密码弹出层
|
||||
.validationPassword{
|
||||
.from{
|
||||
padding: $padding*2;
|
||||
text-align: center;
|
||||
.title{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
padding-bottom: $padding;
|
||||
}
|
||||
input{
|
||||
background: $window-color;
|
||||
height: 90rpx;
|
||||
left: 90rpx;
|
||||
font-size: $title-size-lg;
|
||||
border-radius: 45rpx;
|
||||
}
|
||||
}
|
||||
.buttons{
|
||||
text-align: center;
|
||||
padding: 0 $padding*2;
|
||||
.button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
margin-bottom: $margin;
|
||||
&.cancel{
|
||||
color: $text-gray;
|
||||
}
|
||||
&.confirm{
|
||||
color: white;
|
||||
background: $main-color;
|
||||
border-radius: 45rpx;
|
||||
}
|
||||
}
|
||||
}
|
||||
//
|
||||
//
|
||||
}
|
||||
// 账户
|
||||
.propery {
|
||||
position: relative;
|
||||
padding-top: var(--status-bar-height);
|
||||
background-image: linear-gradient(to right, $main-color, #22aa98);
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
content: " ";
|
||||
// background-image: url(@/static/background/wallet-back.png);
|
||||
background-size: 100%;
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.propery-content {
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
padding: $padding * 5 $padding * 2;
|
||||
text-align: center;
|
||||
|
||||
.currency {
|
||||
font-size: $title-size-m;
|
||||
color: rgba($color: white, $alpha: .8);
|
||||
}
|
||||
|
||||
.balance {
|
||||
font-size: $title-size * 2;
|
||||
padding: ($padding / 2) 0;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.frozen {
|
||||
background: rgba($color: #000000, $alpha: .1);
|
||||
color: rgba($color: white, $alpha: .7);
|
||||
display: inline-block;
|
||||
padding: 0 $padding;
|
||||
font-size: $title-size-m;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
border-radius: $radius-m;
|
||||
border: solid 1rpx rgba($color: white, $alpha: .4)
|
||||
}
|
||||
|
||||
.balance-flex {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
margin-top: $margin * 3;
|
||||
|
||||
.balance-flex-item {
|
||||
background-color: white;
|
||||
width: 200rpx;
|
||||
height: 75rpx;
|
||||
line-height: 75rpx;
|
||||
color: $main-color;
|
||||
margin: 0 $margin;
|
||||
border-radius: $radius-m;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 记录
|
||||
.record {
|
||||
background-color: white;
|
||||
border-radius: $radius $radius 0 0;
|
||||
padding: $padding ($padding * 2);
|
||||
margin-top: -$margin;
|
||||
position: relative;
|
||||
z-index: 2;
|
||||
|
||||
.record-tabs {
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
color: $text-gray;
|
||||
line-height: 70rpx;
|
||||
margin-bottom: $margin;
|
||||
|
||||
.tabs-item {
|
||||
position: relative;
|
||||
padding: 0 $padding;
|
||||
|
||||
&.show {
|
||||
color: $main-color;
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
bottom: 0;
|
||||
left: $padding;
|
||||
right: $padding;
|
||||
height: 4rpx;
|
||||
content: " ";
|
||||
background-color: $main-color;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
150
pages/wallet/resetPassword.vue
Normal file
150
pages/wallet/resetPassword.vue
Normal file
@@ -0,0 +1,150 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 设置钱包密码 -->
|
||||
<view class="password">
|
||||
<view class="prompt">请设置6位数字密码。建议不要使用连续的数字。</view>
|
||||
<view class="group">
|
||||
<view class="inputs">
|
||||
<label>密码</label>
|
||||
<input type="digit" v-model="password" maxlength="6" password placeholder="请设置新密码" />
|
||||
</view>
|
||||
<view class="inputs">
|
||||
<label>确认密码</label>
|
||||
<input type="digit" v-model="verify" maxlength="6" password placeholder="请确认新密码" />
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<button type="default" form-type="submit" @click="createWallet">确认</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
securityReset
|
||||
} from '@/apis/interfaces/wallet'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
password: '',
|
||||
verify: '',
|
||||
oldPassword: ''
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
this.oldPassword = this.$Route.query.password
|
||||
},
|
||||
methods: {
|
||||
// 激活钱包
|
||||
createWallet() {
|
||||
if (this.password === '' || this.verify === '') {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '请设置密码'
|
||||
})
|
||||
return
|
||||
}
|
||||
if (this.password !== this.verify) {
|
||||
uni.showToast({
|
||||
icon: 'none',
|
||||
title: '两次输入密码不一致'
|
||||
})
|
||||
return
|
||||
}
|
||||
securityReset({
|
||||
new_code: this.password,
|
||||
old_code: this.oldPassword
|
||||
}).then(res => {
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '密码已重置',
|
||||
showCancel:false,
|
||||
success: res=> {
|
||||
uni.navigateBack()
|
||||
}
|
||||
})
|
||||
}).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: $mian-color;
|
||||
}
|
||||
|
||||
.group {
|
||||
margin-top: $margin;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
|
||||
.inputs {
|
||||
padding: $padding $padding + 10;
|
||||
border-bottom: solid 1rpx $border-color;
|
||||
|
||||
&:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
label {
|
||||
color: $text-gray;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
|
||||
input {
|
||||
height: 70rpx;
|
||||
line-height: 70rpx;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 按钮
|
||||
.buttons {
|
||||
padding: $padding * 2;
|
||||
|
||||
.text {
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
height: 90rpx;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-lg;
|
||||
color: $mian-color;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
button {
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $mian-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
170
pages/wallet/validation.vue
Normal file
170
pages/wallet/validation.vue
Normal file
@@ -0,0 +1,170 @@
|
||||
<template>
|
||||
<view>
|
||||
<!-- 提示信息 -->
|
||||
<view class="prompt">
|
||||
验证您的钱包助记词
|
||||
</view>
|
||||
<!-- 助记词 -->
|
||||
<view class="mnemonic">
|
||||
<view
|
||||
class="item"
|
||||
v-for="(item, index) in validation"
|
||||
:key="index"
|
||||
:class="item === null ? 'hide': ''"
|
||||
@click="onKeys('removeKey', index)"
|
||||
>{{ item }}</view>
|
||||
</view>
|
||||
<!-- 选择助记词 -->
|
||||
<block v-if="mnemonic.length > 0">
|
||||
<view class="mnemonic-title">
|
||||
按顺序填写助记词
|
||||
</view>
|
||||
<view class="mnemonic-select">
|
||||
<view class="item" v-for="(item, index) in mnemonic" :key="index" @click="onKeys('addKey', index)">{{ item }}</view>
|
||||
</view>
|
||||
</block>
|
||||
<!-- 按钮 -->
|
||||
<view class="buttons">
|
||||
<button type="default" @click="verifyMnemonic">验证</button>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { hash } from "../../apis/interfaces/wallet"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
validation : new Array(12).fill(null), // 验证key
|
||||
mnemonic : [], // 助记词key
|
||||
sign : '', // 助记词校验签名
|
||||
seedString : '', // 助记词原词
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
let seed = this.$Route.query.seed.split(',')
|
||||
seed.sort(() => {
|
||||
return Math.random() - .5
|
||||
});
|
||||
console.log(seed)
|
||||
// this.mnemonic = seed
|
||||
// this.sign = this.$Route.query.sign
|
||||
// this.seedString = this.$Route.query.seed
|
||||
},
|
||||
methods: {
|
||||
// 填写助记词
|
||||
onKeys(type, index){
|
||||
if(type === 'addKey') {
|
||||
this.$set(this.validation, this.validation.findIndex(val => val === null), this.mnemonic[index])
|
||||
this.$delete(this.mnemonic, index)
|
||||
return
|
||||
}
|
||||
if(type === 'removeKey' && this.validation[index] !== null) {
|
||||
this.mnemonic.push(this.validation[index])
|
||||
this.$delete(this.validation, index)
|
||||
this.validation.push(null)
|
||||
}
|
||||
},
|
||||
// 验证助记词
|
||||
verifyMnemonic(){
|
||||
if(this.validation.findIndex(val => val === null) > -1){
|
||||
uni.showToast({
|
||||
title: '请完整填写助记词',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
let seed = this.validation.toString().replace(/,/g, ',')
|
||||
if (this.seedString !== seed) {
|
||||
uni.showToast({
|
||||
title: '验证失败,请确认您的助记词',
|
||||
icon : 'none'
|
||||
})
|
||||
return
|
||||
}
|
||||
uni.redirectTo({
|
||||
url: './create'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
// 提示信息
|
||||
.prompt{
|
||||
color: $text-gray;
|
||||
text-align: center;
|
||||
line-height: 90rpx;
|
||||
font-size: $title-size-m;
|
||||
}
|
||||
// 选择助记词
|
||||
.mnemonic-title{
|
||||
padding-top: $padding * 2;
|
||||
margin: 0 $margin * 2;
|
||||
font-size: $title-size-m;
|
||||
color: $main-color;
|
||||
}
|
||||
.mnemonic-select{
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
padding: $padding $padding + $padding / 2;
|
||||
.item{
|
||||
background-color: white;
|
||||
line-height: 68rpx;
|
||||
height: 68rpx;
|
||||
width: 68rpx;
|
||||
text-align: center;
|
||||
margin: $margin / 2;
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
}
|
||||
}
|
||||
// 助记词
|
||||
.mnemonic{
|
||||
margin: $margin ($margin * 2);
|
||||
border-radius: $radius-m;
|
||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
||||
background-color: white;
|
||||
padding: $padding;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
.item{
|
||||
background: rgba($color: $border-color, $alpha: .4);
|
||||
min-width: 58rpx;
|
||||
height: 58rpx;
|
||||
line-height: 58rpx;
|
||||
text-align: center;
|
||||
color: $text-color;
|
||||
margin: $margin / 2;
|
||||
&.hide{
|
||||
border:dashed 1px $border-color;
|
||||
box-sizing: border-box;
|
||||
background-color: white;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 按钮
|
||||
.buttons{
|
||||
padding: $padding $padding * 2;
|
||||
.text{
|
||||
text-align: center;
|
||||
margin-bottom: $margin * 2;
|
||||
font-size: $title-size-lg;
|
||||
color: $text-price;
|
||||
}
|
||||
button{
|
||||
height: 90rpx;
|
||||
line-height: 90rpx;
|
||||
background-color: $main-color;
|
||||
border-radius: $radius-lg;
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
font-size: $title-size;
|
||||
&[disabled]{
|
||||
background: rgba($color: $main-color, $alpha: .8);
|
||||
}
|
||||
}
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user