mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-05 15:50:18 +08:00
🔨 Refactor: setting-page ui
This commit is contained in:
@@ -177,7 +177,7 @@ export default {
|
||||
})
|
||||
ipcMain.on(SHOW_MAIN_PAGE_MENU, () => {
|
||||
const window = windowManager.get(IWindowList.SETTING_WINDOW)!
|
||||
const menu = buildMainPageMenu()
|
||||
const menu = buildMainPageMenu(window)
|
||||
menu.popup({
|
||||
window
|
||||
})
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
import { privacyManager } from '~/main/utils/privacyManager'
|
||||
import pkg from 'root/package.json'
|
||||
import GuiApi from 'apis/gui'
|
||||
import { PICGO_CONFIG_PLUGIN, PICGO_HANDLE_PLUGIN_ING, PICGO_TOGGLE_PLUGIN } from '~/universal/events/constants'
|
||||
import { PICGO_CONFIG_PLUGIN, PICGO_HANDLE_PLUGIN_ING, PICGO_TOGGLE_PLUGIN, SHOW_MAIN_PAGE_DONATION, SHOW_MAIN_PAGE_QRCODE } from '~/universal/events/constants'
|
||||
import picgoCoreIPC from '~/main/events/picgoCoreIPC'
|
||||
import { PicGo as PicGoCore } from 'picgo'
|
||||
import { T } from '~/universal/i18n'
|
||||
@@ -87,7 +87,7 @@ const buildMiniPageMenu = () => {
|
||||
return Menu.buildFromTemplate(template)
|
||||
}
|
||||
|
||||
const buildMainPageMenu = () => {
|
||||
const buildMainPageMenu = (win: BrowserWindow) => {
|
||||
const template = [
|
||||
{
|
||||
label: T('ABOUT'),
|
||||
@@ -102,14 +102,19 @@ const buildMainPageMenu = () => {
|
||||
{
|
||||
label: T('SPONSOR_PICGO'),
|
||||
click () {
|
||||
// TODO: show donation
|
||||
win?.webContents?.send(SHOW_MAIN_PAGE_DONATION)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: T('SHOW_PICBED_QRCODE'),
|
||||
click () {
|
||||
// TODO: qrcode
|
||||
// _this.qrcodeVisible = true
|
||||
win?.webContents?.send(SHOW_MAIN_PAGE_QRCODE)
|
||||
}
|
||||
},
|
||||
{
|
||||
label: T('SHOW_DEVTOOLS'),
|
||||
click () {
|
||||
win?.webContents?.openDevTools()
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@@ -158,7 +158,9 @@ import InputBoxDialog from '@/components/InputBoxDialog.vue'
|
||||
import {
|
||||
MINIMIZE_WINDOW,
|
||||
CLOSE_WINDOW,
|
||||
SHOW_MAIN_PAGE_MENU
|
||||
SHOW_MAIN_PAGE_MENU,
|
||||
SHOW_MAIN_PAGE_QRCODE,
|
||||
SHOW_MAIN_PAGE_DONATION
|
||||
} from '~/universal/events/constants'
|
||||
@Component({
|
||||
name: 'main-page',
|
||||
@@ -184,6 +186,12 @@ export default class extends Vue {
|
||||
ipcRenderer.send('getPicBeds')
|
||||
ipcRenderer.on('getPicBeds', this.getPicBeds)
|
||||
this.handleGetPicPeds()
|
||||
ipcRenderer.on(SHOW_MAIN_PAGE_QRCODE, () => {
|
||||
this.qrcodeVisible = true
|
||||
})
|
||||
ipcRenderer.on(SHOW_MAIN_PAGE_DONATION, () => {
|
||||
this.visible = true
|
||||
})
|
||||
}
|
||||
|
||||
@Watch('choosedPicBedForQRCode')
|
||||
|
||||
@@ -4,11 +4,11 @@
|
||||
{{ $T('PICGO_SETTINGS') }} - <i class="el-icon-document" @click="goConfigPage"></i>
|
||||
</div>
|
||||
<el-row class="setting-list">
|
||||
<el-col :span="16" :offset="4">
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-row>
|
||||
<el-form
|
||||
label-width="160px"
|
||||
label-position="right"
|
||||
label-position="left"
|
||||
label-width="10"
|
||||
size="small"
|
||||
>
|
||||
<el-form-item
|
||||
@@ -139,6 +139,7 @@
|
||||
></el-switch>
|
||||
</el-form-item>
|
||||
<el-form-item
|
||||
:style="{ marginRight: '-64px' }"
|
||||
:label="$T('CHOOSE_SHOWED_PICBED')"
|
||||
>
|
||||
<el-checkbox-group
|
||||
@@ -756,10 +757,25 @@ export default class extends Vue {
|
||||
overflow-x hidden
|
||||
.setting-list
|
||||
.el-form
|
||||
&-item
|
||||
display: flex
|
||||
justify-content space-between
|
||||
padding-top 8px
|
||||
padding-bottom 8px
|
||||
border-bottom 1px solid darken(#eee, 50%)
|
||||
margin-bottom 0
|
||||
&:last-child
|
||||
border-bottom none
|
||||
&::after
|
||||
display none
|
||||
&::before
|
||||
display none
|
||||
label
|
||||
line-height 32px
|
||||
padding-bottom 0
|
||||
color #eee
|
||||
flex-basis: 50%
|
||||
flex-shrink: 0
|
||||
.el-button-group
|
||||
width 100%
|
||||
.el-button
|
||||
|
||||
@@ -6,8 +6,11 @@
|
||||
<el-row>
|
||||
<el-col :span="20" :offset="2">
|
||||
<el-table
|
||||
class="shortcut-page-table-border"
|
||||
:data="list"
|
||||
size="mini"
|
||||
header-cell-class-name="shortcut-page-table-border"
|
||||
cell-class-name="shortcut-page-table-border"
|
||||
>
|
||||
<el-table-column
|
||||
:label="$T('SHORTCUT_NAME')"
|
||||
@@ -177,6 +180,8 @@ export default class extends Vue {
|
||||
</script>
|
||||
<style lang='stylus'>
|
||||
#shortcut-page
|
||||
.shortcut-page-table-border
|
||||
border-color darken(#eee, 50%)
|
||||
.el-dialog__body
|
||||
padding 10px 20px
|
||||
.el-form-item
|
||||
@@ -189,6 +194,8 @@ export default class extends Vue {
|
||||
.el-table
|
||||
background-color: transparent
|
||||
color #ddd
|
||||
&::before
|
||||
background-color darken(#eee, 50%)
|
||||
thead
|
||||
color #bbb
|
||||
th,tr
|
||||
|
||||
@@ -29,3 +29,5 @@ export const PICGO_TOGGLE_PLUGIN = 'PICGO_TOGGLE_PLUGIN'
|
||||
export const PASTE_TEXT = 'PASTE_TEXT'
|
||||
export const SET_MINI_WINDOW_POS = 'SET_MINI_WINDOW_POS'
|
||||
export const RENAME_FILE_NAME = 'RENAME_FILE_NAME'
|
||||
export const SHOW_MAIN_PAGE_QRCODE = 'SHOW_MAIN_PAGE_QRCODE'
|
||||
export const SHOW_MAIN_PAGE_DONATION = 'SHOW_MAIN_PAGE_DONATION'
|
||||
|
||||
@@ -5,23 +5,15 @@ const languageList = {
|
||||
'zh-CN': ZH_CN
|
||||
}
|
||||
|
||||
const lowercaseKeys = (obj: any) =>
|
||||
Object.keys(obj).reduce((acc: any, key: string) => {
|
||||
acc[key.toLowerCase()] = obj[key]
|
||||
return acc
|
||||
}, {})
|
||||
|
||||
// FIXME: @picgo/i18n no lowecase
|
||||
const objectAdapter = new ObjectAdapter(lowercaseKeys(languageList))
|
||||
const objectAdapter = new ObjectAdapter(languageList)
|
||||
|
||||
const i18n = new I18n({
|
||||
adapter: objectAdapter,
|
||||
defaultLanguage: 'zh-cn'
|
||||
defaultLanguage: 'zh-CN'
|
||||
})
|
||||
|
||||
// FIXME: @picgo/i18n args should be optional
|
||||
const T = (key: ILocalesKey, args: IStringKeyMap = {}): string => {
|
||||
return i18n.translate(key, args)!
|
||||
return i18n.translate(key, args) || ''
|
||||
}
|
||||
|
||||
export { i18n, T }
|
||||
|
||||
@@ -23,6 +23,7 @@ export const ZH_CN = {
|
||||
CONFIG_THING: '配置${c}',
|
||||
FIND_NEW_VERSION: '发现新版本',
|
||||
NO_MORE_NOTICE: '以后不再提醒',
|
||||
SHOW_DEVTOOLS: '打开开发者工具',
|
||||
|
||||
// ---renderer i18n---
|
||||
CHOOSE_YOUR_DEFAULT_PICBED: '选择 ${d} 作为你默认图床:',
|
||||
|
||||
Reference in New Issue
Block a user