支付宝小程序适配

pull/169/head
yunlongn 2025-11-27 10:45:08 +08:00
parent 3184dcd4f1
commit f6a8721238
12 changed files with 60 additions and 30 deletions

View File

@ -185,7 +185,9 @@
"requiredPrivateInfos": ["chooseAddress"] "requiredPrivateInfos": ["chooseAddress"]
}, },
"mp-alipay": { "mp-alipay": {
"usingComponents": true "usingComponents": true,
"styleIsolation": "shared",
"mergeVirtualHostAttributes": true
}, },
"mp-baidu": { "mp-baidu": {
"usingComponents": true "usingComponents": true

View File

@ -675,7 +675,15 @@
"navigationBarTitleText": "芋道商城", "navigationBarTitleText": "芋道商城",
"navigationBarBackgroundColor": "#FFFFFF", "navigationBarBackgroundColor": "#FFFFFF",
"backgroundColor": "#FFFFFF", "backgroundColor": "#FFFFFF",
"navigationStyle": "custom" "navigationStyle": "custom",
"mp-alipay": {
"titleImage": "",
"gestureBack": "YES",
"allowsBounceVertical": "NO",
"transparentTitle": "always",
"navigationStyle": "custom",
"titlePenetrate": "YES"
}
}, },
"tabBar": { "tabBar": {
"list": [{ "list": [{

View File

@ -3,7 +3,10 @@
<su-fixed alway :bgStyles="{ background: '#fff' }" :val="0" noNav opacity :placeholder="false"> <su-fixed alway :bgStyles="{ background: '#fff' }" :val="0" noNav opacity :placeholder="false">
<su-status-bar /> <su-status-bar />
<view <view
class="ui-bar ss-flex ss-col-center ss-row-between ss-p-x-20" class="ui-bar ss-flex ss-col-center ss-row-between"
:class="[{
'ss-p-x-20': sheep.$platform.provider !== 'alipay'
}]"
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]" :style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
> >
<!-- --> <!-- -->

View File

@ -11,7 +11,10 @@
> >
<su-status-bar /> <su-status-bar />
<view <view
class="ui-bar ss-flex ss-col-center ss-row-between ss-p-x-20" class="ui-bar ss-flex ss-col-center ss-row-between"
:class="[{
'ss-p-x-20': sheep.$platform.provider !== 'alipay'
}]"
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]" :style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
> >
<!-- --> <!-- -->

View File

@ -46,18 +46,6 @@
<view class="circle" /> <view class="circle" />
</view> </view>
<!-- 7.3 支付宝小程序登录 -->
<button
v-if="sheep.$platform.name === 'alipayMiniProgram'"
@tap="thirdLogin('alipay')"
class="ss-reset-button auto-login-btn"
>
<image
class="auto-login-img"
:src="sheep.$url.static('/static/img/shop/platform/alipay.png')"
/>
</button>
<!-- 7.2 微信的公众号App小程序的登录基于 openid + code --> <!-- 7.2 微信的公众号App小程序的登录基于 openid + code -->
<button <button
v-if=" v-if="
@ -84,6 +72,18 @@
:src="sheep.$url.static('/static/img/shop/platform/apple.png')" :src="sheep.$url.static('/static/img/shop/platform/apple.png')"
/> />
</button> </button>
<!-- 7.4 支付宝小程序登录 -->
<button
v-if="sheep.$platform.name === 'alipayMiniProgram'"
@tap="thirdLogin('alipay')"
class="ss-reset-button auto-login-btn"
>
<image
class="auto-login-img"
:src="sheep.$url.static('/static/img/shop/pay/alipay.png')"
/>
</button>
</view> </view>
<!-- 用户协议的勾选 --> <!-- 用户协议的勾选 -->
@ -97,7 +97,7 @@
<view class="agreement-options-container"> <view class="agreement-options-container">
<!-- 同意选项 --> <!-- 同意选项 -->
<view class="agreement-option ss-m-b-20"> <view class="agreement-option ss-m-b-20">
<label class="radio ss-flex ss-col-center" @tap="onAgree"> <view class="radio ss-flex ss-col-center" @tap="onAgree">
<radio <radio
:checked="state.protocol === true" :checked="state.protocol === true"
color="var(--ui-BG-Main)" color="var(--ui-BG-Main)"
@ -110,12 +110,12 @@
<view class="agreement-text"></view> <view class="agreement-text"></view>
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 隐私协议 </view> <view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 隐私协议 </view>
</view> </view>
</label> </view>
</view> </view>
<!-- 拒绝选项 --> <!-- 拒绝选项 -->
<view class="agreement-option"> <view class="agreement-option">
<label class="radio ss-flex ss-col-center" @tap="onRefuse"> <view class="radio ss-flex ss-col-center" @tap="onRefuse">
<radio <radio
:checked="state.protocol === false" :checked="state.protocol === false"
color="#ff4d4f" color="#ff4d4f"
@ -128,7 +128,7 @@
<view class="agreement-text"></view> <view class="agreement-text"></view>
<view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 隐私协议 </view> <view class="tcp-text" @tap.stop="onProtocol('隐私协议')"> 隐私协议 </view>
</view> </view>
</label> </view>
</view> </view>
</view> </view>
</view> </view>
@ -197,7 +197,7 @@
} else { } else {
sheep.$helper.toast('请选择是否同意协议'); sheep.$helper.toast('请选择是否同意协议');
} }
// return; return;
} }
const loginRes = await sheep.$platform.useProvider(provider).login(); const loginRes = await sheep.$platform.useProvider(provider).login();
if (loginRes) { if (loginRes) {

View File

@ -17,13 +17,11 @@
/> />
<!-- 顶部导航栏-情况2装修组件导航栏-标准 --> <!-- 顶部导航栏-情况2装修组件导航栏-标准 -->
<!--#ifndef MP-ALIPAY-->
<s-custom-navbar <s-custom-navbar
v-else-if="navbar === 'custom' && navbarMode === 'normal'" v-else-if="navbar === 'custom' && navbarMode === 'normal'"
:data="navbarStyle" :data="navbarStyle"
:showLeftButton="showLeftButton" :showLeftButton="showLeftButton"
/> />
<!--#endif-->
<view class="page-body" :style="[bgBody]"> <view class="page-body" :style="[bgBody]">
<!-- 顶部导航栏-情况3沉浸式头部 --> <!-- 顶部导航栏-情况3沉浸式头部 -->
<su-inner-navbar v-if="navbar === 'inner'" :title="title" /> <su-inner-navbar v-if="navbar === 'inner'" :title="title" />
@ -216,6 +214,11 @@
// 使 onMounted 使 onShow // 使 onMounted 使 onShow
onMounted(()=>{ onMounted(()=>{
// #ifdef MP-ALIPAY
uni.setNavigationBarTitle({
title: "",
});
// #endif
if (!isEmpty(shareInfo.value)) { if (!isEmpty(shareInfo.value)) {
sheep.$platform.share.updateShareInfo(shareInfo.value); sheep.$platform.share.updateShareInfo(shareInfo.value);
} }

View File

@ -2,8 +2,8 @@
<template> <template>
<view :style="[bgStyle, { marginLeft: `${data.space}px` }]"> <view :style="[bgStyle, { marginLeft: `${data.space}px` }]">
<uni-grid :showBorder="Boolean(data.border)" :column="data.column"> <uni-grid :showBorder="Boolean(data.border)" :column="data.column">
<uni-grid-item v-for="(item, index) in data.list" :key="index" @tap="sheep.$router.go(item.url)"> <uni-grid-item v-for="(item, index) in data.list" :key="index" >
<view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center"> <view class="grid-item-box ss-flex ss-flex-col ss-row-center ss-col-center" @tap="sheep.$router.go(item.url)">
<view class="img-box"> <view class="img-box">
<view class="tag-box" v-if="item.badge.show" <view class="tag-box" v-if="item.badge.show"
:style="[{ background: item.badge.bgColor, color: item.badge.textColor }]"> :style="[{ background: item.badge.bgColor, color: item.badge.textColor }]">

View File

@ -20,7 +20,7 @@
:badgeStyle="tabbar.badgeStyle" :badgeStyle="tabbar.badgeStyle"
:isCenter="getTabbarCenter(index)" :isCenter="getTabbarCenter(index)"
:centerImage="sheep.$url.cdn(item.iconUrl)" :centerImage="sheep.$url.cdn(item.iconUrl)"
@tap="sheep.$router.go(item.url)" @click="sheep.$router.go(item.url)"
> >
<template v-slot:active-icon> <template v-slot:active-icon>
<image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.activeIconUrl)"></image> <image class="u-page__item__slot-icon" :src="sheep.$url.cdn(item.activeIconUrl)"></image>

View File

@ -58,6 +58,13 @@ provider = 'wechat';
name = 'alipayMiniProgram'; name = 'alipayMiniProgram';
platform = 'alipayMiniProgram'; platform = 'alipayMiniProgram';
provider = 'alipay'; provider = 'alipay';
if (!device.safeAreaInsets) {
device.safeAreaInsets = uni.getSystemInfoSync().safeAreaInsets
}
// 兜底一下。还是没有值时候,就给个默认值
if (!device.safeAreaInsets) {
device.safeAreaInsets = {}
}
// #endif // #endif
if (isEmpty(name)) { if (isEmpty(name)) {

View File

@ -3,7 +3,7 @@
<view <view
class="ui-fixed-box" class="ui-fixed-box"
:id="`fixed-${uuid}`" :id="`fixed-${uuid}`"
:class="['fixed']" :class="[{ fixed: state.fixed }]"
:style="[ :style="[
{ {
left: sticky ? 'auto' : '0px', left: sticky ? 'auto' : '0px',

View File

@ -17,8 +17,12 @@
--> -->
<view class="ui-navbar-box"> <view class="ui-navbar-box">
<view <view
class="ui-bar ss-p-x-20" class="ui-bar"
:class="state.isDark ? 'text-white' : 'text-black'" :class="[{
'text-white': state.isDark,
'text-black': !state.isDark,
'ss-p-x-20': sheep.$platform.provider !== 'alipay'
}]"
:style="[{ height: sys_navBar - sys_statusBar + 'px' }]" :style="[{ height: sys_navBar - sys_statusBar + 'px' }]"
> >
<view class="icon-box ss-flex"> <view class="icon-box ss-flex">

View File

@ -1,6 +1,6 @@
<!-- 自定义底部导航项 --> <!-- 自定义底部导航项 -->
<template> <template>
<view class="u-tabbar-item" :style="[addStyle(customStyle)]"> <view class="u-tabbar-item" :style="[addStyle(customStyle)]" @click="clickHandler">
<view v-if="isCenter" class="tabbar-center-item"> <view v-if="isCenter" class="tabbar-center-item">
<image class="center-image" :src="centerImage" mode="aspectFill"></image> <image class="center-image" :src="centerImage" mode="aspectFill"></image>
</view> </view>