|
@@ -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>
|