From a9dce21878dd9df018d34be914fa3d1c1feade83 Mon Sep 17 00:00:00 2001 From: Ohh <155351881+mufeng889@users.noreply.github.com> Date: Sat, 27 Jul 2024 03:06:11 +0800 Subject: [PATCH] feat(projects): add plugin pdf preview (#568) --- package.json | 1 + src/locales/langs/en-us.ts | 3 +- src/locales/langs/zh-cn.ts | 3 +- src/router/elegant/imports.ts | 1 + src/router/elegant/routes.ts | 10 ++++ src/router/elegant/transform.ts | 1 + src/typings/components.d.ts | 5 ++ src/typings/elegant-router.d.ts | 2 + src/views/plugin/pdf/index.vue | 82 +++++++++++++++++++++++++++++++++ 9 files changed, 106 insertions(+), 2 deletions(-) create mode 100644 src/views/plugin/pdf/index.vue diff --git a/package.json b/package.json index ad578836..96934c71 100644 --- a/package.json +++ b/package.json @@ -74,6 +74,7 @@ "vue": "3.4.33", "vue-draggable-plus": "0.5.2", "vue-i18n": "9.13.1", + "vue-pdf-embed": "2.1.0", "vue-router": "4.4.0", "wangeditor": "4.7.15", "xgplayer": "3.0.19", diff --git a/src/locales/langs/en-us.ts b/src/locales/langs/en-us.ts index 0575e192..6bce00d2 100644 --- a/src/locales/langs/en-us.ts +++ b/src/locales/langs/en-us.ts @@ -199,7 +199,8 @@ const local: App.I18n.Schema = { plugin_video: 'Video', plugin_barcode: 'Barcode', plugin_pinyin: 'pinyin', - plugin_excel: 'Excel' + plugin_excel: 'Excel', + plugin_pdf: 'PDF preview' }, page: { login: { diff --git a/src/locales/langs/zh-cn.ts b/src/locales/langs/zh-cn.ts index 45920815..f7a2c69f 100644 --- a/src/locales/langs/zh-cn.ts +++ b/src/locales/langs/zh-cn.ts @@ -199,7 +199,8 @@ const local: App.I18n.Schema = { plugin_video: '视频', plugin_barcode: '条形码', plugin_pinyin: '拼音', - plugin_excel: 'Excel' + plugin_excel: 'Excel', + plugin_pdf: 'PDF 预览' }, page: { login: { diff --git a/src/router/elegant/imports.ts b/src/router/elegant/imports.ts index 0bf314e1..0fc93d6f 100644 --- a/src/router/elegant/imports.ts +++ b/src/router/elegant/imports.ts @@ -44,6 +44,7 @@ export const views: Record Promise import("@/views/plugin/excel/index.vue"), plugin_icon: () => import("@/views/plugin/icon/index.vue"), plugin_map: () => import("@/views/plugin/map/index.vue"), + plugin_pdf: () => import("@/views/plugin/pdf/index.vue"), plugin_pinyin: () => import("@/views/plugin/pinyin/index.vue"), plugin_print: () => import("@/views/plugin/print/index.vue"), plugin_swiper: () => import("@/views/plugin/swiper/index.vue"), diff --git a/src/router/elegant/routes.ts b/src/router/elegant/routes.ts index 5981a03a..0cf51a28 100644 --- a/src/router/elegant/routes.ts +++ b/src/router/elegant/routes.ts @@ -444,6 +444,16 @@ export const generatedRoutes: GeneratedRoute[] = [ icon: 'mdi:map' } }, + { + name: 'plugin_pdf', + path: '/plugin/pdf', + component: 'view.plugin_pdf', + meta: { + title: 'plugin_pdf', + i18nKey: 'route.plugin_pdf', + icon:'uiw:file-pdf' + } + }, { name: 'plugin_pinyin', path: '/plugin/pinyin', diff --git a/src/router/elegant/transform.ts b/src/router/elegant/transform.ts index a569bec4..c6cb05a7 100644 --- a/src/router/elegant/transform.ts +++ b/src/router/elegant/transform.ts @@ -212,6 +212,7 @@ const routeMap: RouteMap = { "plugin_excel": "/plugin/excel", "plugin_icon": "/plugin/icon", "plugin_map": "/plugin/map", + "plugin_pdf": "/plugin/pdf", "plugin_pinyin": "/plugin/pinyin", "plugin_print": "/plugin/print", "plugin_swiper": "/plugin/swiper", diff --git a/src/typings/components.d.ts b/src/typings/components.d.ts index 9f9e852d..98d053de 100644 --- a/src/typings/components.d.ts +++ b/src/typings/components.d.ts @@ -19,6 +19,7 @@ declare module 'vue' { IconAntDesignEnterOutlined: typeof import('~icons/ant-design/enter-outlined')['default'] IconAntDesignReloadOutlined: typeof import('~icons/ant-design/reload-outlined')['default'] IconAntDesignSettingOutlined: typeof import('~icons/ant-design/setting-outlined')['default'] + 'IconCharm:download': typeof import('~icons/charm/download')['default'] 'IconFileIcons:microsoftExcel': typeof import('~icons/file-icons/microsoft-excel')['default'] IconGridiconsFullscreen: typeof import('~icons/gridicons/fullscreen')['default'] IconGridiconsFullscreenExit: typeof import('~icons/gridicons/fullscreen-exit')['default'] @@ -32,6 +33,8 @@ declare module 'vue' { IconLocalBanner: typeof import('~icons/local/banner')['default'] IconLocalCast: typeof import('~icons/local/cast')['default'] IconLocalLogo: typeof import('~icons/local/logo')['default'] + 'IconMaterialSymbolsLight:rotate90DegreesCcwOutlineRounded': typeof import('~icons/material-symbols-light/rotate90-degrees-ccw-outline-rounded')['default'] + 'IconMdi:printer': typeof import('~icons/mdi/printer')['default'] IconMdiArrowDownThin: typeof import('~icons/mdi/arrow-down-thin')['default'] IconMdiArrowUpThin: typeof import('~icons/mdi/arrow-up-thin')['default'] IconMdiDrag: typeof import('~icons/mdi/drag')['default'] @@ -77,12 +80,14 @@ declare module 'vue' { NMessageProvider: typeof import('naive-ui')['NMessageProvider'] NModal: typeof import('naive-ui')['NModal'] NNotificationProvider: typeof import('naive-ui')['NNotificationProvider'] + NPagination: typeof import('naive-ui')['NPagination'] NPopconfirm: typeof import('naive-ui')['NPopconfirm'] NPopover: typeof import('naive-ui')['NPopover'] NRadio: typeof import('naive-ui')['NRadio'] NRadioGroup: typeof import('naive-ui')['NRadioGroup'] NScrollbar: typeof import('naive-ui')['NScrollbar'] NSelect: typeof import('naive-ui')['NSelect'] + NSkeleton: typeof import('naive-ui')['NSkeleton'] NSpace: typeof import('naive-ui')['NSpace'] NStatistic: typeof import('naive-ui')['NStatistic'] NSwitch: typeof import('naive-ui')['NSwitch'] diff --git a/src/typings/elegant-router.d.ts b/src/typings/elegant-router.d.ts index 485cec11..37dd8ad3 100644 --- a/src/typings/elegant-router.d.ts +++ b/src/typings/elegant-router.d.ts @@ -68,6 +68,7 @@ declare module "@elegant-router/types" { "plugin_excel": "/plugin/excel"; "plugin_icon": "/plugin/icon"; "plugin_map": "/plugin/map"; + "plugin_pdf": "/plugin/pdf"; "plugin_pinyin": "/plugin/pinyin"; "plugin_print": "/plugin/print"; "plugin_swiper": "/plugin/swiper"; @@ -175,6 +176,7 @@ declare module "@elegant-router/types" { | "plugin_excel" | "plugin_icon" | "plugin_map" + | "plugin_pdf" | "plugin_pinyin" | "plugin_print" | "plugin_swiper" diff --git a/src/views/plugin/pdf/index.vue b/src/views/plugin/pdf/index.vue new file mode 100644 index 00000000..ffcf7e08 --- /dev/null +++ b/src/views/plugin/pdf/index.vue @@ -0,0 +1,82 @@ + + + + +