|
@@ -24,8 +24,9 @@
|
|
|
</view>
|
|
|
<view class="login-btn" @click="getYzmBtn" :class="indexData.telStatus"></view>
|
|
|
</view>
|
|
|
- <view class="bottom-btn-box">
|
|
|
-<!-- <view class="wx-btn" @click="wxLoginClick"></view> -->
|
|
|
+ <view class="bottom-btn-box">
|
|
|
+ <view class="apple-btn" v-if="showAppleLogin" @click="appleLoginClick"></view>
|
|
|
+ <!-- <view class="wx-btn" @click="wxLoginClick"></view> -->
|
|
|
<view class="yk-btn" @click="ykBtn"></view>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -73,8 +74,12 @@
|
|
|
const agreeYkDialog = ref(null);
|
|
|
const telDialogRef = ref(null);
|
|
|
let telDialogFlag = ref(false);
|
|
|
+ let showAppleLogin = ref(false);
|
|
|
|
|
|
- onLoad((options) => {})
|
|
|
+ onLoad((options) => {
|
|
|
+ showAppleLogin.value = isIOS13OrAbove();
|
|
|
+ console.log('showAppleLogin.value',showAppleLogin.value);
|
|
|
+ })
|
|
|
|
|
|
const getYzmBtn = () => {
|
|
|
if (indexData.telStatus === 'tel-btn-normal') {
|
|
@@ -87,6 +92,15 @@
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ const isIOS13OrAbove = () => {
|
|
|
+ const systemInfo = uni.getSystemInfoSync();
|
|
|
+ if (systemInfo.platform == 'ios') {
|
|
|
+ const version = systemInfo.system.split(' ')[1].split('.');
|
|
|
+ const majorVersion = parseInt(version[0], 10);
|
|
|
+ return majorVersion >= 13;
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
// 用户协议同意
|
|
|
const confirmBtn = () => {
|
|
|
indexData.isAgreed = true;
|
|
@@ -165,6 +179,46 @@
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ const appleLoginClick = () => {
|
|
|
+ uni.login({
|
|
|
+ provider: 'apple',
|
|
|
+ success: function(loginRes) {
|
|
|
+ console.log('loginRes', loginRes);
|
|
|
+ let req = {
|
|
|
+ "apple": true,
|
|
|
+ "code": loginRes
|
|
|
+ }
|
|
|
+ console.log(req);
|
|
|
+ wxLogin(req).then(res => {
|
|
|
+ console.log(res);
|
|
|
+ uni.showLoading({
|
|
|
+ title: '登录中'
|
|
|
+ });
|
|
|
+ setTimeout(() => {
|
|
|
+ cacheManager.set('auth', res.data.loginVo)
|
|
|
+ if (res.data.loginVo.cardId == 0) {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/pages/selectGradesTerms/index`
|
|
|
+ })
|
|
|
+ uni.hideLoading();
|
|
|
+ } else {
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/pages/study/index`
|
|
|
+ })
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
+ }).catch((error) => {
|
|
|
+ console.log(error);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ fail: function(err) {
|
|
|
+ console.log('err.code', err.code);
|
|
|
+ // 登录授权失败
|
|
|
+ // err.code错误码参考`授权失败错误码(code)说明`
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
const wxLoginClick = () => {
|
|
|
//获取服务商信息判断手机端是否安装了app
|
|
|
// uni.getProvider({
|
|
@@ -211,22 +265,22 @@
|
|
|
uni.showLoading({
|
|
|
title: '登录中'
|
|
|
});
|
|
|
- setTimeout(()=>{
|
|
|
- cacheManager.set('auth', res.data.loginVo)
|
|
|
- if (res.data.loginVo.cardId == 0) {
|
|
|
-
|
|
|
- uni.redirectTo({
|
|
|
- url: `/pages/selectGradesTerms/index`
|
|
|
- })
|
|
|
- uni.hideLoading();
|
|
|
- } else {
|
|
|
-
|
|
|
- uni.redirectTo({
|
|
|
- url: `/pages/study/index`
|
|
|
- })
|
|
|
- uni.hideLoading();
|
|
|
- }
|
|
|
- },1000)
|
|
|
+ setTimeout(() => {
|
|
|
+ cacheManager.set('auth', res.data.loginVo)
|
|
|
+ if (res.data.loginVo.cardId == 0) {
|
|
|
+
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/pages/selectGradesTerms/index`
|
|
|
+ })
|
|
|
+ uni.hideLoading();
|
|
|
+ } else {
|
|
|
+
|
|
|
+ uni.redirectTo({
|
|
|
+ url: `/pages/study/index`
|
|
|
+ })
|
|
|
+ uni.hideLoading();
|
|
|
+ }
|
|
|
+ }, 1000)
|
|
|
}
|
|
|
}).catch((error) => {
|
|
|
console.log(error);
|