From b6a18d0441c2d5b35faba8c0f504cbcb239a1ddb Mon Sep 17 00:00:00 2001
From: gaoaoy <1042166043@qq.com>
Date: 星期三, 13 三月 2024 10:07:42 +0800
Subject: [PATCH] 检验下单 功能调整

---
 src/view/index.vue |   52 +++++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 41 insertions(+), 11 deletions(-)

diff --git a/src/view/index.vue b/src/view/index.vue
index fcc83e2..f151c85 100644
--- a/src/view/index.vue
+++ b/src/view/index.vue
@@ -359,12 +359,7 @@
 				activeBox: 0,
 				activeP: 0,
 				tabActive: 0,
-				tabs: [{
-					k: 0,
-					v: "涓汉棣栭〉",
-					i: "font icon-a-Group1124",
-					u: "nullFace"
-				}],
+				tabs: [],
 				upIndex: 0,
 				activeIndex: 0,
 				power: []
@@ -376,9 +371,36 @@
 		mounted() {
 			this.userName = JSON.parse(localStorage.getItem("user")).name;
 			this.power = JSON.parse(sessionStorage.getItem('power'))
+			this.tabs = JSON.parse(localStorage.getItem('tabs'))
+			if (this.tabs == undefined || this.tabs == null) {
+				this.tabs = [{
+					k: 0,
+					v: "涓汉棣栭〉",
+					i: "font icon-a-Group1124",
+					u: "nullFace"
+				}]
+			}
+			this.tabActive = JSON.parse(localStorage.getItem('tabActive'))
+			if (this.tabActive == undefined || this.tabActive == null) {
+				this.tabActive = 0
+			}
+			this.activeP = JSON.parse(localStorage.getItem('activeP'))
+			if (this.activeP == undefined || this.activeP == null) {
+				this.activeP = 0
+			}
+			this.activeBox = JSON.parse(localStorage.getItem('activeBox'))
+			if (this.activeBox == undefined || this.activeBox == null) {
+				this.activeBox = 0
+			}
 			this.getPower()
 		},
 		methods: {
+			saveClick(){
+				localStorage.setItem('tabs', JSON.stringify(this.tabs))
+				localStorage.setItem('tabActive', JSON.stringify(this.tabActive))
+				localStorage.setItem('activeP', JSON.stringify(this.activeP))
+				localStorage.setItem('activeBox', JSON.stringify(this.activeBox))
+			},
 			addTab(ob, self) {
 				this.activeBox = self == -1 ? ob.k : self
 				this.activeP = ob.k; //0
@@ -390,9 +412,10 @@
 					}
 				});
 				if (num == -1) {
-					if(ob.u == "") ob.u = "nullFace"
+					if (ob.u == "") ob.u = "nullFace"
 					this.tabs.push(ob);
 				}
+				this.saveClick()
 			},
 			removeTab(index) {
 				this.tabs.splice(index, 1);
@@ -400,6 +423,7 @@
 				this.activeP = data.k;
 				this.tabActive = data.k;
 				this.activeBox = data.k
+				this.saveClick()
 			},
 			allDel() {
 				this.activeBox = 0
@@ -407,10 +431,11 @@
 				this.tabActive = 0
 				this.tabs = [{
 					k: 0,
-					v: " 棣栭〉",
+					v: "涓汉棣栭〉",
 					i: "font icon-a-Group1124",
-					u: "index-index"
+					u: "nullFace"
 				}]
+				this.saveClick()
 			},
 			upTabActive(num) {
 				this.tabActive = num;
@@ -423,10 +448,15 @@
 						}
 					})
 				}
+				this.saveClick()
 			},
 			out() {
 				sessionStorage.clear();
 				localStorage.removeItem("autoenter");
+				localStorage.removeItem("tabs")
+				localStorage.removeItem("tabActive")
+				localStorage.removeItem("activeP")
+				localStorage.removeItem("activeBox")
 				this.$router.push("/enter");
 			},
 			// 鍏抽棴鍙抽敭鑿滃崟
@@ -477,8 +507,8 @@
 			groupCount(g1, gs) {
 				if (g1 == undefined) return 24
 				let count = 0
-				gs.forEach(a=>{
-					if(a.g == g1) count++
+				gs.forEach(a => {
+					if (a.g == g1) count++
 				})
 				if (count > 4) return 8
 				if (count > 1) return 12

--
Gitblit v1.9.3