feat:apple登录
This commit is contained in:
@@ -8,8 +8,15 @@
|
||||
"type" : "uni-app:app-android"
|
||||
},
|
||||
{
|
||||
"customPlaygroundType" : "device",
|
||||
"bundleId" : "com.trustbridge.mm",
|
||||
"certificateFile" : "/Users/qinxingxing/Documents/alpha/资料/商城证书/int/ios/malldev.p12",
|
||||
"certificateProfileFile" : "/Users/qinxingxing/Documents/alpha/资料/商城证书/int/ios/malldev.mobileprovision",
|
||||
"customPlaygroundType" : "local",
|
||||
"iOSProjectStandardBaseHistory" : {
|
||||
"current" : "iOS_debug_5.24.ipa"
|
||||
},
|
||||
"playground" : "custom",
|
||||
"runSignStatus" : 0,
|
||||
"type" : "uni-app:app-ios"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
<view class="register_warp">
|
||||
<view class="header_">
|
||||
<view style="margin-top: 10rpx">
|
||||
<up-image
|
||||
src="/static/common/left.png"
|
||||
width="18"
|
||||
height="20"
|
||||
bgColor="#f1f6ff00"
|
||||
@click="jumpMine"
|
||||
/>
|
||||
<up-image src="/static/common/left.png" width="18" height="20" bgColor="#f1f6ff00" @click="jumpMine" />
|
||||
</view>
|
||||
<view class="title_">绑定手机号</view>
|
||||
<view></view>
|
||||
@@ -16,69 +10,38 @@
|
||||
|
||||
<view class="register_ifo_warp">
|
||||
<view class="register_info_item">
|
||||
<up-input
|
||||
placeholder="请输入手机号"
|
||||
border="surround"
|
||||
v-model="form.mobile"
|
||||
:customStyle="inputCss"
|
||||
></up-input>
|
||||
<up-input placeholder="请输入手机号" border="surround" v-model="form.mobile" :customStyle="inputCss"></up-input>
|
||||
</view>
|
||||
<view class="register_info_item">
|
||||
<up-input
|
||||
placeholder="请输入验证码"
|
||||
border="surround"
|
||||
v-model="form.smsCode"
|
||||
:customStyle="inputCss"
|
||||
>
|
||||
<up-input placeholder="请输入验证码" border="surround" v-model="form.smsCode" :customStyle="inputCss">
|
||||
<template #suffix style="margin-right: 10rpx">
|
||||
<view v-if="countdown" class="code-warp">
|
||||
<up-count-down
|
||||
:time="60 * 1000"
|
||||
format="ss"
|
||||
@finish="countdown = false"
|
||||
></up-count-down>
|
||||
<up-count-down :time="60 * 1000" format="ss" @finish="countdown = false"></up-count-down>
|
||||
<text style="margin-left: 10rpx">s</text>
|
||||
</view>
|
||||
<view v-else @click="getMobileCode" class="code_msg">
|
||||
获取验证码
|
||||
<qiaobao-assistant page-key="pages/login_package/bind-phone/bind-phone" title="账户登录" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
</up-input>
|
||||
</view>
|
||||
</view>
|
||||
|
||||
<view
|
||||
class="login_comm_but login_comm_but_yes"
|
||||
@click="submit"
|
||||
:loading="butLoading"
|
||||
>
|
||||
<view class="login_comm_but login_comm_but_yes" @click="submit" :loading="butLoading">
|
||||
登录
|
||||
</view>
|
||||
|
||||
<view class="policy_warp">
|
||||
<up-checkbox
|
||||
name="isCheck"
|
||||
usedAlone
|
||||
v-model:checked="isPolicy"
|
||||
shape="circle"
|
||||
activeColor="#7934F6"
|
||||
size="19"
|
||||
iconSize="18"
|
||||
>
|
||||
<up-checkbox name="isCheck" usedAlone v-model:checked="isPolicy" shape="circle" activeColor="#7934F6" size="19"
|
||||
iconSize="18">
|
||||
<template #label>
|
||||
<text @click="aa">已阅读并同意</text>
|
||||
<text class="policy_a_warp" @click="jumpUserAgreement"
|
||||
>《服务协议》</text
|
||||
>
|
||||
<text class="policy_a_warp" @click="jumpUserAgreement">《服务协议》</text>
|
||||
<text>、</text>
|
||||
<text class="policy_a_warp" @click="jumpPrivacyAgreement"
|
||||
>《隐私政策》</text
|
||||
>
|
||||
<text class="policy_a_warp" @click="jumpPrivacyAgreement">《隐私政策》</text>
|
||||
<text>、</text>
|
||||
<text class="policy_a_warp" @click="jumpProductAgreement"
|
||||
>《售后保障协议》</text
|
||||
>
|
||||
<text class="policy_a_warp" @click="jumpProductAgreement">《售后保障协议》</text>
|
||||
</template>
|
||||
</up-checkbox>
|
||||
</view>
|
||||
@@ -96,7 +59,7 @@
|
||||
<script>
|
||||
import { SMS_TYPE } from "@/utils/enumUtils.js";
|
||||
import { getUserList } from "@/api/common.js";
|
||||
import { wechatLogin, alipayLogin } from "@/api/auth.js";
|
||||
import { wechatLogin, alipayLogin, appleLogin } from "@/api/auth.js";
|
||||
import {
|
||||
setStorageFun,
|
||||
TOKEN_NAME,
|
||||
@@ -123,7 +86,7 @@ export default {
|
||||
countdown: false, // 清空倒计时
|
||||
butLoading: false,
|
||||
disabled: false,
|
||||
type: 1, //1.微信 2.支付宝
|
||||
type: 1, //1.微信 2.支付宝,3.apple
|
||||
tipsShow: false,
|
||||
content: '确认绑定手机号吗?',
|
||||
isPolicy: false,
|
||||
@@ -136,15 +99,15 @@ export default {
|
||||
console.log("-----1", option, this.form.token, this.type);
|
||||
},
|
||||
methods: {
|
||||
submit(){
|
||||
if(!this.isPolicy){
|
||||
submit() {
|
||||
if (!this.isPolicy) {
|
||||
this.tipsShow = true;
|
||||
}
|
||||
},
|
||||
onCancel(){
|
||||
onCancel() {
|
||||
this.tipsShow = false;
|
||||
},
|
||||
onConfirm(){
|
||||
onConfirm() {
|
||||
this.tipsShow = false;
|
||||
this.isPolicy = true;
|
||||
this.registerFun();
|
||||
@@ -197,7 +160,7 @@ export default {
|
||||
token: form.token,
|
||||
};
|
||||
const response =
|
||||
this.type == 1 ? await wechatLogin(params) : await alipayLogin(params);
|
||||
this.type == 1 ? await wechatLogin(params) : this.type == 2 ? await alipayLogin(params) : await appleLogin(params);
|
||||
console.log("微信登录接口返回:", params, response);
|
||||
if (response && response.bizcode === 100) {
|
||||
const data = response.data;
|
||||
@@ -257,7 +220,7 @@ export default {
|
||||
|
||||
const params = {
|
||||
mobile: form.mobile,
|
||||
type: this.type == 1 ? SMS_TYPE.WECHAT : SMS_TYPE.ALIPAY,
|
||||
type: this.type == 1 ? SMS_TYPE.WECHAT : this.type == 2 ? SMS_TYPE.ALIPAY : SMS_TYPE.APPLE,
|
||||
};
|
||||
const response = await getUserList(params);
|
||||
if (response && response.bizcode === 100) {
|
||||
@@ -278,6 +241,7 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: calc(24rpx + env(safe-area-inset-bottom)) 30rpx 0 30rpx;
|
||||
|
||||
.title_ {
|
||||
font-weight: bold;
|
||||
font-size: 36rpx;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<up-input placeholder="请输入手机号/账户名称" border="surround" v-model="form.name" :customStyle="inputCss"
|
||||
:adjust-position="false" @change="checkNameParam"></up-input>
|
||||
<qiaobao-assistant page-key="pages/login_package/login/login" title="账户登录" />
|
||||
</view>
|
||||
</view>
|
||||
<!-- 密码登录 -->
|
||||
<view class="login_info_item" v-if="loginWay === 'password'">
|
||||
<up-input placeholder="请输入密码" border="surround" v-model="form.password" :customStyle="inputCss"
|
||||
@@ -81,7 +81,7 @@
|
||||
<view class="login_other_item" @click="wechatOneLogin(1)">
|
||||
<up-image src="/pages/login_package/static/login/WXICON.png" width="44" height="44"
|
||||
bgColor="#f1f6ff00"></up-image>
|
||||
微信登录11
|
||||
微信登录
|
||||
</view>
|
||||
</view>
|
||||
<view class="login_other_icon">
|
||||
@@ -524,21 +524,35 @@ export default {
|
||||
}
|
||||
|
||||
// #ifdef APP-PLUS
|
||||
uni.getProvider({
|
||||
service: 'oauth',
|
||||
success: (provRes) => {
|
||||
if (!provRes.provider || !provRes.provider.includes('apple')) {
|
||||
this.loading = false;
|
||||
this.$refs.uToastRef.show({
|
||||
type: "error",
|
||||
message: "当前运行环境或自定义基座未支持 Apple 登录",
|
||||
});
|
||||
return;
|
||||
}
|
||||
uni.login({
|
||||
provider: 'apple',
|
||||
success: async (loginRes) => {
|
||||
console.log('Apple 登录成功:', loginRes);
|
||||
const authResult = loginRes.authResult || {};
|
||||
const authResult = loginRes.appleInfo || {};
|
||||
const params = {
|
||||
identityToken: authResult.identityToken,
|
||||
openId: authResult.user,
|
||||
fullName: authResult.fullName ? `${authResult.fullName.familyName || ''}${authResult.fullName.givenName || ''}` : '',
|
||||
authorizationCode: authResult.authorizationCode
|
||||
// openId: authResult.user,
|
||||
// fullName: authResult.fullName ? `${authResult.fullName.familyName || ''}${authResult.fullName.givenName || ''}` : '',
|
||||
// authorizationCode: authResult.authorizationCode
|
||||
};
|
||||
|
||||
console.log("Apple 登录成功-0:", params)
|
||||
try {
|
||||
const response = await appleLogin(params);
|
||||
console.log("Apple 登录成功-1:", response)
|
||||
if (response && response.bizcode === 100) {
|
||||
|
||||
if (response.data && response.data.userId) {
|
||||
this.loginWay = "apple";
|
||||
this.loginFun(response);
|
||||
@@ -548,6 +562,7 @@ export default {
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log("Apple 登录成功-2:", response)
|
||||
this.$refs.uToastRef.show({
|
||||
type: "error",
|
||||
message: response?.msg || "Apple登录失败",
|
||||
@@ -574,7 +589,10 @@ export default {
|
||||
});
|
||||
// #endif
|
||||
},
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
computed: {
|
||||
isIOS() {
|
||||
// #ifdef APP-PLUS
|
||||
|
||||
@@ -297,7 +297,7 @@
|
||||
<u-modal class="sure_pay" :show="surePayShow" title="提示" showCancelButton @cancel="surePayShow = false"
|
||||
@confirm="cancelPay" confirmColor="#7934F6" content="确定取消支付吗?"></u-modal>
|
||||
<qiaobao-assistant page-key="pages/mine_package/mine_order/mine_order" title="我的订单" />
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
@@ -538,11 +538,11 @@ export default {
|
||||
if (this.$refs.uToastRef) {
|
||||
this.$refs.uToastRef.show({
|
||||
type: 'success',
|
||||
message: '地址修改成功'
|
||||
message: '申请修改地址已提交,请等待'
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: '地址修改成功',
|
||||
title: '申请修改地址已提交,请等待',
|
||||
icon: 'success'
|
||||
});
|
||||
}
|
||||
|
||||
@@ -53,8 +53,7 @@
|
||||
<view class="address_info_name">{{ orderInfo.name }}</view>
|
||||
<view class="address_info_mobile">{{ orderInfo.phone }}</view>
|
||||
</view>
|
||||
<view class="address_but">{{ getValue(LOGISTICS_STATUS_UPDATE,
|
||||
orderInfo.modifyShippingAddressStatus) }}</view>
|
||||
<view class="address_but" :class="{ 'is-rejected': orderInfo.modifyShippingAddressStatus === 3 || getValue(LOGISTICS_STATUS_UPDATE, orderInfo.modifyShippingAddressStatus) === '审核驳回' }">{{ getValue(LOGISTICS_STATUS_UPDATE, orderInfo.modifyShippingAddressStatus) }}</view>
|
||||
</view>
|
||||
<view class="address_content">
|
||||
{{ assembleAddress(orderInfo).names }} {{ orderInfo.address }}
|
||||
@@ -620,6 +619,10 @@ export default {
|
||||
color: #ffffff;
|
||||
padding: 2rpx 16rpx;
|
||||
white-space: nowrap;
|
||||
|
||||
&.is-rejected {
|
||||
background-color: #e54d42;
|
||||
}
|
||||
}
|
||||
|
||||
.address_content {
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@ export const SMS_TYPE = {
|
||||
"LOGIN": "login",
|
||||
"REGISTER": "register",
|
||||
"WECHAT": "wechatValid",
|
||||
"ALIPAY": "alipayValid"
|
||||
"ALIPAY": "alipayValid",
|
||||
"APPLE": "appleValid"
|
||||
}
|
||||
|
||||
// 图片类型 图片分类:COMMON-公共,CATEGORY-商品类目图标,BRAND-品牌LOGO,SHOP-店铺LOGO,GOODS-商品图片,SPECS-商品规格图片
|
||||
|
||||
Reference in New Issue
Block a user