Browse Source

chore: 删除无用依赖

kailong321200875 1 year ago
parent
commit
cc49593ded
8 changed files with 43 additions and 60 deletions
  1. 1 4
      package.json
  2. 0 47
      src/hooks/web/useIntro.ts
  3. 1 1
      src/locales/en.ts
  4. 1 1
      src/locales/zh-CN.ts
  5. 1 0
      src/store/modules/tagsView.ts
  6. 38 3
      src/views/Guide/Guide.vue
  7. 1 3
      tsconfig.json
  8. 0 1
      vite.config.ts

+ 1 - 4
package.json

@@ -35,10 +35,10 @@
     "animate.css": "^4.1.1",
     "axios": "^1.4.0",
     "dayjs": "^1.11.9",
+    "driver.js": "^1.2.1",
     "echarts": "^5.4.3",
     "echarts-wordcloud": "^2.1.0",
     "element-plus": "^2.3.9",
-    "intro.js": "^7.0.1",
     "lodash-es": "^4.17.21",
     "mitt": "^3.0.1",
     "mockjs": "^1.1.0",
@@ -60,7 +60,6 @@
     "@iconify/json": "^2.2.101",
     "@intlify/unplugin-vue-i18n": "^0.12.2",
     "@purge-icons/generated": "^0.9.0",
-    "@types/intro.js": "^5.1.1",
     "@types/lodash-es": "^4.17.8",
     "@types/node": "^20.4.10",
     "@types/nprogress": "^0.2.0",
@@ -73,7 +72,6 @@
     "@vitejs/plugin-legacy": "^4.1.1",
     "@vitejs/plugin-vue": "^4.2.3",
     "@vitejs/plugin-vue-jsx": "^3.0.1",
-    "@vue-macros/volar": "^0.13.3",
     "autoprefixer": "^10.4.14",
     "consola": "^3.2.3",
     "eslint": "^8.47.0",
@@ -99,7 +97,6 @@
     "terser": "^5.19.2",
     "typescript": "5.1.6",
     "unocss": "^0.55.0",
-    "unplugin-vue-define-options": "^1.3.15",
     "vite": "4.4.9",
     "vite-plugin-ejs": "^1.6.4",
     "vite-plugin-eslint": "^1.8.1",

+ 0 - 47
src/hooks/web/useIntro.ts

@@ -1,47 +0,0 @@
-import introJs from 'intro.js'
-import { IntroJs, Step, Options } from 'intro.js'
-import 'intro.js/introjs.css'
-import { useI18n } from '@/hooks/web/useI18n'
-import { useDesign } from '@/hooks/web/useDesign'
-
-export const useIntro = (setps?: Step[], options?: Options) => {
-  const { t } = useI18n()
-
-  const { variables } = useDesign()
-
-  const defaultSetps: Step[] = setps || [
-    {
-      element: `#${variables.namespace}-menu`,
-      title: t('common.menu'),
-      intro: t('common.menuDes'),
-      position: 'right'
-    },
-    {
-      element: `#${variables.namespace}-tool-header`,
-      title: t('common.tool'),
-      intro: t('common.toolDes'),
-      position: 'left'
-    },
-    {
-      element: `#${variables.namespace}-tags-view`,
-      title: t('common.tagsView'),
-      intro: t('common.tagsViewDes'),
-      position: 'bottom'
-    }
-  ]
-
-  const defaultOptions: Options = options || {
-    prevLabel: t('common.prevLabel'),
-    nextLabel: t('common.nextLabel'),
-    skipLabel: t('common.skipLabel'),
-    doneLabel: t('common.doneLabel')
-  }
-
-  const introRef: IntroJs = introJs()
-
-  introRef.addSteps(defaultSetps).setOptions(defaultOptions)
-
-  return {
-    introRef
-  }
-}

+ 1 - 1
src/locales/en.ts

@@ -318,7 +318,7 @@ export default {
     guide: 'Guide',
     start: 'Start',
     message:
-      'The guide page is very useful for some people who enter the project for the first time. You can briefly introduce the functions of the project. The boot page is based on intro js'
+      'The guide page is very useful for some people who enter the project for the first time. You can briefly introduce the functions of the project. The boot page is based on driver.js'
   },
   iconDemo: {
     icon: 'Icon',

+ 1 - 1
src/locales/zh-CN.ts

@@ -313,7 +313,7 @@ export default {
     guide: '引导页',
     start: '开始',
     message:
-      '引导页对于一些第一次进入项目的人很有用,你可以简单介绍下项目的功能。引导页基于 intro.js'
+      '引导页对于一些第一次进入项目的人很有用,你可以简单介绍下项目的功能。引导页基于 driver.js'
   },
   iconDemo: {
     icon: '图标',

+ 1 - 0
src/store/modules/tagsView.ts

@@ -36,6 +36,7 @@ export const useTagsViewStore = defineStore('tagsView', {
     },
     // 新增tag
     addVisitedView(view: RouteLocationNormalizedLoaded) {
+      console.log(view)
       if (this.visitedViews.some((v) => v.path === view.path)) return
       if (view.meta?.noTagsView) return
       this.visitedViews.push(

+ 38 - 3
src/views/Guide/Guide.vue

@@ -1,15 +1,50 @@
 <script setup lang="ts">
 import { ContentWrap } from '@/components/ContentWrap'
 import { useI18n } from '@/hooks/web/useI18n'
-import { useIntro } from '@/hooks/web/useIntro'
 import { ElButton } from 'element-plus'
+import { driver } from 'driver.js'
+import 'driver.js/dist/driver.css'
+import { useDesign } from '@/hooks/web/useDesign'
 
 const { t } = useI18n()
 
-const { introRef } = useIntro()
+const { variables } = useDesign()
+
+const driverObj = driver({
+  showProgress: true,
+  nextBtnText: t('common.nextLabel'),
+  prevBtnText: t('common.prevLabel'),
+  doneBtnText: t('common.doneLabel'),
+  steps: [
+    {
+      element: `#${variables.namespace}-menu`,
+      popover: {
+        title: t('common.menu'),
+        description: t('common.menuDes'),
+        side: 'right'
+      }
+    },
+    {
+      element: `#${variables.namespace}-tool-header`,
+      popover: {
+        title: t('common.tool'),
+        description: t('common.toolDes'),
+        side: 'left'
+      }
+    },
+    {
+      element: `#${variables.namespace}-tags-view`,
+      popover: {
+        title: t('common.tagsView'),
+        description: t('common.tagsViewDes'),
+        side: 'bottom'
+      }
+    }
+  ]
+})
 
 const guideStart = () => {
-  introRef.start()
+  driverObj.drive()
 }
 </script>
 

+ 1 - 3
tsconfig.json

@@ -27,10 +27,8 @@
       "@intlify/unplugin-vue-i18n/types",
       "vite/client",
       "element-plus/global",
-      "@types/intro.js",
       "@types/qrcode",
-      "vite-plugin-svg-icons/client",
-      "unplugin-vue-define-options/macros-global"
+      "vite-plugin-svg-icons/client"
     ]
   },
   "include": ["src", "types/**/*.d.ts", "mock/**/*.ts"]

+ 0 - 1
vite.config.ts

@@ -10,7 +10,6 @@ import { ViteEjsPlugin } from "vite-plugin-ejs"
 import PurgeIcons from 'vite-plugin-purge-icons'
 import VueI18nPlugin from "@intlify/unplugin-vue-i18n/vite"
 import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
-import DefineOptions from "unplugin-vue-define-options/vite"
 import { createStyleImportPlugin, ElementPlusResolve } from 'vite-plugin-style-import'
 import UnoCSS from 'unocss/vite'