lovetiya 4 жил өмнө
parent
commit
30e6ca4dca
2 өөрчлөгдсөн 63 нэмэгдсэн , 58 устгасан
  1. 2 1
      manifest.json
  2. 61 57
      pages/index/index.vue

+ 2 - 1
manifest.json

@@ -65,7 +65,8 @@
                         "appid" : "wx53db61c69b2e1ed1",
                         "appsecret" : "944e2b205734646479c0b76be6cdbd90",
                         "UniversalLinks" : "https://www.qianjiadi.com/merchant/"
-                    }
+                    },
+                    "apple" : {}
                 }
             },
             "splashscreen" : {

+ 61 - 57
pages/index/index.vue

@@ -278,8 +278,8 @@
 				key: 'iosLoginData'
 			})
 			// #ifdef APP-PLUS
-			// this.isIos = (plus.os.name == "iOS") && plus.os.version >= 13
-			this.isIos = true
+			this.isIos = (plus.os.name == "iOS") && plus.os.version >= 13
+			// this.isIos = true
 			console.log('isIos:',this.isIos,plus.os.name)
 			// #endif
 		},
@@ -360,64 +360,68 @@
 				let that = this
 				console.log('isIos:',this.isIos,iosFlag)
 				console.log('app enter')
-				uni.login({
-					provider: (this.isIos && iosFlag) ? 'apple' : 'weixin',
-					success: (res2) => {
-						console.log('res2', res2)
-						uni.getUserInfo({
-							provider: (this.isIos && iosFlag) ? 'apple' : 'weixin',
-							success: (info) => {
-								console.log('info',info)
-								if (this.isIos && iosFlag) {
-									uni.setStorage({
-										key: 'iosLoginData',
-										data: {
-											email: info.userInfo.email,
-											fullname: info.userInfo.fullName.familyName || '匿名用户',
-											user: info.userInfo.openId
-										}
+				try {
+					uni.login({
+						provider: (this.isIos && iosFlag) ? 'apple' : 'weixin',
+						success: (res2) => {
+							console.log('res2', res2)
+							uni.getUserInfo({
+								provider: (this.isIos && iosFlag) ? 'apple' : 'weixin',
+								success: (info) => {
+									console.log('info',info)
+									if (this.isIos && iosFlag) {
+										uni.setStorage({
+											key: 'iosLoginData',
+											data: {
+												email: info.userInfo.email,
+												fullname: info.userInfo.fullName.familyName || '匿名用户',
+												user: info.userInfo.openId
+											}
+										})
+										that.iosLoginData = uni.getStorageSync("iosLoginData")
+										console.log(1111111, that.iosLoginData)
+										that.getUserInfoByIOS()
+									} else {
+										uni.setStorage({
+											key: 'wxLoginData',
+											data: {
+												nickName: info.userInfo.nickName,
+												gender: info.userInfo.gender,
+												avatarUrl: info.userInfo.avatarUrl,
+												unionId: info.userInfo.unionId,
+												openId:info.userInfo.openId
+											}
+										})
+										that.wxLoginData = uni.getStorageSync("wxLoginData")
+										console.log(1111111, that.wxLoginData)
+										// that.userNmae = JSON.parse(that.wxLoginData.rawData).nickName
+										that.getUserInfo()
+									}
+									this.$refs.uTips.show({
+										title: '获取角色信息成功',
+										type: 'success',
 									})
-									that.iosLoginData = uni.getStorageSync("iosLoginData")
-									console.log(1111111, that.iosLoginData)
-									that.getUserInfoByIOS()
-								} else {
-									uni.setStorage({
-										key: 'wxLoginData',
-										data: {
-											nickName: info.userInfo.nickName,
-											gender: info.userInfo.gender,
-											avatarUrl: info.userInfo.avatarUrl,
-											unionId: info.userInfo.unionId,
-											openId:info.userInfo.openId
-										}
+								},
+								fail: (error) => {
+									console.log(2222, error)
+									that.$refs.uTips.show({
+										title: '微信登录授权失败,请再试试',
+										type: 'warning',
 									})
-									that.wxLoginData = uni.getStorageSync("wxLoginData")
-									console.log(1111111, that.wxLoginData)
-									// that.userNmae = JSON.parse(that.wxLoginData.rawData).nickName
-									that.getUserInfo()
 								}
-								this.$refs.uTips.show({
-									title: '获取角色信息成功',
-									type: 'success',
-								})
-							},
-							fail: (error) => {
-								console.log(2222, error)
-								that.$refs.uTips.show({
-									title: '微信登录授权失败,请再试试',
-									type: 'warning',
-								})
-							}
-						})
-					},
-					fail: (error) => {
-						console.log(33333, error)
-						that.$refs.uTips.show({
-							title: '微信登录授权失败',
-							type: 'warning',
-						})
-					}
-				})
+							})
+						},
+						fail: (error) => {
+							console.log(33333, error)
+							that.$refs.uTips.show({
+								title: '微信登录授权失败',
+								type: 'warning',
+							})
+						}
+					})
+				} catch(e) {
+					console.log('是否调登录',e.message)
+				}
 				console.log('app end')
 			},
 			//#endif