新增三码适配
This commit is contained in:
+52
-34
@@ -21,18 +21,18 @@
|
||||
<!-- 全屏地图组件 -->
|
||||
<!-- 支付宝小程序使用专用组件 -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<MapComponentAlipay v-if="!isLoading && userLocation && !locationPermissionDenied" ref="mapRef" :userLocation="userLocation"
|
||||
:positionList="positionList" :filteredPositions="filteredPositions" :searchKeyword="searchKeyword"
|
||||
:enableMarkers="true" :bannerImages="bannerImages"
|
||||
<MapComponentAlipay v-if="!isLoading && userLocation && !locationPermissionDenied" ref="mapRef"
|
||||
:userLocation="userLocation" :positionList="positionList" :filteredPositions="filteredPositions"
|
||||
:searchKeyword="searchKeyword" :enableMarkers="true" :bannerImages="bannerImages"
|
||||
:hideMapOverlays="showGuidePopup || showNoticePopup || showActivityPopup" @relocate="handleRelocate"
|
||||
@scan="handleScan" @showList="showLocationList" @markerTap="selectPosition"
|
||||
@mapCenterChange="onMapCenterChange" @bannerClick="handleBannerClick" @guide="openGuidePopup" />
|
||||
<!-- #endif -->
|
||||
<!-- 非支付宝小程序使用通用组件 -->
|
||||
<!-- #ifndef MP-ALIPAY -->
|
||||
<MapComponent v-if="!isLoading && userLocation && !locationPermissionDenied" ref="mapRef" :userLocation="userLocation"
|
||||
:positionList="positionList" :filteredPositions="filteredPositions" :searchKeyword="searchKeyword"
|
||||
:enableMarkers="true" :bannerImages="bannerImages"
|
||||
<MapComponent v-if="!isLoading && userLocation && !locationPermissionDenied" ref="mapRef"
|
||||
:userLocation="userLocation" :positionList="positionList" :filteredPositions="filteredPositions"
|
||||
:searchKeyword="searchKeyword" :enableMarkers="true" :bannerImages="bannerImages"
|
||||
:hideMapOverlays="showGuidePopup || showNoticePopup || showActivityPopup" @relocate="handleRelocate"
|
||||
@scan="handleScan" @showList="showLocationList" @markerTap="selectPosition"
|
||||
@mapCenterChange="onMapCenterChange" @bannerClick="handleBannerClick" @guide="openGuidePopup" />
|
||||
@@ -125,13 +125,8 @@
|
||||
|
||||
<!-- 支付宝:先授权 phoneNumber,再调用 my.getPhoneNumber,上报后端解密并校验一致性 -->
|
||||
<!-- #ifdef MP-ALIPAY -->
|
||||
<button
|
||||
class="auth-btn"
|
||||
open-type="getAuthorize"
|
||||
scope="phoneNumber"
|
||||
@getAuthorize="onAliAuthorizePhoneNumber"
|
||||
@error="onAliAuthorizePhoneNumberError"
|
||||
>
|
||||
<button class="auth-btn" open-type="getAuthorize" scope="phoneNumber"
|
||||
@getAuthorize="onAliAuthorizePhoneNumber" @error="onAliAuthorizePhoneNumberError">
|
||||
<text>{{ $t('auth.getPhoneNumber') }}</text>
|
||||
</button>
|
||||
<!-- #endif -->
|
||||
@@ -314,11 +309,15 @@
|
||||
const navbarStyle = computed(() => {
|
||||
// #ifdef MP-ALIPAY
|
||||
// 支付宝小程序:不设置 paddingTop
|
||||
return { paddingTop: '0px' }
|
||||
return {
|
||||
paddingTop: '0px'
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP-ALIPAY
|
||||
// 非支付宝小程序:设置 statusBarHeight
|
||||
return { paddingTop: statusBarHeight.value + 'px' }
|
||||
return {
|
||||
paddingTop: statusBarHeight.value + 'px'
|
||||
}
|
||||
// #endif
|
||||
})
|
||||
|
||||
@@ -326,21 +325,29 @@
|
||||
const topInfoSectionStyle = computed(() => {
|
||||
// #ifdef MP-ALIPAY
|
||||
// 支付宝小程序:使用 paddingTop
|
||||
return { top: ( navBarHeight.value) + 'px' }
|
||||
return {
|
||||
top: (navBarHeight.value) + 'px'
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP-ALIPAY
|
||||
// 非支付宝小程序:使用 top
|
||||
return { top: (statusBarHeight.value + navBarHeight.value) + 'px' }
|
||||
return {
|
||||
top: (statusBarHeight.value + navBarHeight.value) + 'px'
|
||||
}
|
||||
// #endif
|
||||
})
|
||||
|
||||
// 主内容区域样式:不同端适配不同的 paddingTop
|
||||
const mainContentStyle = computed(() => {
|
||||
// #ifdef MP-ALIPAY
|
||||
return { paddingTop: (navBarHeight.value + noticeHeight.value) + 'px' }
|
||||
return {
|
||||
paddingTop: (navBarHeight.value + noticeHeight.value) + 'px'
|
||||
}
|
||||
// #endif
|
||||
// #ifndef MP-ALIPAY
|
||||
return { paddingTop: (statusBarHeight.value + navBarHeight.value + noticeHeight.value) + 'px' }
|
||||
return {
|
||||
paddingTop: (statusBarHeight.value + navBarHeight.value + noticeHeight.value) + 'px'
|
||||
}
|
||||
// #endif
|
||||
})
|
||||
|
||||
@@ -372,7 +379,7 @@
|
||||
`${k}=${encodeURIComponent(current.options[k])}`).join('&') : ''
|
||||
const redirect = encodeURIComponent(query ? `${route}?${query}` : route)
|
||||
uni.reLaunch({
|
||||
url: `/subPackages/user/login/index?redirect=${redirect}`
|
||||
url: redirect
|
||||
})
|
||||
} catch (e) {
|
||||
uni.reLaunch({
|
||||
@@ -437,8 +444,8 @@
|
||||
// 调用接口获取广告内容
|
||||
const res = await getCurrentAdvertisement({
|
||||
appPlatform: appPlatform, // 微信平台
|
||||
appType: 'user' ,// 用户端
|
||||
pictureLocation:'home_banner'
|
||||
appType: 'user', // 用户端
|
||||
pictureLocation: 'home_banner'
|
||||
})
|
||||
|
||||
console.log('首页广告响应:', res)
|
||||
@@ -621,7 +628,7 @@
|
||||
onMounted(() => {
|
||||
initNavBarHeight()
|
||||
init()
|
||||
|
||||
|
||||
// #ifdef H5
|
||||
// 监听 H5 扫码结果
|
||||
uni.$on('h5ScanSuccess', (data) => {
|
||||
@@ -941,7 +948,7 @@
|
||||
if (!loc || !loc.longitude || !loc.latitude) {
|
||||
throw new Error('location failed')
|
||||
}
|
||||
|
||||
|
||||
const newLocation = {
|
||||
longitude: Number(loc.longitude),
|
||||
latitude: Number(loc.latitude)
|
||||
@@ -1076,7 +1083,7 @@
|
||||
} catch (error) {
|
||||
console.error('查询商品列表失败:', error)
|
||||
uni.hideLoading()
|
||||
|
||||
|
||||
// 即使查询失败,也跳转到商品页面
|
||||
uni.navigateTo({
|
||||
url: '/subPackages/business/device-goods'
|
||||
@@ -1141,11 +1148,11 @@
|
||||
try {
|
||||
const userInfoRes = await getUserInfo()
|
||||
console.log('userInfoRes', userInfoRes.data.phone);
|
||||
|
||||
|
||||
const phone = userInfoRes.data.phone || ''
|
||||
expectedUserPhone.value = phone
|
||||
console.log('expectedUserPhone', expectedUserPhone.value);
|
||||
|
||||
|
||||
|
||||
// 没有手机号:弹窗引导获取/绑定
|
||||
if (!phone) {
|
||||
@@ -1242,7 +1249,7 @@
|
||||
console.log('scanType:', scanResult.scanType);
|
||||
console.log('result:', scanResult.result);
|
||||
console.log('path:', scanResult.path);
|
||||
|
||||
|
||||
let deviceNo = ''
|
||||
if (scanResult.scanType == 'MANUAL') {
|
||||
deviceNo = extractDeviceNoFromText(scanResult.result)
|
||||
@@ -1336,19 +1343,25 @@
|
||||
uni.navigateBack({
|
||||
success: () => {
|
||||
setTimeout(() => {
|
||||
uni.navigateTo({ url });
|
||||
uni.navigateTo({
|
||||
url
|
||||
});
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
uni.navigateTo({ url });
|
||||
uni.navigateTo({
|
||||
url
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
if (deviceInfo.feeConfig) {
|
||||
try {
|
||||
const feeConfig = JSON.parse(deviceInfo.feeConfig)
|
||||
closeScanPageAndNavigate(`/pages/device/detail?deviceNo=${deviceNo}&feeConfig=${encodeURIComponent(deviceInfo.feeConfig)}`);
|
||||
closeScanPageAndNavigate(
|
||||
`/pages/device/detail?deviceNo=${deviceNo}&feeConfig=${encodeURIComponent(deviceInfo.feeConfig)}`
|
||||
);
|
||||
} catch (e) {
|
||||
closeScanPageAndNavigate(`/pages/device/detail?deviceNo=${deviceNo}`);
|
||||
}
|
||||
@@ -1435,7 +1448,9 @@
|
||||
// #ifdef MP-ALIPAY
|
||||
try {
|
||||
console.log('[ALIPAY] getAuthorize(phoneNumber) event:', e)
|
||||
uni.showLoading({ title: t('common.processing') })
|
||||
uni.showLoading({
|
||||
title: t('common.processing')
|
||||
})
|
||||
const res = await getAlipayUserPhoneNumber()
|
||||
const aliPhone = res?.data?.phoneNumber || res?.data?.phone || res?.phoneNumber || ''
|
||||
if (!aliPhone) {
|
||||
@@ -1453,7 +1468,10 @@
|
||||
}
|
||||
|
||||
// 缓存本次校验结果(避免每次扫码都弹)
|
||||
uni.setStorageSync('alipay_phone_verified', { phone: aliPhone, ts: Date.now() })
|
||||
uni.setStorageSync('alipay_phone_verified', {
|
||||
phone: aliPhone,
|
||||
ts: Date.now()
|
||||
})
|
||||
|
||||
showPhoneAuthPopup.value = false
|
||||
if (pendingScan.value) {
|
||||
@@ -1477,7 +1495,7 @@
|
||||
// 使用指南弹窗控制
|
||||
const openPopup = () => {
|
||||
uni.navigateTo({
|
||||
url:'/subPackages/business/device-goods'
|
||||
url: '/subPackages/business/device-goods'
|
||||
})
|
||||
// try {
|
||||
// showGuidePopup.value = true
|
||||
|
||||
Reference in New Issue
Block a user