Ver código fonte

适配vite基本完成

蒋吉兆 3 anos atrás
pai
commit
b6c6217cda

+ 1 - 1
web/src/components/chooseImg/index.vue

@@ -19,7 +19,7 @@
 </template>
 
 <script>
-const path = import.meta.env.VITE_BASE_API
+const path = process.env.VUE_APP_BASE_API
 import { getFileList } from '@/api/fileUploadAndDownload'
 export default {
   props: {

+ 1 - 1
web/src/components/dashbordCharts/echartsLine.vue

@@ -9,7 +9,7 @@
 </template>
 <script>
 import echarts from 'echarts'
-require('echarts/theme/macarons')
+import 'echarts/theme/macarons'
 
 var dataAxis = []
 for (var i = 1; i < 21; i++) {

+ 3 - 4
web/src/utils/asyncRouter.js

@@ -1,4 +1,4 @@
-const modules = import.meta.glob('../../view/**/*.vue')
+const modules = import.meta.glob('../view/**/*.vue')
 
 export const asyncRouterHandle = (asyncRouter) => {
   asyncRouter.map(item => {
@@ -20,11 +20,10 @@ function dynamicImport(
 ) {
   const keys = Object.keys(dynamicViewsModules)
   const matchKeys = keys.filter((key) => {
-    let k = key.replace('../../view', '')
-    const lastIndex = k.lastIndexOf('.')
-    k = k.substring(0, lastIndex)
+    const k = key.replace('../', '')
     return k === component
   })
   const matchKey = matchKeys[0]
+
   return dynamicViewsModules[matchKey]
 }

+ 1 - 1
web/src/view/example/upload/upload.vue

@@ -72,7 +72,7 @@ import { mapGetters } from 'vuex'
 import infoList from '@/mixins/infoList'
 import { getFileList, deleteFile } from '@/api/fileUploadAndDownload'
 import { downloadImage } from '@/utils/downloadImg'
-import CustomPic from '@/components/customPic'
+import CustomPic from '@/components/customPic/index.vue'
 import UploadImage from '@/components/upload/image.vue'
 export default {
   name: 'Upload',

+ 2 - 2
web/src/view/layout/aside/asideComponent/index.vue

@@ -7,8 +7,8 @@
 </template>
 
 <script>
-import MenuItem from './menuItem'
-import AsyncSubmenu from './asyncSubmenu'
+import MenuItem from './menuItem.vue'
+import AsyncSubmenu from './asyncSubmenu.vue'
 
 export default {
   name: 'AsideComponent',

+ 1 - 1
web/src/view/layout/aside/index.vue

@@ -24,7 +24,7 @@
 
 <script>
 import { mapGetters, mapMutations } from 'vuex'
-import AsideComponent from '@/view/layout/aside/asideComponent'
+import AsideComponent from '@/view/layout/aside/asideComponent/index.vue'
 import { emitter } from '@/utils/bus.js'
 
 export default {

+ 7 - 7
web/src/view/layout/index.vue

@@ -100,14 +100,14 @@
 </template>
 
 <script>
-import Aside from '@/view/layout/aside'
-import HistoryComponent from '@/view/layout/aside/historyComponent/history'
-import Screenfull from '@/view/layout/screenfull'
-import Search from '@/view/layout/search/search'
-import BottomInfo from '@/view/layout/bottomInfo/bottomInfo'
+import Aside from '@/view/layout/aside/index.vue'
+import HistoryComponent from '@/view/layout/aside/historyComponent/history.vue'
+import Screenfull from '@/view/layout/screenfull/index.vue'
+import Search from '@/view/layout/search/search.vue'
+import BottomInfo from '@/view/layout/bottomInfo/bottomInfo.vue'
 import { mapGetters, mapActions } from 'vuex'
-import CustomPic from '@/components/customPic'
-import Setting from './setting'
+import CustomPic from '@/components/customPic/index.vue'
+import Setting from './setting/index.vue'
 import { setUserAuthority } from '@/api/user'
 import { emitter } from '@/utils/bus.js'
 export default {

+ 2 - 2
web/src/view/person/person.vue

@@ -102,8 +102,8 @@
 </template>
 
 <script>
-import ChooseImg from '@/components/chooseImg'
-import { setUserInfo, changePassword } from '@/api/user'
+import ChooseImg from '@/components/chooseImg/index.vue'
+import { setUserInfo, changePassword } from '@/api/user.js'
 
 import { mapGetters, mapMutations } from 'vuex'
 const path = import.meta.env.VITE_BASE_API

+ 3 - 3
web/src/view/superAdmin/authority/authority.vue

@@ -99,9 +99,9 @@ import {
   copyAuthority
 } from '@/api/authority'
 
-import Menus from '@/view/superAdmin/authority/components/menus'
-import Apis from '@/view/superAdmin/authority/components/apis'
-import Datas from '@/view/superAdmin/authority/components/datas'
+import Menus from '@/view/superAdmin/authority/components/menus.vue'
+import Apis from '@/view/superAdmin/authority/components/apis.vue'
+import Datas from '@/view/superAdmin/authority/components/datas.vue'
 
 import infoList from '@/mixins/infoList'
 export default {

+ 1 - 1
web/src/view/superAdmin/menu/menu.vue

@@ -193,7 +193,7 @@ import {
   getBaseMenuById
 } from '@/api/menu'
 import infoList from '@/mixins/infoList'
-import icon from '@/view/superAdmin/menu/icon'
+import icon from '@/view/superAdmin/menu/icon.vue'
 export default {
   name: 'Menus',
   components: {

+ 2 - 2
web/src/view/superAdmin/user/user.vue

@@ -106,8 +106,8 @@ import {
 import { getAuthorityList } from '@/api/authority'
 import infoList from '@/mixins/infoList'
 import { mapGetters } from 'vuex'
-import CustomPic from '@/components/customPic'
-import ChooseImg from '@/components/chooseImg'
+import CustomPic from '@/components/customPic/index.vue'
+import ChooseImg from '@/components/chooseImg/index.vue'
 export default {
   name: 'Api',
   components: { CustomPic, ChooseImg },