Browse Source

放大后跳转页面在回到主页消失问题优化

dengliying 11 months ago
parent
commit
89e591a293

+ 2 - 1
ui/src/store/modules/settings.js

@@ -8,7 +8,8 @@ const state = {
   showSettings: showSettings,
   tagsView: tagsView,
   fixedHeader: fixedHeader,
-  sidebarLogo: sidebarLogo
+  sidebarLogo: sidebarLogo,
+  pfdPageImgeSize: 2148,
 }
 
 const mutations = {

+ 1 - 0
ui/src/views/monitor/pfd/JLQPage.vue

@@ -100,6 +100,7 @@ export default {
       this.$nextTick(() => {
         // 初始化
         console.log(this.$route.query.id)
+
       });
     },
     methods: {

+ 23 - 10
ui/src/views/monitor/pfd/index.vue

@@ -301,16 +301,19 @@ export default {
     },
     mounted () {
         this.$nextTick(() => {
-              this.areaLJLScaleNum = parseFloat(this.scaleNum * (this.areaLJLWidth / this.imageWidth)).toFixed();
-              this.areaJLQScaleNum = parseFloat(this.scaleNum * (this.areaJLQWidth / this.imageWidth)).toFixed();
-              this.areaZJQScaleNum = parseFloat(this.scaleNum * (this.areaZJQWidth / this.imageWidth)).toFixed();
-              this.areaYSScaleNum = parseFloat(this.scaleNum * (this.areaYSWidth / this.imageWidth)).toFixed();
-              this.areaTBPScaleNum = parseFloat(this.scaleNum * (this.areaTBPWidth / this.imageWidth)).toFixed();
-              this.areaRQ1ScaleNum = parseFloat(this.scaleNum * (this.areaRQ1Width / this.imageWidth)).toFixed();
-              this.areaLQ_RQScaleNum = parseFloat(this.scaleNum * (this.areaLQ_RQWidth / this.imageWidth)).toFixed();
-              this.areaLQ_1ScaleNum = parseFloat(this.scaleNum * (this.areaLQ_1Width / this.imageWidth)).toFixed();
-              this.areaLQ_2ScaleNum = parseFloat(this.scaleNum * (this.areaLQ_2Width / this.imageWidth)).toFixed();
-              this.areaRQ2ScaleNum = parseFloat(this.scaleNum * (this.areaRQ2Width / this.imageWidth)).toFixed();
+          // 获取store中记录的主图大小
+          this.imageWidth = this.$store.state.settings.pfdPageImgeSize;
+          // 设置不同区域的缩放比例
+          this.areaLJLScaleNum = parseFloat(this.scaleNum * (this.areaLJLWidth / this.imageWidth)).toFixed();
+          this.areaJLQScaleNum = parseFloat(this.scaleNum * (this.areaJLQWidth / this.imageWidth)).toFixed();
+          this.areaZJQScaleNum = parseFloat(this.scaleNum * (this.areaZJQWidth / this.imageWidth)).toFixed();
+          this.areaYSScaleNum = parseFloat(this.scaleNum * (this.areaYSWidth / this.imageWidth)).toFixed();
+          this.areaTBPScaleNum = parseFloat(this.scaleNum * (this.areaTBPWidth / this.imageWidth)).toFixed();
+          this.areaRQ1ScaleNum = parseFloat(this.scaleNum * (this.areaRQ1Width / this.imageWidth)).toFixed();
+          this.areaLQ_RQScaleNum = parseFloat(this.scaleNum * (this.areaLQ_RQWidth / this.imageWidth)).toFixed();
+          this.areaLQ_1ScaleNum = parseFloat(this.scaleNum * (this.areaLQ_1Width / this.imageWidth)).toFixed();
+          this.areaLQ_2ScaleNum = parseFloat(this.scaleNum * (this.areaLQ_2Width / this.imageWidth)).toFixed();
+          this.areaRQ2ScaleNum = parseFloat(this.scaleNum * (this.areaRQ2Width / this.imageWidth)).toFixed();
 
         });
     },
@@ -881,11 +884,21 @@ export default {
       },
       // 跳转页面
       handleToPage(id){
+        // 记录图片大小
+        this.$store.dispatch('settings/changeSetting', {
+          key: 'pfdPageImgeSize',
+          value: this.imageWidth
+        });
         //带参数跳转
         this.$router.push({ path: '/pfd/jlq' , query: { id: id }});
       },
       // 跳转c2c3页面
       handleToC2C3Page(){
+        // 记录图片大小
+        this.$store.dispatch('settings/changeSetting', {
+          key: 'pfdPageImgeSize',
+          value: this.imageWidth
+        });
         this.$router.push({ path: '/pfd/c2c3' });
       }