diff --git a/portal-ui/src/components/RechargePc.vue b/portal-ui/src/components/RechargePc.vue
index dd1c6f8..50915f4 100644
--- a/portal-ui/src/components/RechargePc.vue
+++ b/portal-ui/src/components/RechargePc.vue
@@ -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) {
diff --git a/portal-ui/src/comps/image-upload/ImageUpload.js b/portal-ui/src/comps/image-upload/ImageUpload.js
index b70029c..e60b735 100644
--- a/portal-ui/src/comps/image-upload/ImageUpload.js
+++ b/portal-ui/src/comps/image-upload/ImageUpload.js
@@ -237,11 +237,18 @@ export default {
{content}
}
- {/* 图片预览区域 */}
+ {/* 图片预览区域 - 点击框体可替换 */}
{!this.$datas.isEmpty(mValue) && (
{mValue.map(item => {
- return
+ return
{
+ e.stopPropagation()
+ e.preventDefault()
+ if (!readonly && !this.disabled) this.triggerUpload()
+ }}
+ >
+ {!readonly && (
+
{
+ e.stopPropagation()
+ this.triggerUpload()
+ }}
+ title={this.$t('common.replaceImage') || '替换'}
+ />
+ )}
{item.type !== '.pdf' && (
}
},
+ // 触发文件选择(用于替换已上传图片)
+ 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 (
-
+
+ {listType === 'draggable' && (
+
+ )}
+
+
)
}
}
diff --git a/portal-ui/src/comps/image-upload/style/index.less b/portal-ui/src/comps/image-upload/style/index.less
index 95ffcb6..25f24d3 100644
--- a/portal-ui/src/comps/image-upload/style/index.less
+++ b/portal-ui/src/comps/image-upload/style/index.less
@@ -112,6 +112,9 @@
&-item {
height: 100%;
position: relative;
+ &.mf-image-upload-draggable-replace {
+ cursor: pointer;
+ }
}
&-mask {
position: absolute;
diff --git a/portal-ui/src/lang/en_US/common.js b/portal-ui/src/lang/en_US/common.js
index ee0d277..fc55fe9 100644
--- a/portal-ui/src/lang/en_US/common.js
+++ b/portal-ui/src/lang/en_US/common.js
@@ -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',
diff --git a/portal-ui/src/lang/i18n.js b/portal-ui/src/lang/i18n.js
index d24b94d..4511743 100644
--- a/portal-ui/src/lang/i18n.js
+++ b/portal-ui/src/lang/i18n.js
@@ -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
diff --git a/portal-ui/src/lang/zh_HK/common.js b/portal-ui/src/lang/zh_HK/common.js
index 23889eb..fd25525 100644
--- a/portal-ui/src/lang/zh_HK/common.js
+++ b/portal-ui/src/lang/zh_HK/common.js
@@ -21,6 +21,7 @@ export default {
uploadTemplate: '點擊上傳自定義模板',
textPlaceholder: '請描述你想生成的圖片',
uploadImageError: '請上傳圖片',
+ replaceImage: '替換圖片',
uploadFaceImageError: '請上傳人臉圖片',
uploadTemplateError: '請上傳自定義模板',
textError: '請輸入提示詞',
diff --git a/portal-ui/src/layout/components/navBar.vue b/portal-ui/src/layout/components/navBar.vue
index 9effc2b..869d5a4 100644
--- a/portal-ui/src/layout/components/navBar.vue
+++ b/portal-ui/src/layout/components/navBar.vue
@@ -33,12 +33,16 @@
@@ -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',
diff --git a/portal-ui/src/views/FastVideo.vue b/portal-ui/src/views/FastVideo.vue
index d171d2d..46b3320 100644
--- a/portal-ui/src/views/FastVideo.vue
+++ b/portal-ui/src/views/FastVideo.vue
@@ -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() {
diff --git a/portal-ui/src/views/Image.vue b/portal-ui/src/views/Image.vue
index b2de09d..e39b1bf 100644
--- a/portal-ui/src/views/Image.vue
+++ b/portal-ui/src/views/Image.vue
@@ -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() {