Fly 1 ano atrás
pai
commit
00bacf2768
1 arquivos alterados com 36 adições e 9 exclusões
  1. 36 9
      pages/home/module/top.vue

+ 36 - 9
pages/home/module/top.vue

@@ -150,11 +150,38 @@
 				// getPhotograph();
 				// 允许从相机和相册扫码
 				uni.scanCode({
+					scanType: ['qrCode'],
 					success: function(res) {
+						switch (res.scanType) {
+							case 'QR_CODE':
+								// 二维码 
+								const result = res.result
+								const val = result.split("?")[1]
+								const v = val.split("&")
+								const obj = {};
+								v.forEach(el => {
+									const _v = el.split("=");
+									obj[_v[0]] = _v[1]
+								});
+								if (obj.URLType === 'BigTurnplate') {
+									uni.navigateTo({
+										url: `/pages/game/Lottery?activityId=${obj.activityId}`
+									})
+								}
+								if (obj.URLType === 'Task') {
+									uni.navigateTo({
+										url: `/pages/task/task-details?taskId=${obj.taskId}`
+									})
+								}
+
+
+
+								break;
+						}
 						console.log('条码类型:' + res.scanType);
 						console.log('条码内容:' + res.result);
 					},
-					fail(fail){
+					fail(fail) {
 						console.log(fail)
 						// if ([0, 11, 12].includes(fail.code)) return;
 						// permision.showManualAuth('android.permission.CAMERA');
@@ -173,14 +200,14 @@
 
 			toQY() {
 				// this.$yghttp.get('/yima/request/appUser/enterprise').then(res=>{
-					// if(res.data.has){
-						this.$openPage(this.toQyKongLimList[0])
-					// }else{
-					// 	this.$openPage({thirdApplicationId:res.data.thirdApplicationId,name:''})
-					// 	// uni.navigateTo({
-					// 	// 	url:"/pages/web-view/Apps?path="+res.data.url
-					// 	// })
-					// }
+				// if(res.data.has){
+				this.$openPage(this.toQyKongLimList[0])
+				// }else{
+				// 	this.$openPage({thirdApplicationId:res.data.thirdApplicationId,name:''})
+				// 	// uni.navigateTo({
+				// 	// 	url:"/pages/web-view/Apps?path="+res.data.url
+				// 	// })
+				// }
 				// })
 			}