邀请页面

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 return
} }
console.log(store.getters.getToken)
console.log(uni.getStorageSync('token'))
// 注入header // 注入header
config.header = { config.header = {
'Accept': 'application/json', 'Accept': 'application/json',

View File

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

View File

@@ -57,7 +57,13 @@
"name": "User", "name": "User",
"style": { "style": {
"navigationBarTitleText": "我的", "navigationBarTitleText": "我的",
"navigationStyle": "custom" "navigationBarTextStyle": "white",
"app-plus": {
"titleNView": {
"backgroundColor": "#34CE98",
"type": "transparent"
}
}
} }
}, },
{ {
@@ -302,6 +308,13 @@
"backgroundColorTop": "#34CE98", "backgroundColorTop": "#34CE98",
"navigationBarTextStyle": "white" "navigationBarTextStyle": "white"
} }
}, {
"path": "pages/invitation/invitation",
"name": "Invitation",
"style": {
"navigationStyle": "custom",
"disableScroll": true
}
} }
], ],
"tabBar": { "tabBar": {
@@ -333,8 +346,5 @@
}, },
"easycom": { "easycom": {
"^u-(.*)": "uview-ui/components/u-$1/u-$1.vue" "^u-(.*)": "uview-ui/components/u-$1/u-$1.vue"
},
"condition": { //模式配置,仅开发期间生效
"current": 0 //当前激活的模式(list 的索引项)
} }
} }

View File

@@ -13,6 +13,9 @@
<input v-model="code" type="number" maxlength="4" placeholder="输入验证码"> <input v-model="code" type="number" maxlength="4" placeholder="输入验证码">
<button :disabled="getSms" size="mini" @click="getPhoneCode()">{{sendCode}}</button> <button :disabled="getSms" size="mini" @click="getPhoneCode()">{{sendCode}}</button>
</view> </view>
<view class="auth-input">
<input v-model="parentId" type="number" placeholder="输入邀请码">
</view>
<view class="auth-button"> <view class="auth-button">
<button @click="login('code')">登录</button> <button @click="login('code')">登录</button>
</view> </view>
@@ -36,6 +39,7 @@
return { return {
phone : '18245180131', phone : '18245180131',
code : '', code : '',
parentId: '',
getSms : false, getSms : false,
sendCode: '获取验证码' sendCode: '获取验证码'
}; };
@@ -81,8 +85,9 @@
title: '登录中' title: '登录中'
}) })
smsAuth({ smsAuth({
mobileNo: this.phone, mobileNo : this.phone,
code : this.code, code : this.code,
parent_id : this.parentId
}).then((res) => { }).then((res) => {
this.$store.commit('setToken', res.token_type + ' ' + res.access_token); this.$store.commit('setToken', res.token_type + ' ' + res.access_token);
if(res.is_new){ 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">
<view class="life-header-flex"> <view class="life-header-flex">
<view class="life-header-item">0.00共力值</view> <view class="life-header-item">0.00GLF</view>
</view> </view>
</view> </view>
<!-- 共力人生 --> <!-- 共力人生 -->

View File

@@ -7,30 +7,16 @@
<image class="cover" @click="onBtn('Setting', {})" :src="userInfo.avatar || require('@/static/user/cover.png')" <image class="cover" @click="onBtn('Setting', {})" :src="userInfo.avatar || require('@/static/user/cover.png')"
mode="aspectFill" /> mode="aspectFill" />
<view class="user-content"> <view class="user-content">
<block v-if="$store.state.token != ''">
<view class="name">{{ userInfo.nickname }}</view> <view class="name">{{ userInfo.nickname }}</view>
<view class="tabs" v-if="userInfo.identity.length !== 0"> <view class="tabs">
<view class="tabs-item"> <view class="tabs-item">
<image src="@/static/user/icon_07.png" /> <image :src="identity.cover_url" mode="heightFix" />{{identity.identity_text}}
VIP会员
</view> </view>
</view> </view>
<view class="tabs" v-else> <view class="chainAddress" v-if="userInfo.addr">
<view class="tabs-item"> <text @click="copy(userInfo.addr)">区块地址:{{userInfo.addr.substring(0,5) + '****' + userInfo.addr.substring(userInfo.addr.length - 5)}}</text>
<image src="@/static/user/icon_07.png" />
普通用户
</view> </view>
</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> </view>
</view> </view>
@@ -38,25 +24,24 @@
<view class="vip-card"> <view class="vip-card">
<view class="title"> <view class="title">
<image src="@/static/user/icon_06.png" mode="widthFix" /> <image src="@/static/user/icon_06.png" mode="widthFix" />
会员 共力会员
</view> </view>
<view class="subtitle"> <view class="subtitle">
<u-notice-bar :text="cardText" icon="" bgColor="" duration="3000" color="#fcc692" direction="column"> <u-notice-bar :text="cardText" icon="" bgColor="" duration="3000" color="#fcc692" direction="column">
</u-notice-bar> </u-notice-bar>
</view> </view>
<!-- v-if="userInfo.identity.length === 0" --> <view class="btn" @click="onBtn('Vip', {})">{{userInfo.isOpenVip ? '开通': '续费'}}</view>
<view class="btn" @click="onBtn('Vip', {})">开通</view>
</view> </view>
<!-- 健康数据 --> <!-- 健康数据 -->
<view class="health-flex"> <view class="health-flex">
<view class="health-flex-item" @click="onBtn('AccountIntegral', {})"> <view class="health-flex-item" @click="onBtn('AccountIntegral', {})">
<view class="title">共力值</view> <view class="title">共力值</view>
<view class="num">0.00</view> <view class="num">{{account.glz}}</view>
</view> </view>
<view class="health-flex-item" @click="onBtn('AccountDt', {})"> <view class="health-flex-item" @click="onBtn('AccountDt', {})">
<view class="title">DT积分</view> <view class="title">DT积分</view>
<view class="num">0.00</view> <view class="num">{{account.dt}}</view>
</view> </view>
</view> </view>
<!-- 订单 --> <!-- 订单 -->
@@ -94,7 +79,7 @@
地址管理 地址管理
<uni-icons class="forward" type="forward" color="#999" /> <uni-icons class="forward" type="forward" color="#999" />
</view> </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" /> <image class="icon" src="@/static/user/userIcon_03.png" mode="widthFix" />
分享邀请 分享邀请
<uni-icons class="forward" type="forward" color="#999" /> <uni-icons class="forward" type="forward" color="#999" />
@@ -140,16 +125,25 @@
info, info,
chainSeed chainSeed
} from '@/apis/interfaces/user'; } from '@/apis/interfaces/user';
import userAuth from '@/public/userAuth';
export default { export default {
data() { data() {
return { return {
cardText: ['开通会员加速共力值增长', '前10000名用户专享阶段折扣价格'], cardText: [],
userInfo: { userInfo: {
nickname: '', nickname : '',
avatar: '', addr : '',
identity: [] avatar : '',
isOpenVip : '',
},
identity : {
button_cover_url: '',
cover_url : '',
identity_text : ''
},
account : {
glz : 0.00,
dt : 0.00
}, },
mnemonic : '', mnemonic : '',
wordsShow: false wordsShow: false
@@ -162,12 +156,19 @@
// 用户信息 // 用户信息
getInfo() { getInfo() {
if (this.$store.state.token === '') return; if (this.$store.state.token === '') return;
info() info().then(res => {
.then(res => {
uni.setNavigationBarTitle({ uni.setNavigationBarTitle({
title: res.nickname title: res.nickname
}); });
this.userInfo = res; 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 => { .catch(err => {
uni.showToast({ uni.showToast({
@@ -310,10 +311,8 @@
font-size: $title-size + 8; font-size: $title-size + 8;
@extend .nowrap; @extend .nowrap;
} }
.tabs { .tabs {
padding-top: 10rpx; padding-top: 10rpx;
&-item { &-item {
background: rgba($color: #000000, $alpha: 0.3); background: rgba($color: #000000, $alpha: 0.3);
font-size: $title-size-sm - 4; font-size: $title-size-sm - 4;
@@ -323,8 +322,8 @@
border-radius: 20rpx; border-radius: 20rpx;
image { image {
width: 26rpx; width: 38rpx;
height: 26rpx; height: 38rpx;
vertical-align: middle; vertical-align: middle;
margin-bottom: 2rpx; margin-bottom: 2rpx;
margin-right: 8rpx; margin-right: 8rpx;

View File

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