支付方式根据当前界面语言构建,中文版只显示支付宝和微信
This commit is contained in:
parent
e6348d51e5
commit
a057c12acc
@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html class="h-full overflow-hidden" lang="zh">
|
||||
<html class="h-full overflow-hidden">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
||||
|
||||
@ -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,14 @@ function vitePluginTranslate(options = {}) {
|
||||
}
|
||||
},
|
||||
transform(code, id) {
|
||||
if (id.endsWith('index.html')) {
|
||||
const lang = locale;
|
||||
return {
|
||||
code: code.replace(/<html([^>]*)>/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;
|
||||
|
||||
@ -11,7 +11,7 @@ import { sentryVitePlugin } from '@sentry/vite-plugin';
|
||||
import vitePluginTranslate from './vite-plugin-translate.mjs';
|
||||
|
||||
// 语言配置:设置目标语言,默认为 'en'(英文),可设置为 'zh'(中文)等
|
||||
const locale = process.env.DASHBOARD_LOCALE || 'en';
|
||||
const locale = process.env.DASHBOARD_LOCALE || 'zh';
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user