chenzhen2 пре 1 година
родитељ
комит
6cb08bc5a3

+ 6 - 0
src/apis/envmonitor.ts

@@ -15,6 +15,12 @@ export const getCompanyInfo = (companyInfo: RequestParams) => {
 export const getWeather = () => {
   return https().request<RootWeatherObject<OutherWeather>>(`${objectService}weather/getCurrent`, Method.GET, undefined, ContentType.json)
 }
+
+// 获取环境数据
+export const queryEnvCurrent = () => {
+  return https().request<RootWeatherObject<OutherWeather>>(`${setupService}environment/queryEnvCurrent`, Method.GET, undefined, ContentType.json)
+}
+
 export const getSpaceInfo = (data: any) => {
   return https().request<RootWeatherObject<SpaceModel>>(`${duoduoenvService}space/property`, Method.POST, data, ContentType.json)
 }

+ 6 - 7
src/store/index.ts

@@ -1,16 +1,16 @@
-import {createStore, createLogger} from 'vuex'
-import {store as permission, PermissionStore, PermissionState} from '@/store/modules/permission'
-import {store as user, UserStore, UserState} from '@/store/modules/user'
-import {store as portait, PortaitStore, PortaitState} from '@/store/modules/portait'
+import { createStore, createLogger } from 'vuex'
+import { store as permission, PermissionStore, PermissionState } from '@/store/modules/permission'
+import { store as user, UserStore, UserState } from '@/store/modules/user'
+// import {store as portait, PortaitStore, PortaitState} from '@/store/modules/portait'
 
 export interface RootState {
   permission: PermissionState
   user: UserState,
-  portait:PortaitState
+  // portait:PortaitState
 }
 
 export type Store = PermissionStore<Pick<RootState, 'permission'>>
-  & UserStore<Pick<RootState, 'user'>>  & PortaitStore<Pick<RootState, 'portait'>>
+  & UserStore<Pick<RootState, 'user'>>
 
 // Plug in logger when in development environment
 const debug = process.env.NODE_ENV !== 'production'
@@ -23,7 +23,6 @@ export const store = createStore({
   modules: {
     permission,
     user,
-    portait
   }
 })
 

+ 0 - 29
src/store/modules/portait/index.ts

@@ -1,29 +0,0 @@
-import {
-  Store as VuexStore,
-  CommitOptions,
-  Module
-} from 'vuex'
-
-// TODO: How to surpass cyclical dependency linting errors cleanly?
-import {RootState} from '@/store'
-import {state} from './state'
-import {mutations, Mutations} from './mutations'
-import type {PortaitState} from './state'
-
-export {PortaitState}
-
-export type PortaitStore<S = PortaitState> = Omit<VuexStore<S>, 'getters' | 'commit' | 'dispatch'>
-  & {
-  commit<K extends keyof Mutations, P extends Parameters<Mutations[K]>[1]>(
-    key: K,
-    payload: P,
-    options?: CommitOptions
-  ): ReturnType<Mutations[K]>
-}
-export const store: Module<PortaitState, RootState> = {
-  state,
-  mutations
-  // TODO: With namespaced option turned on, having problem how to use dispatch with action types...
-  // But without it, a bigger store might have clashes in namings
-  // namespaced: true,
-}

+ 0 - 4
src/store/modules/portait/mutation-types.ts

@@ -1,4 +0,0 @@
-export enum PortaitMutationTypes {
-  SET_AIR = 'SET_AIR',
-  SET_LIGHT = 'SET_LIGHT',
-}

+ 0 - 19
src/store/modules/portait/mutations.ts

@@ -1,19 +0,0 @@
-import {MutationTree} from 'vuex'
-import {PortaitState} from './state'
-import {PortaitMutationTypes} from './mutation-types'
-
-export type Mutations<S = PortaitState> = {
-  [PortaitMutationTypes.SET_AIR](state: S, airConditioner: boolean): void
-  [PortaitMutationTypes.SET_AIR](state: S, light: boolean): void
-}
-
-export const mutations: MutationTree<PortaitState> & Mutations = {
-  [PortaitMutationTypes.SET_AIR](state: PortaitState, airConditioner: boolean) {
-    state.airConditioner = airConditioner
-  },
-  [PortaitMutationTypes.SET_LIGHT](state: PortaitState, light: boolean) {
-    state.light = light
-  }
-}
-
-

+ 0 - 11
src/store/modules/portait/state.ts

@@ -1,11 +0,0 @@
-import {getSession} from "@/utils";
-
-export interface PortaitState {
-  airConditioner: boolean,
-  light: boolean
-}
-
-export const state: PortaitState = {
-  airConditioner: getSession('portraitModule').airConditioner ? getSession('portraitModule').airConditioner : true,
-  light: getSession('portraitModule').light ? getSession('portraitModule').light : true
-}

+ 0 - 1
src/store/modules/user/actions.ts

@@ -10,7 +10,6 @@ import router, { resetRouter } from '@/router'
 import { useRoute, useRouter } from 'vue-router'
 import { RouteRecordRaw } from 'vue-router'
 import { getUsersInfo } from '@/apis/user'
-import { clearAllLocalData, getLocalProjectId, setLocalProjectId } from '@/utils'
 import { Toast } from 'vant'
 import { queryWorkSpace } from '@/apis/envmonitor'
 

+ 30 - 419
src/utils/index.ts

@@ -219,36 +219,19 @@ export function getAddYear(year: number = 0) {
   return new Date(y + '/' + m)
 }
 
-/**
- *
- *  获取上一个月,日期格式yyyyMM
- */
-export function getPreMonth(formatType: any = '') {
-  const nowdays = new Date()
-  let year = nowdays.getFullYear()
-  let month: any = nowdays.getMonth()
-  if (month === 0) {
-    month = 12
-    year = year - 1
-  }
-  if (month < 10) {
-    month = '0' + month
-  }
-  if (formatType === 'YYYY.MM') {
-    return year + '.' + month
-  } else if (formatType === 'YYYY年MM月') {
-    return year + '年' + month + '月'
-  } else {
-    return year + '' + month
-  }
-}
+
 
 /**
  * 格式化日期 3月21日
  */
-export const formatEnergyDate = function (time: any) {
+export const formatEnergyDate = function (type: any = 1) {
   //三目运算符
-  const dates = time ? new Date(time) : new Date()
+  let dates: any = null
+  if (type == 2) {
+    dates = new Date(new Date().setHours(new Date().getHours() + 1))
+  } else {
+    dates = new Date()
+  }
   //月份下标是0-11
   const months: any = (dates.getMonth() + 1) < 10 ? '0' + (dates.getMonth() + 1) : (dates.getMonth() + 1)
   //具体的天数
@@ -257,409 +240,37 @@ export const formatEnergyDate = function (time: any) {
   const hours = dates.getHours() < 10 ? '0' + dates.getHours() : dates.getHours()
   // //分钟
   const minutes = dates.getMinutes() < 10 ? '0' + dates.getMinutes() : dates.getMinutes()
+  const seconds = dates.getSeconds() < 10 ? '0' + dates.getSeconds() : dates.getSeconds()
   //返回数据格式
   return [
-    year + '年' + months + '月',
+    year + '年' + months + '月' + day + '日',
     months + '月' + day + '日',
-    hours + ':' + minutes
+    hours + ':' + minutes + ":" + seconds
   ]
 }
 
-export const setSession = function (key: any = '', obj: any = '') {
-  if (obj) {
-    let str = JSON.stringify(obj)
-    sessionStorage.setItem(key, str)
-  }
-}
-
-export const getSession = function (key: any = '') {
-  if (key) {
-    let obj: any = sessionStorage.getItem(key)
-    if (obj) {
-      return JSON.parse(obj)
-    }
-  }
-  return ''
-}
-
-/**
- * 本地存储localStorage
- * @param key
- * @param obj
- */
-export const setLocalStorage = function (key: any = '', obj: any = '') {
-  if (obj) {
-    if (obj instanceof Object) {
-      let str = JSON.stringify(obj)
-      localStorage.setItem(key, str)
-    } else {
-      localStorage.setItem(key, obj)
-    }
-  }
-}
-
-/**
- * 获取本地存储
- * @param key
- */
-export const getLocalStorage = function (key: any) {
-  if (key) {
-    let obj: any = localStorage.getItem(key)
-    if (obj) {
-      return JSON.parse(obj)
-    } else {
-      return ''
-    }
-  }
-  return ''
-}
-
-/**
- * 存储最新的空间信息
- * @param spaceInfo
- */
-export const setLocalNewSpaceInfo = function (spaceInfo: any) {
-  setLocalStorage(Keys.storageSpaceInfoKey, spaceInfo)
+// 获取当前时间是周几
+export const getWeek = function () {
+  let week:any = new Date().getDay();  
+  let str:any=''
+  if (week == 0) {  
+          str = "星期日";  
+  } else if (week == 1) {  
+          str = "星期一";  
+  } else if (week == 2) {  
+          str = "星期二";  
+  } else if (week == 3) {  
+          str = "星期三";  
+  } else if (week == 4) {  
+          str = "星期四";  
+  } else if (week == 5) {  
+          str = "星期五";  
+  } else if (week == 6) {  
+          str = "星期六";  
+  }  
 }
 
-/**
- * 获取最新的空间信息
- */
-export const getLocalNewSpaceInfo = function () {
-  let spaceInfo: any = getLocalStorage(Keys.storageSpaceInfoKey)
-  return spaceInfo
-}
 
-/**
- * 本地缓存建筑,楼层,空间
- */
-export const localStorageSpaceId = function (buildingId: any, floorId: any, spaceId: any) {
-  let spaceMap: any = getLocalStorage(Keys.storageSpaceKey) ? getLocalStorage(Keys.storageSpaceKey) : {}
-  let key: any = `${buildingId},${floorId}`
-  spaceMap[key] = spaceId
-  setLocalStorage(Keys.storageSpaceKey, spaceMap)
-}
-export const getStorageSpaceId = function () {
-  let spaceMap: any = getLocalStorage(Keys.storageSpaceKey)
-  return spaceMap
-}
 
-/**
- *  本地缓存建筑对应的楼层
- */
-export const localStorageFloor = function (buildingId: any, floorId: any) {
-  let floorMap: any = getLocalStorage(Keys.storageFloorKey) ? getLocalStorage(Keys.storageFloorKey) : {}
-  floorMap[buildingId] = floorId
-  setLocalStorage(Keys.storageFloorKey, floorMap)
-}
-/**
- * 获取本地存储的建筑对应的关系
- * @param buildingId
- * @param floorId
- */
-export const getLocalStorageFloor = function () {
-  let floorMap: any = getLocalStorage(Keys.storageFloorKey)
-  return floorMap
-}
-
-/**
- * 缓存搜索页面最近查找的数据
- * @param item
- */
-export const setLocalSearchSpace = function (item: any) {
-  let historySearch: any = getLocalStorage(Keys.historySearchSpaceKey)
-  let flag = false
-  historySearch = historySearch ? historySearch : []
-  historySearch.map((historyItem: any) => {
-    if (historyItem.id === item.id) {
-      flag = true
-    }
-  })
-  if (!flag) {
-    historySearch.push(item)
-  }
-  setLocalStorage(Keys.historySearchSpaceKey, historySearch)
-}
 
-/**
- * 获取搜索页面最近查找的数据
- */
-export const getLocalSearchSpace = function () {
-  return getLocalStorage(Keys.historySearchSpaceKey) ? getLocalStorage(Keys.historySearchSpaceKey) : []
-}
-
-/**
- *存储当前项目id
- */
-export const setLocalProjectId = function (projectId: any) {
-  setLocalStorage(Keys.projectId, projectId)
-}
 
-/**
- * 获取当前项目id
- * @param projectId
- */
-export const getLocalProjectId = function () {
-  return localStorage.getItem(Keys.projectId)
-}
-/**
- * 清楚当前所有的存储数据
- */
-export const clearAllLocalData = function () {
-  localStorage.clear()
-  Cookies.remove('userInfo')
-  Cookies.remove('projectId')
-  Cookies.remove('accessToken')
-}
-
-export const doHandleMonth = function (month: any) {
-  let m: any = month
-  if (month.toString().length == 1) {
-    m = '0' + month
-  }
-  return m
-}
-
-export const getWeekDate = function (day: any) {
-  let weeks: any = new Array(
-    '周日',
-    '周一',
-    '周二',
-    '周三',
-    '周四',
-    '周五',
-    '周六'
-  )
-  let week: any = weeks[day]
-  return week
-}
-
-export const getNowWeek = function () {
-  let date: any = new Date()
-  let day: any = date.getDay()
-  let nowWeek: any = getWeekDate(day)
-  return nowWeek
-}
-
-export const getDate = function (date: any) {
-  return date.getDate() < 10 ? '0' + date.getDate() : date.getDate()
-}
-
-/**
- * 初始化24:00
- */
-export const getTimers = function () {
-  let timers: any = new Array()
-  for (let i = 0; i <= 24; i++) {
-    let str: any = '00'
-    if (i < 10) {
-      str = '0' + i
-    } else {
-      str = i
-    }
-    timers.push(str + ':00')
-    if (i < 24) {
-      timers.push(str + ':30')
-    }
-  }
-  console.log("timers====")
-  console.log(timers)
-  return timers
-}
-
-export const getNowTime = function () {
-  let date: any = new Date()
-  let hours: any = date.getHours()
-  let minute: any = date.getMinutes()
-  let index: any = date.getHours()
-  if (minute < 30) {
-    hours = hours + ':' + '00'
-    index = index * 2
-  } else {
-    hours = hours + ':' + '30'
-    index = index * 2 + 1
-  }
-  return [hours, index]
-}
-
-// 获取当前真实时间
-export const getRelNowTime = function () {
-  let date: any = new Date()
-  let hours: any = date.getHours()
-  let minute: any = date.getMinutes()
-  if (hours < 10) {
-    hours = "0" + hours
-  }
-  if (minute < 10) {
-    minute = "0" + minute
-  }
-  return hours + "" + minute + "00"
-}
-
-/**
- * 19000转成19:00
- */
-export const formatTimerStr = function (timer: any) {
-  if (timer) {
-    let str: any = (timer / 10000).toFixed(2)
-    str = str.replace(".", ":")
-    return str
-  } else {
-    return ''
-  }
-}
-
-export const newNumber = function (start: any, end: any, masAddess: any) {
-  return masAddess + "" + Math.round(Math.random() * (end - start) + start);//生成在[start,end]范围内的随机数值,只支持不小于0的合法范围
-}
-
-export const formateTimeContinuous: any = function (index: any = 1,
-  startTime: any,
-  endTime: any,
-  type: any = 1, data: any = [], that: any) {
-  let todayDate: any = new Date()
-  let tomorrowData = new Date(todayDate.setTime(todayDate.getTime() + 24 * 60 * 60 * 1000))
-  let nowDate: any = formatDate("YYYY-MM-DD");
-  let tomorrowDate: any = formatDate("YYYY-MM-DD", tomorrowData);
-  data.map((item: any) => {
-    // debugger
-    let date: any = formatDateStr(item.date);
-    let week: any = getWeekDate(new Date(date).getDay());
-    if (date == nowDate) {
-      week = '今日'
-    } else if (date == tomorrowDate) {
-      week = '次日'
-    }
-    item.week = week;
-  });
-  // debugger
-  let text: any = "";
-  // 工作时间和第二天连续的问题
-  // 工作时间连续的问题
-  let cusStartTime: any = data[index].cusStartTime;
-  let cusEndTime: any = data[index].cusEndTime;
-  if (type === 1) {
-    // debugger;
-    if (endTime === "240000") {
-      // 处理时间连续的问题
-      let customSceneList: any = data[index]?.customSceneList ?? [];
-      if (cusStartTime === "000000") {
-        text = data[index].week;
-        endTime = cusEndTime;
-      }
-      customSceneList.map((item: any) => {
-        if (item.startTime === "000000") {
-          text = data[index].week;
-          endTime = item.endTime;
-        } else if (endTime === item.startTime) {
-          text = data[index].week;
-          endTime = item.endTime;
-        }
-        if (endTime === cusStartTime) {
-          text = data[index].week;
-          endTime = cusEndTime;
-        }
-      });
-      if (text) {
-        let nowIndex: any = index + 1;
-        that.text = text
-        if (nowIndex < data.length - 1) {
-          return formateTimeContinuous(nowIndex, startTime, endTime, 1, data, that);
-        } else {
-          return {
-            text: that.text,
-            startTime: startTime,
-            endTime: endTime,
-          };
-        }
-      } else {
-        return {
-          text: that.text,
-          startTime: startTime,
-          endTime: endTime,
-        };
-      }
-    } else {
-      return {
-        text: that.text,
-        startTime: startTime,
-        endTime: endTime,
-      };
-    }
-  } else {
-    // 预约时候后找最近的一段预约时间
-    let nowTime: any = (getNowTime()[0]).replace(":", "") + "00"
-    let customSceneList: any = data[index]?.customSceneList ?? [];
-    customSceneList.map((item: any) => {
-      if (index === 0) {
-        if (nowTime < item.startTime) {
-          if (!startTime || !endTime) {
-            startTime = item.startTime
-            endTime = item.endTime
-            text = data[index].week
-          }
-        }
-      } else {
-        if (!startTime || !endTime) {
-          startTime = item.startTime
-          endTime = item.endTime
-          text = data[index].week
-        } else {
-          // debugger
-          // debugger
-          if (endTime == '240000') {
-            if (item.startTime == "000000") {
-              endTime = item.endTime
-              text = data[index].week
-            }
-          } else {
-            if (endTime === item.startTime) {
-              endTime = item.endTime
-              text = data[index].week
-            }
-          }
-        }
-      }
-      if (that.text) {
-        let startText: any = that.text.split("~")[0]
-        that.text = startText
-        if (text && text != startText) {
-          that.text = startText + "~" + text
-        }
-      } else {
-        that.text = text
-      }
-    })
-    if (startTime && endTime) {
-      if (endTime == '240000') {
-        let nowIndex: any = index + 1
-        if (nowIndex < data.length - 1) {
-          return formateTimeContinuous(nowIndex, startTime, endTime, 2, data, that);
-        } else {
-          return {
-            text: that.text,
-            startTime: startTime,
-            endTime: endTime,
-          };
-        }
-      } else {
-        return {
-          text: that.text,
-          startTime: startTime,
-          endTime: endTime,
-        };
-      }
-    } else {
-      let nowIndex: any = index + 1
-      if (nowIndex < data.length - 1) {
-        return formateTimeContinuous(nowIndex, startTime, endTime, 2, data, that);
-      } else {
-        return {
-          text: that.text,
-          startTime: startTime,
-          endTime: endTime,
-        };
-      }
-    }
-  }
-}

+ 95 - 17
src/views/home/index.vue

@@ -49,18 +49,18 @@
           <span>首尔时间&nbsp;&nbsp;&nbsp;</span>
         </div>
         <div class="time-box">
-          <span>16:50</span>
+          <span>{{ nowTime }}</span>
           <span></span>
-          <span>17:50</span>
+          <span>{{ sTime }}</span>
         </div>
         <div class="time-line"></div>
         <div class="time-bottom">
           <div class="time-left">
             <img src="/skImage/time-icon.svg" alt="" />
-            <span>2023年3月23日</span>
+            <span>{{ nowDate }}</span>
           </div>
           <div class="time-right">
-            <span>星期四</span>
+            <span>{{ week }}</span>
           </div>
         </div>
       </div>
@@ -80,6 +80,8 @@
 </template>
 
 <script>
+import { useRouter } from "vue-router";
+import { formatEnergyDate, getWeek } from "@/utils";
 import $ from "jquery";
 import { nextTick } from "vue";
 import {
@@ -92,7 +94,75 @@ import {
 export default defineComponent({
   components: {},
   setup(props) {
+    const formatEnergyDate = function (type = 1) {
+      //三目运算符
+      let dates = null;
+      if (type == 2) {
+        dates = new Date(new Date().setHours(new Date().getHours() + 1));
+      } else {
+        dates = new Date();
+      }
+      //月份下标是0-11
+      const months =
+        dates.getMonth() + 1 < 10
+          ? "0" + (dates.getMonth() + 1)
+          : dates.getMonth() + 1;
+      //具体的天数
+      const day =
+        dates.getDate() < 10 ? "0" + dates.getDate() : dates.getDate();
+      const year = dates.getFullYear();
+      const hours =
+        dates.getHours() < 10 ? "0" + dates.getHours() : dates.getHours();
+      // //分钟
+      const minutes =
+        dates.getMinutes() < 10 ? "0" + dates.getMinutes() : dates.getMinutes();
+      const seconds =
+        dates.getSeconds() < 10 ? "0" + dates.getSeconds() : dates.getSeconds();
+      //返回数据格式
+      return [
+        year + "年" + months + "月" + day + "日",
+        months + "月" + day + "日",
+        hours + ":" + minutes,
+      ];
+    };
+    const getWeek = function () {
+      let week = new Date().getDay();
+      let str = "";
+      if (week == 0) {
+        str = "星期日";
+      } else if (week == 1) {
+        str = "星期一";
+      } else if (week == 2) {
+        str = "星期二";
+      } else if (week == 3) {
+        str = "星期三";
+      } else if (week == 4) {
+        str = "星期四";
+      } else if (week == 5) {
+        str = "星期五";
+      } else if (week == 6) {
+        str = "星期六";
+      }
+      return str
+    };
+    const router = useRouter();
     const proxyData = reactive({
+      nowTime: formatEnergyDate()[2],
+      sTime: formatEnergyDate(2)[2],
+      nowDate: formatEnergyDate()[0],
+      intevell: null,
+      week: getWeek(),
+      // 设置现在时间
+      setNowDate() {
+        proxyData.intevell = setInterval(() => {
+          let timeArr = formatEnergyDate();
+          proxyData.nowTime = timeArr[2];
+          proxyData.nowDate = timeArr[0];
+          let timeArr1 = formatEnergyDate(2);
+          proxyData.sTime = timeArr1[2];
+          proxyData.week = getWeek();
+        }, 1000);
+      },
       init() {
         let myVid = document.getElementById("video1");
         let aniThree = document.getElementById("aniThree");
@@ -163,14 +233,22 @@ export default defineComponent({
           // proxyData.updateStyle();
           // 第3部分轮播
 
-          // setTimeout(function () {
-          //   $(skSlogan).fadeOut();
-          //   $(aniThree).show();
-          //   $(logoLeft).addClass("logoLeftAni");
-          //   $(logoRight).addClass("logoRightAni");
-          //   $(line).addClass("lineAni");
-          //   $(text).addClass("lineAni");
-          // }, 15000);
+          let timer = setTimeout(function () {
+            $(skSlogan).fadeOut();
+            $(aniThree).show();
+            $(logoLeft).addClass("logoLeftAni");
+            $(logoRight).addClass("logoRightAni");
+            $(line).addClass("lineAni");
+            $(text).addClass("lineAni");
+            clearTimeout(timer);
+            let time2 = setTimeout(() => {
+              clearTimeout(time2);
+              router.push({
+                path: "/weather",
+                // query: { showSpaceTip: 'true' }
+              });
+            }, 30000);
+          }, 60000);
         });
       },
       // 动态修改样式
@@ -475,14 +553,14 @@ export default defineComponent({
   .time-line {
     margin: 0 auto;
     margin-top: 20px;
-    width: 94%;
+    width: 98%;
     height: 1px;
-    background: #7e7e80;
+    background: #c1c1c3;
   }
   .time-bottom {
-    width: 98%;
+    width: 100%;
     margin: 0 auto;
-    padding: 10px;
+    padding: 15px 0;
     font-size: 20px;
     color: #7e7e80;
     display: flex;
@@ -518,7 +596,7 @@ export default defineComponent({
       &:nth-child(2) {
         margin-top: 30px;
         height: 20px;
-        border: 1px solid #6b6b6b;
+        border: 1px solid #c1c1c3;
         // background: #6b6b6b;
       }
     }

+ 142 - 24
src/views/weather/index.vue

@@ -21,20 +21,20 @@
         <div class="weather-left">
           <div class="b-time">
             <span>北京时间</span>
-            <span>16:50:49</span>
+            <span>{{ nowTime }}</span>
           </div>
           <div class="b-time">
             <span>首尔时间</span>
-            <span>16:50:49</span>
+            <span>{{ sTime }}</span>
           </div>
           <div class="weather-detail">
             <div class="d-top">
-              <img src="/skImage/weather/snow.png" alt="" />
-              <span>20℃</span>
+              <img :src="'/skImage/weather/' + logonIcon" alt="" />
+              <span>{{ temperature }} ℃</span>
             </div>
             <div class="d-bottom">
-              <span>2023年3月14日</span>
-              <span>星期二</span>
+              <span>{{ nowDate }}</span>
+              <span>{{ week }}</span>
             </div>
           </div>
         </div>
@@ -42,35 +42,63 @@
       <div class="env-box">
         <div class="env-item env-box-bg">
           <div class="env-icon">
-            <img src="/skImage/weather/温度.png" alt="" />
+            <img
+              :src="
+                weatherKey == 'sunny'
+                  ? '/skImage/weather/温度.png'
+                  : '/skImage/weather/温度.png'
+              "
+              alt=""
+            />
             <span>温度</span>
           </div>
-          <div class="env-text">26.0</div>
+          <div class="env-text">{{ envObj.Tdb }}</div>
           <div class="env-rate">℃</div>
         </div>
         <div class="env-item env-box-bg">
           <div class="env-icon">
-            <img src="/skImage/weather/湿度.png" alt="" />
+            <img
+              :src="
+                weatherKey == 'sunny'
+                  ? '/skImage/weather/湿度.png'
+                  : '/skImage/weather/湿度.png'
+              "
+              alt=""
+            />
             <span>湿度</span>
           </div>
-          <div class="env-text">26.0</div>
+          <div class="env-text">{{ envObj.RH }}</div>
           <div class="env-rate">%</div>
         </div>
         <div class="env-item env-box-bg">
           <div class="env-icon">
-            <img src="/skImage/weather/甲醛.png" alt="" />
+            <img
+              :src="
+                weatherKey == 'sunny'
+                  ? '/skImage/weather/甲醛.png'
+                  : '/skImage/weather/甲醛.png'
+              "
+              alt=""
+            />
             <span>甲醛</span>
           </div>
-          <div class="env-text">26.0</div>
-          <div class="env-rate">mg/m</div>
+          <div class="env-text">{{ envObj.HCHO }}</div>
+          <div class="env-rate">mg/m³</div>
         </div>
         <div class="env-item env-box-bg">
           <div class="env-icon">
-            <img src="/skImage/weather/pm.png" alt="" />
+            <img
+              :src="
+                weatherKey == 'sunny'
+                  ? '/skImage/weather/pm.png'
+                  : '/skImage/weather/pm.png'
+              "
+              alt=""
+            />
             <span>PM2.5</span>
           </div>
-          <div class="env-text">26.0</div>
-          <div class="env-rate">ug/m</div>
+          <div class="env-text">{{ envObj.PM2d5 }}</div>
+          <div class="env-rate">ug/m³</div>
         </div>
       </div>
     </div>
@@ -92,7 +120,9 @@ import ran from "./rain.vue"; // 雨
 import clound from "./cloud.vue"; //  云
 import snow from "./snow.vue"; //  雪
 import sunny from "./sunny.vue"; //  晴
-import { getWeather } from "@/apis/envmonitor";
+import { getWeather, queryEnvCurrent } from "@/apis/envmonitor";
+import { formatEnergyDate, getWeek } from "@/utils";
+import { useRouter } from "vue-router";
 export default defineComponent({
   components: {
     ran,
@@ -101,10 +131,11 @@ export default defineComponent({
     sunny,
   },
   setup(props) {
-    let weatherData = [
+    const router = useRouter();
+    let weatherData: any = [
       {
         text: "云",
-        type: "cloud",
+        type: "clound",
         logonIcon: "阴.png",
       },
       {
@@ -123,10 +154,38 @@ export default defineComponent({
         logonIcon: "晴.png",
       },
     ];
+    let currentData: any = [];
+    let envObj: any = {
+      Tdb: "0", // 温度
+      RH: "0", //湿度
+      HCHO: "0", //甲醛
+      PM2d5: "0",
+    };
+    let intevell: any = null;
+    let timer: any = null;
     const proxyData = reactive({
       weatherData: weatherData,
+      envObj: envObj,
+      temperature: "",
       weatherKey: "sunny",
       logonIcon: "阴.png",
+      currentData: currentData,
+      nowTime: formatEnergyDate()[2],
+      sTime: formatEnergyDate(2)[2],
+      nowDate: formatEnergyDate()[0],
+      intevell: intevell,
+      week: getWeek(),
+      // 设置现在时间
+      setNowDate() {
+        proxyData.intevell = setInterval(() => {
+          let timeArr: any = formatEnergyDate();
+          proxyData.nowTime = timeArr[2];
+          proxyData.nowDate = timeArr[0];
+          let timeArr1: any = formatEnergyDate(2);
+          proxyData.sTime = timeArr1[2];
+          proxyData.week = getWeek();
+        }, 1000);
+      },
       // 设置天气key的值
       setWeatherKey(content: any) {
         if (content.code <= 3) {
@@ -143,22 +202,83 @@ export default defineComponent({
             proxyData.weatherKey = "sunny";
             proxyData.logonIcon = "晴.png";
           } else {
-            proxyData.weatherKey = "cloud";
+            proxyData.weatherKey = "clound";
             proxyData.logonIcon = "阴.png";
           }
         }
       },
+      // 获取天气数据
       getWeatherData() {
         getWeather().then((res) => {
           let resResult: any = res;
           let content: any = resResult.content;
+          proxyData.temperature = content.temperature;
           proxyData.setWeatherKey(content);
         });
       },
+      timer: timer,
+      setTimer(timeLen: any = 600000) {
+        proxyData.timer = setInterval(() => {
+          proxyData.setEnvData();
+          proxyData.queryEnvCurrent();
+        }, timeLen);
+      },
+      // 设置环境数据
+      setEnvData() {
+        proxyData.envObj = {
+          Tdb: "0", // 温度
+          RH: "0", //湿度
+          HCHO: "0", //甲醛
+          PM2d5: "0",
+        };
+        proxyData.currentData.map((item: any) => {
+          if (item.code == "Tdb") {
+            item.data = item.data ? item.data.toFixed(1) : "--";
+          } else if (item.code == "RH") {
+            item.data = item.data ? item.data.toFixed(0) : "--";
+          } else if (item.code == "PM2d5") {
+            item.data = item.data ? item.data.toFixed(0) : "--";
+          } else {
+            item.data = item.data ? item.data.toFixed(2) : "--";
+          }
+
+          proxyData.envObj[item.code] = item.data;
+        });
+      },
+      // 获取环境数据
+      queryEnvCurrent() {
+        queryEnvCurrent()
+          .then((res) => {
+            let resResult: any = res;
+            if (resResult.result == "success") {
+              proxyData.currentData = resResult.data || [];
+            } else {
+              proxyData.currentData = [];
+            }
+            proxyData.setEnvData();
+          })
+          .catch((error: any) => {
+            proxyData.currentData = [];
+          });
+      },
+      changePage() {
+        let times: any = setTimeout(() => {
+          clearTimeout(times);
+          router.push({ path: "/home" });
+        }, 300000);
+      },
+    });
+    onBeforeUnmount(() => {
+      clearInterval(proxyData.intevell);
+      clearInterval(proxyData.timer);
     });
-    onBeforeUnmount(() => {});
     onMounted(() => {
+      proxyData.setNowDate();
+      // 获取天气数据
       proxyData.getWeatherData();
+      // 获取环境数据
+      proxyData.queryEnvCurrent();
+      // proxyData.setTimer();
     });
     return {
       ...toRefs(proxyData),
@@ -203,7 +323,7 @@ export default defineComponent({
         }
         span {
           display: inline-block;
-          margin-left: 10px;
+          margin-left: 20px;
           vertical-align: middle;
           font-size: 60px;
           font-weight: 500;
@@ -219,8 +339,6 @@ export default defineComponent({
         font-weight: 700;
         letter-spacing: 0px;
         color: rgba(255, 255, 255, 1);
-        text-align: left;
-        vertical-align: top;
       }
       .env-rate {
         padding-top: 80px;