mirror of
https://github.com/Kuingsmile/PicList.git
synced 2025-02-02 11:08: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-icon
|
||||
v-if="!item.isDir && isShowRenameFileIcon"
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="#409EFF"
|
||||
@click="handleRenameFile(item)"
|
||||
@ -575,7 +575,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
||||
</el-icon>
|
||||
<el-icon
|
||||
v-if="item.isDir"
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="crimson"
|
||||
@click="handleFolderBatchDownload(item)"
|
||||
@ -585,7 +585,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
||||
<el-dropdown>
|
||||
<template #default>
|
||||
<el-icon
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="#409EFF"
|
||||
@click="async () => {
|
||||
@ -651,7 +651,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
||||
</template>
|
||||
</el-dropdown>
|
||||
<el-icon
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="#409EFF"
|
||||
@click="handleShowFileInfo(item)"
|
||||
@ -659,7 +659,7 @@ https://www.baidu.com/img/bd_logo1.png"
|
||||
<Document />
|
||||
</el-icon>
|
||||
<el-icon
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="#FFB6C1"
|
||||
@click="handleDeleteFile(item)"
|
||||
@ -3461,7 +3461,7 @@ const columns: Column<any>[] = [
|
||||
? item.isDir || !isShowRenameFileIcon.value
|
||||
? item.isDir
|
||||
? <ElIcon
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="#409EFF"
|
||||
// @ts-ignore
|
||||
@ -3471,7 +3471,7 @@ const columns: Column<any>[] = [
|
||||
</ElIcon>
|
||||
: <template></template>
|
||||
: <ElIcon
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="#409EFF"
|
||||
// @ts-ignore
|
||||
@ -3498,7 +3498,7 @@ const columns: Column<any>[] = [
|
||||
{{
|
||||
default: () => (
|
||||
<ElIcon
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="#409EFF"
|
||||
// @ts-ignore
|
||||
@ -3570,7 +3570,7 @@ const columns: Column<any>[] = [
|
||||
hide-after={150}
|
||||
>
|
||||
<ElIcon
|
||||
size="20"
|
||||
size="15"
|
||||
style="cursor: pointer;"
|
||||
color="#409EFF"
|
||||
// @ts-ignore
|
||||
|
@ -58,8 +58,8 @@
|
||||
:xs="24"
|
||||
:sm="pluginList.length === 1 ? 24 : 12"
|
||||
:md="pluginList.length === 1 ? 24 : 12"
|
||||
:lg="pluginList.length === 1 ? 24 : 6"
|
||||
:xl="pluginList.length === 1 ? 24 : 6"
|
||||
:lg="pluginList.length === 1 ? 24 : 12"
|
||||
:xl="pluginList.length === 1 ? 24 : 12"
|
||||
>
|
||||
<div
|
||||
class="plugin-item"
|
||||
@ -85,7 +85,17 @@
|
||||
class="plugin-item__name"
|
||||
@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
|
||||
class="plugin-item__desc"
|
||||
@ -233,7 +243,7 @@ import {
|
||||
} from '#/events/constants'
|
||||
|
||||
// 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'
|
||||
@ -257,6 +267,7 @@ const dialogVisible = ref(false)
|
||||
const pluginNameList = ref<string[]>([])
|
||||
const loading = ref(true)
|
||||
const needReload = ref(false)
|
||||
const latestVersionMap = reactive<{ [key: string]: string }>({})
|
||||
const pluginListToolTip = $T('PLUGIN_LIST')
|
||||
const importLocalPluginToolTip = $T('PLUGIN_IMPORT_LOCAL')
|
||||
// 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 () => {
|
||||
os.value = process.platform
|
||||
ipcRenderer.on('hideLoading', () => {
|
||||
@ -308,6 +328,9 @@ onBeforeMount(async () => {
|
||||
ipcRenderer.on('pluginList', (evt: IpcRendererEvent, list: IPicGoPlugin[]) => {
|
||||
pluginList.value = list
|
||||
pluginNameList.value = list.map(item => item.fullName)
|
||||
for (const item of pluginList.value) {
|
||||
getLatestVersionOfPlugIn(item.fullName)
|
||||
}
|
||||
loading.value = false
|
||||
})
|
||||
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[]
|
||||
ing: boolean
|
||||
hasInstall?: boolean
|
||||
[propName: string]: any
|
||||
}
|
||||
|
||||
interface IPicGoPluginConfig {
|
||||
|
Loading…
Reference in New Issue
Block a user