wzh пре 2 година
родитељ
комит
46df203b4a
3 измењених фајлова са 51 додато и 17 уклоњено
  1. 1 1
      config.js
  2. 48 14
      pages/device/detail.vue
  3. 2 2
      utils/mqttTool.js

+ 1 - 1
config.js

@@ -1,7 +1,7 @@
 // 应用全局配置
 module.exports = {
   //baseUrl: 'https://vue.ruoyi.vip/prod-api',
-   baseUrl: 'https://yun.dnzc.vip',
+   baseUrl: 'https://yun.cszcyl.cn',
   //baseUrl: 'http://127.0.0.1:8991',
   //imgUrl:"https://hyscancode.oss-cn-hangzhou.aliyuncs.com/jianyaoji",
   imgUrl:"https://jianyaoji.oss-cn-hangzhou.aliyuncs.com/jianyaoji",

+ 48 - 14
pages/device/detail.vue

@@ -15,10 +15,10 @@
       </view>
       <view style="position: relative;top:15vh;width: 100%;text-align: center">
 
-        <image :src="imgUrl+'/detail/product.png'" :style="productSize"/>
+        <image :src="productImage" :style="productSize"/>
       </view>
       <view class="tabs">
-        <view class="child_tab"  @click="changeTab(1)">
+        <view class="child_tab" :class="firstMachine?'':'disabled_tab'"  @click="changeTab(1,firstMachine)">
           <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
           <image class="child_img" v-if="tabActive[0]" :src="imgUrl+'/detail/jianyao_on.png'" />
           <image class="child_img" v-if="!tabActive[0]" :src="imgUrl+'/detail/jianyao_off.png'" />
@@ -28,7 +28,7 @@
         </view>
 
 
-        <view class="child_tab" :class="secondMachine?'':'disabled_tab'" @click="changeTab(2)">
+        <view class="child_tab" :class="secondMachine?'':'disabled_tab'" @click="changeTab(2,secondMachine)">
           <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
           <image class="child_img" v-if="tabActive[1]" :src="imgUrl+'/detail/jianyao_on.png'" />
           <image class="child_img" v-if="!tabActive[1]" :src="imgUrl+'/detail/jianyao_off.png'" />
@@ -37,7 +37,7 @@
           </view>
         </view>
 
-        <view class="child_tab" :class="thirdMachine?'':'disabled_tab'" @click="changeTab(3)">
+        <view class="child_tab" :class="thirdMachine?'':'disabled_tab'" @click="changeTab(3,thirdMachine)">
           <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
           <image class="child_img" v-if="tabActive[2]" :src="imgUrl+'/detail/jianyao_on.png'" />
           <image class="child_img" v-if="!tabActive[2]" :src="imgUrl+'/detail/jianyao_off.png'" />
@@ -47,7 +47,7 @@
         </view>
 
 
-        <view class="child_tab" @click="changeTab(4)">
+        <view class="child_tab" :class="forthMachine?'':'disabled_tab'" @click="changeTab(4,forthMachine)">
           <image :src="imgUrl+'/detail/tab.png'" style="width: 100%;height:100%;position: absolute;top:0px;"/>
           <image class="child_img" v-if="firstTab" :src="imgUrl+'/detail/baozhuang_off.png'" />
           <image class="child_img" v-if="!firstTab" :src="imgUrl+'/detail/baozhuang_on.png'" />
@@ -635,6 +635,7 @@ export default {
         {id:3,text:"常温常压"},
       ]],
       productSize:"",
+      productImage:"",
       showModelPicker:false,
       unitFixedStyle:"",
       unitFixedStyle1:"",
@@ -727,8 +728,10 @@ export default {
       jianyaoPopClose:true,
       tabIndex:1,
       appid:"wxfd7b1a0e03e9b7e9",
+      firstMachine:true,
       secondMachine:false,
       thirdMachine:false,
+      forthMachine:true,
       deviceType:1,
       tabActive:[true,false,false],
       resetDuration:4000,
@@ -749,6 +752,7 @@ export default {
     this.getDetail();
     this.imgUrl = config.imgUrl
     this.fixStyle();
+    // this.fixImage();
     // console.log = function(){}
   },
   destroyed() {
@@ -757,6 +761,32 @@ export default {
     clearTimeout(this.checkTimer);
   },
   methods:{
+    fixImage(heng){
+      let self = this;
+      wx.getSystemInfo({
+        success: res => {
+          const { windowWidth, windowHeight, statusBarHeight } = res;
+          if(heng){
+            let rate = 0.35;
+            if(windowHeight<800){
+              rate = 0.30;
+            }
+            let imgHeight = windowWidth*0.85;
+            let imageWidth = windowWidth * 1;
+            self.productSize = ";width:"+imageWidth+"px;height:"+imgHeight+"px;";
+          }else{
+            let rate = 0.35;
+            if(windowHeight<800){
+              rate = 0.30;
+            }
+            let imgHeight = windowHeight*rate;
+            let imageWidth = imgHeight * 0.6;
+            self.productSize = ";width:"+imageWidth+"px;height:"+imgHeight+"px;";
+          }
+
+        }
+      })
+    },
     propChange(type){
       // if(type == 1){
 
@@ -1022,13 +1052,6 @@ export default {
           }
           self.maxWidth = windowWidth;
 
-          let rate = 0.35;
-          if(windowHeight<800){
-            rate = 0.30;
-          }
-          let imgHeight = windowHeight*rate;
-          let imageWidth = imgHeight * 0.6;
-          self.productSize = ";width:"+imageWidth+"px;height:"+imgHeight+"px;";
         }
       })
     },
@@ -1055,7 +1078,10 @@ export default {
       this.fengkouDlgShow = false;
       this.wenhuoTimeDlgShow = false;
     },
-    changeTab(index){
+    changeTab(index,tag){
+      if(!tag){
+        return;
+      }
       let type = this.deviceType;
       let self = this;
       if(index == 2 || index == 3){
@@ -1893,13 +1919,21 @@ export default {
         self.mqttSubscribe(res.data);
         self.getDeviceStatus();
         self.seeTime();
-        self.$forceUpdate();
+
+        let heng = false;
+        self.productImage = self.imgUrl+'/detail/product.png'
         if(self.deviceType == 4 ||self.deviceType == 5 ){
           self.secondMachine = true;
         }
         if(self.deviceType == 5){
           self.thirdMachine = true;
         }
+        if(self.deviceType == 1 || self.deviceType == 7){
+          self.forthMachine = false;
+          self.productImage = self.imgUrl+'/product/YJH20.png'
+        }
+        self.fixImage(heng);
+        self.$forceUpdate();
       });
     },
     getDeviceStatus(func){

+ 2 - 2
utils/mqttTool.js

@@ -21,9 +21,9 @@ mqttTool.connect = function () {
     url = "ws://" + window.location.hostname + ":8083/mqtt";
     console.log('自动获取地址');
   }
-  url = "wss://emqx.dnzc.vip/mqtt";
+  url = "wss://emqx.cszcyl.cn/mqtt";
   // #ifdef MP-WEIXIN
-   url = "wxs://emqx.dnzc.vip/mqtt";
+   url = "wxs://emqx.cszcyl.cn/mqtt";
   // #endif
 
   console.log("mqtt地址:", url);