支付方式根据当前界面语言构建,中文版只显示支付宝和微信
This commit is contained in:
parent
e6348d51e5
commit
89c5c32240
@ -24,6 +24,7 @@
|
||||
<label
|
||||
class="payment-option"
|
||||
:class="{'payment-option-active': paymentGateway === 'Alipay'}"
|
||||
v-if="isChineseLocale"
|
||||
>
|
||||
<div class="payment-icon">
|
||||
<AlipayLogo />
|
||||
@ -39,6 +40,7 @@
|
||||
<label
|
||||
class="payment-option"
|
||||
:class="{'payment-option-active': paymentGateway === 'WeChatPay'}"
|
||||
v-if="isChineseLocale"
|
||||
>
|
||||
<div class="payment-icon">
|
||||
<WeChatPayLogo />
|
||||
@ -54,6 +56,7 @@
|
||||
<label
|
||||
class="payment-option"
|
||||
:class="{'payment-option-active': paymentGateway === 'Stripe'}"
|
||||
v-if="!isChineseLocale"
|
||||
>
|
||||
<div class="payment-icon">
|
||||
<StripeLogo />
|
||||
@ -69,6 +72,7 @@
|
||||
<label
|
||||
class="payment-option"
|
||||
:class="{'payment-option-active': paymentGateway === 'PayPal'}"
|
||||
v-if="!isChineseLocale"
|
||||
>
|
||||
<div class="payment-icon">
|
||||
<!-- PayPal SVG Logo -->
|
||||
@ -187,6 +191,7 @@ import BuyPrepaidCreditsPayPal from './BuyPrepaidCreditsPayPal.vue';
|
||||
import AlipayLogo from '../logo/AlipayLogo.vue';
|
||||
import WeChatPayLogo from '../logo/WeChatPayLogo.vue';
|
||||
import StripeLogo from './StripeLogo.vue';
|
||||
import { getLocale } from '../utils/i18n';
|
||||
|
||||
export default {
|
||||
name: 'BuyPrepaidCreditsForm',
|
||||
@ -201,11 +206,27 @@ export default {
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
paymentGateway: 'Alipay', // Default to Alipay
|
||||
_paymentGateway: null,
|
||||
creditsToBuy: this.minimumAmount || 0,
|
||||
amountError: ''
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
isChineseLocale() {
|
||||
return getLocale() === 'zh';
|
||||
},
|
||||
defaultPaymentGateway() {
|
||||
return this.isChineseLocale ? 'Alipay' : 'Stripe';
|
||||
},
|
||||
paymentGateway: {
|
||||
get() {
|
||||
return this._paymentGateway || this.defaultPaymentGateway;
|
||||
},
|
||||
set(value) {
|
||||
this._paymentGateway = value;
|
||||
}
|
||||
}
|
||||
},
|
||||
props: {
|
||||
modelValue: {
|
||||
default: false
|
||||
@ -347,7 +368,7 @@ export default {
|
||||
min-width: 50px;
|
||||
}
|
||||
|
||||
.alipay-svg, .wechat-svg {
|
||||
.alipay-svg, .wechat-svg, .stripe-svg, .paypal-svg {
|
||||
max-height: 24px;
|
||||
}
|
||||
|
||||
|
||||
@ -162,6 +162,17 @@ function vitePluginTranslate(options = {}) {
|
||||
}
|
||||
},
|
||||
transform(code, id) {
|
||||
// 处理index.html文件
|
||||
if (id.endsWith('index.html')) {
|
||||
// 根据locale更新html标签的lang属性
|
||||
const lang = locale;
|
||||
return {
|
||||
code: code.replace(/<html[^>]*lang=["']([^"']*)["']/i, `<html$1lang="${lang}"`)
|
||||
.replace(/<html([^>]*)(?![^>]*lang=["'])>/i, `<html$1 lang="${lang}">`),
|
||||
map: null
|
||||
};
|
||||
}
|
||||
|
||||
const fileMatches = CONSTANTS.FILE_EXTENSIONS.test(id);
|
||||
if (!fileMatches || locale === defaultLocale || Object.keys(translations).length === 0) {
|
||||
return null;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user