兼容支付宝小程序样式

master
gongfuxiang 2024-01-28 18:09:48 +08:00
parent c7570e341c
commit c587a95f14
7 changed files with 51 additions and 32 deletions

36
App.vue
View File

@ -1699,7 +1699,16 @@
// url
page_url_protocol(url) {
if ((url || null) != null && !this.is_url(url)) {
url = this.get_config('config.common_app_h5_url', '') + url;
// H5
var host = this.get_config('config.common_app_h5_url', '');
// #ifdef H5
if(host == '') {
// H5H5host
host = window.location.href.split('#')[0]+'#/';
}
// #endif
//
url = (host + url).replace('#//', '#/');
}
return url;
},
@ -2529,14 +2538,25 @@
//
set_pages_navigation_bar_title() {
var arr = [
'pages/index/index',
'pages/goods-category/goods-category',
'pages/cart/cart',
'pages/user/user',
'pages/plugins/realstore/detail/detail'
];
//
var url = this.current_page(false);
var arr = url.split('/');
arr = arr.slice(1);
arr = arr.slice(0, -1);
var key = 'pages.'+arr.join('-');
uni.setNavigationBarTitle({
title: i18n.t(key),
});
//
if(arr.indexOf(url) == -1) {
var arr = url.split('/');
arr = arr.slice(1);
arr = arr.slice(0, -1);
var key = 'pages.'+arr.join('-');
uni.setNavigationBarTitle({
title: i18n.t(key),
});
}
},
//

View File

@ -2,17 +2,13 @@
<view :class="theme_view">
<view class="pa-w" :class="(propFixed ? 'pf z-i left-0 top-0 right-0' : '') + ' ' + propClass" :style="'padding-top:' + (status_bar_height > 0 ? status_bar_height + 5 : 0) + 'px;background-color:rgba(255,255,255,' + opacity + ');' + propStyle">
<!-- 返回 -->
<!-- #ifndef MP-ALIPAY -->
<view v-if="(propName || null) != null || propIsRightSlot || propIsShowBack" class="nav-back padding-horizontal-main round va-m flex-row align-c" :class="(opacity > 0.3 ? 'cr-black ' : 'cr-white ') + (status_bar_height > 0 ? '' : 'padding-vertical-main')">
<!-- #ifndef MP-ALIPAY -->
<view v-if="(propName || null) != null" :class="'text-size-md tc pa left-0 right-0 padding-top-xs '+propNameClass" :style="propNameOpacity ? (opacity ? 'color:rgba(51,51,51,' + opacity + ')' : '') : ''">{{ propName }}</view>
<iconfont v-if="propIsShowBack" name="icon-arrow-left" size="40rpx" @tap="top_nav_left_back_event" propClass="pr top-xs z-i" :color="propColor"></iconfont>
<!-- #endif -->
<slot v-if="propIsRightSlot" name="right"></slot>
</view>
<!-- #endif -->
<!-- #ifdef MP-ALIPAY -->
<view class="nav-back"></view>
<!-- #endif -->
<slot name="content"></slot>
</view>
</view>
@ -89,7 +85,7 @@
opacity: top,
});
});
/* #endif */
// #endif
},
methods: {
top_nav_left_back_event() {

View File

@ -113,11 +113,6 @@
type: [Number, String],
default: 0,
},
//
propNavStatusIndex: {
type: Number,
default: 0,
},
//
propPayPrice: {
type: [Number, String],
@ -311,10 +306,12 @@
payment_id: payment_id || this.payment_id,
};
// h5
// #ifdef H5
post_data['redirect_url'] = encodeURIComponent(base64.encode(app.globalData.get_page_url(false) + (this.propNavStatusIndex > 0 ? '?status=' + this.propNavStatusIndex : '')));
// paypal使respond_url
if (payment.payment == 'PayPal') {
// #ifdef H5
var redirect_url = app.globalData.page_url_protocol(this.propToAppointPage || app.globalData.get_page_url(false));
post_data['redirect_url'] = encodeURIComponent(base64.encode(redirect_url));
// 使respond_url
var respond_arr = ['PayPal', 'UniPayment'];
if (respond_arr.indexOf(payment.payment) != -1) {
post_data['respond_url'] = post_data['redirect_url'];
delete post_data['redirect_url'];
}

View File

@ -201,7 +201,8 @@
font-size: 24rpx;
padding: 0 32rpx 0 64rpx;
height: 56rpx;
line-height: 56rpx;
line-height: 56rpx;
background: transparent;
}
.search-content .search-btn {
width: 106rpx;

View File

@ -7,7 +7,10 @@
padding-top: calc(var(--status-bar-height) + 5px);
}
.home-top-nav {
min-height: 56rpx;
min-height: 56rpx;
/* #ifdef MP-ALIPAY */
padding-left: 60rpx;
/* #endif */
}
.home-top-nav-location {
max-width: calc(100% - 200rpx);
@ -61,11 +64,6 @@
z-index: 11;
width: 100%;
}
.search-content-input {
/* #ifdef MP-ALIPAY */
padding-left: 60rpx;
/* #endif */
}
.search-content-fixed-content {
background-repeat: no-repeat;
background-size: 100% auto;

View File

@ -5,6 +5,11 @@ page {
/**
*
*/
.top-nav-search {
/* #ifdef MP-ALIPAY */
padding-left: 60rpx;
/* #endif */
}
.header-content {
margin-top: 20rpx;
/* #ifdef MP-WEIXIN || MP-BAIDU || MP-QQ || MP-KUAISHOU */

View File

@ -8,7 +8,7 @@
<view class="header pr z-i">
<component-nav-back :propIsShowBack="is_realstore_top_nav_back == 1" :propFixed="false" propColor="#333">
<template slot="right" :class="is_mp_env ? 'top-search-width' : 'flex-1 flex-width'">
<view :class="'va-m wh-auto '+(is_realstore_top_nav_back == 1 ? 'padding-left-main' : '')">
<view :class="'va-m wh-auto top-nav-search '+(is_realstore_top_nav_back == 1 ? 'padding-left-main' : '')">
<!-- #ifndef H5 -->
<component-search
@onsearch="search_button_event"
@ -431,10 +431,12 @@
},
});
// #ifdef APP
//
uni.setNavigationBarTitle({
title: this.info.name,
});
// #endif
//
this.setData({