fix: 前端代码更新 支付相关

This commit is contained in:
old burden 2026-03-26 15:55:30 +08:00
parent c291ac99c5
commit cb1fbdb3af
9 changed files with 141 additions and 38 deletions

View File

@ -462,12 +462,11 @@ export default {
//
getCountryName(country) {
if (!country) return ''
//
if (this.lang === 'en_US') {
return country.nameEn || country.name
//
if (this.lang === 'zh_HK') {
return country.name || country.nameEn || ''
}
//
return country.name
return country.nameEn || country.name || ''
},
//
filterCountry(inputValue, option) {

View File

@ -237,11 +237,18 @@ export default {
{content}
</div></div>
}
{/* 图片预览区域 */}
{/* 图片预览区域 - 点击框体可替换 */}
{!this.$datas.isEmpty(mValue) && (
<div class="mf-image-upload-draggable-preview">
{mValue.map(item => {
return <div class="mf-image-upload-draggable-preview-item">
return <div
class="mf-image-upload-draggable-preview-item mf-image-upload-draggable-replace"
onClick={(e) => {
e.stopPropagation()
e.preventDefault()
if (!readonly && !this.disabled) this.triggerUpload()
}}
>
<a-image
width="100%"
height="100%"
@ -250,6 +257,16 @@ export default {
preview={true}
/>
<div class="mf-image-upload-draggable-preview-mask">
{!readonly && (
<mf-icon
value="icon-edit"
onClick={(e) => {
e.stopPropagation()
this.triggerUpload()
}}
title={this.$t('common.replaceImage') || '替换'}
/>
)}
{item.type !== '.pdf' && (
<mf-icon
value="icon-eye"
@ -297,6 +314,52 @@ export default {
</div>
}
},
// 触发文件选择(用于替换已上传图片)
triggerUpload() {
if (this.readonly || this.disabled) return
const mValue = this.getValue()
// draggable 且已有图片时,用专用替换 input避免 a-upload 在 limit 满时不渲染 input
if (this.listType === 'draggable' && mValue.length > 0 && this.$refs.replaceInput) {
this.$refs.replaceInput.value = ''
this.$refs.replaceInput.click()
return
}
const el = this.$refs.mfUpload?.$el
const input = el?.querySelector?.('input[type="file"]')
if (input) {
input.value = ''
input.click()
}
},
// 替换时选择文件后手动上传
handleReplaceFileChange(e) {
const file = e.target.files[0]
if (!file) return
if (file.size / 1024 / 1024 > 10) {
this.$message.error('文件大小不能超过10M')
e.target.value = ''
return
}
this.$emit('beforeUpload', file)
const formData = new FormData()
formData.append('file', file)
const action = import.meta.env.MODE === 'production' ? 'api/file/upload' : 'dev-api/api/file/upload'
const headers = { ...this.headers }
delete headers['Content-Type']
fetch(action, { method: 'POST', body: formData, headers })
.then((res) => res.json())
.then((data) => {
if (data.code === 200 && data.url) {
const url = this.getImageUrl(data.url)
this.handleChange({ url, name: file.name })
this.$emit('success', data.url, file)
} else {
this.$message.error(data.msg || data.url || '上传失败')
}
})
.catch(() => this.$message.error('上传失败'))
.finally(() => { e.target.value = '' })
},
handlePreview() {
let images = this.getValue().map((i) => i.url)
this.$viewerApi({
@ -486,14 +549,26 @@ export default {
}
return (
<a-upload
ref="mfUpload"
class={wrapCls}
action={action}
name="file"
headers={headers}
{...imageUploadProps}
v-slots={slots}></a-upload>
<div class={`${prefixCls}-wrap`}>
{listType === 'draggable' && (
<input
ref="replaceInput"
type="file"
accept={accept}
style={{ position: 'absolute', opacity: 0, width: 0, height: 0, pointerEvents: 'none' }}
onChange={this.handleReplaceFileChange}
/>
)}
<a-upload
ref="mfUpload"
class={wrapCls}
action={action}
name="file"
headers={headers}
{...imageUploadProps}
v-slots={slots}
/>
</div>
)
}
}

View File

@ -112,6 +112,9 @@
&-item {
height: 100%;
position: relative;
&.mf-image-upload-draggable-replace {
cursor: pointer;
}
}
&-mask {
position: absolute;

View File

@ -23,6 +23,7 @@ export default {
uploadTemplate: 'Click to upload custom template',
textPlaceholder: 'Describe the image you want to generate',
uploadImageError: 'Please upload an image',
replaceImage: 'Replace image',
textError: 'Please enter a prompt',
textVideoPlaceholder: "Describe the video you want to generate",
uploadFirstPlaceholder: 'Click to upload first frame',

View File

@ -2,16 +2,40 @@ import { createI18n } from 'vue-i18n'
import Cookies from 'js-cookie'
import zh_HK from '@/lang/zh_HK/index.js'
import en_US from '@/lang/en_US/index.js'
import es_ES from '@/lang/es_ES/index.js'
import pt_BR from '@/lang/pt_BR/index.js'
import hi_IN from '@/lang/hi_IN/index.js'
import ru_RU from '@/lang/ru_RU/index.js'
import ar_SA from '@/lang/ar_SA/index.js'
import fr_FR from '@/lang/fr_FR/index.js'
let locale = Cookies.get('language') || 'en_US'
/** 各语言在界面上的显示名称 */
export const LOCALE_NAMES = {
zh_HK: '繁体中文',
en_US: 'English',
es_ES: 'Español',
pt_BR: 'Português',
hi_IN: 'हिन्दी',
ru_RU: 'Русский',
ar_SA: 'العربية',
fr_FR: 'Français'
}
const i18n = createI18n({
globalInjection: true,
locale,
messages: {
globalInjection: true,
locale,
messages: {
zh_HK,
en_US
}
en_US,
es_ES,
pt_BR,
hi_IN,
ru_RU,
ar_SA,
fr_FR
}
})
export default i18n

View File

@ -21,6 +21,7 @@ export default {
uploadTemplate: '點擊上傳自定義模板',
textPlaceholder: '請描述你想生成的圖片',
uploadImageError: '請上傳圖片',
replaceImage: '替換圖片',
uploadFaceImageError: '請上傳人臉圖片',
uploadTemplateError: '請上傳自定義模板',
textError: '請輸入提示詞',

View File

@ -33,12 +33,16 @@
<div class="right-menu-item language">
<a-dropdown @select="handleSelect">
<mf-button type="text">
{{ lang == 'zh_HK' ? '繁体中文' : 'English' }}
{{ localeName }}
<icon-down />
</mf-button>
<template #content>
<a-doption value="zh_HK">繁体中文</a-doption>
<a-doption value="en_US">English</a-doption>
<a-doption
v-for="(name, code) in localeNames"
:key="code"
:value="code">
{{ name }}
</a-doption>
</template>
</a-dropdown>
</div>
@ -93,7 +97,7 @@ import { mapGetters, mapState } from 'vuex'
import cloneDeep from 'lodash-es/cloneDeep'
import { constantRoutes } from '@/router/index.js'
import Login from './Login.vue'
import i18n from '@/lang/i18n'
import i18n, { LOCALE_NAMES } from '@/lang/i18n'
import User from './User.vue'
export default {
@ -122,6 +126,12 @@ export default {
demoEnv() {
return import.meta.env.MODE === 'demo'
},
localeNames() {
return LOCALE_NAMES
},
localeName() {
return LOCALE_NAMES[this.lang] || 'English'
},
...mapGetters([
'theme',
'permission_routes',

View File

@ -313,16 +313,11 @@ export default {
//
getTemplateName(template) {
if (!template) return ''
// chineseContent
// chineseContent englishContent
if (this.lang === 'zh_HK') {
return template.chineseContent || template.name || ''
}
// englishContent
else if (this.lang === 'en_US') {
return template.englishContent || template.name || ''
}
// name
return template.name || ''
return template.englishContent || template.name || ''
},
//
handleConfirmTemplate() {

View File

@ -311,16 +311,11 @@ export default {
//
getTemplateName(template) {
if (!template) return ''
// chineseContent
// chineseContent englishContent
if (this.lang === 'zh_HK') {
return template.chineseContent || template.name || ''
}
// englishContent
else if (this.lang === 'en_US') {
return template.englishContent || template.name || ''
}
// name
return template.name || ''
return template.englishContent || template.name || ''
},
//
handleConfirmTemplate() {