'admin-22.07.11:同步master分支v2.2.0版本'

This commit is contained in:
lyt
2022-07-11 21:20:11 +08:00
parent 5316fcb159
commit 9bc002602b
24 changed files with 491 additions and 535 deletions

View File

@ -2,6 +2,12 @@
🎉🎉🔥 `vue-next-admin-template` 基于 vue-next-admin-v1.1.2 版本) vue3.x 、Typescript、vite、Element plus 等适配手机、平板、pc 的后台开源免费模板库vue2.x 请切换 vue-prev-admin 分支)
## 2.2.0
`2022.07.11`
- 🎉 同步 master 分支 v2.2.0 版本内容,具体查看 [master CHANGELOG.md](https://gitee.com/lyt-top/vue-next-admin/blob/master/CHANGELOG.md)
## 2.1.1
- 🎉 同步 master 分支 v2.1.1 版本内容,具体查看 [master CHANGELOG.md](https://gitee.com/lyt-top/vue-next-admin/blob/master/CHANGELOG.md)

View File

@ -88,6 +88,7 @@ cnpm run build
1 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">665452019</a>
2 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=zVfy3gNy7pNWVK3kMduDzwU369PZg2fw&jump_from=webapi">766356862</a>
3 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=02EWb5P2JkP-8iwzaDadgFdxA0HSHPpn&jump_from=webapi">795345435</a>
4 群:<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=0gTFO04WwkeZZ6R4lju6gucbeXHK-wNd&jump_from=webapi">736626228</a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=RdUY97Vx0T0vZ_1OOu-X1yFNkWgDwbjC&jump_from=webapi">
<img src="https://img-blog.csdnimg.cn/35e00f12a3fe4820892ec630ca72f15f.png" width="220" height="220" alt="vue-next-admin 讨论群1" title="vue-next-admin 讨论群1"/>
@ -98,6 +99,9 @@ cnpm run build
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=02EWb5P2JkP-8iwzaDadgFdxA0HSHPpn&jump_from=webapi">
<img src="https://img-blog.csdnimg.cn/70c8a012dd304246bddeac2184c4ab3a.png" width="220" height="220" alt="vue-next-admin 讨论群3" title="vue-next-admin 讨论群3"/>
</a>
<a target="_blank" href="https://qm.qq.com/cgi-bin/qm/qr?k=0gTFO04WwkeZZ6R4lju6gucbeXHK-wNd&jump_from=webapi">
<img src="https://img-blog.csdnimg.cn/e5c9704eed1342bc9d9e74b37203402d.png" width="220" height="220" alt="vue-next-admin 讨论群4" title="vue-next-admin 讨论群4"/>
</a>
#### 💒 集成后端
@ -109,6 +113,7 @@ cnpm run build
- <a target="_blank" href="https://gitee.com/zsvg/vboot-net">@zsvg vboot-net</a>
- <a target="_blank" href="https://gitee.com/zsvg/vboot-java">@zsvg vboot-java</a>
- <a target="_blank" href="https://gitee.com/wonderful-code/buildadmin">@青红造了个白 buildadmin</a>
- <a target="_blank" href="https://github.com/xiaodingding/iotfast">@Goodwell iotfast(一个开源的物联网平台)</a>
#### ❤️ 鸣谢列表

786
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
{
"name": "vue-next-admin-template",
"version": "2.1.1",
"version": "2.2.0",
"description": "vue3 vite next admin template",
"author": "lyt_20201208",
"license": "MIT",
@ -10,39 +10,39 @@
"lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/"
},
"dependencies": {
"@element-plus/icons-vue": "^2.0.3",
"@element-plus/icons-vue": "^2.0.6",
"axios": "^0.27.2",
"echarts": "^5.3.2",
"element-plus": "^2.2.2",
"echarts": "^5.3.3",
"element-plus": "^2.2.9",
"js-cookie": "^3.0.1",
"mitt": "^3.0.0",
"nprogress": "^0.2.0",
"pinia": "^2.0.14",
"qrcodejs2-fixes": "^0.0.2",
"screenfull": "^6.0.1",
"screenfull": "^6.0.2",
"sortablejs": "^1.15.0",
"vue": "^3.2.36",
"vue": "^3.2.37",
"vue-clipboard3": "^2.0.0",
"vue-router": "^4.0.15"
"vue-router": "^4.1.1"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/clipboard": "^2.0.1",
"@types/node": "^17.0.39",
"@types/node": "^18.0.3",
"@types/nprogress": "^0.2.0",
"@typescript-eslint/eslint-plugin": "^5.27.0",
"@typescript-eslint/parser": "^5.27.0",
"@typescript-eslint/eslint-plugin": "^5.30.5",
"@typescript-eslint/parser": "^5.30.5",
"@vitejs/plugin-vue": "^2.3.3",
"@vue/compiler-sfc": "^3.2.36",
"@vue/compiler-sfc": "^3.2.37",
"dotenv": "^16.0.1",
"eslint": "^8.17.0",
"eslint-plugin-vue": "^9.1.0",
"prettier": "^2.6.2",
"sass": "^1.52.2",
"sass-loader": "^13.0.0",
"typescript": "^4.7.3",
"vite": "^2.9.9",
"vue-eslint-parser": "^9.0.2"
"eslint": "^8.19.0",
"eslint-plugin-vue": "^9.2.0",
"prettier": "^2.7.1",
"sass": "^1.53.0",
"sass-loader": "^13.0.2",
"typescript": "^4.7.4",
"vite": "^2.9.14",
"vue-eslint-parser": "^9.0.3"
},
"browserslist": [
"> 1%",

View File

@ -28,7 +28,7 @@
<div v-show="isShowLoockLogin" class="layout-lock-screen-login">
<div class="layout-lock-screen-login-box">
<div class="layout-lock-screen-login-box-img">
<img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg" />
<img src="https://img2.baidu.com/it/u=1978192862,2048448374&fm=253&fmt=auto&app=138&f=JPEG?w=504&h=500" />
</div>
<div class="layout-lock-screen-login-box-name">Administrator</div>
<div class="layout-lock-screen-login-box-value">
@ -359,11 +359,11 @@ export default defineComponent({
}
}
}
::v-deep(.el-input-group__append) {
:deep(.el-input-group__append) {
background: var(--el-color-white);
padding: 0px 15px;
}
::v-deep(.el-input__inner) {
:deep(.el-input__inner) {
border-right-color: var(--el-border-color-extra-light);
&:hover {
border-color: var(--el-border-color-extra-light);

View File

@ -148,11 +148,11 @@ export default defineComponent({
font-size: 14px;
margin-right: 5px;
}
::v-deep(.el-breadcrumb__separator) {
:deep(.el-breadcrumb__separator) {
opacity: 0.7;
color: var(--next-bg-topBarColor);
}
::v-deep(.el-breadcrumb__inner a, .el-breadcrumb__inner.is-link) {
:deep(.el-breadcrumb__inner a, .el-breadcrumb__inner.is-link) {
font-weight: unset !important;
color: var(--next-bg-topBarColor);
&:hover {

View File

@ -42,7 +42,7 @@ export default defineComponent({
background: rgba(0, 0, 0, 0.1);
transition: all 0.3s ease;
position: relative;
::v-deep(i) {
:deep(i) {
position: absolute;
left: 10px;
top: 35px;
@ -52,7 +52,7 @@ export default defineComponent({
}
&:hover {
transition: all 0.3s ease;
::v-deep(i) {
:deep(i) {
color: var(--el-color-primary);
transition: all 0.3s ease;
}

View File

@ -120,12 +120,12 @@ export default defineComponent({
<style scoped lang="scss">
.layout-search-dialog {
::v-deep(.el-dialog) {
:deep(.el-dialog) {
box-shadow: unset !important;
border-radius: 0 !important;
background: rgba(0, 0, 0, 0.5);
}
::v-deep(.el-autocomplete) {
:deep(.el-autocomplete) {
width: 560px;
position: absolute;
top: 100px;

View File

@ -668,7 +668,7 @@ export default defineComponent({
.layout-breadcrumb-seting-bar {
height: calc(100vh - 50px);
padding: 0 15px;
::v-deep(.el-scrollbar__view) {
:deep(.el-scrollbar__view) {
overflow-x: hidden !important;
}
.layout-breadcrumb-seting-bar-flex {

View File

@ -140,7 +140,8 @@ export default defineComponent({
},
})
.then(async () => {
Session.clear(); // 清除缓存/token等
// 清除缓存/token等
Session.clear();
// 使用 reload 时,不需要调用 resetRoute() 重置路由
window.location.reload();
})
@ -230,16 +231,16 @@ export default defineComponent({
}
}
}
::v-deep(.el-dropdown) {
:deep(.el-dropdown) {
color: var(--next-bg-topBarColor);
}
::v-deep(.el-badge) {
:deep(.el-badge) {
height: 40px;
line-height: 40px;
display: flex;
align-items: center;
}
::v-deep(.el-badge__content.is-fixed) {
:deep(.el-badge__content.is-fixed) {
top: 12px;
}
}

View File

@ -108,7 +108,7 @@ export default defineComponent({
opacity: 1;
}
}
::v-deep(.el-empty__description p) {
:deep(.el-empty__description p) {
font-size: 13px;
}
}

View File

@ -607,7 +607,7 @@ export default defineComponent({
border-bottom: 1px solid var(--next-border-color-light);
position: relative;
z-index: 4;
::v-deep(.el-scrollbar__wrap) {
:deep(.el-scrollbar__wrap) {
overflow-x: auto !important;
}
&-ul {

View File

@ -141,10 +141,10 @@ export default defineComponent({
flex: 1;
overflow: hidden;
margin-right: 30px;
::v-deep(.el-scrollbar__bar.is-vertical) {
:deep(.el-scrollbar__bar.is-vertical) {
display: none;
}
::v-deep(a) {
:deep(a) {
width: 100%;
}
.el-menu.el-menu--horizontal {

View File

@ -40,7 +40,8 @@ export async function initBackEndControlRoutes() {
// 无 token 停止执行下一步
if (!Session.get('token')) return false;
// 触发初始化用户信息 pinia
useUserInfo().setUserInfos();
// https://gitee.com/lyt-top/vue-next-admin/issues/I5F1HP
await useUserInfo().setUserInfos();
// 获取路由菜单数据
const res = await getBackEndControlRoutes();
// 存储接口原始路由未处理component根据需求选择使用

View File

@ -23,8 +23,8 @@ export async function initFrontEndControlRoutes() {
if (window.nextLoading === undefined) NextLoading.start();
// 无 token 停止执行下一步
if (!Session.get('token')) return false;
// 触发初始化用户信息 pinia
useUserInfo(pinia).setUserInfos();
// https://gitee.com/lyt-top/vue-next-admin/issues/I5F1HP
await useUserInfo(pinia).setUserInfos();
// 添加动态路由
await setAddRoute();
// 设置递归过滤有权限的路由到 vuex routesList 中(已处理成多级嵌套路由)及缓存多级嵌套数组处理后的一维数组

View File

@ -24,7 +24,6 @@ import { initBackEndControlRoutes } from '/@/router/backEnd';
const storesThemeConfig = useThemeConfig(pinia);
const { themeConfig } = storeToRefs(storesThemeConfig);
const { isRequestRoutes } = themeConfig.value;
if (isRequestRoutes) staticRoutes.splice(0, 1);
/**
* 创建一个可以被 Vue 应用程序使用的路由实例
@ -85,9 +84,6 @@ export function formatTwoStageRoutes(arr: any) {
return newArr;
}
// isRequestRoutes 为 true则开启后端控制路由路径`/src/stores/themeConfig.ts`
if (!isRequestRoutes) initFrontEndControlRoutes();
// 路由加载前
router.beforeEach(async (to, from, next) => {
NProgress.configure({ showSpinner: false });
@ -114,6 +110,10 @@ router.beforeEach(async (to, from, next) => {
// 动态添加路由:防止非首页刷新时跳转回首页的问题
// 确保 addRoute() 时动态添加的路由已经被完全加载上去
next({ ...to, replace: true });
} else {
// https://gitee.com/lyt-top/vue-next-admin/issues/I5F1HP
await initFrontEndControlRoutes();
next({ ...to, replace: true });
}
} else {
next();

View File

@ -175,18 +175,6 @@ export const notFoundAndNoPower = [
* @returns 返回路由菜单数据
*/
export const staticRoutes: Array<RouteRecordRaw> = [
{
path: '/',
name: '/',
component: () => import('/@/layout/index.vue'),
meta: {
title: '布局界面',
},
children: [
// 请不要往这里 `children` 中添加内容,此内容为了防止 No match found for location with path "xxx" 问题
...notFoundAndNoPower,
],
},
{
path: '/login',
name: 'login',

View File

@ -19,46 +19,55 @@ export const useUserInfo = defineStore('userInfo', {
}),
actions: {
async setUserInfos() {
// 模拟数据,请求接口时,记得删除多余代码及对应依赖的引入
const userName = Cookies.get('userName');
// 模拟数据
let defaultRoles: Array<string> = [];
let defaultAuthBtnList: Array<string> = [];
// admin 页面权限标识,对应路由 meta.roles用于控制路由的显示/隐藏
let adminRoles: Array<string> = ['admin'];
// admin 按钮权限标识
let adminAuthBtnList: Array<string> = ['btn.add', 'btn.del', 'btn.edit', 'btn.link'];
// test 页面权限标识,对应路由 meta.roles用于控制路由的显示/隐藏
let testRoles: Array<string> = ['common'];
// test 按钮权限标识
let testAuthBtnList: Array<string> = ['btn.add', 'btn.link'];
// 不同用户模拟不同的用户权限
if (userName === 'admin') {
defaultRoles = adminRoles;
defaultAuthBtnList = adminAuthBtnList;
} else {
defaultRoles = testRoles;
defaultAuthBtnList = testAuthBtnList;
}
// 用户信息模拟数据
const userInfos = {
userName: userName,
photo:
userName === 'admin'
? 'https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1813762643,1914315241&fm=26&gp=0.jpg'
: 'https://ss1.bdstatic.com/70cFuXSh_Q1YnxGkpoWK1HF6hhy/it/u=317673774,2961727727&fm=26&gp=0.jpg',
time: new Date().getTime(),
roles: defaultRoles,
authBtnList: defaultAuthBtnList,
};
// 存储用户信息到浏览器缓存
Session.set('userInfo', userInfos);
if (Session.get('userInfo')) {
this.userInfos = Session.get('userInfo');
} else {
const userInfos: any = await this.getApiUserInfo();
this.userInfos = userInfos;
}
},
// 模拟接口数据
// https://gitee.com/lyt-top/vue-next-admin/issues/I5F1HP
async getApiUserInfo() {
return new Promise((resolve) => {
setTimeout(() => {
// 模拟数据,请求接口时,记得删除多余代码及对应依赖的引入
const userName = Cookies.get('userName');
// 模拟数据
let defaultRoles: Array<string> = [];
let defaultAuthBtnList: Array<string> = [];
// admin 页面权限标识,对应路由 meta.roles用于控制路由的显示/隐藏
let adminRoles: Array<string> = ['admin'];
// admin 按钮权限标识
let adminAuthBtnList: Array<string> = ['btn.add', 'btn.del', 'btn.edit', 'btn.link'];
// test 页面权限标识,对应路由 meta.roles用于控制路由的显示/隐藏
let testRoles: Array<string> = ['common'];
// test 按钮权限标识
let testAuthBtnList: Array<string> = ['btn.add', 'btn.link'];
// 不同用户模拟不同的用户权限
if (userName === 'admin') {
defaultRoles = adminRoles;
defaultAuthBtnList = adminAuthBtnList;
} else {
defaultRoles = testRoles;
defaultAuthBtnList = testAuthBtnList;
}
// 用户信息模拟数据
const userInfos = {
userName: userName,
photo:
userName === 'admin'
? 'https://img2.baidu.com/it/u=1978192862,2048448374&fm=253&fmt=auto&app=138&f=JPEG?w=504&h=500'
: 'https://img2.baidu.com/it/u=2370931438,70387529&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=500',
time: new Date().getTime(),
roles: defaultRoles,
authBtnList: defaultAuthBtnList,
};
// 存储用户信息到浏览器缓存
Session.set('userInfo', userInfos);
resolve(userInfos);
}, 3000);
});
},
},
});

View File

@ -27,14 +27,6 @@
max-height: 280px !important;
}
/* Form 表单
------------------------------- */
.el-form {
.el-form-item:last-of-type {
margin-bottom: 0 !important;
}
}
/* Alert 警告
------------------------------- */
.el-alert {

View File

@ -6,6 +6,8 @@
.el-form-item__label {
width: 100% !important;
text-align: left !important;
// 移动端 label 右对齐问题
justify-content: flex-start !important;
}
.el-form-item__content {
margin-left: 0 !important;

View File

@ -8,7 +8,7 @@ export function judementSameArr(newArr: unknown[] | string[], oldArr: string[]):
const news = removeDuplicate(newArr);
const olds = removeDuplicate(oldArr);
let count = 0;
const leng = olds.length;
const leng = news.length;
for (let i in olds) {
for (let j in news) {
if (olds[i] === news[j]) count++;

View File

@ -22,7 +22,6 @@
<script lang="ts">
import { defineComponent, computed } from 'vue';
import { useRouter } from 'vue-router';
import { storeToRefs } from 'pinia';
import { useThemeConfig } from '/@/stores/themeConfig';
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
@ -35,10 +34,12 @@ export default defineComponent({
const storesTagsViewRoutes = useTagsViewRoutes();
const { themeConfig } = storeToRefs(storesThemeConfig);
const { isTagsViewCurrenFull } = storeToRefs(storesTagsViewRoutes);
const router = useRouter();
const onSetAuth = () => {
// https://gitee.com/lyt-top/vue-next-admin/issues/I5C3JS
// 清除缓存/token等
Session.clear();
router.push('/login');
// 使用 reload 时,不需要调用 resetRoute() 重置路由
window.location.reload();
};
// 设置主内容的高度
const initTagViewHeight = computed(() => {

View File

@ -47,7 +47,7 @@ export default defineComponent({
text-align: center;
@extend .login-scan-animation;
animation-delay: 0.1s;
::v-deep(img) {
:deep(img) {
margin: auto;
}
.login-msg {

View File

@ -46,33 +46,8 @@ const viteConfig = defineConfig((mode: ConfigEnv) => {
},
},
},
terserOptions: {
compress: {
drop_console: true,
drop_debugger: true,
},
ie8: true,
output: {
comments: true,
},
},
},
css: {
postcss: {
plugins: [
{
postcssPlugin: 'internal:charset-removal',
AtRule: {
charset: (atRule) => {
if (atRule.name === 'charset') {
atRule.remove();
}
},
},
},
],
},
},
css: { preprocessorOptions: { css: { charset: false } } },
};
});