Browse Source

定时添加

dev_230517
刘洪超 2 years ago
parent
commit
eea94ccd12
  1. 2
      src/view/device-detail/whole-setting.vue
  2. 29
      src/view/tabs/fixed-time.vue
  3. 15
      src/view/tabs/home-screen.vue
  4. 25
      src/view/timing/timing-add.vue
  5. 6
      src/view/ui/env-select.vue

2
src/view/device-detail/whole-setting.vue

@ -137,7 +137,7 @@ const setData = () => {
* 全屋设定Event通知值变化 * 全屋设定Event通知值变化
*/ */
const wholeSetting = () => { const wholeSetting = () => {
proxy.$eventBusService.emit("selectNumEvent", tem); proxy.$eventBusService.emit("queryData", tem.value, hum.value);
router.back(); router.back();
}; };
const temSetting = (type: String) => { const temSetting = (type: String) => {

29
src/view/tabs/fixed-time.vue

@ -70,6 +70,19 @@ const router = useRouter();
const runFun = (index: any) => { const runFun = (index: any) => {
navList.value.splice(index, 1); navList.value.splice(index, 1);
}; };
/**
* 添加定时
* @param index
*/
const addTiming = (data: any) => {
navList.value.unshift({
id: 0,
time: data.time,
name: data.name,
state: false,
selectState: false
});
};
/** /**
* 切换选中状态 * 切换选中状态
*/ */
@ -100,12 +113,14 @@ const onItemDelete = (index: number) => {
pageType: "timingSureDelete", pageType: "timingSureDelete",
index: index, index: index,
hintText: "确定要删除该定时吗?", hintText: "确定要删除该定时吗?",
hintImg: "/assets/imgs/show/icon_delete.png", hintImg: "/assets/imgs/show/icon_delete.png"
}, }
}); });
}; };
onBeforeMount(() => { onBeforeMount(() => {
proxy.$eventBusService.on("timingDelete", runFun); proxy.$eventBusService.on("timingDelete", runFun);
proxy.$eventBusService.on("timingAdd", addTiming);
}); });
const navList = ref([ const navList = ref([
@ -114,22 +129,22 @@ const navList = ref([
time: "2.5", time: "2.5",
name: "主卧空调", name: "主卧空调",
state: false, state: false,
selectState: false, selectState: false
}, },
{ {
id: 1, id: 1,
time: "3.0", time: "3.0",
name: "次卧空调", name: "次卧空调",
state: true, state: true,
selectState: false, selectState: false
}, },
{ {
id: 2, id: 2,
time: "4.0", time: "4.0",
name: "餐厅空调", name: "餐厅空调",
state: false, state: false,
selectState: false, selectState: false
}, }
]); ]);
</script> </script>
@ -194,7 +209,7 @@ const navList = ref([
.delete { .delete {
position: absolute; position: absolute;
right:36px; right: 36px;
width: 60px; width: 60px;
height: 60px; height: 60px;
} }

15
src/view/tabs/home-screen.vue

@ -1,4 +1,5 @@
<template> <template>
<<<<<<< HEAD
<div id="home-screen-wrapper"> <div id="home-screen-wrapper">
<div class="bg-video" @click="changeAnimation()"> <div class="bg-video" @click="changeAnimation()">
<!-- 关机动画循环 --> <!-- 关机动画循环 -->
@ -35,6 +36,20 @@
v-show="currentAnimation === 3" v-show="currentAnimation === 3"
ref="animationExit" ref="animationExit"
></video> ></video>
=======
<div id="home-screen-wrapper">
<div class="nav-top">
<div class="wifi-icon">
<img src="@/assets/imgs/home-screen/WIFI@2x.png" alt="">
</div>
<div class="weather">雪天</div>
<div class="temp">-26</div>
</div>
<div class="content">
<div class="content-left">
<div class="time" @c="envSelect">
{{ hour }}<span>:</span>{{ minutes }}
>>>>>>> 267250d (定时添加)
</div> </div>
<div class="nav-top"> <div class="nav-top">

25
src/view/timing/timing-add.vue

@ -4,7 +4,7 @@
<img <img
class="leftImg" class="leftImg"
src="@/assets/imgs/show/back.png" src="@/assets/imgs/show/back.png"
@click="onClickLeft()" @click="router.back()"
/> />
<div class="zhp-title-text">定时</div> <div class="zhp-title-text">定时</div>
</div> </div>
@ -67,6 +67,7 @@
import { getCurrentInstance, onBeforeMount, ref } from "vue"; import { getCurrentInstance, onBeforeMount, ref } from "vue";
import { useRouter } from "vue-router"; import { useRouter } from "vue-router";
import { $commonService } from "@/services/framework/dependency-injection-service"; import { $commonService } from "@/services/framework/dependency-injection-service";
const getImgSrc = $commonService.$imgService.getImgSrc; const getImgSrc = $commonService.$imgService.getImgSrc;
let selectNum = 0; let selectNum = 0;
let time = 0; let time = 0;
@ -88,9 +89,6 @@ const selectNumEvent = (index: any) => {
const selectTimeEvent = (index: any) => { const selectTimeEvent = (index: any) => {
time = index; time = index;
}; };
const onClickLeft = () => {
onSaveClick();
};
const onOpenClick = (b: boolean) => { const onOpenClick = (b: boolean) => {
isOpen.value = b; isOpen.value = b;
}; };
@ -113,10 +111,12 @@ onBeforeMount(() => {
}); });
const onSaveClick = () => { const onSaveClick = () => {
router.push({ proxy.$eventBusService.emit("timingAdd", { time: time, name: "主卧空调" });
path: "/tabs", router.back();
query: { pageType: "tabs", time: time, device: "主卧空调" } // router.push({
}); // path: "/tabs",
// query: { pageType: "tabs", time: time, device: "" },
// });
}; };
</script> </script>
@ -128,8 +128,8 @@ const onSaveClick = () => {
padding-right: 24px; padding-right: 24px;
margin-bottom: 12px; margin-bottom: 12px;
flex-wrap: wrap; flex-wrap: wrap;
} }
.time-center-item { .time-center-item {
display: flex; display: flex;
align-items: center; align-items: center;
@ -139,13 +139,14 @@ const onSaveClick = () => {
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
background-image: url("@/assets/imgs/show/bg_add_timing_unselect.png"); background-image: url("@/assets/imgs/show/bg_add_timing_unselect.png");
} }
.layout-horizontal { .layout-horizontal {
display: flex; display: flex;
align-items: stretch; align-items: stretch;
box-sizing: border-box; box-sizing: border-box;
} }
.time-center-item-unselect { .time-center-item-unselect {
color: #ffffff; color: #ffffff;
opacity: 0.4; opacity: 0.4;
@ -153,17 +154,20 @@ const onSaveClick = () => {
font-size: 32px; font-size: 32px;
font-weight: 400; font-weight: 400;
} }
.time-center-item-select { .time-center-item-select {
color: #ffffff; color: #ffffff;
text-align: center; text-align: center;
font-size: 32px; font-size: 32px;
font-weight: 700; font-weight: 700;
} }
.selectImg { .selectImg {
width: 60px; width: 60px;
height: 60px; height: 60px;
margin-left: 26px; margin-left: 26px;
} }
.item-content { .item-content {
margin-bottom: 12px; margin-bottom: 12px;
position: relative; position: relative;
@ -195,6 +199,7 @@ const onSaveClick = () => {
font-size: 28px; font-size: 28px;
font-weight: 400; font-weight: 400;
} }
.bottom-btn { .bottom-btn {
bottom: 30px; bottom: 30px;
position: absolute; position: absolute;

6
src/view/ui/env-select.vue

@ -31,12 +31,14 @@
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref } from "vue"; import { getCurrentInstance, ref } from "vue";
import router from "@/router"; import router from "@/router";
import { Toast } from "vant"; import { Toast } from "vant";
const { proxy } = getCurrentInstance() as any;
const itemOnClick = (item: any) => { const itemOnClick = (item: any) => {
Toast("获取的id" + item.id); proxy.$eventBusService.emit("queryType", item.id);
router.back();
}; };
const seasonList = ref([ const seasonList = ref([
{ {

Loading…
Cancel
Save