|
@@ -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
|