Skip to content

Commit

Permalink
🐛 Fix(custom): fix el-select option display problem
Browse files Browse the repository at this point in the history
  • Loading branch information
Kuingsmile committed May 21, 2024
1 parent 5eb3c9d commit 4f95014
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 32 deletions.
2 changes: 1 addition & 1 deletion public/i18n/en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_ERROR_TIPS: "Please create the folder yourself
MANUAL_PAGE_OPEN_TIP: Please select the way to open the manual
MANUAL_PAGE_OPEN_TIP_TITLE: Tips
MANUAL_PAGE_OPEN_BY_BROWSER: Browser
MANUAL_PAGE_OPEN_BY_BUILD_IN: Built-in
MANUAL_PAGE_OPEN_BY_BUILD_IN: Built-in Window
MANUAL_PAGE_OPEN_SETTING_TIP: Select the way to open the manual

# ---renderer i18n begin---
Expand Down
2 changes: 1 addition & 1 deletion public/i18n/zh-CN.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_ERROR_TIPS: 请自行创建文件夹:${path}
MANUAL_PAGE_OPEN_TIP: 请选择打开方式
MANUAL_PAGE_OPEN_TIP_TITLE: Tips
MANUAL_PAGE_OPEN_BY_BROWSER: 浏览器
MANUAL_PAGE_OPEN_BY_BUILD_IN: 内置
MANUAL_PAGE_OPEN_BY_BUILD_IN: 内置窗口
MANUAL_PAGE_OPEN_SETTING_TIP: 选择手册打开方式

# ---renderer i18n begin---
Expand Down
2 changes: 1 addition & 1 deletion public/i18n/zh-TW.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ TOOLBOX_CHECK_CLIPBOARD_FILE_PATH_ERROR_TIPS: 請自行創建文件夾:${path}
MANUAL_PAGE_OPEN_TIP: 請選擇打開方式
MANUAL_PAGE_OPEN_TIP_TITLE: Tips
MANUAL_PAGE_OPEN_BY_BROWSER: 瀏覽器
MANUAL_PAGE_OPEN_BY_BUILD_IN: 內置
MANUAL_PAGE_OPEN_BY_BUILD_IN: 內置窗口s
MANUAL_PAGE_OPEN_SETTING_TIP: 選擇打開手冊方式

# ---renderer i18n begin---
Expand Down
72 changes: 47 additions & 25 deletions src/renderer/pages/PicGoSetting.vue
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
:label="$T('MANUAL_PAGE_OPEN_SETTING_TIP')"
>
<el-select
v-model="form.manualPageOpen"
v-model="currentManualPageOpen"
size="small"
style="width: 50%"
:placeholder="$T('MANUAL_PAGE_OPEN_SETTING_TIP')"
Expand Down Expand Up @@ -469,7 +469,7 @@
:label="$T('SETTINGS_SHORT_URL_SERVER')"
>
<el-select
v-model="form.shortUrlServer"
v-model="currentShortUrlServer"
size="small"
style="width: 50%"
:placeholder="$T('SETTINGS_SHORT_URL_SERVER')"
Expand Down Expand Up @@ -1789,6 +1789,30 @@ const shortUrlServerList = [{
}
]
const languageList = i18nManager.languageList.map(item => ({
label: item.label,
value: item.value
}))
const startModeList = [
{
label: $T('SETTINGS_START_MODE_QUIET'),
value: ISartMode.QUIET
},
{
label: $T('SETTINGS_START_MODE_MINI'),
value: ISartMode.MINI
},
{
label: $T('SETTINGS_START_MODE_NO_TRAY'),
value: ISartMode.NO_TRAY
},
{
label: $T('SETTINGS_START_MODE_MAIN'),
value: ISartMode.MAIN
}
]
const manualPageOpenList = [{
label: $T('MANUAL_PAGE_OPEN_BY_BUILD_IN'),
value: 'window'
Expand All @@ -1799,6 +1823,8 @@ const manualPageOpenList = [{
}
]
const picBed = ref<IPicBedType[]>([])
const waterMarkPositionMap = new Map([
['north', $T('UPLOAD_PAGE_IMAGE_PROCESS_POSITION_TOP')],
['northeast', $T('UPLOAD_PAGE_IMAGE_PROCESS_POSITION_TOP_RIGHT')],
Expand Down Expand Up @@ -1934,9 +1960,7 @@ const form = reactive<ISettingForm>({
autoCloseMainWindow: false,
logLevel: ['all'],
autoCopyUrl: true,
checkBetaUpdate: true,
useBuiltinClipboard: true,
language: 'zh-CN',
logFileSizeLimit: 10,
deleteCloudFile: false,
isCustomMiniIcon: false,
Expand All @@ -1955,22 +1979,20 @@ const form = reactive<ISettingForm>({
deleteLocalFile: false,
serverKey: '',
aesPassword: '',
manualPageOpen: 'browser',
enableWebServer: false,
webServerHost: '0.0.0.0',
webServerPort: 37777,
webServerPath: ''
})
const languageList = i18nManager.languageList.map(item => ({
label: item.label,
value: item.value
}))
const currentLanguage = ref('zh-CN')
const currentStartMode = ref('quiet')
const valueToOptionItem = (value: any, list: { label: string, value: any }[]) => {
return list.find(item => item.value === value) || list[0]
}
const picBed = ref<IPicBedType[]>([])
const currentLanguage = ref()
const currentStartMode = ref()
const currentManualPageOpen = ref()
const currentShortUrlServer = ref()
const logFileVisible = ref(false)
const customLinkVisible = ref(false)
Expand Down Expand Up @@ -2092,22 +2114,20 @@ async function initData () {
if (config !== undefined) {
const settings = config.settings || {}
const picBed = config.picBed
form.updateHelper = settings.showUpdateTip === undefined ? true : settings.showUpdateTip
form.updateHelper = settings.showUpdateTip ?? true
form.autoStart = settings.autoStart || false
form.rename = settings.rename || false
form.autoRename = settings.autoRename || false
form.uploadNotification = settings.uploadNotification || false
form.uploadResultNotification = settings.uploadResultNotification === undefined ? true : settings.uploadResultNotification
form.uploadResultNotification = settings.uploadResultNotification ?? true
form.miniWindowOntop = settings.miniWindowOntop || false
form.autoCloseMiniWindow = settings.autoCloseMiniWindow || false
form.autoCloseMainWindow = settings.autoCloseMainWindow || false
form.logLevel = initArray(settings.logLevel || [], ['all'])
form.autoCopyUrl = settings.autoCopy === undefined ? true : settings.autoCopy
form.checkBetaUpdate = settings.checkBetaUpdate === undefined ? true : settings.checkBetaUpdate
form.useBuiltinClipboard = settings.useBuiltinClipboard === undefined ? true : settings.useBuiltinClipboard
form.autoCopyUrl = settings.autoCopy ?? true
form.useBuiltinClipboard = settings.useBuiltinClipboard ?? true
form.isAutoListenClipboard = settings.isAutoListenClipboard || false
form.language = settings.language ?? 'zh-CN'
form.encodeOutputURL = settings.encodeOutputURL === undefined ? false : settings.encodeOutputURL
form.encodeOutputURL = settings.encodeOutputURL || false
form.deleteCloudFile = settings.deleteCloudFile || false
form.autoImport = settings.autoImport || false
form.autoImportPicBed = initArray(settings.autoImportPicBed || [], [])
Expand All @@ -2123,13 +2143,14 @@ async function initData () {
form.deleteLocalFile = settings.deleteLocalFile || false
form.serverKey = settings.serverKey || ''
form.aesPassword = settings.aesPassword || 'PicList-aesPassword'
form.manualPageOpen = settings.manualPageOpen || 'window'
form.enableWebServer = settings.enableWebServer || false
form.webServerHost = settings.webServerHost || '0.0.0.0'
form.webServerPort = settings.webServerPort || 37777
form.webServerPath = settings.webServerPath || ''
currentLanguage.value = settings.language ?? 'zh-CN'
currentStartMode.value = settings.startMode || 'quiet'
currentLanguage.value = valueToOptionItem(settings.language || 'zh-CN', languageList)
currentStartMode.value = valueToOptionItem(settings.startMode || ISartMode.QUIET, startModeList)
currentManualPageOpen.value = valueToOptionItem(settings.manualPageOpen || 'window', manualPageOpenList)
currentShortUrlServer.value = valueToOptionItem(settings.shortUrlServer || 'c1n', shortUrlServerList)
customLink.value = settings.customLink || '![$fileName]($url)'
proxy.value = picBed.proxy || ''
npmRegistry.value = settings.registry || ''
Expand Down Expand Up @@ -2298,7 +2319,7 @@ function handleAutoImportPicBedChange (val: string[]) {
}
function handleHideDockChange (val: ICheckBoxValueType) {
if (val && currentStartMode.value === 'no-tray') {
if (val && currentStartMode.value.value === ISartMode.NO_TRAY) {
ElMessage.warning($T('SETTINGS_ISHIDEDOCK_TIPS'))
form.isHideDock = false
return
Expand Down Expand Up @@ -2495,6 +2516,7 @@ function handleUseShortUrl (val: ICheckBoxValueType) {
}
function handleShortUrlServerChange (val: string) {
form.shortUrlServer = val
saveConfig(configPaths.settings.shortUrlServer, val)
}
Expand Down Expand Up @@ -2667,7 +2689,7 @@ function handleStartModeChange (val: ISartModeValues) {
if (val === ISartMode.NO_TRAY) {
if (form.isHideDock) {
ElMessage.warning($T('SETTINGS_ISHIDEDOCK_TIPS'))
currentStartMode.value = ISartMode.QUIET
currentStartMode.value = valueToOptionItem(ISartMode.QUIET, startModeList)
return
}
$message.info($T('TIPS_NEED_RELOAD'))
Expand Down
5 changes: 1 addition & 4 deletions src/universal/types/view.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ interface ISettingForm {
autoCloseMainWindow: boolean
logLevel: string[]
autoCopyUrl: boolean
checkBetaUpdate: boolean
useBuiltinClipboard: boolean
language: 'zh-CN' | 'zh-TW' | 'en'
logFileSizeLimit: number
deleteCloudFile: boolean
isCustomMiniIcon: boolean
Expand All @@ -24,15 +22,14 @@ interface ISettingForm {
encodeOutputURL: boolean
isAutoListenClipboard: boolean
useShortUrl: boolean
c1nToken: string
shortUrlServer: string
c1nToken: string
yourlsDomain: string
yourlsSignature: string
cfWorkerHost: string
deleteLocalFile: boolean
serverKey: string
aesPassword: string
manualPageOpen: 'window' | 'browser'
enableWebServer: boolean
webServerHost: string
webServerPort: number
Expand Down

0 comments on commit 4f95014

Please sign in to comment.