Selaa lähdekoodia

清除cdn打包 调整切换用户角色时出现的bug

蒋吉兆 3 vuotta sitten
vanhempi
commit
5c2bfaa603
7 muutettua tiedostoa jossa 15 lisäystä ja 67 poistoa
  1. 0 17
      web/build.config.js
  2. 6 6
      web/package-lock.json
  3. 1 1
      web/package.json
  4. 0 15
      web/src/api/github.js
  5. 4 4
      web/src/main.js
  6. 3 1
      web/src/view/layout/index.vue
  7. 1 23
      web/vue.config.js

+ 0 - 17
web/build.config.js

@@ -1,17 +0,0 @@
-'use strict'
-
-module.exports = {
-  title: 'GIN-VUE-ADMIN',
-  baseCdnUrl: '//cdn.staticfile.org',
-  cdns: [
-    /**
-     * 如果设置path属性, { name: 'vue', scope: 'Vue', path: '/vue/2.6.9/vue.min.js' } 即编译出来以[baseCdnUrl][path]
-     * 否则自动拼写 [baseCdnUrl]/[name]/[version]/[name].min.js
-     */
-    { name: 'vue', scope: 'Vue' },
-    { name: 'vue-router', scope: 'VueRouter' },
-    { name: 'vuex', scope: 'Vuex' },
-    { name: 'axios', scope: 'axios' },
-    { name: 'element-ui', scope: 'ELEMENT', path: '/element-ui/2.12.0/index.js' }
-  ]
-}

+ 6 - 6
web/package-lock.json

@@ -1173,9 +1173,9 @@
       "dev": true
     },
     "@popperjs/core": {
-      "version": "2.9.3",
-      "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.9.3.tgz",
-      "integrity": "sha512-xDu17cEfh7Kid/d95kB6tZsLOmSWKCZKtprnhVepjsSaCij+lM3mItSJDuuHDMbCWTh8Ejmebwb+KONcCJ0eXQ=="
+      "version": "2.10.0",
+      "resolved": "https://registry.npmjs.org/@popperjs/core/-/core-2.10.0.tgz",
+      "integrity": "sha512-QWvCHtYwNIR3C/mxW9jGzOu1gbaZkq/6is2OedayPH7HsxI4CVuVzAZ1PmxRElXLwwwCN7aMjRhxtTAGLEZ8IQ=="
     },
     "@soda/friendly-errors-webpack-plugin": {
       "version": "1.8.0",
@@ -4728,9 +4728,9 @@
       "dev": true
     },
     "element-plus": {
-      "version": "1.1.0-beta.4",
-      "resolved": "https://registry.npmjs.org/element-plus/-/element-plus-1.1.0-beta.4.tgz",
-      "integrity": "sha512-wtef1yfLX4IKysspX18s5bsGU3IG6YbkueBorsXi0L/5ykFANoui8QTverAKMQ5ulBcE/jcR7wegfmXGnK9iOA==",
+      "version": "1.1.0-beta.8",
+      "resolved": "https://registry.npmjs.org/element-plus/-/element-plus-1.1.0-beta.8.tgz",
+      "integrity": "sha512-L0z4UoaazLgvimU+Eb8KHwBdX6ND2sSOO/ja70FMJl7Y3T+PxP95OZAkpr1sNiBzMaVVdMef4lQLBwPqTO6PKw==",
       "requires": {
         "@element-plus/icons": "^0.0.11",
         "@popperjs/core": "^2.4.4",

+ 1 - 1
web/package.json

@@ -11,7 +11,7 @@
     "axios": "^0.19.2",
     "core-js": "^3.6.5",
     "echarts": "4.9.0",
-    "element-plus": "^1.1.0-beta.4",
+    "element-plus": "^1.1.0-beta.8",
     "highlight.js": "^10.6.0",
     "marked": "^2.0.0",
     "mitt": "^3.0.0",

+ 0 - 15
web/src/api/github.js

@@ -1,22 +1,7 @@
 import axios from 'axios'
-import { ElLoading } from 'element-plus'
 
-let loadingInstance
 const service = axios.create()
 
-service.interceptors.request.use((config) => {
-  loadingInstance = ElLoading.service({ fullscreen: true })
-  return config
-})
-
-service.interceptors.response.use((resp) => {
-  loadingInstance.close()
-  return resp
-}, (error) => {
-  loadingInstance.close()
-  return error
-})
-
 export function Commits(page) {
   return service({
     url: 'https://api.github.com/repos/flipped-aurora/gin-vue-admin/commits?page=' + page,

+ 4 - 4
web/src/main.js

@@ -1,7 +1,9 @@
 import { createApp } from 'vue'
+import 'element-plus/dist/index.css'
+import ElementPlus from 'element-plus'
+import zhCn from 'element-plus/es/locale/lang/zh-cn'
 // 引入gin-vue-admin前端初始化相关内容
 import './core/gin-vue-admin'
-
 // 引入封装的router
 import router from '@/router/index'
 import { run } from '@/core/gin-vue-admin.js'
@@ -9,9 +11,7 @@ import '@/permission'
 import { store } from '@/store/index'
 
 import { auth } from '@/directive/auth'
-import ElementPlus from 'element-plus'
-import 'element-plus/dist/index.css'
-import zhCn from 'element-plus/es/locale/lang/zh-cn'
+
 import App from './App.vue'
 const app = createApp(App)
 run(app)

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

@@ -213,7 +213,9 @@ export default {
       })
       if (res.code === 0) {
         emitter.emit('closeAllPage')
-        window.location.reload()
+        setTimeout(() => {
+          window.location.reload()
+        }, 1)
       }
     },
     reload() {

+ 1 - 23
web/vue.config.js

@@ -1,8 +1,6 @@
 'use strict'
 
 const path = require('path')
-const buildConf = require('./build.config')
-const packageConf = require('./package.json')
 
 function resolve(dir) {
   return path.join(__dirname, dir)
@@ -51,29 +49,9 @@ module.exports = {
     config
       .when(process.env.NODE_ENV !== 'development',
         config => {
-          // 不打包 begin
-          // 1.目前已经测试通过[vue,axios,echarts]可以cdn引用,其它组件测试通过后可继续添加
-          // 2.此处添加不打包后,需在public/index.html head中添加相应cdn资源链接
-          config.set('externals', buildConf.cdns.reduce((p, a) => {
-            p[a.name] = a.scope
-            return p
-          }, {}))
-          // 不打包 end
           config.plugin('html')
             .tap(args => {
-              if (buildConf.title) {
-                args[0].title = buildConf.title
-              }
-              if (buildConf.cdns.length > 0) {
-                args[0].cdns = buildConf.cdns.map(conf => {
-                  if (conf.path) {
-                    conf.js = `${buildConf.baseCdnUrl}${conf.path}`
-                  } else {
-                    conf.js = `${buildConf.baseCdnUrl}/${conf.name}/${packageConf.dependencies[conf.name].replace('^', '')}/${conf.name}.min.js`
-                  }
-                  return conf
-                })
-              }
+              args[0].title = 'GIN-VUE-ADMIN'
               return args
             })