Browse Source

2023-12-20

cmy 1 year ago
parent
commit
f1b5f72e50
2 changed files with 61 additions and 34 deletions
  1. 59 33
      pages/index/user.vue
  2. 2 1
      utils/loginUtils.js

+ 59 - 33
pages/index/user.vue

@@ -1,4 +1,3 @@
-
 <template>
 	<view class="container">
 		<view class="top">
@@ -12,7 +11,7 @@
 						<view class="infor margin-b-20">{{ user.nickname || '游客' }}</view>
 						<view class="uservip flex-start" v-if="user.vip">
 							<text>
-							{{ user.vip_name}}
+								{{ user.vip_name}}
 							</text>
 							<image class="vipIcon" :src="user.vip_icon" mode="scaleToFill"></image>
 						</view>
@@ -28,37 +27,41 @@
 					<view class="flex">
 						<view class="item">
 							<view class="te flex-start">
-								<image class="tip margin-r-10" src="../../static/icon/user-U.png" mode="scaleToFill" ></image>
+								<image class="tip margin-r-10" src="../../static/icon/user-U.png" mode="scaleToFill">
+								</image>
 								<text>
-								USDT
+									USDT
 								</text>
 							</view>
 							<view class="tex">
 								{{userWallet}}
 							</view>
-							<view class="texmoney">
+							<!-- <view class="texmoney">
 								≈¥{{userWalletRmb}}
-							</view>
+							</view> -->
 						</view>
 						<view class="item">
 							<view class="te flex-start">
-								<image class="tip margin-r-10" src="../../static/icon/user-R.png" mode="scaleToFill" ></image>
+								<image class="tip margin-r-10" src="../../static/icon/user-R.png" mode="scaleToFill">
+								</image>
 								<text>
-								PKR
+									PKR
 								</text>
 							</view>
 							<view class="tex">
 								{{userPKR}}
 							</view>
-							<view class="texmoney">
+							<!-- <view class="texmoney">
 								≈¥{{userPKRRmb}}
-							</view>
+							</view> -->
 						</view>
 					</view>
 					<view class="btn margin-t-30 flex">
-						<button @click="navTo('/pages/user/money/recharge')" class="btn1"> <text>{{$t('user.a7')}}</text>
+						<button @click="navTo('/pages/user/money/recharge')" class="btn1">
+							<text>{{$t('user.a7')}}</text>
 						</button>
-						<button @click="navTo('/pages/user/money/withdrawal')" class="btn1"> <text>{{$t('user.a6')}}</text>
+						<button @click="navTo('/pages/user/money/withdrawal')" class="btn1">
+							<text>{{$t('user.a6')}}</text>
 						</button>
 					</view>
 				</view>
@@ -97,7 +100,7 @@
 				</view>
 				<image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
 			</view>
-			
+
 			<!-- 额外添加 -->
 			<view class="user-list flex" @click="navTo('/pages/user/shareQrCode')">
 				<image src="../../static/shouye/money.png" mode="scaleToFill" class="left-img"></image>
@@ -114,7 +117,7 @@
 				</view>
 				<image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
 			</view>
-			<view class="user-list flex" @click="navTo('/pages/user/favorites')">
+			<view class="user-list flex" @click="copyShareLink">
 				<image src="../../static/shouye/liebiao.png" mode="scaleToFill" class="left-img"></image>
 				<view class="item-name">
 					{{$t('user.b5')}}
@@ -142,8 +145,8 @@
 				</view>
 				<image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
 			</view> -->
-			
-			 <!-- 跳转到联系客服 -->
+
+			<!-- 跳转到联系客服 -->
 			<view class="user-list flex" @click="nav()">
 				<image src="../../static/shouye/yue.png" mode="scaleToFill" class="left-img"></image>
 				<view class="item-name">
@@ -159,7 +162,7 @@
 				</view>
 				<image src="../../static/icon/back.png" mode="scaleToFill" class="right-img"></image>
 			</view>
-			
+
 		</view>
 		<taber tab='user'></taber>
 	</view>
@@ -168,7 +171,7 @@
 	import {
 		getIndex,
 	} from "@/api/index.js";
-	
+
 	import {
 		gameWallet,
 	} from "@/api/game.js";
@@ -194,14 +197,14 @@
 				current: 2,
 				show: true,
 				userWallet: 0, //余额 
-				userWalletRmb:0,
-				userPKR:0,
-				userPKRRmb:0,
+				userWalletRmb: 0,
+				userPKR: 0,
+				userPKRRmb: 0,
 				extractTotalPrice: '', //累计体现
 				sum_win: '', //累计收益
 				sum_bet: '', //个人交易量
 				group_sum_bet: '', // 团队交易量
-				user:{},
+				user: {},
 				service: ""
 			};
 		},
@@ -215,16 +218,33 @@
 			this.getIndex()
 		},
 		computed: {
-			...mapState('user', [ 'hasLogin','userInfo'])
+			...mapState('user', ['hasLogin', 'userInfo']),
+			...mapState(['baseURL', 'urlFile']),
 		},
 		methods: {
 			...mapMutations('user', ['setUserInfo']),
+			copyShareLink() {
+				if (!this.hasLogin) {
+					// 保存地址
+					saveUrl();
+					// 登录拦截
+					interceptor();
+				} else {
+					uni.setClipboardData({
+						data: this.baseURL + this.urlFile + '/#/pages/index/index?spread=' + this.user.uid,
+						success: function() {
+							//调用方法成功
+							console.log("success");
+						},
+					});
+				}
+			},
 			showY() {
 				this.show = !this.show
 			},
 			async getIndex() {
 				const res = await getIndex()
-				this.service = res.data.service		
+				this.service = res.data.service
 			},
 			// 统计表
 			async getUser() {
@@ -246,7 +266,7 @@
 					const balance = Number(res.data.back.USDT.money.money);
 					this.userWallet = +balance.toFixed(2);
 					this.userWalletRmb = Number(res.data.back.USDT.rmb);
-					this.userPKR =  Number(res.data.back.PKR.money.money);
+					this.userPKR = Number(res.data.back.PKR.money.money);
 					this.userPKRRmb = Number(res.data.back.PKR.rmb);
 					// this.userWallet = +res.data.back.USDT.money.money
 				})
@@ -319,11 +339,13 @@
 					font-weight: 500;
 					color: #FFFFFF;
 				}
-				.vipIcon{
+
+				.vipIcon {
 					width: 40rpx;
 					height: 40rpx;
 					margin-left: 10rpx;
 				}
+
 				.uservip {
 					font-size: 30rpx;
 					font-weight: 500;
@@ -351,33 +373,37 @@
 			text-align: center;
 			padding-top: 40rpx;
 			padding-bottom: 35rpx;
-			.item{
+
+			.item {
 				background-color: #000000;
 				border-radius: 30rpx;
 				padding: 30rpx;
 				text-align: left;
 				width: 48%;
+
 				.te {
 					font-size: 26rpx;
 					font-weight: 500;
 					padding-bottom: 30rpx;
-					.tip{
-						width:64rpx ;
+
+					.tip {
+						width: 64rpx;
 						height: 64rpx;
 					}
 				}
-				
+
 				.tex {
 					font-size: $font-lg;
 					font-weight: bold;
 					padding-bottom: 30rpx;
 				}
-				.texmoney{
+
+				.texmoney {
 					font-size: $font-lg;
-					color:$font-color-disabled;
+					color: $font-color-disabled;
 				}
 			}
-			
+
 
 			.btn {
 				padding: 0 50rpx;

+ 2 - 1
utils/loginUtils.js

@@ -190,7 +190,8 @@ async function toLogin(sign, account, msg) {
 	login({
 			sign,
 			account,
-			msg: msg
+			msg: msg,
+			spread: uni.getStorageSync('spread') || '' //上级推广人
 		})
 		.then(function(e) {
 			uni.setStorageSync('token', e.data.token);