Browse Source

登录判断ios版本号

zhaoxw 4 years ago
parent
commit
4f9c4c90a9
1 changed files with 42 additions and 7 deletions
  1. 42 7
      pages/index/index.vue

+ 42 - 7
pages/index/index.vue

@@ -28,10 +28,17 @@
 
 			<!-- #ifdef APP-PLUS -->
 			<button
+			    v-if="!isIos"
 				class="authorize-login" 
-				@click="getUserinfoApp">
+				@click="getUserinfoApp()">
 				微信一键登录
 			</button>
+			<button v-if="isIos" class="authorize-login-ios" @click="getUserinfoApp('ioslogin')">
+				<image class="login-icon" src="../../static/images/login-apple.png"></image>苹果账户登录
+			</button>
+			<button v-if="isIos" class="authorize-login-ios" @click="getUserinfoApp()">
+				<image class="login-icon2" src="../../static/images/login-weixin.png"></image>微信一键登录
+			</button>
 			<!-- #endif -->
 			<view @click="showAgreement = true" class="agreement">点击登录视为同意<text class="underline">商家入驻协议</text></view>
 		</view>
@@ -271,7 +278,8 @@
 				key: 'iosLoginData'
 			})
 			// #ifdef APP-PLUS
-			this.isIos = (plus.os.name == "iOS")
+			// this.isIos = (plus.os.name == "iOS") && plus.os.version >= 13
+			this.isIos = true
 			console.log('isIos:',this.isIos,plus.os.name)
 			// #endif
 		},
@@ -348,19 +356,19 @@
 			
 			// #ifdef APP-PLUS
 			//  获取app登录权限
-			getUserinfoApp() {
+			getUserinfoApp(iosFlag) {
 				let that = this
-				console.log('isIos:',this.isIos)
+				console.log('isIos:',this.isIos,iosFlag)
 				console.log('app enter')
 				uni.login({
-					provider: this.isIos ? 'apple' : 'weixin',
+					provider: (this.isIos && iosFlag) ? 'apple' : 'weixin',
 					success: (res2) => {
 						console.log('res2', res2)
 						uni.getUserInfo({
-							provider: this.isIos ? 'apple' : 'weixin',
+							provider: (this.isIos && iosFlag) ? 'apple' : 'weixin',
 							success: (info) => {
 								console.log('info',info)
-								if (this.isIos) {
+								if (this.isIos && iosFlag) {
 									uni.setStorage({
 										key: 'iosLoginData',
 										data: {
@@ -604,6 +612,33 @@
 				line-height: 36px;
 				text-align: center;
 			}
+			.authorize-login-ios {
+				width: 210px;
+				height: 33px;
+				float: left;
+				margin: 10px 5px;
+				background: #FFFFFF;
+				border-radius: 4px;
+				font-size: 14px;
+				font-family: PingFang SC;
+				// color: #56a83a;
+				line-height: 33px;
+				text-align: center;
+			}
+			.login-icon {
+				width: 13px;
+				height: 15px;
+				position: absolute;
+				left: 13px;
+				top: 25%;
+			}
+			.login-icon2 {
+				width: 13px;
+				height: 11px;
+				position: absolute;
+				left: 13px;
+				top: 30%;
+			}
 			.authorize-tip {
 				width: 220px;
 				height: 20px;