Ver Fonte

将本地存储更换为会话存储

zy há 5 meses atrás
pai
commit
2300f89ec0

+ 2 - 2
cpp-ui/src/views/cloudDataQuery/index.vue

@@ -685,8 +685,8 @@ export default {
     window.addEventListener("transitionend", this.handleResize);
   },
   destroyed() {
-    // 清空缓存中首页地图跳转的参数
-    localStorage.setItem('map-jump-staion','')
+    // 删除缓存中首页地图跳转的参数
+    localStorage.removeItem('map-jump-staion')
   },
   computed: {},
   methods: {

+ 6 - 6
cpp-ui/src/views/largeScreen/components/center-bottom.vue

@@ -88,13 +88,13 @@ export default {
   },
   methods: {
     initChart() {
-      if(localStorage.getItem('screen-forecast-day')){
-        this.day = localStorage.getItem('screen-forecast-day')
+      if(sessionStorage.getItem('screen-forecast-day')){
+        this.day = sessionStorage.getItem('screen-forecast-day')
       }else{
         this.day = 'day'
       }
-      if(localStorage.getItem('screen-forecast-type')){
-        this.type = localStorage.getItem('screen-forecast-type')
+      if(sessionStorage.getItem('screen-forecast-type')){
+        this.type = sessionStorage.getItem('screen-forecast-type')
       }else{
         this.type = 'wind'
       }
@@ -137,12 +137,12 @@ export default {
      * */
     changeForecastLine(id) {
       const activeItem = document.querySelector('.btu-checked.forecastLine')
-      localStorage.setItem('screen-forecast-day',id)
+      sessionStorage.setItem('screen-forecast-day',id)
       this.checkedClass(id, activeItem)
     },
     changeForecastLineType(id) {
       const activeItem = document.querySelector('.btu-checked.forecastLineType')
-      localStorage.setItem('screen-forecast-type',id)
+      sessionStorage.setItem('screen-forecast-type',id)
       this.checkedClass(id, activeItem)
     },
     checkedClass(id, activeItem) {

+ 3 - 3
cpp-ui/src/views/largeScreen/components/right-middle.vue

@@ -79,8 +79,8 @@ export default {
   },
   methods: {
     initChart() {
-      if(localStorage.getItem('screen-weather-type')){
-        this.type = localStorage.getItem('screen-weather-type')
+      if(sessionStorage.getItem('screen-weather-type')){
+        this.type = sessionStorage.getItem('screen-weather-type')
       }else{
         this.type = 'wind'
       }
@@ -125,7 +125,7 @@ export default {
      * 切换气象预测按钮
      * */
     changeWeather(id) {
-      localStorage.setItem('screen-weather-type',id.includes('wind')?'wind':'photovoltaic')
+      sessionStorage.setItem('screen-weather-type',id.includes('wind')?'wind':'photovoltaic')
       const activeItem = document.querySelector('.btu-checked.weather')
       let clickItem = document.getElementById(id)
       activeItem.classList.remove('btu-checked')

+ 3 - 3
cpp-ui/src/views/largeScreen/components/right-top.vue

@@ -94,8 +94,8 @@ export default {
     this.scrolltimer = null
   },
   mounted() {
-    if (localStorage.getItem('screen-accuracy-type')) {
-      this.type = localStorage.getItem('screen-accuracy-type')
+    if (sessionStorage.getItem('screen-accuracy-type')) {
+      this.type = sessionStorage.getItem('screen-accuracy-type')
     } else {
       this.type = 'day'
     }
@@ -107,7 +107,7 @@ export default {
      * 切换准确率排行按钮
      * */
     changeAccuracy(id) {
-      localStorage.setItem('screen-accuracy-type', id.includes('day') ? 'day' : 'month')
+      sessionStorage.setItem('screen-accuracy-type', id.includes('day') ? 'day' : 'month')
       const activeItem = document.querySelector('.btu-checked.accuracy')
       let clickItem = document.getElementById(id)
       // let activeItem = document.querySelector('.btu-checked')