Browse Source

feat 跳转页面交互2

anxiaoxia 1 year ago
parent
commit
0281525f6e

+ 5 - 3
src/packagesEnv/api/officehome.js

@@ -1,6 +1,7 @@
 import $http from '@/common/request.js'
 import $http from '@/common/request.js'
 import config from '@/config'
 import config from '@/config'
 import store from '@/store/index.js'
 import store from '@/store/index.js'
+import { user } from '@/store/user.js'
 
 
 function storeUser() {
 function storeUser() {
   let userInfo = store.state.user.userInfo
   let userInfo = store.state.user.userInfo
@@ -420,11 +421,12 @@ function queryCustomAndScence(params) {
     errorSave: true
     errorSave: true
   })
   })
 }
 }
-
+// TODO 设置常驻工区
 function changeDefaultSpace(params) {
 function changeDefaultSpace(params) {
   return $http({
   return $http({
-    url: `/user/defaultSpace?spaceId=${params}`,
-    method: 'POST',
+    serverSp: 'http://192.168.4.29:52015',
+    url: `/controlSpaceUser/savePermanentSpace?spaceId=${params}&userId=${storeUser().userId}`,
+    method: 'GET',
     isNotShowErrorToast: true,
     isNotShowErrorToast: true,
     errorSave: true
     errorSave: true
   })
   })

+ 4 - 0
src/packagesEnv/pages/officehome/FloorHeating/floorHeating.wpy

@@ -283,6 +283,10 @@ wepy.component({
     getData() {
     getData() {
       querySapceFloorHeating({ spaceId: this.spaceId }).then(res => {
       querySapceFloorHeating({ spaceId: this.spaceId }).then(res => {
         const resData = res.data
         const resData = res.data
+        if (!resData.equipList) {
+          clearInterval(this.timer)
+          this.timer = null
+        }
         this.equipList = resData.equipList || []
         this.equipList = resData.equipList || []
         this.len = this.equipList.length
         this.len = this.equipList.length
         this.tempSet = resData.tempSet
         this.tempSet = resData.tempSet

+ 28 - 35
src/packagesEnv/pages/officehome/Header/residen-work.wpy

@@ -35,45 +35,38 @@ wepy.component({
   computed: {},
   computed: {},
   methods: {
   methods: {
     showSaveSpace() {
     showSaveSpace() {
-      var _this = this
-      if (_this.spaceId == _this.userInfo.spaceId) {
-        wx.showToast({
-          title: '该空间已是您的常驻工区',
-          icon: 'none',
-          duration: 3000
-        })
-      } else {
-        wx.showModal({
-          title: '设置常驻工区',
-          content: '将该空间设定为您的常驻工区?',
-          confirmText: '确定',
-          cancelText: '取消',
-          cancelColor: '#c4c4c4',
-          confirmColor: '#1DB1B2',
-          success: res => {
-            if (res.confirm) {
-              changeDefaultSpace(_this.options.spaceId).then(res => {
+      const _this = this
+      console.log(this, '----this')
+      _this.$root.getCurrentSpace()
+      wx.showModal({
+        title: '设置常驻工区',
+        content: '将该空间设定为您的常驻工区?',
+        confirmText: '确定',
+        cancelText: '取消',
+        cancelColor: '#c4c4c4',
+        confirmColor: '#1DB1B2',
+        success: res => {
+          if (res.confirm) {
+            changeDefaultSpace(_this.spaceId).then(res => {
                 // getCurrentPages 小程序自己的方法
                 // getCurrentPages 小程序自己的方法
-                var pages = getCurrentPages()
-                console.log('res', res, pages)
-                _this.userInfo.spaceId = _this.options.spaceId
-                wx.showToast({
-                  title: '设置成功',
-                  icon: 'success',
-                  duration: 3000,
-                  complete: res => {
-                    if (pages.length <= 1) {
-                      wx.redirectTo({ url: '/pages/homev2' })
-                    } else {
-                      wx.navigateBack()
-                    }
+              var pages = getCurrentPages()
+              _this.$root.getCurrentSpace()
+              wx.showToast({
+                title: '设置成功',
+                icon: 'success',
+                duration: 3000,
+                complete: res => {
+                  if (pages.length <= 1) {
+                    wx.redirectTo({ url: '/packagesEnv/pages/home/index' })
+                  } else {
+                    wx.navigateBack()
                   }
                   }
-                })
+                }
               })
               })
-            }
+            })
           }
           }
-        })
-      }
+        }
+      })
     }
     }
   },
   },
     // 生命周期 - 创建完成(可以访问当前this实例)
     // 生命周期 - 创建完成(可以访问当前this实例)

+ 2 - 2
src/packagesEnv/pages/officehome/Header/space-basic.wpy

@@ -26,13 +26,13 @@
             <div class="g-fl room-name">
             <div class="g-fl room-name">
                 <span class="name_text">{{officeData.localName || '该空间不可调节'}}</span>
                 <span class="name_text">{{officeData.localName || '该空间不可调节'}}</span>
                 <has-person
                 <has-person
-                    v-if="officeData.isPassengerPass !== undefined && IsShowPerson"
+                    v-show="officeData.isPassengerPass !== undefined && IsShowPerson"
                     :isPassengerPass="officeData.isPassengerPass"
                     :isPassengerPass="officeData.isPassengerPass"
                 ></has-person>
                 ></has-person>
             </div>
             </div>
             <div>
             <div>
                 <residen-work
                 <residen-work
-                    v-if="options.roomType =='开放' && isControlSpace===3 || isControlSpace===4"
+                    v-show="isControlSpace===3 || isControlSpace===4"
                     :IsResiden="isControlSpace"
                     :IsResiden="isControlSpace"
                     :spaceId="options.spaceId"
                     :spaceId="options.spaceId"
                     :userInfo="userInfo"
                     :userInfo="userInfo"

+ 5 - 4
src/packagesEnv/pages/officehome/components/lamp-adjust.wpy

@@ -329,12 +329,13 @@ wepy.component({
 
 
   },
   },
   watch: {
   watch: {
-    spaceId() {
+    spaceId(val) {
       this.showLamps = false // 恢复初始化值
       this.showLamps = false // 恢复初始化值
       this.allowSvg = 'down_Arrow.svg'
       this.allowSvg = 'down_Arrow.svg'
-
-      this.getLampList()
-      this.getTwoTimerLoop()
+      if (val) {
+        this.getLampList()
+        this.getTwoTimerLoop()
+      }
     },
     },
     lampHide(nval) {
     lampHide(nval) {
       if (this.showLamps) {
       if (this.showLamps) {

+ 1 - 1
src/packagesEnv/pages/officehome/components/set-permanent.wpy

@@ -77,7 +77,7 @@
             ></cover-image>
             ></cover-image>
             <cover-view class="little-box">
             <cover-view class="little-box">
                 <cover-view class="text">设为常驻 </cover-view>
                 <cover-view class="text">设为常驻 </cover-view>
-                <cover-image class="little-img" :src="h5StaticPath+'/arrow.svg'"></cover-image>
+                <cover-image class="little-img" :src="h5StaticPath+'arrow.svg'"></cover-image>
             </cover-view>
             </cover-view>
         </cover-view>
         </cover-view>
 
 

+ 7 - 4
src/packagesEnv/pages/officehome/index.wpy

@@ -562,7 +562,8 @@ page {
                         class="maproom-detail"
                         class="maproom-detail"
                         v-show="moveToBottom"
                         v-show="moveToBottom"
                     >
                     >
-                        <div class="upToSpace">
+                        <div class="upToSpace" 
+                        v-if="officeData.localName">
                             <image
                             <image
                                 class="imgSt"
                                 class="imgSt"
                                 src="{{h5StaticPath}}icon-double-arrow.svg"
                                 src="{{h5StaticPath}}icon-double-arrow.svg"
@@ -983,7 +984,7 @@ page {
             </div>
             </div>
         </div>
         </div>
         <set-permanent
         <set-permanent
-            v-if="userControlSpace.isControlSpace === 3 && this.routeParams.from==='homeSetSpace'"
+            v-show="userControlSpace.isControlSpace === 3 && this.routeParams.from==='homeSetSpace'"
             :show="isShowPermanent"
             :show="isShowPermanent"
             @component-permanent-panel-close="closePermanentPanel(false)"
             @component-permanent-panel-close="closePermanentPanel(false)"
         >
         >
@@ -1074,7 +1075,6 @@ wepy.page({
   store,
   store,
   data: {
   data: {
     sceneShow: false,
     sceneShow: false,
-    projectId: 'Pj1101080259',
     isShowPermanent: false,
     isShowPermanent: false,
     userControlSpace: {}, // 用户控制空间
     userControlSpace: {}, // 用户控制空间
     cardWidth: 0, // 动态获取卡片的宽度
     cardWidth: 0, // 动态获取卡片的宽度
@@ -1222,7 +1222,7 @@ wepy.page({
   computed: {
   computed: {
     ...mapState({
     ...mapState({
       userInfo: state => state.user.userInfo,
       userInfo: state => state.user.userInfo,
-            //   projectId: 'Pj1101080259',
+      projectId: state => state.user.userInfo.projectId,
       handPopHight: state => state.officehome.handPopHight
       handPopHight: state => state.officehome.handPopHight
     }),
     }),
     ...mapActions(['setIsApprovalProject']),
     ...mapActions(['setIsApprovalProject']),
@@ -1317,6 +1317,7 @@ wepy.page({
           await this.getData()
           await this.getData()
         }
         }
         let setAirtemp = this.$refs.airHandCard.airTemp
         let setAirtemp = this.$refs.airHandCard.airTemp
+
         switch (this.routeParams.from) {
         switch (this.routeParams.from) {
           case 'homeShowEnv':
           case 'homeShowEnv':
             if (this.userControlSpace.isControlSpace === 1 || this.userControlSpace.isControlSpace === 2) {
             if (this.userControlSpace.isControlSpace === 1 || this.userControlSpace.isControlSpace === 2) {
@@ -1331,6 +1332,7 @@ wepy.page({
             break
             break
           case 'openLamp':
           case 'openLamp':
             this.selectCrad('', 'lamp')
             this.selectCrad('', 'lamp')
+            console.log(this.$refs, '----this.$refs.lampAdjust')
             this.$refs.lampAdjust.eqChange(true, 'allLamp')
             this.$refs.lampAdjust.eqChange(true, 'allLamp')
             break
             break
           case 'airAddOne':
           case 'airAddOne':
@@ -1596,6 +1598,7 @@ wepy.page({
     },
     },
     // 地图数据切换空间
     // 地图数据切换空间
     mapChangeSpaceInfo(obj) {
     mapChangeSpaceInfo(obj) {
+      console.log(obj, '----来自地图')
       this.userControlSpace = obj
       this.userControlSpace = obj
       this.options.spaceId = obj.spaceId
       this.options.spaceId = obj.spaceId
       this.getData()
       this.getData()