diff --git a/.env.development b/.env.development deleted file mode 100644 index de583d0..0000000 --- a/.env.development +++ /dev/null @@ -1,5 +0,0 @@ -# just a flag -ENV = 'development' - -# base api -VUE_APP_BASE_API = '/dev-api' diff --git a/.env.production b/.env.production deleted file mode 100644 index 80c8103..0000000 --- a/.env.production +++ /dev/null @@ -1,6 +0,0 @@ -# just a flag -ENV = 'production' - -# base api -VUE_APP_BASE_API = '/prod-api' - diff --git a/.env.staging b/.env.staging deleted file mode 100644 index a8793a0..0000000 --- a/.env.staging +++ /dev/null @@ -1,8 +0,0 @@ -NODE_ENV = production - -# just a flag -ENV = 'staging' - -# base api -VUE_APP_BASE_API = '/stage-api' - diff --git a/build/index.js b/build/index.js deleted file mode 100644 index 0c57de2..0000000 --- a/build/index.js +++ /dev/null @@ -1,35 +0,0 @@ -const { run } = require('runjs') -const chalk = require('chalk') -const config = require('../vue.config.js') -const rawArgv = process.argv.slice(2) -const args = rawArgv.join(' ') - -if (process.env.npm_config_preview || rawArgv.includes('--preview')) { - const report = rawArgv.includes('--report') - - run(`vue-cli-service build ${args}`) - - const port = 9526 - const publicPath = config.publicPath - - var connect = require('connect') - var serveStatic = require('serve-static') - const app = connect() - - app.use( - publicPath, - serveStatic('./dist', { - index: ['index.html', '/'] - }) - ) - - app.listen(port, function () { - console.log(chalk.green(`> Preview at http://localhost:${port}${publicPath}`)) - if (report) { - console.log(chalk.green(`> Report at http://localhost:${port}${publicPath}report.html`)) - } - - }) -} else { - run(`vue-cli-service build ${args}`) -} diff --git a/favicon.ico b/favicon.ico new file mode 100644 index 0000000..34b63ac Binary files /dev/null and b/favicon.ico differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..053ad2e --- /dev/null +++ b/index.html @@ -0,0 +1,17 @@ + + + + + + + + + + + +
+ + + diff --git a/mock/index.js b/mock/index.js index c514c13..b959299 100644 --- a/mock/index.js +++ b/mock/index.js @@ -1,8 +1,8 @@ -const Mock = require('mockjs') -const { param2Obj } = require('./utils') +import Mock from 'mockjs' +import utils from './utils' -const user = require('./user') -const table = require('./table') +import user from './user' +import table from './table' const mocks = [ ...user, @@ -36,7 +36,7 @@ function mockXHR() { result = respond({ method: type, body: JSON.parse(body), - query: param2Obj(url) + query: utils.param2Obj(url) }) } else { result = respond @@ -50,7 +50,7 @@ function mockXHR() { } } -module.exports = { +export default { mocks, mockXHR } diff --git a/mock/mock-server.js b/mock/mock-server.js index 8941ec0..f7411a4 100644 --- a/mock/mock-server.js +++ b/mock/mock-server.js @@ -34,7 +34,7 @@ function unregisterRoutes() { // for mock server const responseFake = (url, type, respond) => { return { - url: new RegExp(`${process.env.VUE_APP_BASE_API}${url}`), + url: new RegExp(`${import.meta.env.VUE_APP_BASE_API}${url}`), type: type || 'get', response(req, res) { console.log('request invoke:' + req.path) diff --git a/mock/table.js b/mock/table.js index bd0e013..ba95f76 100644 --- a/mock/table.js +++ b/mock/table.js @@ -1,4 +1,4 @@ -const Mock = require('mockjs') +import Mock from 'mockjs' const data = Mock.mock({ 'items|30': [{ @@ -11,7 +11,7 @@ const data = Mock.mock({ }] }) -module.exports = [ +export default [ { url: '/vue-admin-template/table/list', type: 'get', diff --git a/mock/user.js b/mock/user.js index 7555338..f007cd9 100644 --- a/mock/user.js +++ b/mock/user.js @@ -23,7 +23,7 @@ const users = { } } -module.exports = [ +export default [ // user login { url: '/vue-admin-template/user/login', diff --git a/mock/utils.js b/mock/utils.js index 95cc27d..3f958d8 100644 --- a/mock/utils.js +++ b/mock/utils.js @@ -20,6 +20,6 @@ function param2Obj(url) { return obj } -module.exports = { +export default { param2Obj } diff --git a/package.json b/package.json index 2413824..1fd5bb0 100644 --- a/package.json +++ b/package.json @@ -1,20 +1,18 @@ { "name": "vue-admin-template", "version": "4.4.0", - "description": "A vue admin template with Element UI & axios & iconfont & permission control & lint", - "author": "Pan ", + "description": "A vue admin template with Element UI & axios & vite & permission control & lint", + "author": "Xydawn ", "scripts": { - "dev": "vue-cli-service serve", - "build:prod": "vue-cli-service build", - "build:stage": "vue-cli-service build --mode staging", - "preview": "node build/index.js --preview", - "svgo": "svgo -f src/icons/svg --config=src/icons/svgo.yml", + "dev": "vite", + "build": "vite build", + "preview": "vite preview", "lint": "eslint --ext .js,.vue src", "test:unit": "jest --clearCache && vue-cli-service test:unit", "test:ci": "npm run lint && npm run test:unit" }, "dependencies": { - "axios": "0.18.1", + "axios": "^0.18.1", "core-js": "3.6.5", "element-ui": "2.13.2", "js-cookie": "2.2.0", @@ -26,11 +24,7 @@ "vuex": "3.1.0" }, "devDependencies": { - "@vue/cli-plugin-babel": "4.4.4", - "@vue/cli-plugin-eslint": "4.4.4", - "@vue/cli-plugin-unit-jest": "4.4.4", - "@vue/cli-service": "4.4.4", - "@vue/test-utils": "1.0.0-beta.29", + "@vue/compiler-sfc": "^3.2.26", "autoprefixer": "9.5.1", "babel-eslint": "10.1.0", "babel-jest": "23.6.0", @@ -46,8 +40,8 @@ "sass-loader": "8.0.2", "script-ext-html-webpack-plugin": "2.1.3", "serve-static": "1.13.2", - "svg-sprite-loader": "4.1.3", - "svgo": "1.2.2", + "vite": "^2.7.10", + "vite-plugin-vue2": "^1.9.2", "vue-template-compiler": "2.6.10" }, "browserslist": [ @@ -59,4 +53,4 @@ "npm": ">= 3.0.0" }, "license": "MIT" -} +} \ No newline at end of file diff --git a/public/index.html b/public/index.html index fa2be91..d3e56e6 100644 --- a/public/index.html +++ b/public/index.html @@ -4,7 +4,7 @@ - + <%= webpackConfig.name %> diff --git a/src/components/SvgIcon/index.vue b/src/components/SvgIcon/index.vue deleted file mode 100644 index b07ded2..0000000 --- a/src/components/SvgIcon/index.vue +++ /dev/null @@ -1,62 +0,0 @@ - - - - - diff --git a/src/icons/index.js b/src/icons/index.js index 2c6b309..be14ca3 100644 --- a/src/icons/index.js +++ b/src/icons/index.js @@ -1,9 +1,20 @@ -import Vue from 'vue' -import SvgIcon from '@/components/SvgIcon'// svg component +// import Vue from 'vue' +// import SvgIcon from '@/components/SvgIcon'// svg component -// register globally -Vue.component('svg-icon', SvgIcon) +// // register globally +// Vue.component('svg-icon', SvgIcon) -const req = require.context('./svg', false, /\.svg$/) -const requireAll = requireContext => requireContext.keys().map(requireContext) -requireAll(req) +// // const req = require.context('./svg', false, /\.svg$/) +// const modules = import.meta.globEager('./svg/*.svg') +// const requireAll = requireContext => { +// debugger +// Object.keys(requireContext).map(requireContext) +// } +// requireAll(modules) + +// for (const path in modules) { +// debugger +// modules[path]().then((mod) => { +// console.log(path, mod) +// }) +// } diff --git a/src/icons/svg/dashboard.svg b/src/icons/svg/dashboard.svg deleted file mode 100644 index 5317d37..0000000 --- a/src/icons/svg/dashboard.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/example.svg b/src/icons/svg/example.svg deleted file mode 100644 index 46f42b5..0000000 --- a/src/icons/svg/example.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/eye-open.svg b/src/icons/svg/eye-open.svg deleted file mode 100644 index 88dcc98..0000000 --- a/src/icons/svg/eye-open.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/eye.svg b/src/icons/svg/eye.svg deleted file mode 100644 index 16ed2d8..0000000 --- a/src/icons/svg/eye.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/form.svg b/src/icons/svg/form.svg deleted file mode 100644 index dcbaa18..0000000 --- a/src/icons/svg/form.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/link.svg b/src/icons/svg/link.svg deleted file mode 100644 index 48197ba..0000000 --- a/src/icons/svg/link.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/nested.svg b/src/icons/svg/nested.svg deleted file mode 100644 index 06713a8..0000000 --- a/src/icons/svg/nested.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/password.svg b/src/icons/svg/password.svg deleted file mode 100644 index e291d85..0000000 --- a/src/icons/svg/password.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/table.svg b/src/icons/svg/table.svg deleted file mode 100644 index 0e3dc9d..0000000 --- a/src/icons/svg/table.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/tree.svg b/src/icons/svg/tree.svg deleted file mode 100644 index dd4b7dd..0000000 --- a/src/icons/svg/tree.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/icons/svg/user.svg b/src/icons/svg/user.svg deleted file mode 100644 index 0ba0716..0000000 --- a/src/icons/svg/user.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/src/layout/components/Navbar.vue b/src/layout/components/Navbar.vue index 0ca5cf6..a95a5a2 100644 --- a/src/layout/components/Navbar.vue +++ b/src/layout/components/Navbar.vue @@ -7,7 +7,8 @@
- + +
@@ -118,12 +119,12 @@ export default { margin-top: 5px; position: relative; - .user-avatar { - cursor: pointer; - width: 40px; - height: 40px; - border-radius: 10px; - } + // .user-avatar { + // cursor: pointer; + // width: 40px; + // height: 40px; + // border-radius: 10px; + // } .el-icon-caret-bottom { cursor: pointer; diff --git a/src/layout/components/Sidebar/Item.vue b/src/layout/components/Sidebar/Item.vue index aa1f5da..bd20e59 100644 --- a/src/layout/components/Sidebar/Item.vue +++ b/src/layout/components/Sidebar/Item.vue @@ -1,7 +1,17 @@ + diff --git a/src/layout/components/Sidebar/SidebarItem.vue b/src/layout/components/Sidebar/SidebarItem.vue index a418c3d..f3adf9b 100644 --- a/src/layout/components/Sidebar/SidebarItem.vue +++ b/src/layout/components/Sidebar/SidebarItem.vue @@ -25,7 +25,7 @@