lilei 4 éve
szülő
commit
7fdb1af5cd

+ 7 - 14
pages/index/index.vue

@@ -277,23 +277,16 @@
 				if(row.jumpType !== 'NONE'){
 				if(row.jumpType !== 'NONE'){
 					// 如果是大转盘
 					// 如果是大转盘
 					if(row.jumpUrl.indexOf('pagesA/luckDraw') >= 0){
 					if(row.jumpUrl.indexOf('pagesA/luckDraw') >= 0){
-						if(this.hasLogin){
-							if(this.showFixedLottery){
-								uni.navigateTo({
-									url:row.jumpUrl
-								})
-							}else{
-								uni.showToast({
-									icon: 'none',
-									title: '活动已结束'
-								})
-							}
-						}else{
+						if(this.showFixedLottery){
 							uni.navigateTo({
 							uni.navigateTo({
-								url:"/pages/login/login"
+								url:row.jumpUrl
+							})
+						}else{
+							uni.showToast({
+								icon: 'none',
+								title: '活动已结束'
 							})
 							})
 						}
 						}
-						
 					}else{
 					}else{
 						uni.navigateTo({
 						uni.navigateTo({
 							url: row.jumpUrl
 							url: row.jumpUrl

+ 2 - 2
pages/login/login.vue

@@ -34,7 +34,7 @@
 		data() {
 		data() {
 			return {
 			return {
 				path: '/pages/index/index',
 				path: '/pages/index/index',
-				lanuch: true,
+				lanuch: false,
 				code: '',
 				code: '',
 				wxButton: {
 				wxButton: {
 					background: '#07c160'
 					background: '#07c160'
@@ -138,7 +138,7 @@
 			// 手机号登录
 			// 手机号登录
 			phoneLogin () {
 			phoneLogin () {
 			  wx.navigateTo({
 			  wx.navigateTo({
-			    url: '/pages/login/phoneLogin'
+			    url: '/pages/login/phoneLogin?path='+this.path+'&lanuch='+this.lanuch
 			  })
 			  })
 			}
 			}
 		}
 		}

+ 17 - 4
pages/login/phoneLogin.vue

@@ -47,7 +47,9 @@
 				popBtn: [],  //  name为操作按钮名称,color为操作按钮颜色值
 				popBtn: [],  //  name为操作按钮名称,color为操作按钮颜色值
 				changeImg: false,  //  是否重新更换图形验证码
 				changeImg: false,  //  是否重新更换图形验证码
 				randomCode: '',  //  图片验证码随机码
 				randomCode: '',  //  图片验证码随机码
-				wxcode: ''
+				wxcode: '',
+				path: '/pages/index/index',
+				lanuch: false,
 			}
 			}
 		},
 		},
 		onLoad(opts) {
 		onLoad(opts) {
@@ -56,6 +58,11 @@
 				withShareTicket: true,
 				withShareTicket: true,
 				menus: ['shareAppMessage', 'shareTimeline']
 				menus: ['shareAppMessage', 'shareTimeline']
 			})
 			})
+			const {
+				path,
+				lanuch
+			} = option;
+			this.lanuch = (lanuch + '') === 'true';
 		},
 		},
 		onUnload() {
 		onUnload() {
 			uni.$off('getUserInfo')
 			uni.$off('getUserInfo')
@@ -95,9 +102,15 @@
 							getApp().globalData.token = res.data
 							getApp().globalData.token = res.data
 							_this.$u.vuex('vuex_token',res.data)
 							_this.$u.vuex('vuex_token',res.data)
 							uni.$emit("getUserInfo")
 							uni.$emit("getUserInfo")
-						    uni.navigateBack({
-						    	delta: 2
-						    })
+						    if (_this.path === '/pages/index/index' || _this.lanuch) {
+						    	uni.reLaunch({
+						    		url: _this.path
+						    	});
+						    } else {
+						    	uni.redirectTo({
+						    		url: _this.path
+						    	});
+						    }
 						  }else{
 						  }else{
 							  uni.showToast({icon: 'none',title: res.message})
 							  uni.showToast({icon: 'none',title: res.message})
 						  }
 						  }

+ 30 - 34
pagesA/luckDraw/luckDraw.vue

@@ -205,16 +205,10 @@ export default {
 			weightTotal: 0,
 			weightTotal: 0,
 			// 权重数组
 			// 权重数组
 			weightArr: [],
 			weightArr: [],
-			isSocktOut: false // 是否正在抽奖
+			isSocktOut: false ,// 是否正在抽奖
+			scene: '', // 场景
 		};
 		};
 	},
 	},
-	watch: {
-		showLottery(newValue, oldValue) {
-			if(!newValue&&(this.winTypes=='win_0'||this.winTypes=='win_2'||this.winTypes=='win_3')){
-				// this.$refs.lottery.onRotateStart()
-			}
-		}
-	},
 	methods: {
 	methods: {
 		// 重置
 		// 重置
 		handleInitCanvas() {
 		handleInitCanvas() {
@@ -247,6 +241,7 @@ export default {
 				title: '奖品准备中...'
 				title: '奖品准备中...'
 			});
 			});
 			findEnable().then(res => {
 			findEnable().then(res => {
+				console.log(res,'getPrizeList')
 				if(res.status == 200 && res.data){
 				if(res.status == 200 && res.data){
 					this.$u.vuex('vuex_LuckDraw',res.data)
 					this.$u.vuex('vuex_LuckDraw',res.data)
 					this.luckDraw = res.data
 					this.luckDraw = res.data
@@ -255,6 +250,8 @@ export default {
 					if(a){
 					if(a){
 						// 查询免费次数
 						// 查询免费次数
 						this.getCustomerTimes()
 						this.getCustomerTimes()
+						// 查询亦获奖列表
+						this.getDrawList()
 						this.prizeList = this.requestPrizeList()
 						this.prizeList = this.requestPrizeList()
 					}else{
 					}else{
 						uni.showModal({
 						uni.showModal({
@@ -309,14 +306,16 @@ export default {
 		},
 		},
 		// 抽奖次数用完了
 		// 抽奖次数用完了
 		showPayWin(winTypes){
 		showPayWin(winTypes){
-			this.showLottery = true
-			this.winTypes = winTypes
-			this.prizeIndex = -1
-			// clearCacheFile()
+			if(this.hasLogin){
+				this.showLottery = true
+				this.winTypes = winTypes
+				this.prizeIndex = -1
+				// clearCacheFile()
+			}
 		},
 		},
 		// 本次抽奖开始
 		// 本次抽奖开始
 		handleDrawStart() {
 		handleDrawStart() {
-			if(this.isSocktOut){
+			if(this.isSocktOut||this.scene==1154){
 				return
 				return
 			}
 			}
 			this.targetName = '';
 			this.targetName = '';
@@ -449,39 +448,35 @@ export default {
 			})
 			})
 		},
 		},
 	},
 	},
-	onShow() {
-		// 查询免费抽奖次数
-		this.getCustomerTimes()
-		// 查询亦获奖列表
-		this.getDrawList()
-	},
-	onLoad() {
-		this.luckDraw = this.$store.state.vuex_LuckDraw
+	onLoad(options) {
+		let lopts = uni.getLaunchOptionsSync() 
+		console.log(lopts,'aaaa')
+		this.scene = lopts.scene
 		
 		
 		// 判断是否登录
 		// 判断是否登录
 		checkLogin().then(res => {
 		checkLogin().then(res => {
 			console.log(res,'checkLogin')
 			console.log(res,'checkLogin')
 			this.hasLogin = res.status == 200
 			this.hasLogin = res.status == 200
-			if(!this.hasLogin){
-				uni.redirectTo({
-					url:"/pages/login/login"
+			if(this.scene!=1154&&!this.hasLogin){
+				uni.showModal({
+					showCancel: false,
+					title: '请先登录后再抽奖!',
+					success() {
+						uni.redirectTo({
+							url: '/pages/login/login?path=/pagesA/luckDraw/luckDraw'
+						})
+					}
 				})
 				})
-			}else{
-				// 请求奖品数据
-				this.getPrizeList();
 			}
 			}
 		})
 		})
 		
 		
+		// 请求奖品数据
+		this.getPrizeList();
+		
 		// 计算转盘宽度和高度
 		// 计算转盘宽度和高度
 		const res = uni.getSystemInfoSync();
 		const res = uni.getSystemInfoSync();
 		this.canvasData.width = res.screenWidth * 0.65
 		this.canvasData.width = res.screenWidth * 0.65
 		this.canvasData.height = res.screenWidth * 0.65
 		this.canvasData.height = res.screenWidth * 0.65
-		
-		// 开启分享
-		uni.showShareMenu({
-			withShareTicket: true,
-			menus: ['shareAppMessage', 'shareTimeline']
-		})
 	},
 	},
 	onUnload() {
 	onUnload() {
 		uni.hideLoading();
 		uni.hideLoading();
@@ -497,7 +492,8 @@ export default {
 	onShareTimeline() {
 	onShareTimeline() {
 		return {
 		return {
 			title: '[乐色管家]参与垃圾分类,让城市更美丽!好运等你转出来!',
 			title: '[乐色管家]参与垃圾分类,让城市更美丽!好运等你转出来!',
-			imageUrl:'/static/zpthumbr.jpg'
+			imageUrl:'/static/zpthumbr.jpg',
+			query: 'fromType=timeline'
 		}
 		}
 	}
 	}
 };
 };