[消息中心图片处理]
13
pages.json
@@ -173,22 +173,13 @@
|
|||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
"path": "pages/wallet/extract",
|
"path": "pages/wallet/extract",
|
||||||
|
"name": "Extract",
|
||||||
"style": {
|
"style": {
|
||||||
"navigationBarTitleText": "提现能量",
|
"navigationBarTitleText": "提现能量",
|
||||||
"enablePullDownRefresh": false,
|
"enablePullDownRefresh": false,
|
||||||
"navigationBarBackgroundColor": "#774ffd",
|
"navigationBarBackgroundColor": "#774ffd",
|
||||||
"navigationBarTextStyle": "white"
|
"navigationBarTextStyle": "white"
|
||||||
},
|
}
|
||||||
"name": "Extract"
|
|
||||||
}, {
|
|
||||||
"path": "pages/wallet/resetPassword",
|
|
||||||
"style": {
|
|
||||||
"navigationBarTitleText": "重置密码",
|
|
||||||
"enablePullDownRefresh": false,
|
|
||||||
"navigationBarBackgroundColor": "#774ffd",
|
|
||||||
"navigationBarTextStyle": "white"
|
|
||||||
},
|
|
||||||
"name": "ResetPassword"
|
|
||||||
},{
|
},{
|
||||||
"path": "pages/verification/index",
|
"path": "pages/verification/index",
|
||||||
"name": "verificationIndex",
|
"name": "verificationIndex",
|
||||||
|
|||||||
263
pages/login/guide.vue
Normal file
@@ -0,0 +1,263 @@
|
|||||||
|
<template>
|
||||||
|
<view class="content">
|
||||||
|
<!-- <view class="title">易品新境</view> -->
|
||||||
|
<view class="login-top">
|
||||||
|
<view class="top-logo-content">
|
||||||
|
<image class="top-logo" fit="contain" src="/static/imgs/top_logo.png" />
|
||||||
|
链商星球(中国)
|
||||||
|
</view>
|
||||||
|
<image class="top-bg" fit="contain" src="/static/imgs/top_bg.png" />
|
||||||
|
</view>
|
||||||
|
<!-- 输入手机号相关 -->
|
||||||
|
<view class="inputs phone">
|
||||||
|
<label class="label">+86</label>
|
||||||
|
<input type="number" placeholder="输入您的手机号码" v-model="phone" />
|
||||||
|
</view>
|
||||||
|
<view class="inputs sms">
|
||||||
|
<input type="number" placeholder="输入短信验证码" v-model="code" />
|
||||||
|
<button class="sms-btn" type="default" size="mini" :disabled="phone == '' || getSms"
|
||||||
|
@click="getPhoneCode">{{getSms ? '重新发送' + smsTime + 's': '发送验证码'}}</button>
|
||||||
|
</view>
|
||||||
|
<button class="btn" type="default" :disabled="phone == '' || code == ''" @click="login">登录</button>
|
||||||
|
<!-- 快捷登录 -->
|
||||||
|
<view class="quick">
|
||||||
|
<view class="quick-title">快捷登录</view>
|
||||||
|
<view class="quick-box">
|
||||||
|
<image class="quick-icon" src="@/static/icons/wechat.png" mode="widthFix"></image>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
<!-- 用户登录注册协议 -->
|
||||||
|
<view class="agreement">未注册的手机号验证后将自动创建账号,登录即表示同意接收<navigator url="">用户隐私规格</navigator>和<navigator url="">用户服务协议
|
||||||
|
</navigator>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {
|
||||||
|
getSms,
|
||||||
|
smsAuth
|
||||||
|
} from '@/apis/interfaces/auth'
|
||||||
|
export default {
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
phone: "18245180131",
|
||||||
|
code: "",
|
||||||
|
smsTime: 60,
|
||||||
|
getSms: false
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 用户登录
|
||||||
|
login() {
|
||||||
|
smsAuth({
|
||||||
|
mobileNo: this.phone,
|
||||||
|
code: this.code
|
||||||
|
}).then(res => {
|
||||||
|
this.$store.commit('setToken', res.token_type + ' ' + res.access_token)
|
||||||
|
this.$Router.back()
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
},
|
||||||
|
// 获取验证码
|
||||||
|
getPhoneCode() {
|
||||||
|
let outTime
|
||||||
|
getSms({
|
||||||
|
mobileNo: this.phone
|
||||||
|
}).then(res => {
|
||||||
|
uni.showToast({
|
||||||
|
title: res,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
this.getSms = true
|
||||||
|
outTime = setInterval(() => {
|
||||||
|
if (this.smsTime <= 1) {
|
||||||
|
this.getSms = false
|
||||||
|
this.smsTime = 60
|
||||||
|
clearInterval('outTime')
|
||||||
|
}
|
||||||
|
this.smsTime -= 1
|
||||||
|
}, 1000)
|
||||||
|
}).catch(err => {
|
||||||
|
uni.showToast({
|
||||||
|
title: err.message,
|
||||||
|
icon: "none"
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.content {
|
||||||
|
height: 100vh;
|
||||||
|
width: 100vw;
|
||||||
|
padding: $padding * 3;
|
||||||
|
box-sizing: border-box;
|
||||||
|
background: white;
|
||||||
|
|
||||||
|
.login-top {
|
||||||
|
height: 36vh;
|
||||||
|
width: 100%;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
|
padding-bottom: 160rpx;
|
||||||
|
|
||||||
|
.top-bg {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 30rpx;
|
||||||
|
// left: 2rpx;
|
||||||
|
z-index: 2;
|
||||||
|
width: 740rpx;
|
||||||
|
margin-left: 40rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.top-logo-content {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
box-sizing: border-box;
|
||||||
|
color: #7f56a4;
|
||||||
|
font-size: 18px;
|
||||||
|
|
||||||
|
.top-logo {
|
||||||
|
margin-bottom: 20rpx;
|
||||||
|
width: 240rpx;
|
||||||
|
height: 240rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.inputs {
|
||||||
|
background:rgba($color: $mian-color, $alpha: 0.05);
|
||||||
|
border: solid 1rpx $border-color;
|
||||||
|
position: relative;
|
||||||
|
margin-top: $margin;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
|
||||||
|
input {
|
||||||
|
width: 100%;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
padding: 0 $padding;
|
||||||
|
border: none;
|
||||||
|
box-sizing: border-box;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.phone {
|
||||||
|
padding-left: 120rpx;
|
||||||
|
|
||||||
|
.label {
|
||||||
|
position: absolute;
|
||||||
|
left: 0;
|
||||||
|
top: 0;
|
||||||
|
width: 120rpx;
|
||||||
|
text-align: center;
|
||||||
|
border-right: solid 1rpx $border-color;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&.sms {
|
||||||
|
padding-right: 200rpx;
|
||||||
|
|
||||||
|
.sms-btn[size='mini'] {
|
||||||
|
width: 200rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
line-height: 80rpx;
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
padding: 0;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: 0;
|
||||||
|
border-left: solid 1rpx $border-color;
|
||||||
|
color: $text-price;
|
||||||
|
font-size: $title-size-lg;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
color: rgba($color: $text-price, $alpha: .6);
|
||||||
|
background: $border-color-lg;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
text-align: center;
|
||||||
|
font-size: $title-size + 6;
|
||||||
|
font-weight: bold;
|
||||||
|
color: $text-color;
|
||||||
|
margin-bottom: 100rpx;
|
||||||
|
}
|
||||||
|
|
||||||
|
.btn {
|
||||||
|
background: $mian-color;
|
||||||
|
color: white;
|
||||||
|
border-radius: 0;
|
||||||
|
margin-top: $margin;
|
||||||
|
font-size: $title-size;
|
||||||
|
line-height: 90rpx;
|
||||||
|
height: 90rpx;
|
||||||
|
font-weight: bold;
|
||||||
|
|
||||||
|
&::after {
|
||||||
|
border: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
&[disabled] {
|
||||||
|
background: rgba($color: $mian-color, $alpha: .6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick {
|
||||||
|
padding-top: $padding * 3;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
.quick-title {
|
||||||
|
text-align: center;
|
||||||
|
color: $text-gray;
|
||||||
|
font-size: $title-size-sm;
|
||||||
|
padding-bottom: $padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.quick-box {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
.quick-icon {
|
||||||
|
width: 78rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.agreement {
|
||||||
|
padding-top: $padding * 2;
|
||||||
|
font-size: $title-size-sm;
|
||||||
|
color: $text-gray;
|
||||||
|
|
||||||
|
navigator {
|
||||||
|
color: $text-price;
|
||||||
|
display: inline-block;
|
||||||
|
padding: 0 10rpx;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -249,7 +249,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
.agreement {
|
.agreement {
|
||||||
padding-top: $padding * 4;
|
padding-top: $padding * 2;
|
||||||
font-size: $title-size-sm;
|
font-size: $title-size-sm;
|
||||||
color: $text-gray;
|
color: $text-gray;
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<view class="item" v-for="(item,index) in items" :key="index" v-if="items.length>0"
|
<view class="item" v-for="(item,index) in items" :key="index" v-if="items.length>0"
|
||||||
@click="item.read_at === ''?read(index,item):noread(item)">
|
@click="item.read_at === ''?read(index,item):noread(item)">
|
||||||
<view class="top">
|
<view class="top">
|
||||||
<image src="/static/images/news_2_1.png" mode="widthFix"></image>
|
<image src="/static/imgs/news_2_1.png" mode="widthFix" />
|
||||||
<!-- <image v-if="index===1" src="/static/img/news_1_1.png" mode="widthFix"></image>
|
<!-- <image v-if="index===1" src="/static/img/news_1_1.png" mode="widthFix"></image>
|
||||||
<image v-if="index===2" src="/static/img/news_3_1.png" mode="widthFix"></image> -->
|
<image v-if="index===2" src="/static/img/news_3_1.png" mode="widthFix"></image> -->
|
||||||
<view :style="item.read_at=== '' ?'flex:1;':'flex:1;color:#808080;'">{{item.title}}</view>
|
<view :style="item.read_at=== '' ?'flex:1;':'flex:1;color:#808080;'">{{item.title}}</view>
|
||||||
|
|||||||
@@ -1,65 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="content webkit-box">
|
|
||||||
<!-- logo -->
|
|
||||||
<image class="logo" src="@/static/img/oc-logo.png" mode="widthFix"></image>
|
|
||||||
<!-- 副标题 -->
|
|
||||||
<view class="sub-title">激活您的OC Chain区块链钱包地址。</br>地址可以理解为您的个人银行卡卡号,与他人转账时是区块链上两个地址的交易行为</view>
|
|
||||||
<!-- 按钮 -->
|
|
||||||
<navigator class="wallet-btn" url="./mnemonic" open-type="redirect">激活钱包</navigator>
|
|
||||||
<!-- <navigator class="wallet-btn hollow" url="./guide">导入钱包</navigator> -->
|
|
||||||
</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: 30vh;
|
|
||||||
}
|
|
||||||
.sub-title{
|
|
||||||
font-size: $title-size-m;
|
|
||||||
color: $text-gray;
|
|
||||||
}
|
|
||||||
.wallet-btn{
|
|
||||||
width: 100%;
|
|
||||||
background-color: $mian-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: $mian-color;
|
|
||||||
border:solid 2rpx $mian-color;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,136 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="webkit-box code">
|
|
||||||
<view class="webkit-box code-content">
|
|
||||||
<view class="sub-title">扫码转入OC COIN</view>
|
|
||||||
<view class="code-img">
|
|
||||||
<image :src="code" mode="widthFix" />
|
|
||||||
</view>
|
|
||||||
<view class="hr"></view>
|
|
||||||
<view class="sub-title">钱包地址</view>
|
|
||||||
<view class="hash">{{address || '-'}}</view>
|
|
||||||
<view class="buttons">
|
|
||||||
<button class="item red" type="default" @click="showShare()">分享</button>
|
|
||||||
<button class="item greed" type="default" @click="copyAddress">复制</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="footer">OC CHNIA</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { code } from '@/apis/interfaces/wallet'
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
address: '',
|
|
||||||
code: ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
code().then(res=>{
|
|
||||||
this.code = res.image
|
|
||||||
this.address = res.address
|
|
||||||
}).catch(err=>{
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: err.message
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods:{
|
|
||||||
copyAddress(){
|
|
||||||
uni.setClipboardData({
|
|
||||||
data: this.address
|
|
||||||
})
|
|
||||||
},
|
|
||||||
showShare(){
|
|
||||||
uni.share({
|
|
||||||
provider: 'weixin',
|
|
||||||
title: '我正在使用ocChain钱包收款',
|
|
||||||
scene: 'WXSceneSession',
|
|
||||||
href: 'https://live.funnyzhibo.com/blockdownload',
|
|
||||||
imageUrl: 'https://live.funnyzhibo.com/oc-chain.png',
|
|
||||||
summary: '我的收款地址' + this.address
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.code{
|
|
||||||
height: 100vh;
|
|
||||||
background:linear-gradient(to bottom, $mian-color, $mian-color-deep);
|
|
||||||
padding-bottom: env(safe-area-inset-bottom);
|
|
||||||
padding-bottom: constant(safe-area-inset-bottom);
|
|
||||||
box-sizing: border-box;
|
|
||||||
// 收款码
|
|
||||||
.code-content{
|
|
||||||
text-align: center;
|
|
||||||
background: white;
|
|
||||||
margin: 0 8vw;
|
|
||||||
border-radius: $radius;
|
|
||||||
padding: $padding * 2;
|
|
||||||
height: 70vh;
|
|
||||||
box-shadow: 0 0 6rpx 6rpx rgba($color: #000000, $alpha: .02);
|
|
||||||
box-sizing: border-box;
|
|
||||||
.sub-title{
|
|
||||||
font-size: $title-size + 8;
|
|
||||||
}
|
|
||||||
.code-img{
|
|
||||||
width: 20vh;
|
|
||||||
height: 20vh;
|
|
||||||
margin: $margin * 3 0 $margin * 2;
|
|
||||||
display: inline-block;
|
|
||||||
background-image: url(../../static/background/wallet-code-background.png);
|
|
||||||
padding: $padding;
|
|
||||||
box-sizing: border-box;
|
|
||||||
background-position: center;
|
|
||||||
background-size: cover;
|
|
||||||
image{
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.hr{
|
|
||||||
height: 1rpx;
|
|
||||||
background: $border-color;
|
|
||||||
margin: $margin * 2 0;
|
|
||||||
}
|
|
||||||
.hash{
|
|
||||||
word-wrap: break-word;
|
|
||||||
font-size: $title-size;
|
|
||||||
padding: $padding 0;
|
|
||||||
}
|
|
||||||
.buttons{
|
|
||||||
display: flex;
|
|
||||||
padding-top: $padding * 2;
|
|
||||||
.item{
|
|
||||||
width: 40%;
|
|
||||||
height: 80rpx;
|
|
||||||
line-height: 80rpx;
|
|
||||||
border-radius: 40rpx;
|
|
||||||
font-size: $title-size;
|
|
||||||
color: white;
|
|
||||||
&::after{
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
&.red{
|
|
||||||
background: $red-color;
|
|
||||||
}
|
|
||||||
&.greed{
|
|
||||||
background: $mian-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 底部
|
|
||||||
.footer{
|
|
||||||
height: 10vh;
|
|
||||||
line-height: 10vh;
|
|
||||||
text-align: center;
|
|
||||||
font-size: $title-size + 10;
|
|
||||||
font-weight: bold;
|
|
||||||
color: #58876e;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
<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" placeholder="请设置密码" />
|
|
||||||
</view>
|
|
||||||
<view class="inputs">
|
|
||||||
<label>确认密码</label>
|
|
||||||
<input type="digit" 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: this.password
|
|
||||||
}).then(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>
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<form>
|
|
||||||
<!-- 副标题 -->
|
|
||||||
<view class="sub-title">输入您的钱包助记词导入</view>
|
|
||||||
<!-- 助记词 -->
|
|
||||||
<view class="word">
|
|
||||||
<textarea placeholder="输入助记词"></textarea>
|
|
||||||
</view>
|
|
||||||
<!-- 设置钱包密码 -->
|
|
||||||
<view class="password">
|
|
||||||
<view class="group">
|
|
||||||
<view class="inputs">
|
|
||||||
<label>钱包名称</label>
|
|
||||||
<input type="text" placeholder="输入钱包名称" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="title">不少于8个字符。建议包含大小写,符号,特殊字符。</view>
|
|
||||||
<view class="group">
|
|
||||||
<view class="inputs">
|
|
||||||
<label>密码</label>
|
|
||||||
<input type="password" placeholder="请设置密码" />
|
|
||||||
</view>
|
|
||||||
<view class="inputs">
|
|
||||||
<label>确认密码</label>
|
|
||||||
<input type="password" placeholder="请确认密码" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 按钮 -->
|
|
||||||
<view class="buttons">
|
|
||||||
<view class="text">什么是助记词?</view>
|
|
||||||
<button type="default" form-type="submit">开始导入</button>
|
|
||||||
</view>
|
|
||||||
</form>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
// 副标题
|
|
||||||
.sub-title{
|
|
||||||
line-height: 90rpx;
|
|
||||||
color: $text-gray;
|
|
||||||
text-align: center;
|
|
||||||
margin: $margin;
|
|
||||||
font-size: $title-size-m;
|
|
||||||
}
|
|
||||||
// 助记词
|
|
||||||
.word{
|
|
||||||
background-color: white;
|
|
||||||
margin: $margin * 2;
|
|
||||||
padding: $padding + 10;
|
|
||||||
border-radius: $radius-m;
|
|
||||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
|
||||||
& textarea{
|
|
||||||
height: 200rpx;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 设置密码
|
|
||||||
.password{
|
|
||||||
padding: 0 $padding * 2;
|
|
||||||
.title{
|
|
||||||
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>
|
|
||||||
@@ -1,144 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view class="animate__animated animate__fadeInRight">
|
|
||||||
<!-- 数字资产 -->
|
|
||||||
<view class="property">
|
|
||||||
<view class="title">总资产(元)</view>
|
|
||||||
<view class="number">0.00</view>
|
|
||||||
</view>
|
|
||||||
<!-- 资产列表 -->
|
|
||||||
<view class="lists">
|
|
||||||
<view class="lists-header">
|
|
||||||
资产列表
|
|
||||||
<uni-icons type="plus" size="24" color="#aa55ff"></uni-icons>
|
|
||||||
</view>
|
|
||||||
<view class="item" v-for="(item, index) in 2" :key="index" @click="propertyInfo(item)">
|
|
||||||
<view class="cost">
|
|
||||||
<image class="logo" src="" mode="" />
|
|
||||||
<view class="title ellipsis">OC COIN</view>
|
|
||||||
<view class="text ellipsis">≈¥0.21</view>
|
|
||||||
</view>
|
|
||||||
<view class="balance">
|
|
||||||
<view class="title ellipsis">120,330.00</view>
|
|
||||||
<view class="text ellipsis">¥25269.3000</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
|
|
||||||
};
|
|
||||||
},
|
|
||||||
methods:{
|
|
||||||
propertyInfo(e){
|
|
||||||
console.log(e)
|
|
||||||
uni.navigateTo({
|
|
||||||
url: './property'
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
// 数字资产
|
|
||||||
.property{
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
margin-top: $margin;
|
|
||||||
margin-left: $margin + ($margin / 2);
|
|
||||||
background-color: $mian-color;
|
|
||||||
border-radius: $radius 0 0 $radius;
|
|
||||||
padding: ($padding * 3) ($padding * 3) ($padding * 3) ($padding * 2);
|
|
||||||
color: white;
|
|
||||||
font-weight: bold;
|
|
||||||
&::before,&::after{
|
|
||||||
background-color: rgba($color: $red-color, $alpha: .03);
|
|
||||||
border-radius: 50%;
|
|
||||||
content: " ";
|
|
||||||
position: absolute;
|
|
||||||
}
|
|
||||||
&::before{
|
|
||||||
top: -300rpx;
|
|
||||||
left: 40%;
|
|
||||||
height: 400rpx;
|
|
||||||
width: 400rpx;
|
|
||||||
}
|
|
||||||
&::after{
|
|
||||||
bottom: -200rpx;
|
|
||||||
left: -100rpx;
|
|
||||||
height: 300rpx;
|
|
||||||
width: 300rpx;
|
|
||||||
}
|
|
||||||
.title{
|
|
||||||
font-size: $title-size;
|
|
||||||
}
|
|
||||||
.number{
|
|
||||||
font-size: $title-size + 18;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 资产列表
|
|
||||||
.lists{
|
|
||||||
padding: $margin + ($margin / 2);
|
|
||||||
.lists-header{
|
|
||||||
display: flex;
|
|
||||||
font-size: $title-size + 2;
|
|
||||||
color: $text-color;
|
|
||||||
font-weight: bold;
|
|
||||||
padding: $padding 0 ($padding/2) 0;
|
|
||||||
justify-content: space-between;
|
|
||||||
justify-items: center;
|
|
||||||
align-items: center;
|
|
||||||
}
|
|
||||||
.item{
|
|
||||||
background-color: white;
|
|
||||||
border-radius: $radius;
|
|
||||||
box-shadow: 0 0 4rpx 4rpx rgba($color: #000000, $alpha: .02);
|
|
||||||
margin-top: $margin;
|
|
||||||
padding: $padding * 2;
|
|
||||||
display: flex;
|
|
||||||
&:first-child{
|
|
||||||
margin-top: 0;
|
|
||||||
}
|
|
||||||
.cost{
|
|
||||||
position: relative;
|
|
||||||
margin-right: $margin;
|
|
||||||
padding-left: 108rpx;
|
|
||||||
width: 50%;
|
|
||||||
box-sizing: border-box;
|
|
||||||
.logo{
|
|
||||||
position: absolute;
|
|
||||||
left: 0;
|
|
||||||
top: 0;
|
|
||||||
width: 88rpx;
|
|
||||||
height: 88rpx;
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: $border-color;
|
|
||||||
margin-right: $margin;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.balance{
|
|
||||||
padding-left: $padding;
|
|
||||||
width: 50%;
|
|
||||||
text-align: right;
|
|
||||||
box-sizing: border-box;
|
|
||||||
}
|
|
||||||
.title{
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: $title-size;
|
|
||||||
}
|
|
||||||
.text{
|
|
||||||
font-size: $title-size-m;
|
|
||||||
color: $text-gray;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
<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('/pages/wallet/validation')">验证助记词</button>
|
|
||||||
</view>
|
|
||||||
<!-- <view class="skip">暂时不验证?<navigator url="/pages/index/index" open-type="switchTab">点此跳过</navigator></view> -->
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { seed } from "../../apis/interfaces/wallet"
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
mnemonic: [], // 助记词
|
|
||||||
sign : '' // 校验签名
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad() {
|
|
||||||
seed().then(res => {
|
|
||||||
this.mnemonic = res.seed.split(' ')
|
|
||||||
this.sign = res.sign
|
|
||||||
}).catch(err => {
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: err.message
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
goto(url){
|
|
||||||
uni.redirectTo({
|
|
||||||
url: url + '?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: $mian-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;
|
|
||||||
line-height: 58rpx;
|
|
||||||
width: 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-lg;
|
|
||||||
color: $red-color;
|
|
||||||
}
|
|
||||||
button{
|
|
||||||
height: 90rpx;
|
|
||||||
line-height: 90rpx;
|
|
||||||
background-color: $mian-color;
|
|
||||||
border-radius: $radius-lg;
|
|
||||||
color: white;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: $title-size;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,108 +0,0 @@
|
|||||||
<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>
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
<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>
|
|
||||||
@@ -1,77 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<view class="webkit-box results">
|
|
||||||
<uni-icons type="checkbox-filled" size="88" color="#009b69"></uni-icons>
|
|
||||||
<view class="title">交易已提交</view>
|
|
||||||
<view class="sub-title">预计10秒内到账,可在交易记录中查询,以实际到账时间为准</view>
|
|
||||||
<view class="hash">
|
|
||||||
<view class="hash-title">交易哈希</view>
|
|
||||||
<view class="hash-text">{{hash}}</view>
|
|
||||||
</view>
|
|
||||||
<button class="results-button" type="default" @click="navBack">返回</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
hash: ''
|
|
||||||
};
|
|
||||||
},
|
|
||||||
onLoad(e){
|
|
||||||
this.hash = e.hash
|
|
||||||
},
|
|
||||||
methods:{
|
|
||||||
navBack(){
|
|
||||||
uni.navigateBack()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
.results{
|
|
||||||
height: 100vh;
|
|
||||||
box-sizing: border-box;
|
|
||||||
text-align: center;
|
|
||||||
padding-left: $padding * 3;
|
|
||||||
padding-right: $padding * 3;
|
|
||||||
padding-bottom: 20vh;
|
|
||||||
.title{
|
|
||||||
font-size: $title-size + 8;
|
|
||||||
color: $text-color;
|
|
||||||
font-weight: bold;
|
|
||||||
line-height: 80rpx;
|
|
||||||
padding: $padding 0;
|
|
||||||
}
|
|
||||||
.sub-title{
|
|
||||||
color: $text-gray;
|
|
||||||
line-height: 40rpx;
|
|
||||||
}
|
|
||||||
.hash{
|
|
||||||
background-color: white;
|
|
||||||
padding: $padding * 2;
|
|
||||||
border-radius: $radius-lg;
|
|
||||||
margin-top: $margin * 2;
|
|
||||||
font-size: $title-size;
|
|
||||||
color: $text-color;
|
|
||||||
.hash-title{
|
|
||||||
padding-bottom: $padding;
|
|
||||||
}
|
|
||||||
.hash-text{
|
|
||||||
word-break:break-all;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.results-button{
|
|
||||||
margin-top: $margin * 3;
|
|
||||||
height: 90rpx;
|
|
||||||
line-height: 90rpx;
|
|
||||||
background-color: $mian-color;
|
|
||||||
color: white;
|
|
||||||
font-size: $title-size;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
@@ -1,216 +0,0 @@
|
|||||||
<template>
|
|
||||||
<view>
|
|
||||||
<!-- 账户余额 -->
|
|
||||||
<view class="transfer-block">
|
|
||||||
<view class="unit">OCC</view>
|
|
||||||
<view class="transfer-flex">
|
|
||||||
<view class="item ellipsis">
|
|
||||||
<label>数量</label>{{balance.balance || '0.00'}}
|
|
||||||
</view>
|
|
||||||
<view class="item ellipsis">
|
|
||||||
<label>估值(CNY)</label>≈{{cny || '0.00'}}
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="sub-title">
|
|
||||||
<text>请认真确认地址及数量,地址错误无法找回</text>
|
|
||||||
</view>
|
|
||||||
<!-- 转账信息 -->
|
|
||||||
<view class="password">
|
|
||||||
<view class="group">
|
|
||||||
<view class="inputs input-scan">
|
|
||||||
<label>接收地址</label>
|
|
||||||
<input type="text" placeholder="请输入接收地址" v-model="address" />
|
|
||||||
<view class="input-scan-icon" @click="scanCode">
|
|
||||||
<uni-icons type="scan" size="22" color="#009b69"></uni-icons>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="inputs">
|
|
||||||
<label>转账数量</label>
|
|
||||||
<input type="number" placeholder="请输入转账数量" v-model="number" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<view class="group">
|
|
||||||
<view class="inputs">
|
|
||||||
<label>交易密码</label>
|
|
||||||
<input type="password" placeholder="请输入安全密码" v-model="password" />
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
<!-- 按钮 -->
|
|
||||||
<view class="buttons">
|
|
||||||
<button type="default" @click="submitTransfer">转账</button>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
import { sum, price, transfer } from '@/apis/interfaces/wallet'
|
|
||||||
export default {
|
|
||||||
data() {
|
|
||||||
return {
|
|
||||||
balance: {},
|
|
||||||
cny: '0.00',
|
|
||||||
address: '',
|
|
||||||
number: '',
|
|
||||||
password: ''
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(e){
|
|
||||||
if(e.hashAddress) this.address = e.hashAddress
|
|
||||||
},
|
|
||||||
mounted() {
|
|
||||||
Promise.all([
|
|
||||||
sum(),
|
|
||||||
price()
|
|
||||||
]).then(res => {
|
|
||||||
this.balance = res[0]
|
|
||||||
if (res[0].balance > 0) this.cny = (res[1] * res[0].balance).toFixed(2)
|
|
||||||
}).catch(err => {
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: err.message
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
// 转账
|
|
||||||
submitTransfer(){
|
|
||||||
if(this.address === '' || this.number === '' || this.password === ''){
|
|
||||||
let messageText
|
|
||||||
if(this.address === '') messageText = '请输入接收地址'
|
|
||||||
else if(this.number === '') messageText = '请输入转账数量'
|
|
||||||
else if(this.password === '') messageText = '请输入安全密码'
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: messageText
|
|
||||||
})
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// 提交转账信息
|
|
||||||
transfer({
|
|
||||||
to: this.address,
|
|
||||||
amount: this.number,
|
|
||||||
security_code: this.password
|
|
||||||
}).then(res => {
|
|
||||||
uni.redirectTo({
|
|
||||||
url: './results?hash=' + res.txHash + '&number=' + this.number
|
|
||||||
})
|
|
||||||
}).catch(err => {
|
|
||||||
uni.showToast({
|
|
||||||
icon: 'none',
|
|
||||||
title: err.message
|
|
||||||
})
|
|
||||||
})
|
|
||||||
},
|
|
||||||
// 扫码
|
|
||||||
scanCode(){
|
|
||||||
uni.scanCode({
|
|
||||||
scanType: ['qrCode'],
|
|
||||||
success: res=> {
|
|
||||||
this.address = res.result
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
|
||||||
// 账户余额
|
|
||||||
.transfer-block{
|
|
||||||
background-color: white;
|
|
||||||
margin: $margin * 2;
|
|
||||||
border-radius: $radius-m;
|
|
||||||
box-shadow: 0 0 4rpx 4rpx rgba($color: $text-color, $alpha: .02);
|
|
||||||
background-color: white;
|
|
||||||
padding: $padding $padding + 10;
|
|
||||||
.unit{
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: $title-size + 10;
|
|
||||||
line-height: 90rpx;
|
|
||||||
color: $text-color;
|
|
||||||
}
|
|
||||||
.transfer-flex{
|
|
||||||
display: flex;
|
|
||||||
padding: $padding 0;
|
|
||||||
border-top: solid 1rpx $border-color;
|
|
||||||
.item{
|
|
||||||
width: 50%;
|
|
||||||
font-size: $title-size-m;
|
|
||||||
& > label{
|
|
||||||
color: $text-gray;
|
|
||||||
padding-right: $padding/2;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 提示信息
|
|
||||||
.sub-title{
|
|
||||||
color: $text-gray;
|
|
||||||
text-align: center;
|
|
||||||
margin: $margin * 2 $margin;
|
|
||||||
font-size: $title-size-m;
|
|
||||||
}
|
|
||||||
// 转账信息
|
|
||||||
.password{
|
|
||||||
padding: 0 $padding * 2;
|
|
||||||
.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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.input-scan{
|
|
||||||
position: relative;
|
|
||||||
padding-right: ($padding*2) + 70;
|
|
||||||
.input-scan-icon{
|
|
||||||
position: absolute;
|
|
||||||
bottom: $padding;
|
|
||||||
right: $padding;
|
|
||||||
height: 70rpx;
|
|
||||||
width: 70rpx;
|
|
||||||
line-height: 70rpx;
|
|
||||||
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: $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>
|
|
||||||
@@ -1,169 +0,0 @@
|
|||||||
<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(15).fill(null), // 验证key
|
|
||||||
mnemonic : [], // 助记词key
|
|
||||||
sign : '', // 助记词校验签名
|
|
||||||
seedString : '', // 助记词原词
|
|
||||||
}
|
|
||||||
},
|
|
||||||
onLoad(e) {
|
|
||||||
let seed = e.seed.split(',')
|
|
||||||
seed.sort(() => {
|
|
||||||
return Math.random() - .5
|
|
||||||
});
|
|
||||||
this.mnemonic = seed
|
|
||||||
this.sign = e.sign
|
|
||||||
this.seedString = e.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: $mian-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);
|
|
||||||
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: $red-color;
|
|
||||||
}
|
|
||||||
button{
|
|
||||||
height: 90rpx;
|
|
||||||
line-height: 90rpx;
|
|
||||||
background-color: $mian-color;
|
|
||||||
border-radius: $radius-lg;
|
|
||||||
color: white;
|
|
||||||
font-weight: bold;
|
|
||||||
font-size: $title-size;
|
|
||||||
&[disabled]{
|
|
||||||
background: rgba($color: $mian-color, $alpha: .8);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
|
Before Width: | Height: | Size: 2.7 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 2.8 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 569 B After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 3.4 KiB After Width: | Height: | Size: 11 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.5 KiB |
22
uni_modules/uni-badge/changelog.md
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
## 1.1.6(2021-09-22)
|
||||||
|
- 修复 在字节小程序上样式不生效的 bug
|
||||||
|
## 1.1.5(2021-07-30)
|
||||||
|
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
|
||||||
|
## 1.1.4(2021-07-29)
|
||||||
|
- 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性
|
||||||
|
## 1.1.3(2021-06-24)
|
||||||
|
- 优化 示例项目
|
||||||
|
## 1.1.1(2021-05-12)
|
||||||
|
- 新增 组件示例地址
|
||||||
|
## 1.1.0(2021-05-12)
|
||||||
|
- 新增 uni-badge 的 absolute 属性,支持定位
|
||||||
|
- 新增 uni-badge 的 offset 属性,支持定位偏移
|
||||||
|
- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点
|
||||||
|
- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+
|
||||||
|
- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式
|
||||||
|
## 1.0.7(2021-05-07)
|
||||||
|
- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug
|
||||||
|
- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug
|
||||||
|
- 新增 uni-badge 属性 custom-style, 支持自定义样式
|
||||||
|
## 1.0.6(2021-02-04)
|
||||||
|
- 调整为uni_modules目录规范
|
||||||
253
uni_modules/uni-badge/components/uni-badge/uni-badge.vue
Normal file
@@ -0,0 +1,253 @@
|
|||||||
|
<template>
|
||||||
|
<view class="uni-badge--x">
|
||||||
|
<slot />
|
||||||
|
<text v-if="text" :class="classNames" :style="[badgeWidth, positionStyle, customStyle, dotStyle]"
|
||||||
|
class="uni-badge"
|
||||||
|
@click="onClick()">{{displayValue}}</text>
|
||||||
|
</view>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
/**
|
||||||
|
* Badge 数字角标
|
||||||
|
* @description 数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景
|
||||||
|
* @tutorial https://ext.dcloud.net.cn/plugin?id=21
|
||||||
|
* @property {String} text 角标内容
|
||||||
|
* @property {String} type = [default|primary|success|warning|error] 颜色类型
|
||||||
|
* @value default 灰色
|
||||||
|
* @value primary 蓝色
|
||||||
|
* @value success 绿色
|
||||||
|
* @value warning 黄色
|
||||||
|
* @value error 红色
|
||||||
|
* @property {String} size = [normal|small] Badge 大小
|
||||||
|
* @value normal 一般尺寸
|
||||||
|
* @value small 小尺寸
|
||||||
|
* @property {String} inverted = [true|false] 是否无需背景颜色
|
||||||
|
* @event {Function} click 点击 Badge 触发事件
|
||||||
|
* @example <uni-badge text="1"></uni-badge>
|
||||||
|
*/
|
||||||
|
export default {
|
||||||
|
name: 'UniBadge',
|
||||||
|
emits:['click'],
|
||||||
|
props: {
|
||||||
|
type: {
|
||||||
|
type: String,
|
||||||
|
default: 'default'
|
||||||
|
},
|
||||||
|
inverted: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
isDot: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
|
maxNum: {
|
||||||
|
type: Number,
|
||||||
|
default: 99
|
||||||
|
},
|
||||||
|
absolute: {
|
||||||
|
type: String,
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
offset: {
|
||||||
|
type: Array,
|
||||||
|
default () {
|
||||||
|
return [0, 0]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
text: {
|
||||||
|
type: [String, Number],
|
||||||
|
default: ''
|
||||||
|
},
|
||||||
|
size: {
|
||||||
|
type: String,
|
||||||
|
default: 'normal'
|
||||||
|
},
|
||||||
|
customStyle: {
|
||||||
|
type: Object,
|
||||||
|
default () {
|
||||||
|
return {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
data() {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
width() {
|
||||||
|
return String(this.text).length * 8 + 12
|
||||||
|
},
|
||||||
|
classNames() {
|
||||||
|
const {
|
||||||
|
inverted,
|
||||||
|
type,
|
||||||
|
size,
|
||||||
|
absolute
|
||||||
|
} = this
|
||||||
|
return [
|
||||||
|
inverted ? 'uni-badge--' + type + '-inverted' : '',
|
||||||
|
'uni-badge--' + type,
|
||||||
|
'uni-badge--' + size,
|
||||||
|
absolute ? 'uni-badge--absolute' : ''
|
||||||
|
].join(' ')
|
||||||
|
},
|
||||||
|
positionStyle() {
|
||||||
|
if (!this.absolute) return {}
|
||||||
|
let w = this.width / 2,
|
||||||
|
h = 10
|
||||||
|
if (this.isDot) {
|
||||||
|
w = 5
|
||||||
|
h = 5
|
||||||
|
}
|
||||||
|
const x = `${- w + this.offset[0]}px`
|
||||||
|
const y = `${- h + this.offset[1]}px`
|
||||||
|
|
||||||
|
const whiteList = {
|
||||||
|
rightTop: {
|
||||||
|
right: x,
|
||||||
|
top: y
|
||||||
|
},
|
||||||
|
rightBottom: {
|
||||||
|
right: x,
|
||||||
|
bottom: y
|
||||||
|
},
|
||||||
|
leftBottom: {
|
||||||
|
left: x,
|
||||||
|
bottom: y
|
||||||
|
},
|
||||||
|
leftTop: {
|
||||||
|
left: x,
|
||||||
|
top: y
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const match = whiteList[this.absolute]
|
||||||
|
return match ? match : whiteList['rightTop']
|
||||||
|
},
|
||||||
|
badgeWidth() {
|
||||||
|
return {
|
||||||
|
width: `${this.width}px`
|
||||||
|
}
|
||||||
|
},
|
||||||
|
dotStyle() {
|
||||||
|
if (!this.isDot) return {}
|
||||||
|
return {
|
||||||
|
width: '10px',
|
||||||
|
height: '10px',
|
||||||
|
borderRadius: '10px'
|
||||||
|
}
|
||||||
|
},
|
||||||
|
displayValue() {
|
||||||
|
const { isDot, text, maxNum } = this
|
||||||
|
return isDot ? '' : (Number(text) > maxNum ? `${maxNum}+` : text)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onClick() {
|
||||||
|
this.$emit('click');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
$bage-size: 12px;
|
||||||
|
$bage-small: scale(0.8);
|
||||||
|
$bage-height: 20px;
|
||||||
|
|
||||||
|
.uni-badge--x {
|
||||||
|
/* #ifdef APP-NVUE */
|
||||||
|
// align-self: flex-start;
|
||||||
|
/* #endif */
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: inline-block;
|
||||||
|
/* #endif */
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--absolute {
|
||||||
|
position: absolute;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge {
|
||||||
|
/* #ifndef APP-NVUE */
|
||||||
|
display: flex;
|
||||||
|
overflow: hidden;
|
||||||
|
box-sizing: border-box;
|
||||||
|
/* #endif */
|
||||||
|
justify-content: center;
|
||||||
|
flex-direction: row;
|
||||||
|
height: $bage-height;
|
||||||
|
line-height: $bage-height;
|
||||||
|
color: $uni-text-color;
|
||||||
|
border-radius: 100px;
|
||||||
|
background-color: $uni-bg-color-hover;
|
||||||
|
background-color: transparent;
|
||||||
|
text-align: center;
|
||||||
|
font-family: 'Helvetica Neue', Helvetica, sans-serif;
|
||||||
|
font-size: $bage-size;
|
||||||
|
/* #ifdef H5 */
|
||||||
|
cursor: pointer;
|
||||||
|
/* #endif */
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--inverted {
|
||||||
|
padding: 0 5px 0 0;
|
||||||
|
color: $uni-bg-color-hover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--default {
|
||||||
|
color: $uni-text-color;
|
||||||
|
background-color: $uni-bg-color-hover;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--default-inverted {
|
||||||
|
color: $uni-text-color-grey;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--primary {
|
||||||
|
color: $uni-text-color-inverse;
|
||||||
|
background-color: $uni-color-primary;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--primary-inverted {
|
||||||
|
color: $uni-color-primary;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--success {
|
||||||
|
color: $uni-text-color-inverse;
|
||||||
|
background-color: $uni-color-success;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--success-inverted {
|
||||||
|
color: $uni-color-success;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--warning {
|
||||||
|
color: $uni-text-color-inverse;
|
||||||
|
background-color: $uni-color-warning;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--warning-inverted {
|
||||||
|
color: $uni-color-warning;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--error {
|
||||||
|
color: $uni-text-color-inverse;
|
||||||
|
background-color: $uni-color-error;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--error-inverted {
|
||||||
|
color: $uni-color-error;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uni-badge--small {
|
||||||
|
transform: $bage-small;
|
||||||
|
transform-origin: center center;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
88
uni_modules/uni-badge/package.json
Normal file
@@ -0,0 +1,88 @@
|
|||||||
|
{
|
||||||
|
"id": "uni-badge",
|
||||||
|
"displayName": "uni-badge 数字角标",
|
||||||
|
"version": "1.1.6",
|
||||||
|
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
|
||||||
|
"keywords": [
|
||||||
|
"",
|
||||||
|
"badge",
|
||||||
|
"uni-ui",
|
||||||
|
"uniui",
|
||||||
|
"数字角标",
|
||||||
|
"徽章"
|
||||||
|
],
|
||||||
|
"repository": "https://github.com/dcloudio/uni-ui",
|
||||||
|
"engines": {
|
||||||
|
"HBuilderX": ""
|
||||||
|
},
|
||||||
|
"directories": {
|
||||||
|
"example": "../../temps/example_temps"
|
||||||
|
},
|
||||||
|
"dcloudext": {
|
||||||
|
"category": [
|
||||||
|
"前端组件",
|
||||||
|
"通用组件"
|
||||||
|
],
|
||||||
|
"sale": {
|
||||||
|
"regular": {
|
||||||
|
"price": "0.00"
|
||||||
|
},
|
||||||
|
"sourcecode": {
|
||||||
|
"price": "0.00"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"contact": {
|
||||||
|
"qq": ""
|
||||||
|
},
|
||||||
|
"declaration": {
|
||||||
|
"ads": "无",
|
||||||
|
"data": "无",
|
||||||
|
"permissions": "无"
|
||||||
|
},
|
||||||
|
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
|
||||||
|
},
|
||||||
|
"uni_modules": {
|
||||||
|
"dependencies": [],
|
||||||
|
"encrypt": [],
|
||||||
|
"platforms": {
|
||||||
|
"cloud": {
|
||||||
|
"tcb": "y",
|
||||||
|
"aliyun": "y"
|
||||||
|
},
|
||||||
|
"client": {
|
||||||
|
"App": {
|
||||||
|
"app-vue": "y",
|
||||||
|
"app-nvue": "y"
|
||||||
|
},
|
||||||
|
"H5-mobile": {
|
||||||
|
"Safari": "y",
|
||||||
|
"Android Browser": "y",
|
||||||
|
"微信浏览器(Android)": "y",
|
||||||
|
"QQ浏览器(Android)": "y"
|
||||||
|
},
|
||||||
|
"H5-pc": {
|
||||||
|
"Chrome": "y",
|
||||||
|
"IE": "y",
|
||||||
|
"Edge": "y",
|
||||||
|
"Firefox": "y",
|
||||||
|
"Safari": "y"
|
||||||
|
},
|
||||||
|
"小程序": {
|
||||||
|
"微信": "y",
|
||||||
|
"阿里": "y",
|
||||||
|
"百度": "y",
|
||||||
|
"字节跳动": "y",
|
||||||
|
"QQ": "y"
|
||||||
|
},
|
||||||
|
"快应用": {
|
||||||
|
"华为": "y",
|
||||||
|
"联盟": "y"
|
||||||
|
},
|
||||||
|
"Vue": {
|
||||||
|
"vue2": "y",
|
||||||
|
"vue3": "y"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
58
uni_modules/uni-badge/readme.md
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
|
||||||
|
## Badge 数字角标
|
||||||
|
> **组件名:uni-badge**
|
||||||
|
> 代码块: `uBadge`
|
||||||
|
|
||||||
|
|
||||||
|
数字角标一般和其它控件(列表、9宫格等)配合使用,用于进行数量提示,默认为实心灰色背景,
|
||||||
|
|
||||||
|
### 安装方式
|
||||||
|
|
||||||
|
本组件符合[easycom](https://uniapp.dcloud.io/collocation/pages?id=easycom)规范,`HBuilderX 2.5.5`起,只需将本组件导入项目,在页面`template`中即可直接使用,无需在页面中`import`和注册`components`。
|
||||||
|
|
||||||
|
如需通过`npm`方式使用`uni-ui`组件,另见文档:[https://ext.dcloud.net.cn/plugin?id=55](https://ext.dcloud.net.cn/plugin?id=55)
|
||||||
|
|
||||||
|
### 基本用法
|
||||||
|
|
||||||
|
在 ``template`` 中使用组件
|
||||||
|
|
||||||
|
```html
|
||||||
|
<uni-badge size="small" :text="100" absolute="rightBottom" type="primary">
|
||||||
|
<button type="default">右上</button>
|
||||||
|
</uni-badge>
|
||||||
|
<uni-badge text="1"></uni-badge>
|
||||||
|
<uni-badge text="2" type="purple" @click="bindClick"></uni-badge>
|
||||||
|
<uni-badge text="3" type="primary" :inverted="true"></uni-badge>
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
### Badge Props
|
||||||
|
|
||||||
|
|属性名 |类型 |默认值 |说明 |
|
||||||
|
|:-: |:-: |:-: |:-: |
|
||||||
|
|text |String |- |角标内容 |
|
||||||
|
|type |String |default|颜色类型,可选值:default(灰色)、primary(蓝色)、success(绿色)、warning(黄色)、error(红色)|
|
||||||
|
|size |String |normal |Badge 大小,可取值:normal、small |
|
||||||
|
|is-dot |Boolean|false |不展示数字,只有一个小点 |
|
||||||
|
|max-num |String/Numbuer|99 |展示封顶的数字值,超过 99 显示99+ |
|
||||||
|
|custom-style |Object | {} |自定义 Badge 样式, 样式对象语法 |
|
||||||
|
|inverted |Boolean|false |是否无需背景颜色,为 true 时,背景颜色将变为文字的字体颜色 |
|
||||||
|
|absolute (不支持 nvue) |String| rightTop|开启绝对定位, 角标将定位到其包裹的标签的四个角上,可选值: rightTop(右上角)、rightBottom(右下角)、leftBottom(左下角) 、leftTop(左上角) |
|
||||||
|
|offset |Array[number]| [0, 0]|距定位角中心点的偏移量,[-10, -10] 表示向 absolute 指定的方向偏移 10px,[10, 10] 表示向 absolute 指定的反方向偏移 10px,只有存在 absolute 属性时有效,与absolute 的值一一对应(例如:值为rightTop, 对应 offset 为 [right, Top])|
|
||||||
|
|
||||||
|
### Badge Events
|
||||||
|
|
||||||
|
|事件名 |事件说明 |返回参数 |
|
||||||
|
|:-: |:-: |:-: |
|
||||||
|
|@click |点击 Badge 触发事件| - |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
## 组件示例
|
||||||
|
|
||||||
|
点击查看:[https://hellouniapp.dcloud.net.cn/pages/extUI/badge/badge](https://hellouniapp.dcloud.net.cn/pages/extUI/badge/badge)
|
||||||