diff --git a/.browserslistrc b/.browserslistrc
deleted file mode 100644
index 214388f..0000000
--- a/.browserslistrc
+++ /dev/null
@@ -1,3 +0,0 @@
-> 1%
-last 2 versions
-not dead
diff --git a/.editorconfig b/.editorconfig
deleted file mode 100644
index 7053c49..0000000
--- a/.editorconfig
+++ /dev/null
@@ -1,5 +0,0 @@
-[*.{js,jsx,ts,tsx,vue}]
-indent_style = space
-indent_size = 2
-trim_trailing_whitespace = true
-insert_final_newline = true
diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 905c914..0000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,18 +0,0 @@
-module.exports = {
- root: true,
- env: {
- node: true
- },
- extends: [
- 'plugin:vue/vue3-essential',
- '@vue/standard',
- '@vue/typescript/recommended'
- ],
- parserOptions: {
- ecmaVersion: 2020
- },
- rules: {
- 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
- 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
- }
-}
diff --git a/.gitignore b/.gitignore
index 403adbc..a547bf3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,21 +1,22 @@
-.DS_Store
-node_modules
-/dist
-
-
-# local env files
-.env.local
-.env.*.local
-
-# Log files
+# Logs
+logs
+*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
+lerna-debug.log*
+
+node_modules
+dist
+dist-ssr
+*.local
# Editor directories and files
+.vscode/*
+!.vscode/extensions.json
.idea
-.vscode
+.DS_Store
*.suo
*.ntvs*
*.njsproj
diff --git a/README.md b/README.md
index 4195884..52dc53f 100644
--- a/README.md
+++ b/README.md
@@ -43,7 +43,16 @@ vue3.0 + Typescript + vuex + vue-router + Element-Plus scss
- 其他各组件
-## 项目 master 分支 基于vue3.0 + Typescript + vuex + vue-router + Element-Plus scss
+## 分支管理
+- master 技术采用 vite + vue3.0 + Typescript + vuex + vue-router + Element-Plus scss
+ ```
+ 注意:使用 Vite 构建工具,需要 Node.js 版本 >= 12.0.0 查看 Node.js 版本 node-v
+ ```
+- webpack 技术采用 webpack + vue3.0 + Typescript + vuex + vue-router + Element-Plus scss
+- uniapp 技术采用 uniapp +vuex +element scss
+
+
+## 项目 master 分支 基于vite + vue3.0 + Typescript + vuex + vue-router + Element-Plus scss
```
# 克隆项目
git clone https://github.com/zouzhibin/vue-admin-perfect.git
diff --git a/babel.config.js b/babel.config.js
deleted file mode 100644
index e955840..0000000
--- a/babel.config.js
+++ /dev/null
@@ -1,5 +0,0 @@
-module.exports = {
- presets: [
- '@vue/cli-plugin-babel/preset'
- ]
-}
diff --git a/deploy.sh b/deploy.sh
deleted file mode 100644
index f31ae91..0000000
--- a/deploy.sh
+++ /dev/null
@@ -1,18 +0,0 @@
-#强制推送
-#!/usr/bin/env bash
-set -e
-npm run build
-cd dist
-touch .nojekyll
-git init
-git add -A
-git commit -m 'deploy'
-git push -f "https://${access_token}@gitee.com/yuanzbz/vue-admin-perfect.git" master:gh-pages
-git push -f "https://${access_token}@github.com/zouzhibin/vue-admin-perfect.git" master:gh-pages
-
-cd -
-exec /bin/bash
-
-
-
-
diff --git a/package.json b/package.json
index da47ea6..fe32cfc 100644
--- a/package.json
+++ b/package.json
@@ -1,17 +1,18 @@
{
- "name": "vue-admin-perfect",
- "version": "0.1.0",
+ "name": "my-vue-app",
"private": true,
+ "version": "0.0.0",
+ "type": "module",
"scripts": {
- "dev": "npm run serve",
- "serve": "vue-cli-service serve",
- "build": "vue-cli-service build",
- "lint": "vue-cli-service lint"
+ "dev": "vite",
+ "build": "vite build",
+ "preview": "vite preview"
},
"dependencies": {
"@better-scroll/core": "^2.4.2",
"clipboard": "^2.0.10",
"core-js": "^3.6.5",
+ "dayjs": "^1.11.4",
"echarts": "^5.3.1",
"echarts-liquidfill": "^3.1.0",
"element-plus": "^2.1.4",
@@ -21,8 +22,10 @@
"mavon-editor": "^2.10.4",
"md-editor-v3": "^1.11.3",
"nprogress": "^0.2.0",
+ "path-browserify": "^1.0.1",
"path-to-regexp": "^6.2.0",
"print-js": "^1.6.0",
+ "sass": "^1.54.0",
"splitpanes": "^3.1.1",
"svg-sprite-loader": "^6.0.11",
"vue": "^3.0.0",
@@ -38,32 +41,15 @@
"xlsx": "^0.18.5"
},
"devDependencies": {
- "@typescript-eslint/eslint-plugin": "^4.18.0",
- "@typescript-eslint/parser": "^4.18.0",
- "@vue/cli-plugin-babel": "~4.5.8",
- "@vue/cli-plugin-eslint": "~4.5.8",
- "@vue/cli-plugin-router": "~4.5.8",
- "@vue/cli-plugin-typescript": "~4.5.8",
- "@vue/cli-plugin-vuex": "~4.5.8",
- "@vue/cli-service": "~4.5.8",
- "@vue/compiler-sfc": "^3.0.0",
- "@vue/eslint-config-standard": "^5.1.2",
- "@vue/eslint-config-typescript": "^7.0.0",
- "eslint": "^6.7.2",
- "eslint-plugin-import": "^2.20.2",
- "eslint-plugin-node": "^11.1.0",
- "eslint-plugin-promise": "^4.2.1",
- "eslint-plugin-standard": "^4.0.0",
- "eslint-plugin-vue": "^7.0.0",
- "lint-staged": "^9.5.0",
- "sass": "^1.26.5",
- "sass-loader": "^8.0.2",
- "typescript": "~4.1.5"
- },
- "lint-staged": {
- "*.{js,jsx,vue,ts,tsx}": [
- "vue-cli-service lint",
- "git add"
- ]
+ "@vitejs/plugin-vue": "^3.0.0",
+ "dart-sass": "^1.25.0",
+ "fast-glob": "^3.2.11",
+ "typescript": "^4.6.4",
+ "unplugin-auto-import": "^0.10.3",
+ "unplugin-vue-components": "^0.21.2",
+ "vite": "^3.0.0",
+ "vite-plugin-compression": "^0.5.1",
+ "vite-plugin-svg-icons": "^2.0.1",
+ "vue-tsc": "^0.38.4"
}
}
diff --git a/push.sh b/push.sh
deleted file mode 100644
index 884fc8a..0000000
--- a/push.sh
+++ /dev/null
@@ -1,13 +0,0 @@
-#强制推送
-#!/usr/bin/env bash
-set -e
-git init
-git add -A
-git commit -m '🎉 feat: init project'
-git push -f "https://${access_token}@gitee.com/yuanzbz/vue-admin-perfect.git" master
-git push -f "https://${access_token}@github.com/zouzhibin/vue-admin-perfect.git" master
-exec /bin/bash
-
-
-
-
diff --git a/src/App.vue b/src/App.vue
index 4180448..9cc4c1b 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -1,7 +1,5 @@
-
-
-
+
diff --git a/src/abandon/exprotExcel.ts b/src/abandon/exprotExcel.ts
deleted file mode 100644
index 9a1b974..0000000
--- a/src/abandon/exprotExcel.ts
+++ /dev/null
@@ -1,200 +0,0 @@
-const ExcelJS = require("exceljs");
-
-const autoWidthAction = (val,width=10)=>{
- if (val == null) {
- width = 10;
- } else if (val.toString().charCodeAt(0) > 255) {
- /*if chinese*/
- width = val.toString().length * 2;
- } else {
- width = val.toString().length;
- }
- return width
-}
-export const exportExcel = ({column,data,filename,autoWidth})=>{
- // 创建excel
- const workbook = new ExcelJS.Workbook();
- // 设置信息
- workbook.creator = "Me";
- workbook.title = filename;
- workbook.created = new Date();
- workbook.modified = new Date();
- // 创建工作表
- const worksheet = workbook.addWorksheet(filename);
- // 设置列名
- let columnsName = [];
- column.forEach((item,index)=>{
- let obj = {
- header: item.label, key:item.name, width: null
- }
- if(autoWidth){
- let maxArr = [autoWidthAction(item.label)]
- data.forEach(ite=>{
- let str = ite[item.name] ||''
- if(str){
- maxArr.push(autoWidthAction(str))
- }
- })
- obj.width = Math.max(...maxArr)+5
- }
- // 设置列名、键和宽度
- columnsName.push(obj);
- })
- worksheet.columns = columnsName;
- // 添加行
- worksheet.addRows(data);
- // 写入文件
- workbook.xlsx.writeBuffer().then((data) => {
- const blob = new Blob([data, { type: "application/vnd.ms-excel" }]);
- if (window.navigator.msSaveOrOpenBlob) {
- // msSaveOrOpenBlob方法返回boolean值
- navigator.msSaveBlob(blob, filename + ".xlsx");
- // 本地保存
- } else {
- const link = document.createElement("a"); // a标签下载
- link.href = window.URL.createObjectURL(blob); // href属性指定下载链接
- link.download = filename + ".xlsx"; // dowload属性指定文件名
- link.click(); // click()事件触发下载
- window.URL.revokeObjectURL(link.href); // 释放内存
- }
- });
-}
-// 默认的列宽
-export const DEFAULT_COLUMN_WIDTH = 20;
-
-function getColumnNumber(width: number) {
- // 需要的列数,四舍五入
- return Math.round(width / DEFAULT_COLUMN_WIDTH);
-}
-
-
-function addData(worksheet,headerKeys,headers,data){
-
-}
-
-export const exportMultiHeaderExcel = ({column,data,filename,autoWidth})=>{
- // 创建excel
- const workbook = new ExcelJS.Workbook();
- // 创建工作表
- const worksheet = workbook.addWorksheet(filename);
-
- // 第一行表头
- const names1= [];
- // 第二行表头
- const names2= [];
-
- // 用于匹配数据的 keys
- const headerKeys= [];
-
- let headers = [];
- column.forEach((item,index)=>{
- let obj = {
- header: item.label, key:item.name, width: null
- }
- let maxArr = [autoWidthAction(item.label)]
- data.forEach(ite=>{
- let str = ite[item.name] ||''
- if(str){
- maxArr.push(autoWidthAction(str))
- }
- })
- obj.width = Math.max(...maxArr)+5
- // 设置列名、键和宽度
- headers.push(obj);
- })
-
- column.forEach(item => {
- if (item.children) {
- // 有 children 说明是多级表头,header name 需要两行
- item.children.forEach(child => {
- names1.push(item.label);
- names2.push(child.label);
- headerKeys.push(child.name);
- });
- } else {
- names1.push(item.label);
- names2.push(item.label);
- headerKeys.push(item.name);
- }
- });
-
-
-
- // 判断是否有 children, 有的话是两行表头
- const isMultiHeader = column.some(item => item.children);
- if(isMultiHeader){
- const rowHeader1 = worksheet.addRow(names1);
- const rowHeader2 = worksheet.addRow(names2);
-
- console.log('rowHeader1====',names1,names2,rowHeader1,rowHeader2)
- mergeColumnCell(headers, rowHeader1, rowHeader2, names1, names2, worksheet)
- // return
-
- }
-
- data.forEach((item: any) => {
- const rowData = headerKeys?.map(key => item[key]);
- const row = worksheet.addRow(rowData);
- // console.log('row--------',row)
- })
- // 写入文件
- workbook.xlsx.writeBuffer().then((data) => {
- const blob = new Blob([data, { type: "application/vnd.ms-excel" }]);
- if (window.navigator.msSaveOrOpenBlob) {
- // msSaveOrOpenBlob方法返回boolean值
- navigator.msSaveBlob(blob, filename + ".xlsx");
- // 本地保存
- } else {
- const link = document.createElement("a"); // a标签下载
- link.href = window.URL.createObjectURL(blob); // href属性指定下载链接
- link.download = filename + ".xlsx"; // dowload属性指定文件名
- link.click(); // click()事件触发下载
- window.URL.revokeObjectURL(link.href); // 释放内存
- }
- });
-}
-
-
-function mergeColumnCell(headers, rowHeader1, rowHeader2, nameRow1, nameRow2, worksheet){
- // 当前 index 的指针
- let pointer = -1;
- nameRow1.forEach((name, index) => {
- // 当 index 小于指针时,说明这一列已经被合并过了,不能再合并
- if (index <= pointer) return;
- // 是否应该列合并
- const shouldVerticalMerge = name === nameRow2[index];
-
-
- // 是否应该行合并
- const shouldHorizontalMerge = index !== nameRow1.lastIndexOf(name);
-
- console.log('==',name,nameRow2[index],index,nameRow1.lastIndexOf(name),shouldVerticalMerge,shouldHorizontalMerge)
-
- pointer = nameRow1.lastIndexOf(name);
- if (shouldVerticalMerge && shouldHorizontalMerge) {
- // 两个方向都合并
- worksheet.mergeCells(
- Number(rowHeader1.number),
- index + 1,
- Number(rowHeader2.number),
- nameRow1.lastIndexOf(name) + 1,
- );
- console.log('==')
- } else if (shouldVerticalMerge && !shouldHorizontalMerge) {
- // 只在垂直方向上同一列的两行合并
- worksheet.mergeCells(Number(rowHeader1.number), index + 1, Number(rowHeader2.number), index + 1);
- } else if (!shouldVerticalMerge && shouldHorizontalMerge) {
- // 只有水平方向同一行的多列合并
- worksheet.mergeCells(
- Number(rowHeader1.number),
- index + 1,
- Number(rowHeader1.number),
- nameRow1.lastIndexOf(name) + 1,
- );
- // eslint-disable-next-line no-param-reassign
- const cell = rowHeader1.getCell(index + 1);
- cell.alignment = { vertical: 'middle', horizontal: 'center', wrapText: true };
- }
- });
-
-}
diff --git a/src/components/Charts/Keyboard.vue b/src/components/Charts/Keyboard.vue
index 0b258f3..41a1ea3 100644
--- a/src/components/Charts/Keyboard.vue
+++ b/src/components/Charts/Keyboard.vue
@@ -2,7 +2,7 @@
-
diff --git a/src/layout/components/Sidebar/index.vue b/src/layout/components/Sidebar/index.vue
index 0369603..cfa481a 100644
--- a/src/layout/components/Sidebar/index.vue
+++ b/src/layout/components/Sidebar/index.vue
@@ -9,33 +9,12 @@
\ No newline at end of file
+
diff --git a/src/layout/components/TagsView/index.vue b/src/layout/components/TagsView/index.vue
index 0a47da2..71afbaf 100644
--- a/src/layout/components/TagsView/index.vue
+++ b/src/layout/components/TagsView/index.vue
@@ -42,7 +42,7 @@
import { useStore } from 'vuex'
import {useRoute,useRouter} from 'vue-router'
- const path = require('path')
+ import path from 'path-browserify'
const store = useStore()
const route = useRoute()
const router = useRouter()
diff --git a/src/main.ts b/src/main.ts
index 1a35474..15dde55 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -2,9 +2,10 @@ import { createApp } from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
-
+//
import './permission'
-import SvgIcon from './icons/index'
+import 'virtual:svg-icons-register'
+import SvgIcon from '@/components/SvgIcon/index.vue'// svg component
import ElementPlus from 'element-plus'
import UContainerLayout from '@/components/u-container-layout/index.vue'
import 'element-plus/dist/index.css'
@@ -22,7 +23,9 @@ Object.keys(ElIconsModules).forEach((key) => {//循环遍历组件名称
}
});
-import '@/styles/index.scss' // global css
-app.use(store).use(router).use(ElementPlus,{
+app.use(store)
+app.use(router)
+
+app.use(ElementPlus,{
locale: zhCn,
}).mount('#app')
diff --git a/src/permission.ts b/src/permission.ts
index 10b15d1..5c9d706 100644
--- a/src/permission.ts
+++ b/src/permission.ts
@@ -13,15 +13,12 @@ let hasRoles = true
router.beforeEach(async(to, from, next) => {
// 开启进度条
NProgress.start()
-
// 设置标题
if(typeof(to.meta.title) === 'string'){
document.title = to.meta.title ||'vue-admin-perfect'
}
-
// 确定用户是否已登录
const hasToken = getToken()
-
if (hasToken) {
if (to.path === '/login') {
// 如果已登录,请重定向到主页
diff --git a/src/router/index.ts b/src/router/index.ts
index a5e888e..0dc7918 100644
--- a/src/router/index.ts
+++ b/src/router/index.ts
@@ -71,7 +71,7 @@ const clipboardTable = {
]
}
-
+// //
const zipRoutes = {
path: '/zip',
component: Layout,
@@ -94,8 +94,8 @@ const zipRoutes = {
]
}
-
-// 异步组件
+//
+// // 异步组件
export const asyncRoutes = [
tableRouter,
chartsRouter,
diff --git a/src/shims-vue.d.ts b/src/shims-vue.d.ts
deleted file mode 100644
index 3804a43..0000000
--- a/src/shims-vue.d.ts
+++ /dev/null
@@ -1,6 +0,0 @@
-/* eslint-disable */
-declare module '*.vue' {
- import type { DefineComponent } from 'vue'
- const component: DefineComponent<{}, {}, any>
- export default component
-}
diff --git a/src/store/modules/permission.ts b/src/store/modules/permission.ts
index 3ab1062..25fe745 100644
--- a/src/store/modules/permission.ts
+++ b/src/store/modules/permission.ts
@@ -47,6 +47,7 @@ const mutations = {
SET_ROUTES: (state, routes) => {
state.addRoutes = routes
state.routes = constantRoutes.concat(routes)
+ // state.routes = routes
},
CLEAR_ROUTERS:(state, routes) => {
state.addRoutes = []
diff --git a/src/views/charts/complex.vue b/src/views/charts/complex.vue
index 12894a0..95e38eb 100644
--- a/src/views/charts/complex.vue
+++ b/src/views/charts/complex.vue
@@ -12,8 +12,8 @@