From 5c2bfaa603f5317788ca787ece1fd42872637e3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=92=8B=E5=90=89=E5=85=86?= <303176530@qq.com> Date: Thu, 2 Sep 2021 23:47:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B8=85=E9=99=A4cdn=E6=89=93=E5=8C=85=20?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=87=E6=8D=A2=E7=94=A8=E6=88=B7=E8=A7=92?= =?UTF-8?q?=E8=89=B2=E6=97=B6=E5=87=BA=E7=8E=B0=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/build.config.js | 17 ----------------- web/package-lock.json | 12 ++++++------ web/package.json | 2 +- web/src/api/github.js | 15 --------------- web/src/main.js | 8 ++++---- web/src/view/layout/index.vue | 4 +++- web/vue.config.js | 24 +----------------------- 7 files changed, 15 insertions(+), 67 deletions(-) delete mode 100644 web/build.config.js diff --git a/web/build.config.js b/web/build.config.js deleted file mode 100644 index 617cbf52..00000000 --- a/web/build.config.js +++ /dev/null @@ -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' } - ] -} diff --git a/web/package-lock.json b/web/package-lock.json index 4aec088b..36e6f4c1 100644 --- a/web/package-lock.json +++ b/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", diff --git a/web/package.json b/web/package.json index d32883ff..58bb3765 100644 --- a/web/package.json +++ b/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", diff --git a/web/src/api/github.js b/web/src/api/github.js index 597af0b4..4dc4eed5 100644 --- a/web/src/api/github.js +++ b/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, diff --git a/web/src/main.js b/web/src/main.js index 7ff432b9..5cd0c413 100644 --- a/web/src/main.js +++ b/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) diff --git a/web/src/view/layout/index.vue b/web/src/view/layout/index.vue index 26684c5f..fa3c75f9 100644 --- a/web/src/view/layout/index.vue +++ b/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() { diff --git a/web/vue.config.js b/web/vue.config.js index e841a5e1..c87cbfc7 100644 --- a/web/vue.config.js +++ b/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 })