'admin-22.07.16:同步vue-next-admin-template分支v2.2.0版本(22.07.16)'

This commit is contained in:
lyt 2022-07-16 21:48:36 +08:00
parent 5a5f7c324d
commit 0055b8f407
25 changed files with 617 additions and 620 deletions

View File

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

View File

@ -20,7 +20,7 @@
<p>&nbsp;</p>
</div>
#### 🌈 介绍 基础版 js不带国际化基于 vue-next-admin-template V2.1.1 版)
#### 🌈 介绍 基础版 js不带国际化基于 vue-next-admin-template V2.2.0 版)
基于 vue3.x + CompositionAPI + vite + element plus + vue-router-next适配手机、平板、pc 的后台开源免费模板,希望减少工作量,帮助大家实现快速开发。
@ -79,6 +79,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"/>
@ -89,6 +90,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>
#### 💒 集成后端
@ -100,6 +104,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>
#### ❤️ 鸣谢列表

982
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-js",
"version": "2.1.1",
"version": "2.2.0",
"description": "vue3 vite next admin template js setup",
"author": "lyt_20201208",
"license": "MIT",
@ -10,34 +10,34 @@
"lint-fix": "eslint --fix --ext .js --ext .jsx --ext .vue src/"
},
"dependencies": {
"@element-plus/icons-vue": "^2.0.4",
"@element-plus/icons-vue": "^2.0.6",
"axios": "^0.27.2",
"echarts": "^5.3.2",
"element-plus": "^2.2.5",
"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",
"pinia": "^2.0.16",
"qrcodejs2-fixes": "^0.0.2",
"screenfull": "^6.0.1",
"screenfull": "^6.0.2",
"sortablejs": "^1.15.0",
"vue": "^3.2.37",
"vue-clipboard3": "^2.0.0",
"vue-router": "^4.0.16"
"vue-router": "^4.1.2"
},
"devDependencies": {
"@vitejs/plugin-vue": "^2.3.3",
"@vitejs/plugin-vue": "^3.0.0",
"@vue/compiler-sfc": "^3.2.37",
"dotenv": "^16.0.1",
"eslint": "^8.17.0",
"eslint-plugin-vue": "^9.1.1",
"prettier": "^2.6.2",
"sass": "^1.52.3",
"sass-loader": "^13.0.0",
"unplugin-auto-import": "^0.8.7",
"vite": "^2.9.12",
"eslint": "^8.19.0",
"eslint-plugin-vue": "^9.2.0",
"prettier": "^2.7.1",
"sass": "^1.53.0",
"sass-loader": "^13.0.2",
"unplugin-auto-import": "^0.9.3",
"vite": "^3.0.0",
"vite-plugin-vue-setup-extend": "^0.4.0",
"vue-eslint-parser": "^9.0.2"
"vue-eslint-parser": "^9.0.3"
},
"browserslist": [
"> 1%",

View File

@ -28,7 +28,7 @@
<div v-show="state.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">
@ -326,11 +326,11 @@ onUnmounted(() => {
}
}
}
::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

@ -129,11 +129,11 @@ onBeforeRouteUpdate((to) => {
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

@ -34,7 +34,7 @@ const onCloseFullscreen = () => {
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;
@ -43,7 +43,7 @@ const onCloseFullscreen = () => {
}
&:hover {
transition: all 0.3s ease;
::v-deep(i) {
:deep(i) {
color: var(--el-color-primary);
transition: all 0.3s ease;
}

View File

@ -96,12 +96,12 @@ defineExpose({
<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

@ -640,7 +640,7 @@ defineExpose({
.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

@ -138,7 +138,8 @@ const onHandleCommandClick = (path) => {
},
})
.then(async () => {
Session.clear(); // /token
// /token
Session.clear();
// 使 reload resetRoute()
window.location.reload();
})
@ -216,16 +217,16 @@ onMounted(() => {
}
}
}
::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

@ -96,7 +96,7 @@ const onGoToGiteeClick = () => {
opacity: 1;
}
}
::v-deep(.el-empty__description p) {
:deep(.el-empty__description p) {
font-size: 13px;
}
}

View File

@ -538,7 +538,7 @@ watch(
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

@ -129,10 +129,10 @@ onBeforeRouteUpdate((to) => {
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

@ -39,7 +39,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,7 +23,8 @@ export async function initFrontEndControlRoutes() {
// 无 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) {
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

@ -172,18 +172,6 @@ export const notFoundAndNoPower = [
* @returns 返回路由菜单数据
*/
export const staticRoutes = [
{
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

@ -18,46 +18,55 @@ export const useUserInfo = defineStore('userInfo', {
}),
actions: {
async setUserInfos() {
// 模拟数据,请求接口时,记得删除多余代码及对应依赖的引入
const userName = Cookies.get('userName');
// 模拟数据
let defaultRoles = [];
let defaultAuthBtnList = [];
// admin 页面权限标识,对应路由 meta.roles用于控制路由的显示/隐藏
let adminRoles = ['admin'];
// admin 按钮权限标识
let adminAuthBtnList = ['btn.add', 'btn.del', 'btn.edit', 'btn.link'];
// test 页面权限标识,对应路由 meta.roles用于控制路由的显示/隐藏
let testRoles = ['common'];
// test 按钮权限标识
let testAuthBtnList = ['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 = 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 = [];
let defaultAuthBtnList = [];
// admin 页面权限标识,对应路由 meta.roles用于控制路由的显示/隐藏
let adminRoles = ['admin'];
// admin 按钮权限标识
let adminAuthBtnList = ['btn.add', 'btn.del', 'btn.edit', 'btn.link'];
// test 页面权限标识,对应路由 meta.roles用于控制路由的显示/隐藏
let testRoles = ['common'];
// test 按钮权限标识
let testAuthBtnList = ['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

@ -33,9 +33,20 @@
/* Form 表单
------------------------------- */
.el-form {
// 用于修改弹窗时表单内容间隔太大问题如系统设置的新增菜单弹窗里的表单内容
.el-form-item:last-of-type {
margin-bottom: 0 !important;
}
// 修复行内表单最后一个 el-form-item 位置下移问题
&.el-form--inline {
.el-form-item--large.el-form-item:last-of-type {
margin-bottom: 22px !important;
}
.el-form-item--default.el-form-item:last-of-type,
.el-form-item--small.el-form-item:last-of-type {
margin-bottom: 18px !important;
}
}
}
/* 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, oldArr) {
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

@ -26,7 +26,6 @@ import { useThemeConfig } from '/@/stores/themeConfig';
import { useTagsViewRoutes } from '/@/stores/tagsViewRoutes';
import { Session } from '/@/utils/storage';
const router = useRouter();
const storesThemeConfig = useThemeConfig();
const storesTagsViewRoutes = useTagsViewRoutes();
const { themeConfig } = storeToRefs(storesThemeConfig);
@ -43,8 +42,11 @@ const initTagViewHeight = computed(() => {
});
//
const onSetAuth = () => {
// https://gitee.com/lyt-top/vue-next-admin/issues/I5C3JS
// /token
Session.clear();
router.push('/login');
// 使 reload resetRoute()
window.location.reload();
};
</script>

View File

@ -40,7 +40,7 @@ onMounted(() => {
text-align: center;
@extend .login-scan-animation;
animation-delay: 0.1s;
::v-deep(img) {
:deep(img) {
margin: auto;
}
.login-msg {

View File

@ -1,5 +1,19 @@
<template>
<div class="system-role-container">
<el-form :inline="true" :model="state.formInline" class="demo-form-inline" size="default">
<el-form-item label="Approved by">
<el-input v-model="state.formInline.user" placeholder="Approved by" />
</el-form-item>
<el-form-item label="Activity zone">
<el-select v-model="state.formInline.region" placeholder="Activity zone">
<el-option label="Zone one" value="shanghai" />
<el-option label="Zone two" value="beijing" />
</el-select>
</el-form-item>
<el-form-item>
<el-button type="primary">Query</el-button>
</el-form-item>
</el-form>
<el-card shadow="hover">
<div class="system-user-search mb15">
<el-input size="default" placeholder="请输入角色名称" style="max-width: 180px"> </el-input>
@ -74,6 +88,10 @@ const state = reactive({
pageSize: 10,
},
},
formInline: {
user: '',
region: '',
},
});
//
const initTableData = () => {

View File

@ -54,33 +54,8 @@ const viteConfig = defineConfig((mode) => {
},
},
},
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 } } },
};
});