Merge branch 'develop'

This commit is contained in:
sc 2023-01-30 14:44:23 +08:00
commit 1210eeef8b
31 changed files with 366 additions and 113 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "scui", "name": "scui",
"version": "1.6.6", "version": "1.6.7",
"private": true, "private": true,
"scripts": { "scripts": {
"serve": "vue-cli-service serve", "serve": "vue-cli-service serve",
@ -8,36 +8,36 @@
"lint": "vue-cli-service lint" "lint": "vue-cli-service lint"
}, },
"dependencies": { "dependencies": {
"@element-plus/icons-vue": "2.0.6", "@element-plus/icons-vue": "2.0.10",
"@tinymce/tinymce-vue": "5.0.0", "@tinymce/tinymce-vue": "5.0.0",
"axios": "0.27.2", "axios": "1.2.6",
"codemirror": "5.65.5", "codemirror": "5.65.5",
"core-js": "3.24.1", "core-js": "3.27.2",
"cropperjs": "1.5.12", "cropperjs": "1.5.13",
"crypto-js": "4.1.1", "crypto-js": "4.1.1",
"echarts": "5.3.3", "echarts": "5.4.1",
"element-plus": "2.2.12", "element-plus": "2.2.28",
"nprogress": "0.2.0", "nprogress": "0.2.0",
"qrcodejs2": "0.0.2", "qrcodejs2": "0.0.2",
"sortablejs": "1.15.0", "sortablejs": "1.15.0",
"tinymce": "6.1.2", "tinymce": "6.3.1",
"vue": "3.2.37", "vue": "3.2.45",
"vue-i18n": "9.2.2", "vue-i18n": "9.2.2",
"vue-router": "4.1.3", "vue-router": "4.1.6",
"vuedraggable": "4.0.3", "vuedraggable": "4.0.3",
"vuex": "4.0.2", "vuex": "4.1.0",
"xgplayer": "2.31.7", "xgplayer": "2.32.2",
"xgplayer-hls": "2.5.2" "xgplayer-hls": "2.5.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "7.18.9", "@babel/core": "7.20.12",
"@babel/eslint-parser": "7.18.9", "@babel/eslint-parser": "7.19.1",
"@vue/cli-plugin-babel": "5.0.8", "@vue/cli-plugin-babel": "5.0.8",
"@vue/cli-plugin-eslint": "5.0.8", "@vue/cli-plugin-eslint": "5.0.8",
"@vue/cli-service": "5.0.8", "@vue/cli-service": "5.0.8",
"eslint": "8.21.0", "eslint": "8.33.0",
"eslint-plugin-vue": "9.3.0", "eslint-plugin-vue": "9.9.0",
"sass": "1.37.5", "sass": "1.57.1",
"sass-loader": "10.1.1" "sass-loader": "10.1.1"
}, },
"eslintConfig": { "eslintConfig": {

View File

@ -1,10 +1,10 @@
<!-- <!--
* @Descripttion: scContextmenuItem组件 * @Descripttion: scContextmenuItem组件
* @version: 1.2 * @version: 1.3
* @Author: sakuya * @Author: sakuya
* @Date: 2021年7月23日16:29:36 * @Date: 2021年7月23日16:29:36
* @LastEditors: sakuya * @LastEditors: sakuya
* @LastEditTime: 20222月8日15:51:07 * @LastEditTime: 202211月23日10:09:54
--> -->
<template> <template>
@ -50,6 +50,9 @@
if(!menu){ if(!menu){
return false return false
} }
if(this.disabled){
return false
}
menu.style.display = 'inline-block' menu.style.display = 'inline-block'
var rect = menu.getBoundingClientRect() var rect = menu.getBoundingClientRect()
var menuX = rect.left var menuX = rect.left

View File

@ -59,6 +59,10 @@
templates: { templates: {
type: Array, type: Array,
default: () => [] default: () => []
},
options: {
type: Object,
default: () => {}
} }
}, },
data() { data() {
@ -86,6 +90,7 @@
quickbars_insert_toolbar: false, quickbars_insert_toolbar: false,
image_caption: true, image_caption: true,
image_advtab: true, image_advtab: true,
convert_urls: false,
images_upload_handler: function(blobInfo) { images_upload_handler: function(blobInfo) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const data = new FormData(); const data = new FormData();
@ -113,7 +118,8 @@
},0) },0)
} }
}) })
} },
...this.options
}, },
contentValue: this.modelValue contentValue: this.modelValue
} }

View File

@ -2,11 +2,11 @@
<template> <template>
<el-table ref="table" :data="columnData" row-key="prop" style="width: 100%" border> <el-table ref="table" :data="columnData" row-key="prop" style="width: 100%" border>
<el-table-column prop="" label="排序" width="60"> <el-table-column prop="" label="排序" width="60">
<el-tag class="move" style="cursor: move;"><el-icon style="cursor: move;"><el-icon-d-caret/></el-icon></el-tag> <el-tag disable-transitions class="move" style="cursor: move;"><el-icon style="cursor: move;"><el-icon-d-caret/></el-icon></el-tag>
</el-table-column> </el-table-column>
<el-table-column prop="label" label="列名"> <el-table-column prop="label" label="列名">
<template #default="scope"> <template #default="scope">
<el-tag round :effect="scope.row.hide?'light':'dark'" :type="scope.row.hide?'info':''">{{ scope.row.label }}</el-tag> <el-tag round disable-transitions :effect="scope.row.hide?'light':'dark'" :type="scope.row.hide?'info':''">{{ scope.row.label }}</el-tag>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column prop="hide" label="显示" width="60"> <el-table-column prop="hide" label="显示" width="60">

View File

@ -103,6 +103,9 @@
apiObj(){ apiObj(){
this.tableParams = this.params; this.tableParams = this.params;
this.refresh(); this.refresh();
},
column(){
this.userColumn=this.column;
} }
}, },
computed: { computed: {

View File

@ -6,10 +6,10 @@ const DEFAULT_CONFIG = {
DASHBOARD_URL: "/dashboard", DASHBOARD_URL: "/dashboard",
//版本号 //版本号
APP_VER: "1.6.6", APP_VER: "1.6.7",
//内核版本号 //内核版本号
CORE_VER: "1.6.6", CORE_VER: "1.6.7",
//接口地址 //接口地址
API_URL: process.env.NODE_ENV === 'development' && process.env.VUE_APP_PROXY === 'true' ? "/api" : process.env.VUE_APP_API_BASEURL, API_URL: process.env.NODE_ENV === 'development' && process.env.VUE_APP_PROXY === 'true' ? "/api" : process.env.VUE_APP_API_BASEURL,

View File

@ -1,22 +1,18 @@
import { permission } from '@/utils/permission' import { permissionAll } from '@/utils/permission'
import tool from '@/utils/tool';
/**
* 用户权限指令
* @directive 单个权限验证v-auth="'xxx'"
* @directive 多个权限验证满足一个则显示v-auths="['xxx','xxx']"
* @directive 多个权限验证全部满足则显示v-auths-all="['xxx','xxx']"
*/
export default { export default {
mounted(el, binding) { mounted (el, binding) {
const { value } = binding if(permissionAll()){
if(Array.isArray(value)){ return
let ishas = false;
value.forEach(item => {
if(permission(item)){
ishas = true;
}
})
if (!ishas){
el.parentNode.removeChild(el)
}
}else{
if(!permission(value)){
el.parentNode.removeChild(el);
}
} }
let permissions = tool.data.get("PERMISSIONS");
if (!permissions.some((v) => v === binding.value)) el.parentNode.removeChild(el);
} }
}; }

24
src/directives/auths.js Normal file
View File

@ -0,0 +1,24 @@
import { permissionAll } from '@/utils/permission'
import tool from '@/utils/tool';
/**
* 用户权限指令
* @directive 单个权限验证v-auth="'xxx'"
* @directive 多个权限验证满足一个则显示v-auths="['xxx','xxx']"
* @directive 多个权限验证全部满足则显示v-auths-all="['xxx','xxx']"
*/
export default {
mounted (el, binding) {
if(permissionAll()){
return
}
let permissions = tool.data.get("PERMISSIONS");
let flag = false;
permissions.map((val) => {
binding.value.map((v) => {
if (val === v) flag = true;
});
});
if (!flag) el.parentNode.removeChild(el);
}
}

View File

@ -0,0 +1,19 @@
import { permissionAll, judementSameArr } from '@/utils/permission'
import tool from '@/utils/tool';
/**
* 用户权限指令
* @directive 单个权限验证v-auth="'xxx'"
* @directive 多个权限验证满足一个则显示v-auths="['xxx','xxx']"
* @directive 多个权限验证全部满足则显示v-auths-all="['xxx','xxx']"
*/
export default {
mounted (el, binding) {
if(permissionAll()){
return
}
let permissions = tool.data.get("PERMISSIONS");
const flag = judementSameArr(binding.value, permissions);
if (!flag) el.parentNode.removeChild(el);
}
}

View File

@ -73,6 +73,10 @@
this.$TOOL.data.set("APP_LANG", val); this.$TOOL.data.set("APP_LANG", val);
}, },
colorPrimary(val){ colorPrimary(val){
if(!val){
val = '#409EFF'
this.colorPrimary = '#409EFF'
}
document.documentElement.style.setProperty('--el-color-primary', val); document.documentElement.style.setProperty('--el-color-primary', val);
for (let i = 1; i <= 9; i++) { for (let i = 1; i <= 9; i++) {
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, colorTool.lighten(val,i/10)); document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, colorTool.lighten(val,i/10));

View File

@ -65,17 +65,16 @@
}) })
}, },
contextMenuVisible(value) { contextMenuVisible(value) {
var _this = this; const cm = (e) => {
var cm = function(e){ const sp = document.getElementById("contextmenu");
let sp = document.getElementById("contextmenu"); if (sp && !sp.contains(e.target)) {
if(sp&&!sp.contains(e.target)){ this.closeMenu()
_this.closeMenu()
} }
} }
if (value) { if (value) {
document.body.addEventListener('click', e=>cm(e)) document.body.addEventListener('click', e => cm(e))
}else{ } else {
document.body.removeEventListener('click', e=>cm(e)) document.body.removeEventListener('click', e => cm(e))
} }
} }
}, },
@ -160,24 +159,24 @@
this.contextMenuVisible = false this.contextMenuVisible = false
}, },
//TAB //TAB
refreshTab(){ refreshTab() {
var nowTag = this.contextMenuItem;
this.contextMenuVisible = false this.contextMenuVisible = false
const nowTag = this.contextMenuItem;
// //
if(this.$route.fullPath != nowTag.fullPath){ if (this.$route.fullPath !== nowTag.fullPath) {
this.$router.push({ this.$router.push({
path: nowTag.fullPath, path: nowTag.fullPath,
query: nowTag.query query: nowTag.query
}) })
} }
this.$store.commit("refreshIframe", nowTag) this.$store.commit("refreshIframe", nowTag)
var _this = this; setTimeout(() => {
setTimeout(function() { this.$store.commit("removeKeepLive", nowTag.name)
_this.$store.commit("removeKeepLive", nowTag.name) this.$store.commit("setRouteShow", false)
_this.$store.commit("setRouteShow", false) this.$nextTick(() => {
_this.$nextTick(() => { this.$store.commit("pushKeepLive", nowTag.name)
_this.$store.commit("pushKeepLive",nowTag.name) this.$store.commit("setRouteShow", true)
_this.$store.commit("setRouteShow", true)
}) })
}, 0); }, 0);
}, },

View File

@ -61,11 +61,11 @@
</el-dropdown> </el-dropdown>
</div> </div>
<el-dialog v-model="searchVisible" :width="700" title="搜索" custom-class="drawerBG" center destroy-on-close> <el-dialog v-model="searchVisible" :width="700" title="搜索" center destroy-on-close>
<search @success="searchVisible=false"></search> <search @success="searchVisible=false"></search>
</el-dialog> </el-dialog>
<el-drawer v-model="tasksVisible" :size="450" title="任务中心" custom-class="drawerBG" destroy-on-close> <el-drawer v-model="tasksVisible" :size="450" title="任务中心" destroy-on-close>
<tasks></tasks> <tasks></tasks>
</el-drawer> </el-drawer>

View File

@ -187,6 +187,8 @@
<el-drawer title="布局实时演示" v-model="settingDialog" :size="400" append-to-body destroy-on-close> <el-drawer title="布局实时演示" v-model="settingDialog" :size="400" append-to-body destroy-on-close>
<setting></setting> <setting></setting>
</el-drawer> </el-drawer>
<auto-exit></auto-exit>
</template> </template>
<script> <script>
@ -197,6 +199,7 @@
import userbar from './components/userbar.vue'; import userbar from './components/userbar.vue';
import setting from './components/setting.vue'; import setting from './components/setting.vue';
import iframeView from './components/iframeView.vue'; import iframeView from './components/iframeView.vue';
import autoExit from './other/autoExit.js';
export default { export default {
name: 'index', name: 'index',
@ -207,7 +210,8 @@
NavMenu, NavMenu,
userbar, userbar,
setting, setting,
iframeView iframeView,
autoExit
}, },
data() { data() {
return { return {

View File

@ -0,0 +1,51 @@
export default {
render() {
},
data() {
return {
logoutCount: this.$TOOL.data.get('AUTO_EXIT')
}
},
mounted() {
if(this.logoutCount){
this.setNewAutoExitTime()
document.onclick = () => {
this.setNewAutoExitTime()
}
document.onmousemove = () => {
this.setNewAutoExitTime()
}
document.onkeydown = () => {
this.setNewAutoExitTime()
}
document.onscroll = () => {
this.setNewAutoExitTime()
}
window.autoExitTimer = window.setInterval(this.autoExitfun, 1000)
}
},
unmounted() {
if(this.logoutCount){
clearInterval(window.autoExitTimer)
window.autoExitTimer = null
}
},
methods: {
setNewAutoExitTime(){
window.autoExitTime = new Date().getTime()
},
autoExitfun(){
if(new Date().getTime() - window.autoExitTime > this.logoutCount * 60 * 1000){
clearInterval(window.autoExitTimer)
window.autoExitTimer = null
this.$router.replace({path: '/login'})
this.$alert("用户长时间无操作,为保证账户安全,系统已自动登出。", "提示", {
type: 'warning',
center: true,
roundButton: true
})
}
}
}
}

View File

@ -1,3 +1,4 @@
import { createApp } from 'vue'
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
import 'element-plus/theme-chalk/display.css' import 'element-plus/theme-chalk/display.css'
@ -5,7 +6,6 @@ import scui from './scui'
import i18n from './locales' import i18n from './locales'
import router from './router' import router from './router'
import store from './store' import store from './store'
import { createApp } from 'vue'
import App from './App.vue' import App from './App.vue'
const app = createApp(App); const app = createApp(App);

View File

@ -24,6 +24,8 @@ import scStatusIndicator from './components/scMini/scStatusIndicator'
import scTrend from './components/scMini/scTrend' import scTrend from './components/scMini/scTrend'
import auth from './directives/auth' import auth from './directives/auth'
import auths from './directives/auths'
import authsAll from './directives/authsAll'
import role from './directives/role' import role from './directives/role'
import time from './directives/time' import time from './directives/time'
import copy from './directives/copy' import copy from './directives/copy'
@ -63,6 +65,8 @@ export default {
//注册全局指令 //注册全局指令
app.directive('auth', auth) app.directive('auth', auth)
app.directive('auths', auths)
app.directive('auths-all', authsAll)
app.directive('role', role) app.directive('role', role)
app.directive('time', time) app.directive('time', time)
app.directive('copy', copy) app.directive('copy', copy)

View File

@ -27,6 +27,11 @@ html.dark {
.adminui-main {background: var(--el-bg-color);} .adminui-main {background: var(--el-bg-color);}
.drawerBG {background: var(--el-bg-color);} .drawerBG {background: var(--el-bg-color);}
.adminui-header-menu .el-menu {--el-menu-bg-color:var(--el-bg-color-overlay) !important;--el-menu-hover-bg-color: #171819 !important;} .adminui-header-menu .el-menu {--el-menu-bg-color:var(--el-bg-color-overlay) !important;--el-menu-hover-bg-color: #171819 !important;}
.adminui-header-menu .el-menu .el-sub-menu__title {background-color:transparent !important;}
//全局滚动条样式
::-webkit-scrollbar-thumb {background-color: rgba(163, 166, 173, 0.3);}
::-webkit-scrollbar-thumb:hover {background-color: rgba(163, 166, 173, 0.5);}
//组件 //组件
.el-header, .el-main.nopadding, .el-footer {background: var(--el-bg-color-overlay);border-color: var(--el-border-color-light);} .el-header, .el-main.nopadding, .el-footer {background: var(--el-bg-color-overlay);border-color: var(--el-border-color-light);}

View File

@ -1,5 +1,37 @@
import tool from '@/utils/tool'; import tool from '@/utils/tool';
/**
* 是否含有不限分类有则表示全部允许通过
*/
export function permissionAll() {
const allPermissions = "*/*/*"
let permissions = tool.data.get("PERMISSIONS");
return permissions.includes(allPermissions);
}
/**
* 比对两组数据是否一致
* @param news
* @param old
* @returns {boolean}
*/
export function judementSameArr(news, old) {
// console.log(news)
// console.log(old)
let count = 0;
const leng = news.length;
for (let i in news) {
for (let j in old) {
if (news[i] === old[j]) {
count++;
// console.log(news[i])
}
}
}
// console.log('相同的数量', count)
return count === leng;
}
export function permission(data) { export function permission(data) {
let permissions = tool.data.get("PERMISSIONS"); let permissions = tool.data.get("PERMISSIONS");
if(!permissions){ if(!permissions){

View File

@ -27,6 +27,9 @@ axios.interceptors.request.use(
} }
); );
//FIX 多个API同时401时疯狂弹窗BUG
let MessageBox_401_show = false
// HTTP response 拦截器 // HTTP response 拦截器
axios.interceptors.response.use( axios.interceptors.response.use(
(response) => { (response) => {
@ -45,14 +48,21 @@ axios.interceptors.response.use(
message: error.response.data.message || "Status:500服务器发生错误" message: error.response.data.message || "Status:500服务器发生错误"
}); });
} else if (error.response.status == 401) { } else if (error.response.status == 401) {
ElMessageBox.confirm('当前用户已被登出或无权限访问当前资源,请尝试重新登录后再操作。', '无权限访问', { if(!MessageBox_401_show){
type: 'error', MessageBox_401_show = true
closeOnClickModal: false, ElMessageBox.confirm('当前用户已被登出或无权限访问当前资源,请尝试重新登录后再操作。', '无权限访问', {
center: true, type: 'error',
confirmButtonText: '重新登录' closeOnClickModal: false,
}).then(() => { center: true,
router.replace({path: '/login'}); confirmButtonText: '重新登录',
}).catch(() => {}) beforeClose: (action, instance, done) => {
MessageBox_401_show = false
done()
}
}).then(() => {
router.replace({path: '/login'});
}).catch(() => {})
}
} else { } else {
ElNotification.error({ ElNotification.error({
title: '请求错误', title: '请求错误',
@ -73,9 +83,9 @@ axios.interceptors.response.use(
var http = { var http = {
/** get /** get
* @param {接口地址} url * @param {string} url 接口地址
* @param {请求参数} params * @param {object} params 请求参数
* @param {参数} config * @param {object} config 参数
*/ */
get: function(url, params={}, config={}) { get: function(url, params={}, config={}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -93,9 +103,9 @@ var http = {
}, },
/** post /** post
* @param {接口地址} url * @param {string} url 接口地址
* @param {请求参数} data * @param {object} data 请求参数
* @param {参数} config * @param {object} config 参数
*/ */
post: function(url, data={}, config={}) { post: function(url, data={}, config={}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -113,9 +123,9 @@ var http = {
}, },
/** put /** put
* @param {接口地址} url * @param {string} url 接口地址
* @param {请求参数} data * @param {object} data 请求参数
* @param {参数} config * @param {object} config 参数
*/ */
put: function(url, data={}, config={}) { put: function(url, data={}, config={}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -133,9 +143,9 @@ var http = {
}, },
/** patch /** patch
* @param {接口地址} url * @param {string} url 接口地址
* @param {请求参数} data * @param {object} data 请求参数
* @param {参数} config * @param {object} config 参数
*/ */
patch: function(url, data={}, config={}) { patch: function(url, data={}, config={}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -153,9 +163,9 @@ var http = {
}, },
/** delete /** delete
* @param {接口地址} url * @param {string} url 接口地址
* @param {请求参数} data * @param {object} data 请求参数
* @param {参数} config * @param {object} config 参数
*/ */
delete: function(url, data={}, config={}) { delete: function(url, data={}, config={}) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
@ -173,8 +183,8 @@ var http = {
}, },
/** jsonp /** jsonp
* @param {接口地址} url * @param {string} url 接口地址
* @param {JSONP回调函数名称} name * @param {string} name JSONP回调函数名称
*/ */
jsonp: function(url, name='jsonp'){ jsonp: function(url, name='jsonp'){
return new Promise((resolve) => { return new Promise((resolve) => {

View File

@ -133,7 +133,8 @@
return allCompsList return allCompsList
}, },
myCompsList(){ myCompsList(){
return this.allCompsList.filter(item => !item.disabled ) var myGrid = this.$TOOL.data.get("DASHBOARDGRID")
return this.allCompsList.filter(item => !item.disabled && myGrid.includes(item.key))
}, },
nowCompsList(){ nowCompsList(){
return this.grid.copmsList.reduce(function(a, b){return a.concat(b)}) return this.grid.copmsList.reduce(function(a, b){return a.concat(b)})

View File

@ -1,5 +1,5 @@
<template> <template>
<el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large"> <el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large" @keyup.enter="login">
<el-form-item prop="user"> <el-form-item prop="user">
<el-input v-model="form.user" prefix-icon="el-icon-user" clearable :placeholder="$t('login.userPlaceholder')"> <el-input v-model="form.user" prefix-icon="el-icon-user" clearable :placeholder="$t('login.userPlaceholder')">
<template #append> <template #append>
@ -106,6 +106,7 @@
} }
this.$TOOL.data.set("MENU", menu.data.menu) this.$TOOL.data.set("MENU", menu.data.menu)
this.$TOOL.data.set("PERMISSIONS", menu.data.permissions) this.$TOOL.data.set("PERMISSIONS", menu.data.permissions)
this.$TOOL.data.set("DASHBOARDGRID", menu.data.dashboardGrid)
}else{ }else{
this.islogin = false this.islogin = false
this.$message.warning(menu.message) this.$message.warning(menu.message)

View File

@ -1,5 +1,5 @@
<template> <template>
<el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large"> <el-form ref="loginForm" :model="form" :rules="rules" label-width="0" size="large" @keyup.enter="login">
<el-form-item prop="phone"> <el-form-item prop="phone">
<el-input v-model="form.phone" prefix-icon="el-icon-iphone" clearable :placeholder="$t('login.mobilePlaceholder')"> <el-input v-model="form.phone" prefix-icon="el-icon-iphone" clearable :placeholder="$t('login.mobilePlaceholder')">
<template #prepend>+86</template> <template #prepend>+86</template>

View File

@ -121,6 +121,7 @@
this.$TOOL.data.remove("USER_INFO") this.$TOOL.data.remove("USER_INFO")
this.$TOOL.data.remove("MENU") this.$TOOL.data.remove("MENU")
this.$TOOL.data.remove("PERMISSIONS") this.$TOOL.data.remove("PERMISSIONS")
this.$TOOL.data.remove("DASHBOARDGRID")
this.$TOOL.data.remove("grid") this.$TOOL.data.remove("grid")
this.$store.commit("clearViewTags") this.$store.commit("clearViewTags")
this.$store.commit("clearKeepLive") this.$store.commit("clearKeepLive")

View File

@ -2,8 +2,12 @@
<el-main> <el-main>
<el-card shadow="never" header="v-auth 高精度权限控制"> <el-card shadow="never" header="v-auth 高精度权限控制">
<el-button v-auth="'user.add'" type="primary">v-auth="'user.add'"</el-button> <el-button v-auth="'user.add'" type="primary">v-auth="'user.add'"</el-button>
<el-button v-auth="['user.no','user.add']" type="primary">v-auth="['user.no','user.add']"</el-button> <el-button v-auths="['user.no','user.add']" type="primary">v-auths="['user.no','user.add']"</el-button>
<el-alert title="v-auth指令 是$AUTH的语法糖, 原先需要使用v-if来判断是否有权限, 使用指令将减少代码冗余. 并且支持传入数组,有一项满足就判断有权限" style="margin-top: 20px;"></el-alert> <el-button v-auths-all="['list.add','user.add']" type="primary">v-auths-all="['list.add','user.add']"</el-button>
<el-alert title="v-auth指令 是$AUTH的语法糖, 原先需要使用v-if来判断是否有权限, 判断单项权限,如果满足就判断有权限" style="margin-top: 20px;"></el-alert>
<el-alert title="v-auths指令 传入数组,有一项满足就判断有权限" style="margin-top: 20px;"></el-alert>
<el-alert title="v-auths-all指令 传入数组,必须全满足才有权限比如user.no没有这个权限加到这里的话就表示不全部满足" style="margin-top: 20px;"></el-alert>
</el-card> </el-card>
<el-card shadow="never" header="v-role 角色权限控制" style="margin-top: 15px;"> <el-card shadow="never" header="v-role 角色权限控制" style="margin-top: 15px;">
<el-button v-role="'admin'" type="primary">v-role="'admin'"</el-button> <el-button v-role="'admin'" type="primary">v-role="'admin'"</el-button>
@ -34,20 +38,20 @@
</template> </template>
<script> <script>
export default { export default {
name: 'directive', name: 'directive',
data() { data() {
return { return {
time1: new Date(), time1: new Date(),
time2: new Date().setMinutes(new Date().getMinutes()-1), time2: new Date().setMinutes(new Date().getMinutes()-1),
time3: new Date().setMinutes(new Date().getMinutes()-120), time3: new Date().setMinutes(new Date().getMinutes()-120),
copyText: '测试复制内容' copyText: '测试复制内容'
}
},
created() {
} }
},
created() {
} }
}
</script> </script>
<style> <style>

View File

@ -324,6 +324,7 @@
</script> </script>
<style scoped> <style scoped>
.menu:deep(.el-tree-node__label) {display: flex;flex: 1;height:100%;}
.custom-tree-node {display: flex;flex: 1;align-items: center;justify-content: space-between;font-size: 14px;padding-right: 24px;height:100%;} .custom-tree-node {display: flex;flex: 1;align-items: center;justify-content: space-between;font-size: 14px;padding-right: 24px;height:100%;}
.custom-tree-node .code {font-size: 12px;color: #999;} .custom-tree-node .code {font-size: 12px;color: #999;}
.custom-tree-node .do {display: none;} .custom-tree-node .do {display: none;}

View File

@ -9,12 +9,12 @@
<el-tree ref="menu" class="menu" node-key="id" :data="menuList" :props="menuProps" draggable highlight-current :expand-on-click-node="false" check-strictly show-checkbox :filter-node-method="menuFilterNode" @node-click="menuClick" @node-drop="nodeDrop"> <el-tree ref="menu" class="menu" node-key="id" :data="menuList" :props="menuProps" draggable highlight-current :expand-on-click-node="false" check-strictly show-checkbox :filter-node-method="menuFilterNode" @node-click="menuClick" @node-drop="nodeDrop">
<template #default="{node, data}"> <template #default="{node, data}">
<span class="custom-tree-node el-tree-node__label"> <span class="custom-tree-node">
<span class="label"> <span class="label">
{{ node.label }} {{ node.label }}
</span> </span>
<span class="do"> <span class="do">
<el-icon @click.stop="add(node, data)"><el-icon-plus /></el-icon> <el-button icon="el-icon-plus" size="small" @click.stop="add(node, data)"></el-button>
</span> </span>
</span> </span>
</template> </template>
@ -153,7 +153,8 @@
</script> </script>
<style scoped> <style scoped>
.custom-tree-node {display: flex;flex: 1;align-items: center;justify-content: space-between;font-size: 14px;padding-right: 24px;height:100%;} .menu:deep(.el-tree-node__label) {display: flex;flex: 1;height:100%;}
.custom-tree-node {display: flex;flex: 1;align-items: center;justify-content: space-between;font-size: 14px;height:100%;padding-right:24px;}
.custom-tree-node .label {display: flex;align-items: center;;height: 100%;} .custom-tree-node .label {display: flex;align-items: center;;height: 100%;}
.custom-tree-node .label .el-tag {margin-left: 5px;} .custom-tree-node .label .el-tag {margin-left: 5px;}
.custom-tree-node .do {display: none;} .custom-tree-node .do {display: none;}

View File

@ -28,6 +28,11 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-tab-pane> </el-tab-pane>
<el-tab-pane label="控制台模块">
<div class="treeMain">
<el-tree ref="grid" node-key="key" :data="grid.list" :props="grid.props" :default-checked-keys="grid.checked" show-checkbox></el-tree>
</div>
</el-tab-pane>
<el-tab-pane label="控制台"> <el-tab-pane label="控制台">
<el-form label-width="100px" label-position="left"> <el-form label-width="100px" label-position="left">
<el-form-item label="控制台视图"> <el-form-item label="控制台视图">
@ -65,6 +70,18 @@
} }
} }
}, },
grid: {
list: [],
checked: ["welcome", "ver", "time", "progress", "echarts", "about"],
props: {
label: (data)=>{
return data.title
},
disabled: (data)=>{
return data.isFixed
}
}
},
data: { data: {
dataType :"1", dataType :"1",
list: [], list: [],
@ -91,6 +108,7 @@
mounted() { mounted() {
this.getMenu() this.getMenu()
this.getDept() this.getDept()
this.getGrid()
}, },
methods: { methods: {
open(){ open(){
@ -132,6 +150,36 @@
let filterKeys = this.data.checked.filter(key => this.$refs.dept.getNode(key).isLeaf) let filterKeys = this.data.checked.filter(key => this.$refs.dept.getNode(key).isLeaf)
this.$refs.dept.setCheckedKeys(filterKeys, true) this.$refs.dept.setCheckedKeys(filterKeys, true)
}) })
},
getGrid(){
this.grid.list = [
{
key: "welcome",
title: "欢迎",
isFixed: true
},
{
key: "ver",
title: "版本信息",
isFixed: true
},
{
key: "time",
title: "时钟"
},
{
key: "progress",
title: "进度环"
},
{
key: "echarts",
title: "实时收入"
},
{
key: "about",
title: "关于项目"
}
]
} }
} }
} }

View File

@ -38,7 +38,7 @@
<save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></save-dialog> <save-dialog v-if="dialog.save" ref="saveDialog" @success="handleSaveSuccess" @closed="dialog.save=false"></save-dialog>
<el-drawer v-model="dialog.info" :size="800" title="详细" custom-class="drawerBG" direction="rtl" destroy-on-close> <el-drawer v-model="dialog.info" :size="800" title="详细" direction="rtl" destroy-on-close>
<info ref="infoDialog"></info> <info ref="infoDialog"></info>
</el-drawer> </el-drawer>

View File

@ -6,7 +6,7 @@
<div class="user-info-top"> <div class="user-info-top">
<el-avatar :size="70" src="img/avatar.jpg"></el-avatar> <el-avatar :size="70" src="img/avatar.jpg"></el-avatar>
<h2>{{ user.userName }}</h2> <h2>{{ user.userName }}</h2>
<p><el-tag effect="dark" round size="large">{{ user.role }}</el-tag></p> <p><el-tag effect="dark" round size="large" disable-transitions>{{ user.role }}</el-tag></p>
</div> </div>
</el-header> </el-header>
<el-main class="nopadding"> <el-main class="nopadding">

View File

@ -17,6 +17,29 @@
</el-form-item> </el-form-item>
</el-form> </el-form>
</el-card> </el-card>
<el-card shadow="never" header="个人设置" style="margin-top:20px;">
<el-form ref="form" label-width="120px" style="margin-top:20px;">
<el-form-item label="自动登出">
<el-select v-model="config.autoExit">
<el-option label="从不" :value="0"></el-option>
<el-option label="1分钟" :value="1"></el-option>
<el-option label="5分钟" :value="5"></el-option>
<el-option label="10分钟" :value="10"></el-option>
<el-option label="15分钟" :value="15"></el-option>
<el-option label="20分钟" :value="20"></el-option>
<el-option label="25分钟" :value="25"></el-option>
<el-option label="30分钟" :value="30"></el-option>
<el-option label="35分钟" :value="35"></el-option>
<el-option label="40分钟" :value="40"></el-option>
<el-option label="45分钟" :value="45"></el-option>
<el-option label="50分钟" :value="50"></el-option>
<el-option label="55分钟" :value="55"></el-option>
<el-option label="60分钟" :value="60"></el-option>
</el-select>
<div class="el-form-item-msg">自动登出设置将在下次登录时生效</div>
</el-form-item>
</el-form>
</el-card>
</template> </template>
<script> <script>
@ -29,7 +52,8 @@
config: { config: {
lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG, lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
dark: this.$TOOL.data.get('APP_DARK') || false, dark: this.$TOOL.data.get('APP_DARK') || false,
colorPrimary: this.$TOOL.data.get('APP_COLOR') || this.$CONFIG.COLOR || '#409EFF' colorPrimary: this.$TOOL.data.get('APP_COLOR') || this.$CONFIG.COLOR || '#409EFF',
autoExit: this.$TOOL.data.get('AUTO_EXIT') || 0,
} }
} }
}, },
@ -48,6 +72,10 @@
this.$TOOL.data.set("APP_LANG", val); this.$TOOL.data.set("APP_LANG", val);
}, },
'config.colorPrimary'(val){ 'config.colorPrimary'(val){
if(!val){
val = '#409EFF'
this.config.colorPrimary = '#409EFF'
}
document.documentElement.style.setProperty('--el-color-primary', val); document.documentElement.style.setProperty('--el-color-primary', val);
for (let i = 1; i <= 9; i++) { for (let i = 1; i <= 9; i++) {
document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, colorTool.lighten(val,i/10)); document.documentElement.style.setProperty(`--el-color-primary-light-${i}`, colorTool.lighten(val,i/10));
@ -56,7 +84,14 @@
document.documentElement.style.setProperty(`--el-color-primary-dark-${i}`, colorTool.darken(val,i/10)); document.documentElement.style.setProperty(`--el-color-primary-dark-${i}`, colorTool.darken(val,i/10));
} }
this.$TOOL.data.set("APP_COLOR", val); this.$TOOL.data.set("APP_COLOR", val);
} },
'config.autoExit'(val){
if(val == 0){
this.$TOOL.data.remove("AUTO_EXIT")
}else{
this.$TOOL.data.set("AUTO_EXIT", val)
}
},
}, },
} }
</script> </script>

View File

@ -13,6 +13,7 @@
<el-descriptions-item label="toolbar">自定义工具栏使用"|"竖杠分割使用"\"斜杠分组默认'undo redo | forecolor backcolor bold italic underline strikethrough link | blocks fontfamily fontsize | \ <el-descriptions-item label="toolbar">自定义工具栏使用"|"竖杠分割使用"\"斜杠分组默认'undo redo | forecolor backcolor bold italic underline strikethrough link | blocks fontfamily fontsize | \
alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | pagebreak | \ alignleft aligncenter alignright alignjustify | outdent indent | numlist bullist | pagebreak | \
image media table template preview | code selectall'</el-descriptions-item> image media table template preview | code selectall'</el-descriptions-item>
<el-descriptions-item label="options">支持tinymce的其他配置项</el-descriptions-item>
</el-descriptions> </el-descriptions>
</el-card> </el-card>
</el-main> </el-main>