邀请页面

This commit is contained in:
唐明明
2022-06-10 15:32:48 +08:00
parent d7cd566e57
commit b4e55f90ec
14 changed files with 4515 additions and 3810 deletions

View File

@@ -27,8 +27,6 @@ const request = (parameter, hideLoding = true) => {
})
return
}
console.log(store.getters.getToken)
console.log(uni.getStorageSync('token'))
// 注入header
config.header = {
'Accept': 'application/json',

View File

@@ -21,7 +21,15 @@ const chainSeed = () => {
})
}
// 获取邀请码
const invitationCode = () => {
return request({
url: 'user/invite'
})
}
export {
info,
chainSeed
chainSeed,
invitationCode
}

View File

@@ -57,7 +57,13 @@
"name": "User",
"style": {
"navigationBarTitleText": "我的",
"navigationStyle": "custom"
"navigationBarTextStyle": "white",
"app-plus": {
"titleNView": {
"backgroundColor": "#34CE98",
"type": "transparent"
}
}
}
},
{
@@ -266,42 +272,49 @@
"enablePullDownRefresh": true
}
}, {
"path": "pages/account/log",
"path": "pages/account/log",
"name": "AccountLog",
"style": {
"navigationBarTitleText": "充值记录",
"navigationBarTitleText": "充值记录",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/account/transfer",
"path": "pages/account/transfer",
"name": "AccountTransfer",
"style": {
"navigationBarTitleText": "转账",
"navigationBarTitleText": "转账",
"navigationBarBackgroundColor": "#F3F6FB"
}
}, {
"path": "pages/account/resetPassword",
"path": "pages/account/resetPassword",
"name": "AccountResetPassword",
"style": {
"navigationBarTitleText": "钱包密码",
"navigationBarTitleText": "钱包密码",
"navigationBarBackgroundColor": "#F3F6FB"
}
}, {
"path": "pages/account/results",
"path": "pages/account/results",
"name": "Accountresults",
"style": {
"navigationBarTitleText": "转账结果",
"navigationBarTitleText": "转账结果",
"navigationBarBackgroundColor": "#FFFFFF"
}
}, {
"path": "pages/account/code",
"path": "pages/account/code",
"name": "AccountCode",
"style": {
"navigationBarTitleText": "收款码",
"navigationBarBackgroundColor": "#34CE98",
"backgroundColorTop": "#34CE98",
"navigationBarTitleText": "收款码",
"navigationBarBackgroundColor": "#34CE98",
"backgroundColorTop": "#34CE98",
"navigationBarTextStyle": "white"
}
}, {
"path": "pages/invitation/invitation",
"name": "Invitation",
"style": {
"navigationStyle": "custom",
"disableScroll": true
}
}
],
"tabBar": {
@@ -333,8 +346,5 @@
},
"easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"condition": { //模式配置,仅开发期间生效
"current": 0 //当前激活的模式(list 的索引项)
}
}

View File

@@ -12,6 +12,9 @@
<view class="auth-input auth-code">
<input v-model="code" type="number" maxlength="4" placeholder="输入验证码">
<button :disabled="getSms" size="mini" @click="getPhoneCode()">{{sendCode}}</button>
</view>
<view class="auth-input">
<input v-model="parentId" type="number" placeholder="输入邀请码">
</view>
<view class="auth-button">
<button @click="login('code')">登录</button>
@@ -35,7 +38,8 @@
data() {
return {
phone : '18245180131',
code : '',
code : '',
parentId: '',
getSms : false,
sendCode: '获取验证码'
};
@@ -81,8 +85,9 @@
title: '登录中'
})
smsAuth({
mobileNo: this.phone,
code : this.code,
mobileNo : this.phone,
code : this.code,
parent_id : this.parentId
}).then((res) => {
this.$store.commit('setToken', res.token_type + ' ' + res.access_token);
if(res.is_new){

View File

@@ -0,0 +1,142 @@
<template>
<view class="invitation">
<view class="invitation-refund">
<view class="invitation-refund-btn" @click="onBack">
<uni-icons type="back" color="white" size="24"></uni-icons>
</view>
</view>
<image class="invitation-back" src="@/static/img/code_back.png" mode="aspectFill"></image>
<view class="invitation-content">
<view class="invitation-lay">
<image class="invitation-code" :src="code"></image>
<view class="invitation-text">
<view class="invitation-text-code" @click="copyInvite"><text>{{invite}}</text>点击复制</view>
<view class="invitation-text-sub">扫码下载共力生态App</view>
<view class="invitation-text-sub">邀请好友增加共力分增长</view>
</view>
</view>
<button class="invitation-btn">分享邀请</button>
</view>
</view>
</template>
<script>
import { invitationCode } from '@/apis/interfaces/user.js'
export default {
data() {
return {
invite: '',
code : '',
};
},
created() {
invitationCode().then(res => {
console.log(res)
this.invite = res[0].invite
this.code = res[0].code
})
},
methods: {
// 返回
onBack(){
this.$Router.back()
},
// 复制邀请码
copyInvite(){
uni.setClipboardData({
data: this.invite,
success() {
uni.showToast({
title: '邀请码已复制',
icon : 'none'
})
}
})
}
}
}
</script>
<style lang="scss">
.invitation{
position: relative;
background: #1c2472;
min-height: 100vh;
.invitation-refund{
@extend .ios-top;
position: absolute;
top: 30rpx;
left: $margin*2;
z-index: 9;
.invitation-refund-btn{
border-radius: 50%;
line-height: 58rpx;
width: 58rpx;
height: 58rpx;
text-align: center;
font-weight: bold;
background: rgba(0, 0, 0, .5);
}
}
.invitation-back{
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}
}
.invitation-content{
padding: $padding*2;
position: absolute;
bottom: 5vh;
width: 100%;
box-sizing: border-box;
.invitation-lay{
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
background: rgba(0, 0, 0, .5);
border-radius: $radius;
padding: $padding;
margin-bottom: $margin;
color: white;
.invitation-code{
width: 168rpx;
height: 168rpx;
background: white;
}
.invitation-text{
width: calc(100% - 198rpx);
.invitation-text-code{
font-size: 26rpx;
line-height: 50rpx;
text{
font-weight: bold;
font-size: 40rpx;
margin-right: 10rpx;
text-decoration: underline;
}
}
.invitation-text-sub{
font-size: 26rpx;
line-height: 50rpx;
}
}
}
.invitation-btn{
height: 90rpx;
line-height: 90rpx;
border-radius: 45rpx;
font-size: 32rpx;
font-weight: bold;
background: linear-gradient(to top left, #2b307f, #83a8de);
color: white;
&::after{
display: none;
}
}
}
</style>

View File

@@ -3,7 +3,7 @@
<!-- 账户信息 -->
<view class="life-header">
<view class="life-header-flex">
<view class="life-header-item">0.00共力值</view>
<view class="life-header-item">0.00GLF</view>
</view>
</view>
<!-- 共力人生 -->

View File

@@ -7,29 +7,15 @@
<image class="cover" @click="onBtn('Setting', {})" :src="userInfo.avatar || require('@/static/user/cover.png')"
mode="aspectFill" />
<view class="user-content">
<block v-if="$store.state.token != ''">
<view class="name">{{ userInfo.nickname }}</view>
<view class="tabs" v-if="userInfo.identity.length !== 0">
<view class="tabs-item">
<image src="@/static/user/icon_07.png" />
VIP会员
</view>
<view class="name">{{ userInfo.nickname }}</view>
<view class="tabs">
<view class="tabs-item">
<image :src="identity.cover_url" mode="heightFix" />{{identity.identity_text}}
</view>
<view class="tabs" v-else>
<view class="tabs-item">
<image src="@/static/user/icon_07.png" />
普通用户
</view>
</view>
<!-- <view class="chainAddress" v-if="userInfo.chain_address">
<u-icon labelPos="left" @click="copy(userInfo.chain_address)" labelSize="14"
labelColor="#fff" :label="userInfo.chain_address.substr(0, 20)+'...'" space="10"
:name="require('@/static/imgs/copy.png')" size="16" />
</view> -->
</block>
<block v-else>
<view class="name">未登录</view>
</block>
</view>
<view class="chainAddress" v-if="userInfo.addr">
<text @click="copy(userInfo.addr)">区块地址:{{userInfo.addr.substring(0,5) + '****' + userInfo.addr.substring(userInfo.addr.length - 5)}}</text>
</view>
</view>
</view>
</view>
@@ -38,25 +24,24 @@
<view class="vip-card">
<view class="title">
<image src="@/static/user/icon_06.png" mode="widthFix" />
会员
共力会员
</view>
<view class="subtitle">
<u-notice-bar :text="cardText" icon="" bgColor="" duration="3000" color="#fcc692" direction="column">
</u-notice-bar>
</view>
<!-- v-if="userInfo.identity.length === 0" -->
<view class="btn" @click="onBtn('Vip', {})">开通</view>
<view class="btn" @click="onBtn('Vip', {})">{{userInfo.isOpenVip ? '开通': '续费'}}</view>
</view>
<!-- 健康数据 -->
<view class="health-flex">
<view class="health-flex-item" @click="onBtn('AccountIntegral', {})">
<view class="title">共力值</view>
<view class="num">0.00</view>
<view class="num">{{account.glz}}</view>
</view>
<view class="health-flex-item" @click="onBtn('AccountDt', {})">
<view class="title">DT积分</view>
<view class="num">0.00</view>
<view class="num">{{account.dt}}</view>
</view>
</view>
<!-- 订单 -->
@@ -94,11 +79,11 @@
地址管理
<uni-icons class="forward" type="forward" color="#999" />
</view>
<view class="btns-box-item">
<view class="btns-box-item" @click="onBtn('Invitation', {})">
<image class="icon" src="@/static/user/userIcon_03.png" mode="widthFix" />
分享邀请
<uni-icons class="forward" type="forward" color="#999" />
</view>
</view>
</view>
<view class="btns-box">
<view class="btns-box-item">
@@ -139,17 +124,26 @@
import {
info,
chainSeed
} from '@/apis/interfaces/user';
import userAuth from '@/public/userAuth';
} from '@/apis/interfaces/user';
export default {
data() {
return {
cardText: ['开通会员加速共力值增长', '前10000名用户专享阶段折扣价格'],
cardText: [],
userInfo: {
nickname: '',
avatar: '',
identity: []
nickname : '',
addr : '',
avatar : '',
isOpenVip : '',
},
identity : {
button_cover_url: '',
cover_url : '',
identity_text : ''
},
account : {
glz : 0.00,
dt : 0.00
},
mnemonic : '',
wordsShow: false
@@ -160,21 +154,28 @@
},
methods: {
// 用户信息
getInfo() {
getInfo() {
if (this.$store.state.token === '') return;
info()
.then(res => {
uni.setNavigationBarTitle({
title: res.nickname
});
this.userInfo = res;
})
.catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
});
info().then(res => {
uni.setNavigationBarTitle({
title: res.nickname
});
this.cardText = res.identity_array
this.userInfo = {
nickname : res.nickname,
addr : res.addr,
avatar : res.avatar,
isOpenVip : res.is_open_vip,
}
this.identity = res.identity
this.account = res.account
})
.catch(err => {
uni.showToast({
title: err.message,
icon: 'none'
});
});
},
// 导出助记词
onMnemonic(){
@@ -310,26 +311,24 @@
font-size: $title-size + 8;
@extend .nowrap;
}
.tabs {
padding-top: 10rpx;
&-item {
background: rgba($color: #000000, $alpha: 0.3);
font-size: $title-size-sm - 4;
display: inline-block;
line-height: 36rpx;
padding: 0 20rpx;
border-radius: 20rpx;
image {
width: 26rpx;
height: 26rpx;
vertical-align: middle;
margin-bottom: 2rpx;
margin-right: 8rpx;
}
}
padding-top: 10rpx;
&-item {
background: rgba($color: #000000, $alpha: 0.3);
font-size: $title-size-sm - 4;
display: inline-block;
line-height: 36rpx;
padding: 0 20rpx;
border-radius: 20rpx;
image {
width: 38rpx;
height: 38rpx;
vertical-align: middle;
margin-bottom: 2rpx;
margin-right: 8rpx;
}
}
}
}
}

View File

@@ -4,7 +4,7 @@
<view class="vip-user">
<image class="user-cover" :src="user.avatar" mode="aspectFill"></image>
<view class="user-nickname">{{user.nickname}}</view>
<view class="user-date">到期日期{{identity.ended_at}}</view>
<view class="user-date">到期日期{{endedAt}}</view>
<view class="vip-renewal" v-if="!isOpen">续费</view>
</view>
<view class="user-cards">
@@ -68,8 +68,9 @@
identity: {
identity_text: '',
cover_url: '',
ended_at: ''
},
// 到期时间
endedAt: '',
// 下级身份
nextIdentity:{
identity_text: ''
@@ -97,6 +98,7 @@
this.secondRule = res.second_rule
this.nextIdentity = res.next_identity
this.identity = res.identity
this.endedAt = res.identity_ended_at
this.user = res.user
}).catch(err => {
uni.showToast({

BIN
static/img/code_back.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB