Sfoglia il codice sorgente

fix:添加行政端登录页面

zhaojing 1 anno fa
parent
commit
75646b2e20

+ 43 - 11
src/api/home.js

@@ -1,16 +1,48 @@
+import $http from '@/common/request.js';
+
 function getUserHasFollowed() {
-    return $http({
-        url: `/home/indexWechatPublic`,
-    })
+  return $http({
+    url: `/home/indexWechatPublic`,
+  });
 }
 
 export function getCompanyMapData(companyId) {
-    return $http({
-      url: `/config/map/${companyId}`,
-      method: 'GET'
-    })
-  }
+  return $http({
+    url: `/config/map/${companyId}`,
+    method: 'GET',
+  });
+}
+//常驻空间快速调节卡片
+export function querySpaceFunctionCard(params) {
+  return $http({
+    url: `/controlSpaceUser/queryPermanentSpaceFunctionCard?userId=${params.userId}&companyId=${params.companyId}`,
+    method: 'GET',
+    serverSp:'http://192.168.4.29:52015/'
+  });
+}
+//常驻空间参数属性
+export function getSpaceProperty(params) {
+  return $http({
+    url: `/duoduo-service/duoduoenv-service/custom/spaceProperty?projectId=${params.projectId}&spaceId=${params.spaceId}`,
+    method: 'GET',
+    serverSp:'http://192.168.4.29:52015/'
+  });
+}
+//切换公司
+export function switchCompany(companyId) {
+  return $http({
+    url: `/duoduo-service/duoduoenv-service/userNew/switchCompany/${companyId}`,
+    method: 'POST',
+    isComParams: false,
+  });
+}
+// 天气预报
+export function getWeather() {
+  return $http({
+    isNotShowErrorToast: true,
+    url: `/duoduo-service/object-service/weather/getCurrentWeather`,
+    method: 'get'
+  });
+}
 
-export {
-    getUserHasFollowed
-}
+export { getUserHasFollowed };

+ 6 - 0
src/app.wpy

@@ -7,6 +7,9 @@
   justify-content: space-between;
   box-sizing: border-box;
 }
+page {
+  height: 100%;
+}
 </style>
 
 <script>
@@ -71,6 +74,9 @@ wepy.app({
           'pages/personalCenter/personalInfo',
           'pages/personalCenter/operating',
           'pages/personalCenter/xiaosa',
+          'pages/administration/index',
+          'pages/administration/asuccess',
+          'pages/administration/chooseIdentity'
         ]
       },
     ],

+ 71 - 0
src/packagesEnv/pages/administration/asuccess.wpy

@@ -0,0 +1,71 @@
+<style lang="less">
+.aIndex {
+  height: 100%;
+  overflow: hidden;
+  position: relative;
+  background-color: #ebf5fa;
+  background-repeat: no-repeat;
+  background-size: contain;
+  padding-top: 400rpx;
+  box-sizing: border-box;
+  
+  .aImageDiv {
+    text-align: center;
+    margin-bottom: 46rpx;
+    .image {
+      width: 375px;
+    }
+  }
+
+  .aInfo {
+    text-align: center;
+    color: #1b2129;
+    font-size: 18px;
+    line-height: 22px;
+  }
+}
+</style>
+<template>
+<div class="aIndex" :style="{'background-image': 'url('+h5StaticPath+'adminBack.png)'}">
+  <navigationbar></navigationbar>
+  <div class="aImageDiv">
+    <image class="image" :src="h5StaticPath+'successPc.png'" mode="widthFix" />
+  </div>
+  <div class="aInfo">登录成功</div>
+</div>
+</template>
+
+<script>
+import wepy from '@wepy/core';
+import eventHub from '@/common/eventHub';
+import { mapState } from '@wepy/x';
+import store from '@/store';
+import config from '@/config';
+
+wepy.page({
+  store,
+  config: {},
+  data: {
+    h5StaticPath: config.h5StaticPath + '/page-home/',
+  },
+  computed: {
+    ...mapState({
+      userInfo: (state) => state.user.userInfo,
+      projctId: (state) => state.user?.userInfo?.projctId,
+      companyId: (state) => state.user?.userInfo?.companyId,
+    }),
+  },
+  methods: {},
+  onLoad() {},
+  onShow() {},
+});
+</script>
+<config>
+{
+"navigationStyle":"custom",
+usingComponents: {
+  "van-icon": "module:@vant/weapp/dist/icon",
+  "navigationbar":'./navigationbar',
+}
+}
+</config>

+ 191 - 0
src/packagesEnv/pages/administration/chooseIdentity.wpy

@@ -0,0 +1,191 @@
+<style lang="less">
+.overflow-wrap {
+  box-sizing: border-box;
+  position:relative;
+  width: 100%;
+  height: 100%;
+  background-color: #ebf5fa;
+  background-repeat: no-repeat;
+  background-size: contain;
+  padding-left: 40rpx;
+  padding-right: 40rpx;
+  padding-top: 166rpx;
+  padding-bottom: 208rpx;
+  overflow-y: auto;
+
+  .bind-item {
+    position: relative;
+    width: 100%;
+    box-sizing: border-box;
+    padding: 40rpx 48rpx;
+    margin: 0 auto;
+    margin-top: 24rpx;
+    background: #ffffff;
+    border-radius: 20px;
+    overflow: hidden;
+    // &:nth-child(1) {
+    //   margin-top: 34rpx;
+    // }
+    .checked-icon {
+      position: absolute;
+      right: 0;
+      top: 0;
+      width: 56rpx;
+      height: 56rpx;
+    }
+    .tenant-name {
+      font-family: PingFang SC;
+      font-size: 36rpx;
+      font-weight: 500;
+      line-height: 50rpx;
+      letter-spacing: 0px;
+    }
+    .tenant-identity {
+      display: flex;
+      padding-top: 8rpx;
+      justify-content: space-between;
+      font-family: PingFang SC;
+
+      .info {
+        font-size: 28rpx;
+        font-weight: 400;
+        padding: 8rpx;
+        //styleName: 14/常规;
+        font-family: PingFang SC;
+        font-weight: 400;
+        color: #8b949e;
+      }
+      image {
+        width: 112rpx;
+        height: 40rpx;
+      }
+    }
+  }
+  .check-item {
+    background: #3dcbcc4d;
+  }
+  .bind-btn-box {
+    position: fixed;
+    z-index: 333;
+    bottom: 0;
+    left: 0;
+    height: 208rpx;
+    width: 100%;
+    background: linear-gradient(
+      180deg,
+      rgba(235, 245, 250, 0) 0%,
+      #ebf5fa 44.97%
+    );
+    button {
+      margin-top: 20px;
+      width: 670rpx;
+      height: 100rpx;
+      line-height: 100rpx;
+      border: none;
+      border-color: transparent;
+      color: #fff;
+      border-radius: 28px;
+      background: #3dcbcc;
+    }
+  }
+}
+</style>
+<template>
+  <div class="overflow-wrap"  :style="{'background-image': 'url('+h5StaticPath+'/page-home/adminBack.png)'}">
+    <navigationbar :ntitle="'选择登录身份'"></navigationbar>
+   <div class="bind-item" >
+      <div class="tenant-name">博锐尚格技术有限公司</div>
+      <div class="tenant-identity">
+        <div class="info">正式员工</div>
+        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
+      </div>
+      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
+   </div>
+   <div class="bind-item" >
+      <div class="tenant-name">博锐尚格技术有限公司</div>
+      <div class="tenant-identity">
+        <div class="info">正式员工</div>
+        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
+      </div>
+      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
+   </div>
+   <div class="bind-item" >
+      <div class="tenant-name">博锐尚格技术有限公司</div>
+      <div class="tenant-identity">
+        <div class="info">正式员工</div>
+        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
+      </div>
+      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
+   </div>
+   <div class="bind-item" >
+      <div class="tenant-name">博锐尚格技术有限公司</div>
+      <div class="tenant-identity">
+        <div class="info">正式员工</div>
+        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
+      </div>
+      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
+   </div>
+   <div class="bind-item" >
+      <div class="tenant-name">博锐尚格技术有限公司</div>
+      <div class="tenant-identity">
+        <div class="info">正式员工</div>
+        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
+      </div>
+      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
+   </div>
+   <div class="bind-item" >
+      <div class="tenant-name">博锐尚格技术有限公司</div>
+      <div class="tenant-identity">
+        <div class="info">正式员工</div>
+        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
+      </div>
+      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
+   </div>
+   <div class="bind-item" >
+      <div class="tenant-name">博锐尚格技术有限公司</div>
+      <div class="tenant-identity">
+        <div class="info">正式员工</div>
+        <image class="logo-icon"  src="{{h5StaticPath+'/page-bind-tenant/logo_icon.svg'}}"/>
+      </div>
+      <image class="checked-icon"   src="{{h5StaticPath+'/page-bind-tenant/checked.svg'}}"/>
+   </div>
+   <div class="bind-btn-box">
+    <button @click.stop="bindTent">确认</button>
+   </div>
+ </div>
+</template>
+
+<script>
+import wepy from '@wepy/core';
+import eventHub from '@/common/eventHub';
+import { mapState } from '@wepy/x';
+import store from '@/store';
+import config from '@/config';
+
+wepy.page({
+  store,
+  config: {},
+  data: {
+    h5StaticPath: config.h5StaticPath,
+  },
+  computed: {
+    ...mapState({
+      userInfo: (state) => state.user.userInfo,
+      projctId: (state) => state.user?.userInfo?.projctId,
+      companyId: (state) => state.user?.userInfo?.companyId,
+    }),
+  },
+  methods: {},
+  onLoad() {},
+  onShow() {},
+});
+</script>
+<config>
+{
+"navigationStyle":"custom",
+usingComponents: {
+  "van-icon": "module:@vant/weapp/dist/icon",
+  "navigationbar":'./navigationbar',
+}
+}
+</config>

+ 122 - 0
src/packagesEnv/pages/administration/index.wpy

@@ -0,0 +1,122 @@
+<style lang="less">
+.aIndex {
+  height: 100%;
+  overflow: hidden;
+  position: relative;
+  background-color: #ebf5fa;
+  background-repeat: no-repeat;
+  background-size: contain;
+  box-sizing: border-box;
+  .top {
+    position: relative;
+    top: 18%;
+  }
+  .aTitle {
+    text-align: center;
+    color: #2e3742;
+    font-size: 22px;
+    font-weight: 600;
+    line-height: 32px;
+    margin-bottom: 72rpx;
+  }
+  .aImageDiv {
+    position: relative;
+    text-align: center;
+    margin-bottom: 72rpx;
+    .image {
+      width: 204px;
+    }
+  }
+  .aLink {
+    text-align: center;
+    color: #8b949e;
+    font-size: 14px;
+    line-height: 22px;
+    margin-bottom: 16rpx;
+    .copy {
+      margin-left: 8px;
+      color: #1db1b2;
+    }
+  }
+  .aButton {
+    text-align: center;
+    color: #ffffff;
+    font-size: 16px;
+    line-height: 50px;
+    background: #3dcbcc;
+    width: 275px;
+    height: 50px;
+    border-radius: 28px;
+    margin: 0 auto 32rpx;
+    display: flex;
+    align-items: center;
+    justify-content: center;
+  }
+  .aInfo {
+    text-align: center;
+    color: #8b949e;
+    font-size: 14px;
+    line-height: 22px;
+  }
+  .bottom {
+    position: absolute;
+    bottom: 9%;
+    left: 0;
+    width: 100%;
+  }
+}
+</style>
+<template>
+<div class="aIndex" :style="{'background-image': 'url('+h5StaticPath+'adminBack.png)'}">
+  <navigationbar></navigationbar>
+  <div class="top">
+    <div class="aTitle">登录电脑行政端</div>
+    <div class="aImageDiv">
+      <image class="image" :src="h5StaticPath+'administration.png'" mode="widthFix" />
+    </div>
+    <div class="aLink">行政端:sagacare.tenants.link</div>
+    <div class="aLink">用电脑打开上方行政端网址<span class="copy">复制网址</span></div>
+  </div>
+  <div class="bottom">
+    <div class="aButton">
+      <van-icon name="scan" style="margin-right:8px;"/>扫码登录
+    </div>
+  <div class="aInfo">扫一扫行政端二维码,登录行政端</div>
+  </div>
+</div>
+</template>
+
+<script>
+import wepy from '@wepy/core';
+import eventHub from '@/common/eventHub';
+import { mapState } from '@wepy/x';
+import store from '@/store';
+import config from '@/config';
+
+wepy.page({
+  store,
+  config: {},
+  data: {
+    h5StaticPath: config.h5StaticPath + '/page-home/',
+  },
+  computed: {
+    ...mapState({
+      userInfo: (state) => state.user.userInfo,
+      projctId: (state) => state.user?.userInfo?.projctId,
+      companyId: (state) => state.user?.userInfo?.companyId,
+    }),
+  },
+  methods: {},
+  onLoad() {},
+  onShow() {},
+});
+</script>
+<config>
+{
+"navigationStyle":"custom",
+usingComponents: {
+  "van-icon": "module:@vant/weapp/dist/icon",
+  "navigationbar":'./navigationbar',
+}
+}
+</config>

+ 74 - 0
src/packagesEnv/pages/administration/navigationbar.wpy

@@ -0,0 +1,74 @@
+<style lang="less">
+.nwrap {
+  position: fixed;
+  left: 0;
+  top: 0;
+  width: 100%;
+  box-sizing: border-box;
+  z-index: 2;
+  // background: rgba(61, 203, 204, 0.2);
+
+  .arrow {
+    position: absolute;
+    top: 0;
+    left: 16px;
+  }
+  .title {
+    font-size: 18px;
+    font-weight: 500;
+    line-height: 24px;
+    text-align: center;
+    color: #1b2129;
+  }
+}
+</style>
+<template>
+  <div class="nwrap" style="height:{{ barHeight }}px;padding-top:{{ barTop }}px;">
+    <div class="arrow" style="top:{{ barTop }}px" @click="goBack"><van-icon name="arrow-left" size="20"/></div>
+    <div class="title" v-if="ntitle">{{ ntitle?ntitle:'' }}</div>
+  </div>
+
+</template>
+
+<script>
+import wepy from '@wepy/core';
+import store from '@/store';
+import config from '@/config';
+
+wepy.component({
+  store,
+  props: { ntitle: String },
+  data: {
+    h5StaticPath: config.h5StaticPath + '/page-home/',
+    barTop: 0,
+    barHeight: 0,
+  },
+  ready() {
+    debugger;
+
+    // 胶囊按钮位置信息
+    const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
+    console.log('menuButtonInfo', menuButtonInfo);
+    this.barTop = menuButtonInfo.top + 4;
+    this.barHeight = menuButtonInfo.top + menuButtonInfo.height;
+  },
+  detached() {
+    debugger;
+    console.log('detacheddetached');
+  },
+  watch: {},
+  methods: {
+    goBack() {
+      wx.navigateBack();
+    },
+  },
+});
+</script>
+<config>
+{
+"navigationStyle":"custom",
+usingComponents: {
+  "van-icon": "module:@vant/weapp/dist/icon",
+}
+}
+</config>

+ 5 - 1
src/packagesEnv/pages/home/carboncredit.wpy

@@ -1,13 +1,17 @@
 <style lang="less">
 .box {
   padding: 118px 20px 60px;
+  background-color: #ebf5fa;
+  background-repeat: no-repeat;
+  background-size: contain;
+
   .image {
     width: 100%;
   }
 }
 </style>
 <template>
-<div class="box">
+<div class="box" :style="{'background-image': 'url('+h5StaticPath+'detailBack.jpg)'}">
   <navigationbar></navigationbar>
   <image class="image" :src="h5StaticPath+'carboncredit.svg'" mode="widthFix"/></div>
 </template>

+ 167 - 35
src/packagesEnv/pages/home/index.wpy

@@ -1,20 +1,25 @@
 <style lang="less">
 .homeIndex {
-  padding: 68px 12px 30px;
+  padding: 68px 0px 30px;
   position: relative;
-  background: #96f2e3;
+  background-color: #ebf5fa;
+  background-repeat: no-repeat;
+  background-size: contain;
+
   .projectTitle {
     color: #1f2429;
     font-size: 22px;
     line-height: 32px;
     font-weight: 500;
     display: flex;
+    padding-left: 20px;
     .name {
       margin-right: 5px;
     }
   }
 
   .projectInfo {
+    padding-left: 20px;
     color: #626c78;
     font-size: 13px;
     line-height: 20px;
@@ -46,6 +51,8 @@
     z-index: 2;
     white-space: nowrap;
     margin-top: 27px;
+    // padding: 0 20px;
+    overflow: hidden;
   }
   .scroll-view-item {
     position: relative;
@@ -53,12 +60,12 @@
     display: inline-block;
     width: 280px;
     height: 350px;
-    margin-right: 12px;
     background: red;
     border-radius: 24px;
+    margin-right: 12px;
     .itemCont {
       position: relative;
-      top: 106px;
+      bottom: -260px;
       padding-left: 22px;
       line-height: 32px;
       font-size: 22px;
@@ -84,6 +91,15 @@
         }
       }
     }
+    .envirItem {
+      // top: 270px;
+    }
+  }
+  .scroll-view-item:nth-child(1) {
+    margin-left: 20px;
+  }
+  .scroll-view-item:nth-last-child(1) {
+    margin-right: 20px;
   }
   .scroll-view2 {
     position: relative;
@@ -92,12 +108,14 @@
     z-index: 2;
     white-space: nowrap;
     margin-top: 25px;
+    // padding: 0 20px;
+    overflow: hidden;
   }
   .scroll-view-item2 {
     display: inline-block;
     min-width: 164px;
     height: 76px;
-    margin-right: 10px;
+    margin-right: 8px;
     background: #fff;
     border-radius: 20px;
     padding-top: 15px;
@@ -128,7 +146,14 @@
       }
     }
   }
+  .scroll-view-item2:nth-child(1) {
+    margin-left: 20px;
+  }
+  .scroll-view-item2:nth-last-child(1) {
+    margin-right: 20px;
+  }
   .menuWrap {
+    padding: 0 20px;
     .menuHeader {
       color: #626c78;
       line-height: 24px;
@@ -140,10 +165,10 @@
       overflow: hidden;
     }
     .menuItem {
-      width: 106px;
+      width: 205rpx;
       height: 84px;
       border-radius: 20px;
-      margin-right: 8px;
+      margin-right: 15rpx;
       float: left;
       background: #fff;
       margin-bottom: 8px;
@@ -178,7 +203,7 @@
         &:hover {
           background: #f1f4f6;
         }
-        &:sel {
+        &.sel {
           color: #1db1b2;
         }
       }
@@ -196,35 +221,34 @@
   }
 }
 .van-popup {
-  background-color: red;
 }
 </style>
 <template>
-<div class="homeIndex">
+<div class="homeIndex" :style="{'background-image': 'url('+h5StaticPath+'homeBack.jpg)'}">
   <div class="projectTitle"  @click="showProject"><span class="name">上格云</span><van-icon name="arrow-down" size="20"/></div>
   <div class="projectInfo">成为一家牛的让员工幸福的企业</div>
-  <div class="weather"><image class="image" :src="h5StaticPath+'cloudy.png'"/><span class="value">26.5℃</span><span class="text">晴</span></div>
+  <div class="weather"><image class="image" :src="h5StaticPath+weather.imgname"/><span class="value">{{weather.temperature}}℃</span><span class="text">{{weather.text}}</span></div>
   <scroll-view scroll-x="true" class="scroll-view">
     <view class="scroll-view-item">
-      <div class="itemCont">
+      <div class="itemCont" v-if="reSpaceId">
         <div class="spaceName">上格云<span class="resident">常驻工区</span></div>
-        <div class="environment"><span class="param">25℃</span><span class="param">299ppm</span><span class="param">0.09μg/m³</span></div>
+        <div class="environment"><span class="param">{{spaceParam.temperature}}℃</span><span class="param">{{spaceParam.co2}}ppm</span><span class="param">{{spaceParam.pm25}}μg/m³</span></div>
       </div>
-      <div class="itemCont">去设置<br>您的常驻工区<van-icon name="arrow" size="20"/></div>
+      <div class="itemCont" v-if="!reSpaceId">去设置<br>您的常驻工区<van-icon name="arrow" size="20"/></div>
     </view>
-    <view class="scroll-view-item"><div class="itemCont">环境健康小知识<van-icon name="arrow" size="20"/></div></view>
-  </scroll-view>
-  <scroll-view scroll-x="true" class="scroll-view2">
-    <view class="scroll-view-item2"><div class="title">开启照明</div><div class="info">快速启动</div><div class="imageDiv">
+    <view class="scroll-view-item"><div class="itemCont envirItem">环境健康小知识<van-icon name="arrow" size="20"/></div></view>
+  </scroll-view>  
+   <scroll-view scroll-x="true" class="scroll-view2">
+    <view class="scroll-view-item2" v-if="showCard.openLight"><div class="title">开启照明</div><div class="info">快速启动</div><div class="imageDiv">
       <image class="image" :src="h5StaticPath+'lamb.png'"/>
     </div></view>
-    <view class="scroll-view-item2"><div class="title">调高温度</div><div class="info">快速启动</div><div class="imageDiv">
+    <view class="scroll-view-item2"  v-if="showCard.raiseTemperature"><div class="title">调高温度</div><div class="info">快速启动</div><div class="imageDiv">
       <image class="image" :src="h5StaticPath+'airAdjust.png'"/>
     </div></view>
-    <view class="scroll-view-item2"><div class="title">调低温度</div><div class="info">快速启动</div><div class="imageDiv">
+    <view class="scroll-view-item2"  v-if="showCard.lowerTemperature"><div class="title">调低温度</div><div class="info">快速启动</div><div class="imageDiv">
       <image class="image" :src="h5StaticPath+'airAdjust.png'"/>
     </div></view>
-    <view class="scroll-view-item2"><div class="title">一键全关</div><div class="info">快速全关</div><div class="imageDiv">
+    <view class="scroll-view-item2"  v-if="showCard.oneClickFullClose"><div class="title">一键全关</div><div class="info">快速全关</div><div class="imageDiv">
       <image class="image" :src="h5StaticPath+'allClose.png'"/>
     </div></view>
     <view class="scroll-view-item2" @click="goToIntroduce('overtime')"><div class="title">如何预约加时?</div><div class="info">点击查看<van-icon name="arrow" size="14"/></div></view>
@@ -247,14 +271,7 @@
 <van-popup :show="show" position="bottom"  @close="hideProject" round>
   <div class="projectPop">
     <div class="projectWrap" style="max-height:{{screenHeight-200}}px">
-      <div class="projectItem">上格云11</div><div class="projectItem">上格云22</div>
-      <div class="projectItem">上格云33</div><div class="projectItem">上格云44</div>
-      <div class="projectItem">上格云11</div><div class="projectItem">上格云22</div>
-      <div class="projectItem">上格云33</div><div class="projectItem">上格云44</div>
-      <div class="projectItem">上格云11</div><div class="projectItem">上格云22</div>
-      <div class="projectItem">上格云33</div><div class="projectItem">上格云44</div>
-      <div class="projectItem">上格云11</div><div class="projectItem">上格云22</div>
-      <div class="projectItem">上格云33</div><div class="projectItem">上格云44</div>
+      <div class="projectItem"  :class="{'sel':item.id==userInfo.companyId}" v-for="(item, index) in projectList" :key="index" @click="projectClick(item)">{{ item.name }}</div>
     </div>
     <div class="button">取消</div>
   </div>
@@ -267,20 +284,96 @@ import wepy from '@wepy/core';
 import eventHub from '@/common/eventHub';
 import { mapState } from '@wepy/x';
 import store from '@/store';
-import testMixin from '@/mixins/test';
 import config from '@/config';
+import {
+  querySpaceFunctionCard,
+  getSpaceProperty,
+  switchCompany,
+  getWeather,
+} from '@/api/home.js';
+import { getCompanyDataByPhone, wxLogin } from '@/service/user.js';
 
 wepy.page({
   store,
-  config: {
-    navigationBarTitleText: 'test',
-  },
+  config: {},
   data: {
     show: false,
     h5StaticPath: config.h5StaticPath + '/page-home/',
     screenHeight: 560,
+    projectList: [],
+    reSpaceId: '', //常驻空间
+    showCard: {},
+    spaceParam: {},
+    weather: {},
+  },
+  computed: {
+    ...mapState({
+      userInfo: (state) => state.user.userInfo,
+      projctId: (state) => state.user?.userInfo?.projctId,
+      companyId: (state) => state.user?.userInfo?.companyId,
+    }),
   },
   methods: {
+    loadData() {
+      //常驻空间快速调节卡片
+      querySpaceFunctionCard({
+        userId: this.userInfo.userId,
+        companyId: this.userInfo.companyId,
+      })
+        .then((res) => {
+          console.log('querySpaceFunctionCard', res);
+        })
+        .catch((err) => {
+          this.reSpaceId = 'xxxx';
+          this.showCard = {
+            openLight: 1,
+            raiseTemperature: 2,
+            lowerTemperature: 3,
+            // oneClickFullClose: 4,
+          };
+          console.log('showCardshowCard', this.showCard);
+
+          //常驻空间参数属性
+          this.reSpaceId &&
+            getSpaceProperty({
+              projectId: this.userInfo.projectId,
+              spaceId: this.reSpaceId,
+            })
+              .then((res) => {
+                console.log('getSpaceProperty', res);
+              })
+              .catch((err) => {
+                this.spaceParam = {
+                  hcho: 0,
+                  pm25: 0,
+                  co2: 0,
+                  temperature: 0,
+                  humidity: 0,
+                };
+              });
+        });
+    },
+    projectClick: function(item) {
+      //console.log('projectClickprojectClick', item);
+      this.show = false;
+      switchCompany(item.id)
+        .then((res) => {
+          wxLogin()
+            .then((res) => {})
+            .catch((err) => {
+              this.loadData();
+            });
+        })
+        .catch((err) => {
+          debugger;
+          console.log('switchCompanyswitchCompany');
+          wxLogin()
+            .then((res) => {})
+            .catch((err) => {
+              this.loadData();
+            });
+        });
+    },
     hideProject: function() {
       this.show = false;
     },
@@ -294,7 +387,6 @@ wepy.page({
       });
     },
     goToIntroduce(id) {
-      debugger;
       wx.navigateTo({
         url: '/packagesEnv/pages/home/' + id,
       });
@@ -314,8 +406,48 @@ wepy.page({
     // 获取系统信息
     const systemInfo = wx.getSystemInfoSync();
     this.screenHeight = systemInfo.screenHeight;
-    console.log('systemInfo', systemInfo);
+    //console.log('systemInfo', systemInfo);
+
+    //获取项目list
+    getCompanyDataByPhone()
+      .then((res) => {
+        console.log('getCompanyDataByPhone', res);
+      })
+      .catch((err) => {
+        this.projectList = [
+          { name: '上格云', id: 'aaaa' },
+          { name: '上格云1', id: 'bb' },
+          { name: '上格云2', id: 'cc' },
+          { name: '上格云3' },
+        ];
+      });
+    getWeather()
+      .then((res) => {})
+      .catch((err) => {
+        this.weather = { temperature: 30, text: '云' };
+        var text = '云';
+        var imgname = 'sunny.png';
+        if (text.indexOf('晴') > -1) {
+          imgname = 'sunny.png';
+        } else if (text.indexOf('雨') > -1) {
+          imgname = 'rain.png';
+        } else if (text.indexOf('阴') > -1) {
+          imgname = 'cloudy.png';
+        } else if (text.indexOf('云') > -1) {
+          imgname = 'muchCloud.png';
+        } else if (text.indexOf('雾') > -1 || text.indexOf('霾') > -1) {
+          imgname = 'fog.png';
+        } else if (text.indexOf('风') > -1) {
+          imgname = 'wind.png';
+        } else if (text.indexOf('雪') > -1) {
+          imgname = 'snow.png';
+        }
+
+        this.weather.imgname = imgname;
+      });
+    this.loadData();
   },
+  onShow() {},
 });
 </script>
 <config>

+ 2 - 3
src/packagesEnv/pages/home/navigationbar.wpy

@@ -1,6 +1,6 @@
 <style lang="less">
 .arrow {
-  position: absolute;
+  position: fixed;
   left: 16px;
 }
 </style>
@@ -13,7 +13,7 @@ import wepy from '@wepy/core';
 import store from '@/store';
 import config from '@/config';
 
-wepy.page({
+wepy.component({
   store,
   props: {},
   data: {
@@ -22,7 +22,6 @@ wepy.page({
   },
   ready() {
     debugger;
- 
     // 胶囊按钮位置信息
     const menuButtonInfo = wx.getMenuButtonBoundingClientRect();
     // console.log('menuButtonInfo', menuButtonInfo);

+ 5 - 1
src/packagesEnv/pages/home/overtime.wpy

@@ -1,13 +1,17 @@
 <style lang="less">
 .box {
   padding: 118px 20px 60px;
+  background-color: #ebf5fa;
+  background-repeat: no-repeat;
+  background-size: contain;
+
   .image {
     width: 100%;
   }
 }
 </style>
 <template>
-<div class="box">
+<div class="box" :style="{'background-image': 'url('+h5StaticPath+'detailBack.jpg)'}">
   <navigationbar></navigationbar>
   <image class="image" :src="h5StaticPath+'overtime.svg'" mode="widthFix"/>
 </div>

+ 5 - 1
src/packagesEnv/pages/home/resident.wpy

@@ -2,6 +2,10 @@
 .box {
   position: relative;
   padding: 118px 20px 120px;
+  background-color: #ebf5fa;
+  background-repeat: no-repeat;
+  background-size: contain;
+
   .image {
     width: 100%;
   }
@@ -20,7 +24,7 @@
 }
 </style>
 <template>
-<div class="box">
+<div class="box" :style="{'background-image': 'url('+h5StaticPath+'detailBack.jpg)'}">
   <navigationbar></navigationbar>
   <image class="image" :src="h5StaticPath+'resident.svg'" mode="widthFix"/>
   <div class="button">去设置常驻工区</div>