Explorar el Código

feat 跳转页面交互2

anxiaoxia hace 1 año
padre
commit
0281525f6e

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

@@ -1,6 +1,7 @@
 import $http from '@/common/request.js'
 import config from '@/config'
 import store from '@/store/index.js'
+import { user } from '@/store/user.js'
 
 function storeUser() {
   let userInfo = store.state.user.userInfo
@@ -420,11 +421,12 @@ function queryCustomAndScence(params) {
     errorSave: true
   })
 }
-
+// TODO 设置常驻工区
 function changeDefaultSpace(params) {
   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,
     errorSave: true
   })

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

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

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

@@ -35,45 +35,38 @@ wepy.component({
   computed: {},
   methods: {
     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 小程序自己的方法
-                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实例)

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

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

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

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

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

@@ -77,7 +77,7 @@
             ></cover-image>
             <cover-view class="little-box">
                 <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>
 

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

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