mirror of
https://github.com/Kuingsmile/PicList.git
synced 2026-06-01 07:59:42 +08:00
✨ Feature(custom): add tray tooltip
This commit is contained in:
@@ -228,28 +228,15 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// Element Plus 图标
|
||||
import { Close, Download, Refresh, Goods, Remove, Tools } from '@element-plus/icons-vue'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// 组件
|
||||
import ConfigForm from '@/components/ConfigFormForPlugin.vue'
|
||||
|
||||
// Lodash 函数节流
|
||||
import { debounce, DebouncedFunc } from 'lodash'
|
||||
|
||||
// Electron 相关
|
||||
import {
|
||||
ipcRenderer,
|
||||
IpcRendererEvent
|
||||
} from 'electron'
|
||||
|
||||
// 工具函数
|
||||
import { handleStreamlinePluginName } from '~/universal/utils/common'
|
||||
|
||||
// 事件常量
|
||||
import {
|
||||
OPEN_URL,
|
||||
PICGO_CONFIG_PLUGIN,
|
||||
@@ -259,20 +246,10 @@ import {
|
||||
GET_PICBEDS,
|
||||
PICGO_HANDLE_PLUGIN_DONE
|
||||
} from '#/events/constants'
|
||||
|
||||
// Vue 相关
|
||||
import { computed, ref, onBeforeMount, onBeforeUnmount, watch, onMounted, reactive, toRaw } from 'vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// Element Plus 消息框组件
|
||||
import { ElMessageBox } from 'element-plus'
|
||||
|
||||
// Axios
|
||||
import axios from 'axios'
|
||||
|
||||
// 枚举类型声明
|
||||
import { IRPCActionType } from '~/universal/types/enum'
|
||||
import { configPaths } from '~/universal/utils/configPaths'
|
||||
|
||||
@@ -461,26 +438,6 @@ function installPlugin (item: IPicGoPlugin) {
|
||||
}
|
||||
}
|
||||
|
||||
// function uninstallPlugin (val: string) {
|
||||
// pluginList.value.forEach(item => {
|
||||
// if (item.name === val) {
|
||||
// item.ing = true
|
||||
// }
|
||||
// })
|
||||
// loading.value = true
|
||||
// sendToMain('uninstallPlugin', val)
|
||||
// }
|
||||
|
||||
// function updatePlugin (val: string) {
|
||||
// pluginList.value.forEach(item => {
|
||||
// if (item.fullName === val) {
|
||||
// item.ing = true
|
||||
// }
|
||||
// })
|
||||
// loading.value = true
|
||||
// sendToMain('updatePlugin', val)
|
||||
// }
|
||||
|
||||
function reloadApp () {
|
||||
sendRPC(IRPCActionType.RELOAD_APP)
|
||||
}
|
||||
|
||||
@@ -51,29 +51,15 @@
|
||||
</el-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// Element Plus 图标
|
||||
import { Close } from '@element-plus/icons-vue'
|
||||
|
||||
// 事件常量
|
||||
import { GET_RENAME_FILE_NAME, RENAME_FILE_NAME } from '#/events/constants'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// Electron 相关
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// Vue 生命周期钩子
|
||||
import { onBeforeUnmount, onBeforeMount, ref, reactive } from 'vue'
|
||||
|
||||
// 自定义钩子
|
||||
import { useIPCOn } from '@/hooks/useIPC'
|
||||
|
||||
// Element Plus 表单实例类型
|
||||
import { FormInstance } from 'element-plus'
|
||||
|
||||
const id = ref<string | null>(null)
|
||||
@@ -84,7 +70,7 @@ const form = reactive({
|
||||
originName: ''
|
||||
})
|
||||
|
||||
const handleFileName = (event: IpcRendererEvent, newName: string, _originName: string, _id: string) => {
|
||||
const handleFileName = (_: IpcRendererEvent, newName: string, _originName: string, _id: string) => {
|
||||
form.fileName = newName
|
||||
form.originName = _originName
|
||||
id.value = _id
|
||||
|
||||
@@ -117,22 +117,11 @@
|
||||
</div>
|
||||
</template>
|
||||
<script lang="ts" setup>
|
||||
// 按键绑定工具函数
|
||||
import keyBinding from '@/utils/key-binding'
|
||||
|
||||
// Electron 相关
|
||||
import { ipcRenderer, IpcRendererEvent } from 'electron'
|
||||
|
||||
// 事件常量
|
||||
import { TOGGLE_SHORTKEY_MODIFIED_MODE } from '#/events/constants'
|
||||
|
||||
// Vue 生命周期钩子
|
||||
import { onBeforeUnmount, onBeforeMount, ref, watch } from 'vue'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n'
|
||||
import { configPaths } from '~/universal/utils/configPaths'
|
||||
|
||||
|
||||
@@ -62,31 +62,14 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts" setup>
|
||||
// Vue 相关
|
||||
import { reactive, ref, onBeforeUnmount, onBeforeMount } from 'vue'
|
||||
|
||||
// Electron 相关
|
||||
import { clipboard, ipcRenderer } from 'electron'
|
||||
|
||||
// 数据库操作
|
||||
import $$db from '@/utils/db'
|
||||
|
||||
// 国际化函数
|
||||
import { T as $T } from '@/i18n/index'
|
||||
|
||||
// Picgo Store 相关类型
|
||||
import { IResult } from '@picgo/store/dist/types'
|
||||
|
||||
// 事件常量
|
||||
import { OPEN_WINDOW } from '#/events/constants'
|
||||
|
||||
// 枚举类型声明
|
||||
import { IPasteStyle, IWindowList } from '#/types/enum'
|
||||
|
||||
// 数据发送工具函数
|
||||
import { getConfig, sendToMain } from '@/utils/dataSender'
|
||||
|
||||
// 工具函数
|
||||
import { handleUrlEncode } from '#/utils/common'
|
||||
import { configPaths } from '~/universal/utils/configPaths'
|
||||
|
||||
@@ -99,8 +82,6 @@ const notification = reactive({
|
||||
const clipboardFiles = ref<ImgInfo[]>([])
|
||||
const uploadFlag = ref(false)
|
||||
|
||||
// const reverseList = computed(() => files.value.slice().reverse())
|
||||
|
||||
function openSettingWindow () {
|
||||
sendToMain(OPEN_WINDOW, IWindowList.SETTING_WINDOW)
|
||||
}
|
||||
@@ -166,10 +147,6 @@ async function pasteTemplate (style: IPasteStyle, item: ImgInfo, customLink: str
|
||||
return tpl[style]
|
||||
}
|
||||
|
||||
// function calcHeight (width: number, height: number): number {
|
||||
// return height * 160 / width
|
||||
// }
|
||||
|
||||
function disableDragFile () {
|
||||
window.addEventListener('dragover', (e) => {
|
||||
e = e || event
|
||||
|
||||
@@ -119,6 +119,7 @@ import { PICBEDS_PAGE, UPLOADER_CONFIG_PAGE } from '@/router/config'
|
||||
// 状态管理
|
||||
import { useStore } from '@/hooks/useStore'
|
||||
import { configPaths } from '~/universal/utils/configPaths'
|
||||
import { ipcRenderer } from 'electron'
|
||||
|
||||
const $router = useRouter()
|
||||
const $route = useRoute()
|
||||
@@ -130,10 +131,11 @@ const store = useStore()
|
||||
|
||||
async function selectItem (id: string) {
|
||||
await triggerRPC<void>(IRPCActionType.SELECT_UPLOADER, type.value, id)
|
||||
ipcRenderer.send('setTrayToolTip', `${type.value} ${curConfigList.value.find(item => item._id === id)?._configName || ''}`)
|
||||
defaultConfigId.value = id
|
||||
}
|
||||
|
||||
onBeforeRouteUpdate((to, from, next) => {
|
||||
onBeforeRouteUpdate((to, _, next) => {
|
||||
if (to.params.type && (to.name === UPLOADER_CONFIG_PAGE)) {
|
||||
type.value = to.params.type as string
|
||||
getCurrentConfigList()
|
||||
@@ -193,6 +195,8 @@ function setDefaultPicBed (type: string) {
|
||||
})
|
||||
|
||||
store?.setDefaultPicBed(type)
|
||||
const currentConfigName = curConfigList.value.find(item => item._id === defaultConfigId.value)?._configName
|
||||
ipcRenderer.send('setTrayToolTip', `${type} ${currentConfigName || ''}`)
|
||||
const successNotification = new Notification($T('SETTINGS_DEFAULT_PICBED'), {
|
||||
body: $T('TIPS_SET_SUCCEED')
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user