From 3dc2a742f9597e9ac23404f8c6c12546541b0ee3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=B0=8F=E9=99=8C?= <xiaomo.drip@gmail.com>
Date: Sun, 11 Jun 2023 22:57:51 +0800
Subject: [PATCH] TOOL

---
 src/App.vue                                 |  2 +-
 src/components/scStatistic/index.vue        |  2 +-
 src/layout/components/search.vue            | 10 +++++-----
 src/layout/components/setting.vue           | 14 ++++++-------
 src/layout/components/userbar.vue           |  6 +++---
 src/layout/other/autoExit.js                |  2 +-
 src/scui.js                                 |  2 +-
 src/views/home/index.vue                    |  2 +-
 src/views/home/widgets/components/time.vue  |  4 ++--
 src/views/home/widgets/index.vue            |  8 ++++----
 src/views/home/work/components/myapp.vue    |  6 +++---
 src/views/login/components/passwordForm.vue | 12 +++++------
 src/views/login/index.vue                   | 22 ++++++++++-----------
 src/views/userCenter/user/seting.vue        | 20 +++++++++----------
 14 files changed, 56 insertions(+), 56 deletions(-)

diff --git a/src/App.vue b/src/App.vue
index 85bc78c..5934488 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -28,7 +28,7 @@
 		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){
 				document.documentElement.style.setProperty('--el-color-primary', app_color);
 				for (let i = 1; i <= 9; i++) {
diff --git a/src/components/scStatistic/index.vue b/src/components/scStatistic/index.vue
index e32bbf2..3702be3 100644
--- a/src/components/scStatistic/index.vue
+++ b/src/components/scStatistic/index.vue
@@ -51,7 +51,7 @@
 		},
 		computed: {
 			cmtValue(){
-				return this.groupSeparator ? this.$TOOL.groupSeparator(this.value) : this.value
+				return this.groupSeparator ? this.$tool.groupSeparator(this.value) : this.value
 			}
 		}
 	}
diff --git a/src/layout/components/search.vue b/src/layout/components/search.vue
index fd727f3..988da90 100644
--- a/src/layout/components/search.vue
+++ b/src/layout/components/search.vue
@@ -29,9 +29,9 @@
 			}
 		},
 		mounted() {
-			var searchHistory = this.$TOOL.data.get("SEARCH_HISTORY") || []
+			var searchHistory = this.$tool.data.get("SEARCH_HISTORY") || []
 			this.history = searchHistory
-			var menuTree = this.$TOOL.data.get("MENU")
+			var menuTree = this.$tool.data.get("MENU")
 			this.filterMenu(menuTree)
 			this.$refs.input.focus()
 		},
@@ -94,7 +94,7 @@
 			to(item){
 				if(!this.history.includes(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"){
 					setTimeout(()=>{
@@ -118,9 +118,9 @@
 			historyClose(index){
 				this.history.splice(index, 1);
 				if(this.history.length <= 0){
-					this.$TOOL.data.remove("SEARCH_HISTORY")
+					this.$tool.data.remove("SEARCH_HISTORY")
 				}else{
-					this.$TOOL.data.set("SEARCH_HISTORY", this.history)
+					this.$tool.data.set("SEARCH_HISTORY", this.history)
 				}
 			}
 		}
diff --git a/src/layout/components/setting.vue b/src/layout/components/setting.vue
index e60bee8..ec5d11f 100644
--- a/src/layout/components/setting.vue
+++ b/src/layout/components/setting.vue
@@ -41,10 +41,10 @@
 				layout: this.$store.state.global.layout,
 				menuIsCollapse: this.$store.state.global.menuIsCollapse,
 				layoutTags: this.$store.state.global.layoutTags,
-				lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
-				dark: this.$TOOL.data.get('APP_DARK') || false,
+				lang: this.$tool.data.get('APP_LANG') || this.$CONFIG.LANG,
+				dark: this.$tool.data.get('APP_DARK') || false,
 				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: {
@@ -60,15 +60,15 @@
 			dark(val){
 				if(val){
 					document.documentElement.classList.add("dark")
-					this.$TOOL.data.set("APP_DARK", val)
+					this.$tool.data.set("APP_DARK", val)
 				}else{
 					document.documentElement.classList.remove("dark")
-					this.$TOOL.data.remove("APP_DARK")
+					this.$tool.data.remove("APP_DARK")
 				}
 			},
 			lang(val){
 				this.$i18n.locale = val
-				this.$TOOL.data.set("APP_LANG", val);
+				this.$tool.data.set("APP_LANG", val);
 			},
 			colorPrimary(val){
 				if(!val){
@@ -82,7 +82,7 @@
 				for (let i = 1; i <= 9; i++) {
 					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);
 			}
 		}
 	}
diff --git a/src/layout/components/userbar.vue b/src/layout/components/userbar.vue
index 14d7d4f..6527d3d 100644
--- a/src/layout/components/userbar.vue
+++ b/src/layout/components/userbar.vue
@@ -119,7 +119,7 @@
 			}
 		},
 		created() {
-			var userInfo = this.$TOOL.data.get("USER_INFO");
+			var userInfo = this.$tool.data.get("USER_INFO");
 			this.userName = userInfo.userName;
 			this.avatar = userInfo.avatar;
 		},
@@ -137,7 +137,7 @@
 						type: 'info',
 					}).then(() => {
 						const loading = this.$loading()
-						this.$TOOL.data.clear()
+						this.$tool.data.clear()
 						this.$router.replace({path: '/login'})
 						setTimeout(()=>{
 							loading.close()
@@ -162,7 +162,7 @@
 			//全屏
 			screen(){
 				var element = document.documentElement;
-				this.$TOOL.screen(element)
+				this.$tool.screen(element)
 			},
 			//显示短消息
 			showMsg(){
diff --git a/src/layout/other/autoExit.js b/src/layout/other/autoExit.js
index c88c85b..9013b96 100644
--- a/src/layout/other/autoExit.js
+++ b/src/layout/other/autoExit.js
@@ -4,7 +4,7 @@ export default {
 	},
 	data() {
 		return {
-			logoutCount: this.$TOOL.data.get('AUTO_EXIT')
+			logoutCount: this.$tool.data.get('AUTO_EXIT')
 		}
 	},
 	mounted() {
diff --git a/src/scui.js b/src/scui.js
index 603cd4c..921e6f6 100644
--- a/src/scui.js
+++ b/src/scui.js
@@ -38,7 +38,7 @@ export default {
 	install(app) {
 		//挂载全局对象
 		app.config.globalProperties.$CONFIG = config;
-		app.config.globalProperties.$TOOL = tool;
+		app.config.globalProperties.$tool = tool;
 		app.config.globalProperties.$http = http;
 		app.config.globalProperties.$api = api;
 		app.config.globalProperties.$AUTH = permission;
diff --git a/src/views/home/index.vue b/src/views/home/index.vue
index dae58c7..80f65a8 100644
--- a/src/views/home/index.vue
+++ b/src/views/home/index.vue
@@ -31,7 +31,7 @@
 			}
 		},
 		created(){
-			this.dashboard = this.$TOOL.data.get("USER_INFO").dashboard || '0';
+			this.dashboard = this.$tool.data.get("USER_INFO").dashboard || '0';
 		},
 		mounted(){
 
diff --git a/src/views/home/widgets/components/time.vue b/src/views/home/widgets/components/time.vue
index c551cbc..b861a9c 100644
--- a/src/views/home/widgets/components/time.vue
+++ b/src/views/home/widgets/components/time.vue
@@ -26,8 +26,8 @@
 		},
 		methods: {
 			showTime(){
-				this.time = this.$TOOL.dateFormat(new Date(), 'hh:mm:ss')
-				this.day = this.$TOOL.dateFormat(new Date(), 'yyyy年MM月dd日')
+				this.time = this.$tool.dateFormat(new Date(), 'hh:mm:ss')
+				this.day = this.$tool.dateFormat(new Date(), 'yyyy年MM月dd日')
 			}
 		}
 	}
diff --git a/src/views/home/widgets/index.vue b/src/views/home/widgets/index.vue
index 42da28a..ef490d9 100644
--- a/src/views/home/widgets/index.vue
+++ b/src/views/home/widgets/index.vue
@@ -107,7 +107,7 @@
 			}
 		},
 		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() {
 			this.$emit('on-mounted')
@@ -133,7 +133,7 @@
 				return allCompsList
 			},
 			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))
 			},
 			nowCompsList(){
@@ -176,14 +176,14 @@
 			save(){
 				this.customizing = false
 				this.$refs.widgets.style.removeProperty('transform')
-				this.$TOOL.data.set("grid", this.grid)
+				this.$tool.data.set("grid", this.grid)
 			},
 			//恢复默认
 			backDefaul(){
 				this.customizing = false
 				this.$refs.widgets.style.removeProperty('transform')
 				this.grid =  JSON.parse(JSON.stringify(this.defaultGrid))
-				this.$TOOL.data.remove("grid")
+				this.$tool.data.remove("grid")
 			},
 			//关闭
 			close(){
diff --git a/src/views/home/work/components/myapp.vue b/src/views/home/work/components/myapp.vue
index 3a0ad72..fa9da6e 100644
--- a/src/views/home/work/components/myapp.vue
+++ b/src/views/home/work/components/myapp.vue
@@ -74,8 +74,8 @@
 			},
 			getMods(){
 				//这里可用改为读取远程数据
-				this.myModsName = this.$TOOL.data.get("my-mods") || []
-				var menuTree = this.$TOOL.data.get("MENU")
+				this.myModsName = this.$tool.data.get("my-mods") || []
+				var menuTree = this.$tool.data.get("MENU")
 				this.filterMenu(menuTree)
 				this.myMods = this.mods.filter(item => {
 					return this.myModsName.includes(item.name)
@@ -101,7 +101,7 @@
 			},
 			saveMods(){
 				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.modsDrawer = false
 			}
diff --git a/src/views/login/components/passwordForm.vue b/src/views/login/components/passwordForm.vue
index 08d0985..0a5601c 100644
--- a/src/views/login/components/passwordForm.vue
+++ b/src/views/login/components/passwordForm.vue
@@ -68,12 +68,12 @@
 				this.islogin = true
 				var data = {
 					username: this.form.user,
-					password: this.$TOOL.crypto.MD5(this.form.password)
+					password: this.$tool.crypto.MD5(this.form.password)
 				}
 				//获取token
 				var user = await this.$api.auth.token.post(data)
 				if(user.code == 200){
-					this.$TOOL.cookie.set("TOKEN", user.data.token, {
+					this.$tool.cookie.set("TOKEN", user.data.token, {
 						expires: 86400*360
 					})
 				}else{
@@ -95,10 +95,10 @@
 						})
 						return false
 					}
-					this.$TOOL.data.set("MENU", menu.data.menu)
-					this.$TOOL.data.set("USER_INFO", menu.data.user)
-					this.$TOOL.data.set("PERMISSIONS", menu.data.permissions)
-					this.$TOOL.data.set("DASHBOARDGRID", menu.data.dashboardGrid)
+					this.$tool.data.set("MENU", menu.data.menu)
+					this.$tool.data.set("USER_INFO", menu.data.user)
+					this.$tool.data.set("PERMISSIONS", menu.data.permissions)
+					this.$tool.data.set("DASHBOARDGRID", menu.data.dashboardGrid)
 				}else{
 					this.islogin = false
 					this.$message.warning(menu.message)
diff --git a/src/views/login/index.vue b/src/views/login/index.vue
index 72261fe..bbad696 100644
--- a/src/views/login/index.vue
+++ b/src/views/login/index.vue
@@ -72,8 +72,8 @@
 		data() {
 			return {
 				config: {
-					lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
-					dark: this.$TOOL.data.get('APP_DARK') || false
+					lang: this.$tool.data.get('APP_LANG') || this.$CONFIG.LANG,
+					dark: this.$tool.data.get('APP_DARK') || false
 				},
 				lang: [
 					{
@@ -94,24 +94,24 @@
 			'config.dark'(val){
 				if(val){
 					document.documentElement.classList.add("dark")
-					this.$TOOL.data.set("APP_DARK", val)
+					this.$tool.data.set("APP_DARK", val)
 				}else{
 					document.documentElement.classList.remove("dark")
-					this.$TOOL.data.remove("APP_DARK")
+					this.$tool.data.remove("APP_DARK")
 				}
 			},
 			'config.lang'(val){
 				this.$i18n.locale = val
-				this.$TOOL.data.set("APP_LANG", val)
+				this.$tool.data.set("APP_LANG", val)
 			}
 		},
 		created: function() {
-			this.$TOOL.cookie.remove("TOKEN")
-			this.$TOOL.data.remove("USER_INFO")
-			this.$TOOL.data.remove("MENU")
-			this.$TOOL.data.remove("PERMISSIONS")
-			this.$TOOL.data.remove("DASHBOARDGRID")
-			this.$TOOL.data.remove("grid")
+			this.$tool.cookie.remove("TOKEN")
+			this.$tool.data.remove("USER_INFO")
+			this.$tool.data.remove("MENU")
+			this.$tool.data.remove("PERMISSIONS")
+			this.$tool.data.remove("DASHBOARDGRID")
+			this.$tool.data.remove("grid")
 			this.$store.commit("clearViewTags")
 			this.$store.commit("clearKeepLive")
 			this.$store.commit("clearIframeList")
diff --git a/src/views/userCenter/user/seting.vue b/src/views/userCenter/user/seting.vue
index 00fae2c..7a893e9 100644
--- a/src/views/userCenter/user/seting.vue
+++ b/src/views/userCenter/user/seting.vue
@@ -50,10 +50,10 @@
 			return {
 				colorList: ['#409EFF', '#009688', '#536dfe', '#ff5c93', '#c62f2f', '#fd726d'],
 				config: {
-					lang: this.$TOOL.data.get('APP_LANG') || this.$CONFIG.LANG,
-					dark: this.$TOOL.data.get('APP_DARK') || false,
-					colorPrimary: this.$TOOL.data.get('APP_COLOR') || this.$CONFIG.COLOR || '#409EFF',
-					autoExit: this.$TOOL.data.get('AUTO_EXIT') || 0,
+					lang: this.$tool.data.get('APP_LANG') || this.$CONFIG.LANG,
+					dark: this.$tool.data.get('APP_DARK') || false,
+					colorPrimary: this.$tool.data.get('APP_COLOR') || this.$CONFIG.COLOR || '#409EFF',
+					autoExit: this.$tool.data.get('AUTO_EXIT') || 0,
 				}
 			}
 		},
@@ -61,15 +61,15 @@
 			'config.dark'(val){
 				if(val){
 					document.documentElement.classList.add("dark")
-					this.$TOOL.data.set("APP_DARK", val)
+					this.$tool.data.set("APP_DARK", val)
 				}else{
 					document.documentElement.classList.remove("dark")
-					this.$TOOL.data.remove("APP_DARK")
+					this.$tool.data.remove("APP_DARK")
 				}
 			},
 			'config.lang'(val){
 				this.$i18n.locale = val
-				this.$TOOL.data.set("APP_LANG", val);
+				this.$tool.data.set("APP_LANG", val);
 			},
 			'config.colorPrimary'(val){
 				if(!val){
@@ -83,13 +83,13 @@
 				for (let i = 1; i <= 9; i++) {
 					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")
+					this.$tool.data.remove("AUTO_EXIT")
 				}else{
-					this.$TOOL.data.set("AUTO_EXIT", val)
+					this.$tool.data.set("AUTO_EXIT", val)
 				}
 			},
 		},