Compare commits
No commits in common. "10fed3b522049f3851b6d6f38c2c52251fc68dca" and "c291ac99c5bd4132f22b57fb805378bf0212d36f" have entirely different histories.
10fed3b522
...
c291ac99c5
|
|
@ -462,11 +462,12 @@ export default {
|
||||||
// 获取国家名称(根据当前语言)
|
// 获取国家名称(根据当前语言)
|
||||||
getCountryName(country) {
|
getCountryName(country) {
|
||||||
if (!country) return ''
|
if (!country) return ''
|
||||||
// 繁体中文显示中文名称,其他语言显示英文名称
|
// 如果是英文,显示英文名称
|
||||||
if (this.lang === 'zh_HK') {
|
if (this.lang === 'en_US') {
|
||||||
return country.name || country.nameEn || ''
|
return country.nameEn || country.name
|
||||||
}
|
}
|
||||||
return country.nameEn || country.name || ''
|
// 默认显示中文名称
|
||||||
|
return country.name
|
||||||
},
|
},
|
||||||
// 国家下拉框搜索过滤
|
// 国家下拉框搜索过滤
|
||||||
filterCountry(inputValue, option) {
|
filterCountry(inputValue, option) {
|
||||||
|
|
|
||||||
|
|
@ -237,18 +237,11 @@ export default {
|
||||||
{content}
|
{content}
|
||||||
</div></div>
|
</div></div>
|
||||||
}
|
}
|
||||||
{/* 图片预览区域 - 点击框体可替换 */}
|
{/* 图片预览区域 */}
|
||||||
{!this.$datas.isEmpty(mValue) && (
|
{!this.$datas.isEmpty(mValue) && (
|
||||||
<div class="mf-image-upload-draggable-preview">
|
<div class="mf-image-upload-draggable-preview">
|
||||||
{mValue.map(item => {
|
{mValue.map(item => {
|
||||||
return <div
|
return <div class="mf-image-upload-draggable-preview-item">
|
||||||
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
|
<a-image
|
||||||
width="100%"
|
width="100%"
|
||||||
height="100%"
|
height="100%"
|
||||||
|
|
@ -257,16 +250,6 @@ export default {
|
||||||
preview={true}
|
preview={true}
|
||||||
/>
|
/>
|
||||||
<div class="mf-image-upload-draggable-preview-mask">
|
<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' && (
|
{item.type !== '.pdf' && (
|
||||||
<mf-icon
|
<mf-icon
|
||||||
value="icon-eye"
|
value="icon-eye"
|
||||||
|
|
@ -314,52 +297,6 @@ export default {
|
||||||
</div>
|
</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() {
|
handlePreview() {
|
||||||
let images = this.getValue().map((i) => i.url)
|
let images = this.getValue().map((i) => i.url)
|
||||||
this.$viewerApi({
|
this.$viewerApi({
|
||||||
|
|
@ -549,26 +486,14 @@ export default {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div class={`${prefixCls}-wrap`}>
|
<a-upload
|
||||||
{listType === 'draggable' && (
|
ref="mfUpload"
|
||||||
<input
|
class={wrapCls}
|
||||||
ref="replaceInput"
|
action={action}
|
||||||
type="file"
|
name="file"
|
||||||
accept={accept}
|
headers={headers}
|
||||||
style={{ position: 'absolute', opacity: 0, width: 0, height: 0, pointerEvents: 'none' }}
|
{...imageUploadProps}
|
||||||
onChange={this.handleReplaceFileChange}
|
v-slots={slots}></a-upload>
|
||||||
/>
|
|
||||||
)}
|
|
||||||
<a-upload
|
|
||||||
ref="mfUpload"
|
|
||||||
class={wrapCls}
|
|
||||||
action={action}
|
|
||||||
name="file"
|
|
||||||
headers={headers}
|
|
||||||
{...imageUploadProps}
|
|
||||||
v-slots={slots}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -112,9 +112,6 @@
|
||||||
&-item {
|
&-item {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
&.mf-image-upload-draggable-replace {
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
&-mask {
|
&-mask {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,6 @@ export default {
|
||||||
uploadTemplate: 'Click to upload custom template',
|
uploadTemplate: 'Click to upload custom template',
|
||||||
textPlaceholder: 'Describe the image you want to generate',
|
textPlaceholder: 'Describe the image you want to generate',
|
||||||
uploadImageError: 'Please upload an image',
|
uploadImageError: 'Please upload an image',
|
||||||
replaceImage: 'Replace image',
|
|
||||||
textError: 'Please enter a prompt',
|
textError: 'Please enter a prompt',
|
||||||
textVideoPlaceholder: "Describe the video you want to generate",
|
textVideoPlaceholder: "Describe the video you want to generate",
|
||||||
uploadFirstPlaceholder: 'Click to upload first frame',
|
uploadFirstPlaceholder: 'Click to upload first frame',
|
||||||
|
|
|
||||||
|
|
@ -2,40 +2,16 @@ import { createI18n } from 'vue-i18n'
|
||||||
import Cookies from 'js-cookie'
|
import Cookies from 'js-cookie'
|
||||||
import zh_HK from '@/lang/zh_HK/index.js'
|
import zh_HK from '@/lang/zh_HK/index.js'
|
||||||
import en_US from '@/lang/en_US/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'
|
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({
|
const i18n = createI18n({
|
||||||
globalInjection: true,
|
globalInjection: true,
|
||||||
locale,
|
locale,
|
||||||
messages: {
|
messages: {
|
||||||
zh_HK,
|
zh_HK,
|
||||||
en_US,
|
en_US
|
||||||
es_ES,
|
}
|
||||||
pt_BR,
|
|
||||||
hi_IN,
|
|
||||||
ru_RU,
|
|
||||||
ar_SA,
|
|
||||||
fr_FR
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
export default i18n
|
export default i18n
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ export default {
|
||||||
uploadTemplate: '點擊上傳自定義模板',
|
uploadTemplate: '點擊上傳自定義模板',
|
||||||
textPlaceholder: '請描述你想生成的圖片',
|
textPlaceholder: '請描述你想生成的圖片',
|
||||||
uploadImageError: '請上傳圖片',
|
uploadImageError: '請上傳圖片',
|
||||||
replaceImage: '替換圖片',
|
|
||||||
uploadFaceImageError: '請上傳人臉圖片',
|
uploadFaceImageError: '請上傳人臉圖片',
|
||||||
uploadTemplateError: '請上傳自定義模板',
|
uploadTemplateError: '請上傳自定義模板',
|
||||||
textError: '請輸入提示詞',
|
textError: '請輸入提示詞',
|
||||||
|
|
|
||||||
|
|
@ -33,16 +33,12 @@
|
||||||
<div class="right-menu-item language">
|
<div class="right-menu-item language">
|
||||||
<a-dropdown @select="handleSelect">
|
<a-dropdown @select="handleSelect">
|
||||||
<mf-button type="text">
|
<mf-button type="text">
|
||||||
{{ localeName }}
|
{{ lang == 'zh_HK' ? '繁体中文' : 'English' }}
|
||||||
<icon-down />
|
<icon-down />
|
||||||
</mf-button>
|
</mf-button>
|
||||||
<template #content>
|
<template #content>
|
||||||
<a-doption
|
<a-doption value="zh_HK">繁体中文</a-doption>
|
||||||
v-for="(name, code) in localeNames"
|
<a-doption value="en_US">English</a-doption>
|
||||||
:key="code"
|
|
||||||
:value="code">
|
|
||||||
{{ name }}
|
|
||||||
</a-doption>
|
|
||||||
</template>
|
</template>
|
||||||
</a-dropdown>
|
</a-dropdown>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -97,7 +93,7 @@ import { mapGetters, mapState } from 'vuex'
|
||||||
import cloneDeep from 'lodash-es/cloneDeep'
|
import cloneDeep from 'lodash-es/cloneDeep'
|
||||||
import { constantRoutes } from '@/router/index.js'
|
import { constantRoutes } from '@/router/index.js'
|
||||||
import Login from './Login.vue'
|
import Login from './Login.vue'
|
||||||
import i18n, { LOCALE_NAMES } from '@/lang/i18n'
|
import i18n from '@/lang/i18n'
|
||||||
import User from './User.vue'
|
import User from './User.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
|
|
@ -126,12 +122,6 @@ export default {
|
||||||
demoEnv() {
|
demoEnv() {
|
||||||
return import.meta.env.MODE === 'demo'
|
return import.meta.env.MODE === 'demo'
|
||||||
},
|
},
|
||||||
localeNames() {
|
|
||||||
return LOCALE_NAMES
|
|
||||||
},
|
|
||||||
localeName() {
|
|
||||||
return LOCALE_NAMES[this.lang] || 'English'
|
|
||||||
},
|
|
||||||
...mapGetters([
|
...mapGetters([
|
||||||
'theme',
|
'theme',
|
||||||
'permission_routes',
|
'permission_routes',
|
||||||
|
|
|
||||||
|
|
@ -313,11 +313,16 @@ export default {
|
||||||
// 获取模板名称(根据当前语言)
|
// 获取模板名称(根据当前语言)
|
||||||
getTemplateName(template) {
|
getTemplateName(template) {
|
||||||
if (!template) return ''
|
if (!template) return ''
|
||||||
// 繁体中文显示 chineseContent,其他语言显示 englishContent
|
// 如果是中文繁体,显示 chineseContent
|
||||||
if (this.lang === 'zh_HK') {
|
if (this.lang === 'zh_HK') {
|
||||||
return template.chineseContent || template.name || ''
|
return template.chineseContent || template.name || ''
|
||||||
}
|
}
|
||||||
return template.englishContent || template.name || ''
|
// 如果是英文,显示 englishContent
|
||||||
|
else if (this.lang === 'en_US') {
|
||||||
|
return template.englishContent || template.name || ''
|
||||||
|
}
|
||||||
|
// 默认返回 name
|
||||||
|
return template.name || ''
|
||||||
},
|
},
|
||||||
// 确认选择模板
|
// 确认选择模板
|
||||||
handleConfirmTemplate() {
|
handleConfirmTemplate() {
|
||||||
|
|
|
||||||
|
|
@ -311,11 +311,16 @@ export default {
|
||||||
// 获取模板名称(根据当前语言)
|
// 获取模板名称(根据当前语言)
|
||||||
getTemplateName(template) {
|
getTemplateName(template) {
|
||||||
if (!template) return ''
|
if (!template) return ''
|
||||||
// 繁体中文显示 chineseContent,其他语言显示 englishContent
|
// 如果是中文繁体,显示 chineseContent
|
||||||
if (this.lang === 'zh_HK') {
|
if (this.lang === 'zh_HK') {
|
||||||
return template.chineseContent || template.name || ''
|
return template.chineseContent || template.name || ''
|
||||||
}
|
}
|
||||||
return template.englishContent || template.name || ''
|
// 如果是英文,显示 englishContent
|
||||||
|
else if (this.lang === 'en_US') {
|
||||||
|
return template.englishContent || template.name || ''
|
||||||
|
}
|
||||||
|
// 默认返回 name
|
||||||
|
return template.name || ''
|
||||||
},
|
},
|
||||||
// 确认选择模板
|
// 确认选择模板
|
||||||
handleConfirmTemplate() {
|
handleConfirmTemplate() {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue