mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-08 21:38:13 -05:00
✨ Feature: optimize manage page UI, add new version check for plugin page
This commit is contained in:
parent
c36a5b85cc
commit
e8189b0837
@ -566,7 +566,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
|||||||
<el-row>
|
<el-row>
|
||||||
<el-icon
|
<el-icon
|
||||||
v-if="!item.isDir && isShowRenameFileIcon"
|
v-if="!item.isDir && isShowRenameFileIcon"
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
@click="handleRenameFile(item)"
|
@click="handleRenameFile(item)"
|
||||||
@ -575,7 +575,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
|||||||
</el-icon>
|
</el-icon>
|
||||||
<el-icon
|
<el-icon
|
||||||
v-if="item.isDir"
|
v-if="item.isDir"
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="crimson"
|
color="crimson"
|
||||||
@click="handleFolderBatchDownload(item)"
|
@click="handleFolderBatchDownload(item)"
|
||||||
@ -585,7 +585,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
|||||||
<el-dropdown>
|
<el-dropdown>
|
||||||
<template #default>
|
<template #default>
|
||||||
<el-icon
|
<el-icon
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
@click="async () => {
|
@click="async () => {
|
||||||
@ -651,7 +651,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
|||||||
</template>
|
</template>
|
||||||
</el-dropdown>
|
</el-dropdown>
|
||||||
<el-icon
|
<el-icon
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
@click="handleShowFileInfo(item)"
|
@click="handleShowFileInfo(item)"
|
||||||
@ -659,7 +659,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
|||||||
<Document />
|
<Document />
|
||||||
</el-icon>
|
</el-icon>
|
||||||
<el-icon
|
<el-icon
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#FFB6C1"
|
color="#FFB6C1"
|
||||||
@click="handleDeleteFile(item)"
|
@click="handleDeleteFile(item)"
|
||||||
@ -3461,7 +3461,7 @@ const columns: Column<any>[] = [
|
|||||||
? item.isDir || !isShowRenameFileIcon.value
|
? item.isDir || !isShowRenameFileIcon.value
|
||||||
? item.isDir
|
? item.isDir
|
||||||
? <ElIcon
|
? <ElIcon
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -3471,7 +3471,7 @@ const columns: Column<any>[] = [
|
|||||||
</ElIcon>
|
</ElIcon>
|
||||||
: <template></template>
|
: <template></template>
|
||||||
: <ElIcon
|
: <ElIcon
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -3498,7 +3498,7 @@ const columns: Column<any>[] = [
|
|||||||
{{
|
{{
|
||||||
default: () => (
|
default: () => (
|
||||||
<ElIcon
|
<ElIcon
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -3570,7 +3570,7 @@ const columns: Column<any>[] = [
|
|||||||
hide-after={150}
|
hide-after={150}
|
||||||
>
|
>
|
||||||
<ElIcon
|
<ElIcon
|
||||||
size="20"
|
size="15"
|
||||||
style="cursor: pointer;"
|
style="cursor: pointer;"
|
||||||
color="#409EFF"
|
color="#409EFF"
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -58,8 +58,8 @@
|
|||||||
:xs="24"
|
:xs="24"
|
||||||
:sm="pluginList.length === 1 ? 24 : 12"
|
:sm="pluginList.length === 1 ? 24 : 12"
|
||||||
:md="pluginList.length === 1 ? 24 : 12"
|
:md="pluginList.length === 1 ? 24 : 12"
|
||||||
:lg="pluginList.length === 1 ? 24 : 6"
|
:lg="pluginList.length === 1 ? 24 : 12"
|
||||||
:xl="pluginList.length === 1 ? 24 : 6"
|
:xl="pluginList.length === 1 ? 24 : 12"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="plugin-item"
|
class="plugin-item"
|
||||||
@ -85,7 +85,17 @@
|
|||||||
class="plugin-item__name"
|
class="plugin-item__name"
|
||||||
@click="openHomepage(item.homepage)"
|
@click="openHomepage(item.homepage)"
|
||||||
>
|
>
|
||||||
{{ item.name }} <small>{{ ' ' + item.version }}</small>
|
{{ item.name }} <small>{{ ' ' + item.version }}</small>
|
||||||
|
<!-- 升级提示 -->
|
||||||
|
<el-tag
|
||||||
|
v-if="latestVersionMap[item.fullName] && latestVersionMap[item.fullName] !== item.version"
|
||||||
|
type="success"
|
||||||
|
size="small"
|
||||||
|
round
|
||||||
|
effect="plain"
|
||||||
|
>
|
||||||
|
new
|
||||||
|
</el-tag>
|
||||||
</div>
|
</div>
|
||||||
<div
|
<div
|
||||||
class="plugin-item__desc"
|
class="plugin-item__desc"
|
||||||
@ -233,7 +243,7 @@ import {
|
|||||||
} from '#/events/constants'
|
} from '#/events/constants'
|
||||||
|
|
||||||
// Vue 相关
|
// Vue 相关
|
||||||
import { computed, ref, onBeforeMount, onBeforeUnmount, watch, onMounted } from 'vue'
|
import { computed, ref, onBeforeMount, onBeforeUnmount, watch, onMounted, reactive } from 'vue'
|
||||||
|
|
||||||
// 数据发送工具函数
|
// 数据发送工具函数
|
||||||
import { getConfig, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender'
|
import { getConfig, saveConfig, sendRPC, sendToMain } from '@/utils/dataSender'
|
||||||
@ -257,6 +267,7 @@ const dialogVisible = ref(false)
|
|||||||
const pluginNameList = ref<string[]>([])
|
const pluginNameList = ref<string[]>([])
|
||||||
const loading = ref(true)
|
const loading = ref(true)
|
||||||
const needReload = ref(false)
|
const needReload = ref(false)
|
||||||
|
const latestVersionMap = reactive<{ [key: string]: string }>({})
|
||||||
const pluginListToolTip = $T('PLUGIN_LIST')
|
const pluginListToolTip = $T('PLUGIN_LIST')
|
||||||
const importLocalPluginToolTip = $T('PLUGIN_IMPORT_LOCAL')
|
const importLocalPluginToolTip = $T('PLUGIN_IMPORT_LOCAL')
|
||||||
// const id = ref('')
|
// const id = ref('')
|
||||||
@ -292,6 +303,15 @@ watch(dialogVisible, (val: boolean) => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
async function getLatestVersionOfPlugIn (pluginName: string) {
|
||||||
|
try {
|
||||||
|
const res = await axios.get(`https://registry.npmjs.com/${pluginName}`)
|
||||||
|
latestVersionMap[pluginName] = res.data['dist-tags'].latest
|
||||||
|
} catch (err) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onBeforeMount(async () => {
|
onBeforeMount(async () => {
|
||||||
os.value = process.platform
|
os.value = process.platform
|
||||||
ipcRenderer.on('hideLoading', () => {
|
ipcRenderer.on('hideLoading', () => {
|
||||||
@ -308,6 +328,9 @@ onBeforeMount(async () => {
|
|||||||
ipcRenderer.on('pluginList', (evt: IpcRendererEvent, list: IPicGoPlugin[]) => {
|
ipcRenderer.on('pluginList', (evt: IpcRendererEvent, list: IPicGoPlugin[]) => {
|
||||||
pluginList.value = list
|
pluginList.value = list
|
||||||
pluginNameList.value = list.map(item => item.fullName)
|
pluginNameList.value = list.map(item => item.fullName)
|
||||||
|
for (const item of pluginList.value) {
|
||||||
|
getLatestVersionOfPlugIn(item.fullName)
|
||||||
|
}
|
||||||
loading.value = false
|
loading.value = false
|
||||||
})
|
})
|
||||||
ipcRenderer.on('installPlugin', (evt: IpcRendererEvent, { success, body }: {
|
ipcRenderer.on('installPlugin', (evt: IpcRendererEvent, { success, body }: {
|
||||||
|
1
src/universal/types/types.d.ts
vendored
1
src/universal/types/types.d.ts
vendored
@ -151,6 +151,7 @@ interface IPicGoPlugin {
|
|||||||
guiMenu?: any[]
|
guiMenu?: any[]
|
||||||
ing: boolean
|
ing: boolean
|
||||||
hasInstall?: boolean
|
hasInstall?: boolean
|
||||||
|
[propName: string]: any
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IPicGoPluginConfig {
|
interface IPicGoPluginConfig {
|
||||||
|
Loading…
Reference in New Issue
Block a user