TOOL
This commit is contained in:
parent
5297af0122
commit
3dc2a742f9
@ -28,7 +28,7 @@
|
|||||||
created() {
|
created() {
|
||||||
|
|
||||||
//设置主题颜色
|
//设置主题颜色
|
||||||
const app_color = this.$CONFIG.COLOR || this.$TOOL.data.get('APP_COLOR')
|
const app_color = this.$CONFIG.COLOR || this.$tool.data.get('APP_COLOR')
|
||||||
if(app_color){
|
if(app_color){
|
||||||
document.documentElement.style.setProperty('--el-color-primary', app_color);
|
document.documentElement.style.setProperty('--el-color-primary', app_color);
|
||||||
for (let i = 1; i <= 9; i++) {
|
for (let i = 1; i <= 9; i++) {
|
||||||
|
@ -51,7 +51,7 @@
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
cmtValue(){
|
cmtValue(){
|
||||||
return this.groupSeparator ? this.$TOOL.groupSeparator(this.value) : this.value
|
return this.groupSeparator ? this.$tool.groupSeparator(this.value) : this.value
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,9 +29,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
var searchHistory = this.$TOOL.data.get("SEARCH_HISTORY") || []
|
var searchHistory = this.$tool.data.get("SEARCH_HISTORY") || []
|
||||||
this.history = searchHistory
|
this.history = searchHistory
|
||||||
var menuTree = this.$TOOL.data.get("MENU")
|
var menuTree = this.$tool.data.get("MENU")
|
||||||
this.filterMenu(menuTree)
|
this.filterMenu(menuTree)
|
||||||
this.$refs.input.focus()
|
this.$refs.input.focus()
|
||||||
},
|
},
|
||||||
@ -94,7 +94,7 @@
|
|||||||
to(item){
|
to(item){
|
||||||
if(!this.history.includes(this.input)){
|
if(!this.history.includes(this.input)){
|
||||||
this.history.push(this.input)
|
this.history.push(this.input)
|
||||||
this.$TOOL.data.set("SEARCH_HISTORY", this.history)
|
this.$tool.data.set("SEARCH_HISTORY", this.history)
|
||||||
}
|
}
|
||||||
if(item.type=="link"){
|
if(item.type=="link"){
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
@ -118,9 +118,9 @@
|
|||||||
historyClose(index){
|
historyClose(index){
|
||||||
this.history.splice(index, 1);
|
this.history.splice(index, 1);
|
||||||
if(this.history.length <= 0){
|
if(this.history.length <= 0){
|
||||||
this.$TOOL.data.remove("SEARCH_HISTORY")
|
this.$tool.data.remove("SEARCH_HISTORY")
|
||||||
}else{
|
}else{
|
||||||
this.$TOOL.data.set("SEARCH_HISTORY", this.history)
|
this.$tool.data.set("SEARCH_HISTORY", this.history)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,10 +41,10 @@
|
|||||||
layout: this.$store.state.global.layout,
|
layout: this.$store.state.global.layout,
|
||||||
menuIsCollapse: this.$store.state.global.menuIsCollapse,
|
menuIsCollapse: this.$store.state.global.menuIsCollapse,
|
||||||
layoutTags: this.$store.state.global.layoutTags,
|
layoutTags: this.$store.state.global.layoutTags,
|
||||||
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,
|
||||||
colorList: ['#409EFF', '#009688', '#536dfe', '#ff5c93', '#c62f2f', '#fd726d'],
|
colorList: ['#409EFF', '#009688', '#536dfe', '#ff5c93', '#c62f2f', '#fd726d'],
|
||||||
colorPrimary: this.$TOOL.data.get('APP_COLOR') || this.$CONFIG.COLOR || '#409EFF'
|
colorPrimary: this.$tool.data.get('APP_COLOR') || this.$CONFIG.COLOR || '#409EFF'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -60,15 +60,15 @@
|
|||||||
dark(val){
|
dark(val){
|
||||||
if(val){
|
if(val){
|
||||||
document.documentElement.classList.add("dark")
|
document.documentElement.classList.add("dark")
|
||||||
this.$TOOL.data.set("APP_DARK", val)
|
this.$tool.data.set("APP_DARK", val)
|
||||||
}else{
|
}else{
|
||||||
document.documentElement.classList.remove("dark")
|
document.documentElement.classList.remove("dark")
|
||||||
this.$TOOL.data.remove("APP_DARK")
|
this.$tool.data.remove("APP_DARK")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lang(val){
|
lang(val){
|
||||||
this.$i18n.locale = val
|
this.$i18n.locale = val
|
||||||
this.$TOOL.data.set("APP_LANG", val);
|
this.$tool.data.set("APP_LANG", val);
|
||||||
},
|
},
|
||||||
colorPrimary(val){
|
colorPrimary(val){
|
||||||
if(!val){
|
if(!val){
|
||||||
@ -82,7 +82,7 @@
|
|||||||
for (let i = 1; i <= 9; i++) {
|
for (let i = 1; i <= 9; i++) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
var userInfo = this.$TOOL.data.get("USER_INFO");
|
var userInfo = this.$tool.data.get("USER_INFO");
|
||||||
this.userName = userInfo.userName;
|
this.userName = userInfo.userName;
|
||||||
this.avatar = userInfo.avatar;
|
this.avatar = userInfo.avatar;
|
||||||
},
|
},
|
||||||
@ -137,7 +137,7 @@
|
|||||||
type: 'info',
|
type: 'info',
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const loading = this.$loading()
|
const loading = this.$loading()
|
||||||
this.$TOOL.data.clear()
|
this.$tool.data.clear()
|
||||||
this.$router.replace({path: '/login'})
|
this.$router.replace({path: '/login'})
|
||||||
setTimeout(()=>{
|
setTimeout(()=>{
|
||||||
loading.close()
|
loading.close()
|
||||||
@ -162,7 +162,7 @@
|
|||||||
//全屏
|
//全屏
|
||||||
screen(){
|
screen(){
|
||||||
var element = document.documentElement;
|
var element = document.documentElement;
|
||||||
this.$TOOL.screen(element)
|
this.$tool.screen(element)
|
||||||
},
|
},
|
||||||
//显示短消息
|
//显示短消息
|
||||||
showMsg(){
|
showMsg(){
|
||||||
|
@ -4,7 +4,7 @@ export default {
|
|||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
logoutCount: this.$TOOL.data.get('AUTO_EXIT')
|
logoutCount: this.$tool.data.get('AUTO_EXIT')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
@ -38,7 +38,7 @@ export default {
|
|||||||
install(app) {
|
install(app) {
|
||||||
//挂载全局对象
|
//挂载全局对象
|
||||||
app.config.globalProperties.$CONFIG = config;
|
app.config.globalProperties.$CONFIG = config;
|
||||||
app.config.globalProperties.$TOOL = tool;
|
app.config.globalProperties.$tool = tool;
|
||||||
app.config.globalProperties.$http = http;
|
app.config.globalProperties.$http = http;
|
||||||
app.config.globalProperties.$api = api;
|
app.config.globalProperties.$api = api;
|
||||||
app.config.globalProperties.$AUTH = permission;
|
app.config.globalProperties.$AUTH = permission;
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
this.dashboard = this.$TOOL.data.get("USER_INFO").dashboard || '0';
|
this.dashboard = this.$tool.data.get("USER_INFO").dashboard || '0';
|
||||||
},
|
},
|
||||||
mounted(){
|
mounted(){
|
||||||
|
|
||||||
|
@ -26,8 +26,8 @@
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
showTime(){
|
showTime(){
|
||||||
this.time = this.$TOOL.dateFormat(new Date(), 'hh:mm:ss')
|
this.time = this.$tool.dateFormat(new Date(), 'hh:mm:ss')
|
||||||
this.day = this.$TOOL.dateFormat(new Date(), 'yyyy年MM月dd日')
|
this.day = this.$tool.dateFormat(new Date(), 'yyyy年MM月dd日')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
created(){
|
created(){
|
||||||
this.grid = this.$TOOL.data.get("grid") || JSON.parse(JSON.stringify(this.defaultGrid))
|
this.grid = this.$tool.data.get("grid") || JSON.parse(JSON.stringify(this.defaultGrid))
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$emit('on-mounted')
|
this.$emit('on-mounted')
|
||||||
@ -133,7 +133,7 @@
|
|||||||
return allCompsList
|
return allCompsList
|
||||||
},
|
},
|
||||||
myCompsList(){
|
myCompsList(){
|
||||||
var myGrid = this.$TOOL.data.get("DASHBOARDGRID")
|
var myGrid = this.$tool.data.get("DASHBOARDGRID")
|
||||||
return this.allCompsList.filter(item => !item.disabled && myGrid.includes(item.key))
|
return this.allCompsList.filter(item => !item.disabled && myGrid.includes(item.key))
|
||||||
},
|
},
|
||||||
nowCompsList(){
|
nowCompsList(){
|
||||||
@ -176,14 +176,14 @@
|
|||||||
save(){
|
save(){
|
||||||
this.customizing = false
|
this.customizing = false
|
||||||
this.$refs.widgets.style.removeProperty('transform')
|
this.$refs.widgets.style.removeProperty('transform')
|
||||||
this.$TOOL.data.set("grid", this.grid)
|
this.$tool.data.set("grid", this.grid)
|
||||||
},
|
},
|
||||||
//恢复默认
|
//恢复默认
|
||||||
backDefaul(){
|
backDefaul(){
|
||||||
this.customizing = false
|
this.customizing = false
|
||||||
this.$refs.widgets.style.removeProperty('transform')
|
this.$refs.widgets.style.removeProperty('transform')
|
||||||
this.grid = JSON.parse(JSON.stringify(this.defaultGrid))
|
this.grid = JSON.parse(JSON.stringify(this.defaultGrid))
|
||||||
this.$TOOL.data.remove("grid")
|
this.$tool.data.remove("grid")
|
||||||
},
|
},
|
||||||
//关闭
|
//关闭
|
||||||
close(){
|
close(){
|
||||||
|
@ -74,8 +74,8 @@
|
|||||||
},
|
},
|
||||||
getMods(){
|
getMods(){
|
||||||
//这里可用改为读取远程数据
|
//这里可用改为读取远程数据
|
||||||
this.myModsName = this.$TOOL.data.get("my-mods") || []
|
this.myModsName = this.$tool.data.get("my-mods") || []
|
||||||
var menuTree = this.$TOOL.data.get("MENU")
|
var menuTree = this.$tool.data.get("MENU")
|
||||||
this.filterMenu(menuTree)
|
this.filterMenu(menuTree)
|
||||||
this.myMods = this.mods.filter(item => {
|
this.myMods = this.mods.filter(item => {
|
||||||
return this.myModsName.includes(item.name)
|
return this.myModsName.includes(item.name)
|
||||||
@ -101,7 +101,7 @@
|
|||||||
},
|
},
|
||||||
saveMods(){
|
saveMods(){
|
||||||
const myModsName = this.myMods.map(v => v.name)
|
const myModsName = this.myMods.map(v => v.name)
|
||||||
this.$TOOL.data.set("my-mods", myModsName)
|
this.$tool.data.set("my-mods", myModsName)
|
||||||
this.$message.success("设置常用成功")
|
this.$message.success("设置常用成功")
|
||||||
this.modsDrawer = false
|
this.modsDrawer = false
|
||||||
}
|
}
|
||||||
|
@ -68,12 +68,12 @@
|
|||||||
this.islogin = true
|
this.islogin = true
|
||||||
var data = {
|
var data = {
|
||||||
username: this.form.user,
|
username: this.form.user,
|
||||||
password: this.$TOOL.crypto.MD5(this.form.password)
|
password: this.$tool.crypto.MD5(this.form.password)
|
||||||
}
|
}
|
||||||
//获取token
|
//获取token
|
||||||
var user = await this.$api.auth.token.post(data)
|
var user = await this.$api.auth.token.post(data)
|
||||||
if(user.code == 200){
|
if(user.code == 200){
|
||||||
this.$TOOL.cookie.set("TOKEN", user.data.token, {
|
this.$tool.cookie.set("TOKEN", user.data.token, {
|
||||||
expires: 86400*360
|
expires: 86400*360
|
||||||
})
|
})
|
||||||
}else{
|
}else{
|
||||||
@ -95,10 +95,10 @@
|
|||||||
})
|
})
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
this.$TOOL.data.set("MENU", menu.data.menu)
|
this.$tool.data.set("MENU", menu.data.menu)
|
||||||
this.$TOOL.data.set("USER_INFO", menu.data.user)
|
this.$tool.data.set("USER_INFO", menu.data.user)
|
||||||
this.$TOOL.data.set("PERMISSIONS", menu.data.permissions)
|
this.$tool.data.set("PERMISSIONS", menu.data.permissions)
|
||||||
this.$TOOL.data.set("DASHBOARDGRID", menu.data.dashboardGrid)
|
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)
|
||||||
|
@ -72,8 +72,8 @@
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
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
|
||||||
},
|
},
|
||||||
lang: [
|
lang: [
|
||||||
{
|
{
|
||||||
@ -94,24 +94,24 @@
|
|||||||
'config.dark'(val){
|
'config.dark'(val){
|
||||||
if(val){
|
if(val){
|
||||||
document.documentElement.classList.add("dark")
|
document.documentElement.classList.add("dark")
|
||||||
this.$TOOL.data.set("APP_DARK", val)
|
this.$tool.data.set("APP_DARK", val)
|
||||||
}else{
|
}else{
|
||||||
document.documentElement.classList.remove("dark")
|
document.documentElement.classList.remove("dark")
|
||||||
this.$TOOL.data.remove("APP_DARK")
|
this.$tool.data.remove("APP_DARK")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'config.lang'(val){
|
'config.lang'(val){
|
||||||
this.$i18n.locale = val
|
this.$i18n.locale = val
|
||||||
this.$TOOL.data.set("APP_LANG", val)
|
this.$tool.data.set("APP_LANG", val)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
created: function() {
|
created: function() {
|
||||||
this.$TOOL.cookie.remove("TOKEN")
|
this.$tool.cookie.remove("TOKEN")
|
||||||
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("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")
|
||||||
this.$store.commit("clearIframeList")
|
this.$store.commit("clearIframeList")
|
||||||
|
@ -50,10 +50,10 @@
|
|||||||
return {
|
return {
|
||||||
colorList: ['#409EFF', '#009688', '#536dfe', '#ff5c93', '#c62f2f', '#fd726d'],
|
colorList: ['#409EFF', '#009688', '#536dfe', '#ff5c93', '#c62f2f', '#fd726d'],
|
||||||
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,
|
autoExit: this.$tool.data.get('AUTO_EXIT') || 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -61,15 +61,15 @@
|
|||||||
'config.dark'(val){
|
'config.dark'(val){
|
||||||
if(val){
|
if(val){
|
||||||
document.documentElement.classList.add("dark")
|
document.documentElement.classList.add("dark")
|
||||||
this.$TOOL.data.set("APP_DARK", val)
|
this.$tool.data.set("APP_DARK", val)
|
||||||
}else{
|
}else{
|
||||||
document.documentElement.classList.remove("dark")
|
document.documentElement.classList.remove("dark")
|
||||||
this.$TOOL.data.remove("APP_DARK")
|
this.$tool.data.remove("APP_DARK")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
'config.lang'(val){
|
'config.lang'(val){
|
||||||
this.$i18n.locale = val
|
this.$i18n.locale = val
|
||||||
this.$TOOL.data.set("APP_LANG", val);
|
this.$tool.data.set("APP_LANG", val);
|
||||||
},
|
},
|
||||||
'config.colorPrimary'(val){
|
'config.colorPrimary'(val){
|
||||||
if(!val){
|
if(!val){
|
||||||
@ -83,13 +83,13 @@
|
|||||||
for (let i = 1; i <= 9; i++) {
|
for (let i = 1; i <= 9; i++) {
|
||||||
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){
|
'config.autoExit'(val){
|
||||||
if(val == 0){
|
if(val == 0){
|
||||||
this.$TOOL.data.remove("AUTO_EXIT")
|
this.$tool.data.remove("AUTO_EXIT")
|
||||||
}else{
|
}else{
|
||||||
this.$TOOL.data.set("AUTO_EXIT", val)
|
this.$tool.data.set("AUTO_EXIT", val)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user