忆雪 11 місяців тому
батько
коміт
c32a738f65

+ 8 - 7
src/pages/login/login.vue

@@ -87,15 +87,16 @@
 		},
 		methods: {
 
-			onLaunch(options) {
-
-				const launchOptions = uni.getLaunchOptionsSync();
-
+			onLoad: function(options) {
+				console.log('options========>', options.q);
+				if (options.q) {
+					const urlString = decodeURIComponent(options.q)
+					const pathSegments = urlString.split('/');
+					const promoterId = pathSegments[pathSegments.length - 1];
+					this.$store.commit('SET_INVITATIONCODE', promoterId)
+				}
 
-				const promoterId = launchOptions.query.promoterId;
-				this.$store.commit('SET_INVITATIONCODE', promoterId)
 
-				console.log('promoterId:', promoterId);
 			},
 
 			checkAgree() {

+ 10 - 3
src/pages/tabbar/home.vue

@@ -149,17 +149,24 @@
 			},
 		},
 		onShow() {
-			console.log("执行了没有", this.invitationCode)
+			console.log("首页执行了没有", this.invitationCode)
 			// 如果 invitationCode 存在且不等于特殊值时执行代码
 			if (this.invitationCode) {
-				console.log("sadsad")
+				console.log("存在邀请码")
 				let params = {
 					userId: this.userId,
 					targetId: this.invitationCode,
 					type: 1
 				};
 				inviteBind(params).then(res => {
-					console.log("绑定邀请码结果:", res);
+					if(res&& res.code ==200){
+						uni.showToast({
+							title:'您已成功加入团队',
+							icon:'success',
+							dration:2000
+						})
+					}
+					// console.log("绑定邀请码结果:", res);
 				});
 				this.$store.commit('SET_INVITATIONCODE', '')
 				

+ 5 - 11
src/pages/tabbar/promotionCode.vue

@@ -17,6 +17,7 @@
 			</view>
 		</view>
 		<view class="scan-text">扫描上方二维码,加入我的团队</view>
+	
 		<tabbar currentTab="promotionCode" />
 	</view>
 </template>
@@ -29,25 +30,18 @@
 	export default {
 		data() {
 			return {
-				text: "https://test.chelvc.com/static/preview?promoterId=123123123",
-				// text:`https://test.chelvc.com/static/preview?promoterId=${this.userId}`,
+				text: `https://test.chelvc.com/static/${this.userId}`,
 				size: 200,
 			};
 		},
 		components: {
-			uQrcode ,
+			uQrcode,
 		},
 		computed: {
-			...mapGetters(['location', 'avatar', 'nickname',"userId"]),
+			...mapGetters(['location', 'avatar', 'nickname', "userId"]),
 		},
 		methods: {
-			gotoBaidu() {
-				// 使用 uni.navigateTo 或 uni.redirectTo 跳转到百度的网址
-				uni.navigateTo({
-					url: 'https://test.chelvc.com/static/preview?promoterId=123123123'
-				})
-			},
-			complete(e) {
+			kplete(e) {
 				if (e.success) {
 					console.log('生成成功');
 				} else {