lyqu 4 år sedan
förälder
incheckning
3600a329c9
2 ändrade filer med 51 tillägg och 5 borttagningar
  1. 47 4
      App.vue
  2. 4 1
      pages/activityList/home/home.vue

+ 47 - 4
App.vue

@@ -3,7 +3,11 @@
 	export default {
 		onLaunch: function(e) {
 			console.log('App Launch', e)
-			let userId = uni.getStorageSync("userId")
+			// if (this.$isWxBrowser()) {
+			// 	this.WxBrowser(e);
+			// } else {
+			// 	this.externalBrowser(e);
+			// }
 			if (this.$isWxBrowser() && this.$u.test.isEmpty(e.query)) {
 				// uni.reLaunch({
 				// 	url: "/pages/index/guide"
@@ -15,9 +19,18 @@
 					url: 'pages/index/guide'
 				})
 			} else if (this.$isWxBrowser() && !this.$u.test.isEmpty(e.query.userId)) {
-				uni.reLaunch({
-					url: 'pages/index/guide?userId=' + e.query.userId
-				})
+				if (e.query.userId != uni.getStorageSync("userId")) {
+					let url = window.location.href;
+					let len = url.indexOf("userId=") - 1
+					let tmp = url.substring(0, len)
+					console.log(tmp);
+					window.location.href = tmp
+				} else {
+					uni.reLaunch({
+						url: 'pages/index/guide?userId=' + e.query.userId
+					})
+				}
+				
 			} else {
 				if (!this.$u.test.isEmpty(e.query.userId)) {
 					uni.reLaunch({
@@ -36,6 +49,36 @@
 		onHide: function() {
 			console.log('App Hide')
 		},
+		methods: {
+			WxBrowser(e) {
+				let userId = uni.getStorageSync("userId");
+				if (this.$u.test.isEmpty(e.query) && this.$u.test.isEmpty(userId)) {
+					let path = 'pages/index/guide?login=1';
+					window.location.href = authUrl(path);
+				} else if (!this.$u.test.isEmpty(e.query.login)) {
+					uni.reLaunch({
+						url: 'pages/index/guide'
+					})
+				} else if (!this.$u.test.isEmpty(userId) && (userId != e.query.userId)) {
+					window.location.href = "https://music.nanyue6688.com/vote-h5/index.html#/";
+				} else {
+					uni.reLaunch({
+						url: 'pages/index/guide?userId=' + e.query.userId
+					})
+				}
+			},
+			externalBrowser(e) {
+				if (!this.$u.test.isEmpty(e.query.userId)) {
+					uni.reLaunch({
+						url: "/pages/activityList/home/home?activityId=1407016573251153922&userId=" + e.query.userId
+					})
+				} else {
+					uni.reLaunch({
+						url: "/pages/activityList/home/home?activityId=1407016573251153922"
+					})
+				}
+			}
+		}
 	}
 </script>
 

+ 4 - 1
pages/activityList/home/home.vue

@@ -42,9 +42,12 @@
 			}
 		},
 		onLoad(options) {
-			console.log("home", options);
 			if (!this.$u.test.isEmpty(options.userId)) {
 				uni.setStorageSync("userId", options.userId);
+				let url = window.location.href;
+				let len = url.indexOf("userId=") - 1
+				let tmp = url.substring(0, len)
+				window.location.href = tmp
 			}
 			this.activityId = options.activityId;
 			// this.authorization(options.current);