Browse Source

修改样式,增加模式选择弹窗

dev_230517
zhangzhiyi 2 years ago
parent
commit
c2c3265c54
  1. BIN
      src/assets/imgs/device-detail/normal-mode/down@2x.png
  2. BIN
      src/assets/imgs/device-detail/normal-mode/mode_select_bg_cold@2x.png
  3. BIN
      src/assets/imgs/device-detail/normal-mode/mode_select_bg_hot@2x.png
  4. BIN
      src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png
  5. BIN
      src/assets/imgs/device-detail/normal-mode/mode_select_bg_wind@2x.png
  6. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_annual_wet@2x.png
  7. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_auto@2x.png
  8. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_auto_wet@2x.png
  9. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_cold@2x.png
  10. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_dry_wet@2x.png
  11. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_floor@2x.png
  12. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_hot@2x.png
  13. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_hot_floor@2x.png
  14. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_relax@2x.png
  15. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_sleep@2x.png
  16. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_strong_wet@2x.png
  17. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_wet@2x.png
  18. BIN
      src/assets/imgs/device-detail/normal-mode/shut_down_wind@2x.png
  19. BIN
      src/assets/imgs/device-detail/normal-mode/switch_cold@2x.png
  20. BIN
      src/assets/imgs/device-detail/normal-mode/switch_hot@2x.png
  21. BIN
      src/assets/imgs/device-detail/normal-mode/switch_shutdown@2x.png
  22. BIN
      src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png
  23. BIN
      src/assets/imgs/device-detail/normal-mode/switch_wind@2x.png
  24. 150
      src/components/mode-change.vue
  25. 56
      src/view/device-detail/device-detail.vue
  26. 108
      src/view/device-detail/mode/mode-dic.ts
  27. 138
      src/view/device-detail/mode/normal.vue
  28. 24
      src/view/drop-down-menu/drop-down-menu.vue
  29. 52
      src/view/tabs/device-control.vue

BIN
src/assets/imgs/device-detail/normal-mode/down@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

BIN
src/assets/imgs/device-detail/normal-mode/mode_select_bg_cold@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

BIN
src/assets/imgs/device-detail/normal-mode/mode_select_bg_hot@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.2 KiB

BIN
src/assets/imgs/device-detail/normal-mode/mode_select_bg_wind@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_annual_wet@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_auto@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_auto_wet@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_cold@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_dry_wet@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_floor@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_hot@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_hot_floor@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_relax@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_sleep@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_strong_wet@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_wet@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 KiB

BIN
src/assets/imgs/device-detail/normal-mode/shut_down_wind@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

BIN
src/assets/imgs/device-detail/normal-mode/switch_cold@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/imgs/device-detail/normal-mode/switch_hot@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.1 KiB

BIN
src/assets/imgs/device-detail/normal-mode/switch_shutdown@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB

BIN
src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.4 KiB

BIN
src/assets/imgs/device-detail/normal-mode/switch_wind@2x.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.5 KiB

150
src/components/mode-change.vue

@ -0,0 +1,150 @@
<!--
模式切换的弹出框
点击蒙版可以关闭弹窗
showModePop展示弹窗是否开启需要传参进来
关闭弹窗事件closePop父组件需要接收值并更改showModePop
-->
<template>
<van-popup
v-model:show="showModePop"
position="bottom"
class="modeChangePop"
@click-overlay="closePop()"
>
<div class="mode-change-wrapper">
<!-- 关闭按钮 -->
<div class="close-pop" @click="closePop()">
<img src="@/assets/imgs/device-detail/normal-mode/down@2x.png" class="close-img">
</div>
<!-- 模式内容 -->
<div class="content">
<div
class="mode-card"
v-for="(item, index) in list"
:key="index"
>
<div class="mode-card-top" :class="{'mode-card-selected': item.selected}" @click="switchMode(item, index)">
<img :src="item.modeImg">
</div>
<div class="mode-card-btm">
{{ item.modeName }}
</div>
</div>
</div>
</div>
</van-popup>
</template>
<script lang="ts" setup>
import { ref, toRefs, onMounted } from 'vue';
const props = defineProps<{
showModePop: boolean; //
modeList: any[]; //
}>()
const { showModePop, modeList } = toRefs(props);
/** 像父组件事件 */
const emit = defineEmits(['closePop']);
/** 模式数组接收 */
const list = ref(modeList);
onMounted(() => {
changeCardBg();
})
/** 关闭弹窗 */
const closePop = () => {
const params = {
showModePop: false,
modeList: list.value
}
emit('closePop', params);
}
/**
* 切换模式
* @param changeMode 选中的模式数据
* @param index 下标
*/
const switchMode = (changeMode: any, index: number) => {
list.value.forEach((item, i) => {
if (index === i) {
item.selected = true;
} else {
item.selected = false;
}
})
changeCardBg();
}
/** 更换选中的图 */
const changeCardBg = () => {
const selectModeBg = list.value.find(item => item.selected).selectModeBg;
const dom: any = document.getElementsByClassName(`mode-card-selected`)[0];
if (dom) {
dom.style.background = `url(${selectModeBg})`;
dom.style.backgroundSize = '100% 100%';
}
}
</script>
<style lang="scss" scoped>
.modeChangePop {
.mode-change-wrapper {
background-color: #20252E;
.close-pop {
text-align: center;
.close-img {
width: 142px;
height: 50px;
}
}
.content {
margin-top: 20px;
display: flex;
flex-wrap: wrap;
align-items: center;
padding: 0 29px;
.mode-card {
display: flex;
flex-direction: column;
align-items: center;
margin: 0 27px 40px 27px;
position: relative;
.mode-card-top {
padding: 27px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
background: url('src/assets/imgs/device-detail/normal-mode/circle-bg@2x.png') no-repeat;
background-size: 100% 100%;
margin-bottom: 60px;
img {
width: 56px;
height: 56px;
}
}
.mode-card-btm {
position: absolute;
top: 130px;
color: #FFF;
font-size: 28px;
font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400;
min-width: 150px;
text-align: center;
}
}
}
}
}
</style>

56
src/view/device-detail/device-detail.vue

@ -1,5 +1,5 @@
<template> <template>
<div class="device-detail-wrapper"> <div class="device-detail-wrapper" ref="deviceDetailWrapper">
<div class="title"> <div class="title">
<!-- 返回按钮 --> <!-- 返回按钮 -->
<div class="back-icon" style="margin-left: 24px;"> <div class="back-icon" style="margin-left: 24px;">
@ -39,7 +39,7 @@
<!-- 模式 --> <!-- 模式 -->
<!-- 常规模式 --> <!-- 常规模式 -->
<NormalMode class="normal-mode"></NormalMode> <NormalMode class="normal-mode" @change-bg="nomalChangeBg($event)"></NormalMode>
</div> </div>
</template> </template>
@ -49,6 +49,8 @@ import { useRouter, onBeforeRouteUpdate } from "vue-router";
import NormalMode from './mode/normal.vue'; import NormalMode from './mode/normal.vue';
const router = useRouter(); const router = useRouter();
/** $ref获取最外层dom, onMounted会赋值 */
const deviceDetailWrapper: any = ref(null);
/** 模式tab列表 */ /** 模式tab列表 */
const modeTabList = ref([ const modeTabList = ref([
{id: 0, value: '常规'}, {id: 0, value: '常规'},
@ -109,6 +111,16 @@ const switchModeTabs = (item: any) => {
activeTab.value = item.id; activeTab.value = item.id;
} }
/**
* 监听常规模式下切换背景
* @param url 背景图片静态地址
*/
const nomalChangeBg = (url: string) => {
if (deviceDetailWrapper.value) {
deviceDetailWrapper.value.style.background = `url(${url})`;
}
}
/** 返回上一个页面 */ /** 返回上一个页面 */
const back = () => { const back = () => {
router.back(); router.back();
@ -132,12 +144,12 @@ const back = () => {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
padding: 62px 0; padding: 31px 0;
flex-shrink: 0; flex-shrink: 0;
.back-icon, .more-icon { .back-icon, .more-icon {
width: 96px; width: 48px;
height: 96px; height: 48px;
img { img {
width: 100%; width: 100%;
@ -147,7 +159,7 @@ const back = () => {
.title-name { .title-name {
color: #FFF; color: #FFF;
font-size: 80px; font-size: 40px;
font-weight: 400; font-weight: 400;
} }
} }
@ -161,16 +173,16 @@ const back = () => {
flex-shrink: 0; flex-shrink: 0;
.switch-mode-container { .switch-mode-container {
padding: 12px; padding: 6px;
display: flex; display: flex;
font-size: 56px; font-size: 28px;
font-weight: 400; font-weight: 400;
background: url('src/assets/imgs/device-detail/mode-container-bg@2x.png') no-repeat; background: url('src/assets/imgs/device-detail/mode-container-bg@2x.png') no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
.default-tab { .default-tab {
color: rgba($color: #FFF, $alpha: .7); color: rgba($color: #FFF, $alpha: .7);
padding: 26px 58px; padding: 13px 29px;
} }
.active-tab { .active-tab {
@ -182,40 +194,40 @@ const back = () => {
.cleanliness { .cleanliness {
position: absolute; position: absolute;
top: 220px; top: 110px;
right: 50px; right: 25px;
color: #FFF; color: #FFF;
.cleanliness-text { .cleanliness-text {
font-size: 52px; font-size: 26px;
} }
.cleanliness-container { .cleanliness-container {
width: 152px; width: 76px;
height: 28px; height: 14px;
background-color: rgba($color: #B8B8B8 , $alpha: .2); background-color: rgba($color: #B8B8B8 , $alpha: .2);
border-radius: 4px; border-radius: 2px;
margin-top: 32px; margin-top: 16px;
.cleanliness-progress { .cleanliness-progress {
width: 0%; width: 0%;
height: 100%; height: 100%;
border-radius: 4px; border-radius: 2px;
} }
} }
.cleanliness-reminder { .cleanliness-reminder {
font-size: 40px; font-size: 20px;
padding: 12px 20px; padding: 6px 10px;
margin-top: 20px; margin-top: 10px;
border-radius: 32px; border-radius: 16px;
} }
} }
} }
.normal-mode { .normal-mode {
flex: 1; flex: 1;
margin-top: 46px; margin-top: 23px;
} }
} }
</style> </style>

108
src/view/device-detail/mode/mode-dic.ts

@ -7,6 +7,11 @@ import { Mode } from './enmu/mode.enmu';
* modeImg * modeImg
* nomalBg * nomalBg
* smartBg * smartBg
* selectSwitchImg
* shutdownImg
* shutdownSwitchImg
* select
* selectModeBg
*/ */
const ModeOptions = [ const ModeOptions = [
{ {
@ -14,89 +19,160 @@ const ModeOptions = [
mode: Mode.COLD, mode: Mode.COLD,
modeImg: '/src/assets/imgs/device-detail/normal-mode/cold@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/cold@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_cold@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_cold@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_cold@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_cold@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_cold@2x.png',
}, { }, {
modeName: '除湿', modeName: '除湿',
mode: Mode.WET, mode: Mode.WET,
modeImg: '/src/assets/imgs/device-detail/normal-mode/wet@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/wet@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_wet@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png',
}, { }, {
modeName: '干爽除湿', modeName: '干爽除湿',
mode: Mode.DRY_WET, mode: Mode.DRY_WET,
modeImg: '/src/assets/imgs/device-detail/normal-mode/dry_wet@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/dry_wet@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_dry_wet@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png',
}, { }, {
modeName: '强力除湿', modeName: '强力除湿',
mode: Mode.STRONG_WET, mode: Mode.STRONG_WET,
modeImg: '/src/assets/imgs/device-detail/normal-mode/strong_wet@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/strong_wet@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_strong_wet@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png',
}, { }, {
modeName: '自动除湿', modeName: '自动除湿',
mode: Mode.AUTO_WET, mode: Mode.AUTO_WET,
modeImg: '/src/assets/imgs/device-detail/normal-mode/auto_wet@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/auto_wet@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_auto_wet@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png',
}, { }, {
modeName: '全年除湿', modeName: '全年除湿',
mode: Mode.ANNUAL_WET, mode: Mode.ANNUAL_WET,
modeImg: '/src/assets/imgs/device-detail/normal-mode/annual_wet@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/annual_wet@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_annual_wet@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png',
}, { }, {
modeName: '舒爽', modeName: '舒爽',
mode: Mode.RELAX, mode: Mode.RELAX,
modeImg: '/src/assets/imgs/device-detail/normal-mode/relax@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/relax@2x.png',
nomalBg: 'normal_bg_wind@2x.png', nomalBg: 'normal_bg_wind@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wind@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_relax@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wind@2x.png',
}, { }, {
modeName: '舒心睡眠', modeName: '舒心睡眠',
mode: Mode.SLEEP, mode: Mode.SLEEP,
modeImg: '/src/assets/imgs/device-detail/normal-mode/sleep@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/sleep@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_sleep@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png',
}, { }, {
modeName: '制热', modeName: '制热',
mode: Mode.HOT, mode: Mode.HOT,
modeImg: '/src/assets/imgs/device-detail/normal-mode/hot@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/hot@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_hot@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_hot@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_hot@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_hot@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_hot@2x.png',
}, { }, {
modeName: '送风', modeName: '送风',
mode: Mode.WIND, mode: Mode.WIND,
modeImg: '/src/assets/imgs/device-detail/normal-mode/wind@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/wind@2x.png',
nomalBg: 'normal_bg_wind@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wind@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wind@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_wind@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wind@2x.png',
}, { }, {
modeName: '自动', modeName: '自动',
mode: Mode.AUTO, mode: Mode.AUTO,
modeImg: '/src/assets/imgs/device-detail/normal-mode/auto@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/auto@2x.png',
nomalBg: 'normal_bg_wind@2x.png', shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_auto@2x.png',
smartBg: '' nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wind@2x.png',
smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wind@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wind@2x.png',
}, { }, {
modeName: '地暖', modeName: '地暖',
mode: Mode.FLOOR, mode: Mode.FLOOR,
modeImg: '/src/assets/imgs/device-detail/normal-mode/floor@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/floor@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_hot@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_hot@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_hot@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_floor@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_hot@2x.png',
}, { }, {
modeName: '制热+地暖', modeName: '制热+地暖',
mode: Mode.HOT_FLOOR, mode: Mode.HOT_FLOOR,
modeImg: '/src/assets/imgs/device-detail/normal-mode/hot_floor@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/hot_floor@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_hot@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_hot@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_hot@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_hot_floor@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_hot@2x.png',
}, { }, {
modeName: '除湿+地暖', modeName: '除湿+地暖',
mode: Mode.WET_FLOOR, mode: Mode.WET_FLOOR,
modeImg: '/src/assets/imgs/device-detail/normal-mode/wet_floor@2x.png', modeImg: '/src/assets/imgs/device-detail/normal-mode/wet_floor@2x.png',
nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png', nomalBg: '/src/assets/imgs/device-detail/normal-mode/normal_bg_wet@2x.png',
smartBg: '' smartBg: '',
selectSwitchImg: '/src/assets/imgs/device-detail/normal-mode/switch_wet@2x.png',
shutdownImg: '/src/assets/imgs/device-detail/normal-mode/shut_down_hot_floor@2x.png',
shutdownSwitchImg: '',
selected: false,
selectModeBg: '/src/assets/imgs/device-detail/normal-mode/mode_select_bg_wet@2x.png',
} }
] ]
ModeOptions.forEach((item: any, index: number) => { ModeOptions.forEach((item: any, index: number) => {
item['id'] = index; item['id'] = index;
item['shutdownSwitchImg'] = '/src/assets/imgs/device-detail/normal-mode/switch_shutdown@2x.png';
}); });
export {ModeOptions} export {ModeOptions}

138
src/view/device-detail/mode/normal.vue

@ -26,13 +26,18 @@
</div> </div>
<!-- 模式风量风向开关 --> <!-- 模式风量风向开关 -->
<div class="setting-control"> <div class="setting-control">
<div class="circle-card mode"> <div class="circle-card mode" @click="openModePop()">
<img :src="modeImg" alt=""> <img :src="modeImg">
</div> </div>
<div class="circle-card wind"></div> <div class="circle-card wind"></div>
<div class="circle-card wind-dire"></div> <div class="circle-card wind-dire"></div>
<div class="circle-card switch"></div> <div class="circle-card switch" @click="changeSwitch()">
<img :src="onOffImg">
</div>
</div> </div>
<!-- 模式切换弹窗 -->
<ModeChangePop :show-mode-pop="showModePop" :mode-list="modeList" @close-pop="closeModePop($event)"></ModeChangePop>
</div> </div>
</template> </template>
@ -40,7 +45,9 @@
import { ref, onBeforeMount, onMounted } from 'vue'; import { ref, onBeforeMount, onMounted } from 'vue';
import { ModeOptions } from './mode-dic'; import { ModeOptions } from './mode-dic';
import { Mode } from './enmu/mode.enmu'; import { Mode } from './enmu/mode.enmu';
import ModeChangePop from '@/components/mode-change.vue';
/** 温度配置 */
const tempOptions = ref({ const tempOptions = ref({
titleName: '室内', titleName: '室内',
value: 25, value: 25,
@ -49,6 +56,7 @@ const tempOptions = ref({
max: 32, max: 32,
current: 'temp' current: 'temp'
}); });
/** 湿度配置 */
const humiOptions = ref({ const humiOptions = ref({
titleName: '湿度', titleName: '湿度',
value: 76, value: 76,
@ -57,21 +65,75 @@ const humiOptions = ref({
max: 90, max: 90,
current: 'humi' current: 'humi'
}); });
/** 当前展示可操作性的配置 */
const currentOptions = ref(); const currentOptions = ref();
/** 等待操作的配置 */
const treatOptions = ref(); const treatOptions = ref();
/** 模式配置字典 */
const modeOptions: any = ModeOptions; const modeOptions: any = ModeOptions;
/** 当前选中的模式 */
const mode = ref(Mode.COLD); const mode = ref(Mode.COLD);
/** 模式展示的图片 */
const modeImg = ref(''); const modeImg = ref('');
/** 可设定的模式数组 */
const modeList = ref<any[]>([]);
/**
* 开关
* true: false:
*/
const onOff = ref(false);
/** 开关图片 */
const onOffImg = ref('');
/** 当前选中的风量 */
const wind = ref();
/** 风量展示的图片 */
const windImg = ref('');
/** 模式更改弹窗是否开启 */
const showModePop = ref(false);
/** 向父组件传递事件 */
const emit = defineEmits(['changeBg']);
onBeforeMount(() => { onBeforeMount(() => {
currentOptions.value = {...tempOptions.value}; currentOptions.value = {...tempOptions.value};
treatOptions.value = {...humiOptions.value}; treatOptions.value = {...humiOptions.value};
modeImg.value = modeOptions.find((item: any) => item.mode === mode.value).modeImg; const modeArr = [Mode.COLD, Mode.WET, Mode.HOT, Mode.WIND, Mode.FLOOR, Mode.HOT_FLOOR, Mode.AUTO];
modeArr.forEach(item => {
modeList.value.push(modeOptions.find((item1: any) => item1.mode === item));
})
getShowImg();
}) })
onMounted(() => { onMounted(() => {
}) })
/** 获取展示图片 */
const getShowImg = () => {
modeList.value.forEach(item => {
if (item.mode === mode.value) {
item.selected = true;
} else {
item.selected = false;
}
})
//
const modeData = modeOptions.find((item: any) => item.mode === mode.value);
if (onOff.value) {
//
modeImg.value = modeData.modeImg;
//
onOffImg.value = modeData.selectSwitchImg;
//
emit('changeBg', modeData.nomalBg);
} else {
//
modeImg.value = modeOptions.find((item: any) => item.mode === mode.value).shutdownImg;
//
onOffImg.value = modeOptions.find((item: any) => item.mode === mode.value).shutdownSwitchImg;
//
emit('changeBg', 'src/assets/imgs/device-detail/normal-mode/normal_bg_shutdown@2x.png');
}
}
/** 温湿度减 */ /** 温湿度减 */
const handleReduce = () => { const handleReduce = () => {
if (currentOptions.value.value <= currentOptions.value.min) { if (currentOptions.value.value <= currentOptions.value.min) {
@ -102,6 +164,26 @@ const switchTempHumi = () => {
treatOptions.value = {...humiOptions.value}; treatOptions.value = {...humiOptions.value};
} }
} }
/** 模式切换弹窗开启 */
const openModePop = () => {
showModePop.value = true;
}
/** 模式弹窗关闭 */
const closeModePop = (params: any) => {
console.log(params)
showModePop.value = params.showModePop;
modeList.value = params.modeList;
mode.value = modeList.value.find(item => item.selected).mode;
getShowImg();
}
/** 开关切换 */
const changeSwitch = () => {
onOff.value = !onOff.value;
getShowImg();
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -111,7 +193,7 @@ const switchTempHumi = () => {
.title { .title {
color: #FFF; color: #FFF;
font-size: 56px; font-size: 28px;
text-align: center; text-align: center;
} }
@ -119,12 +201,12 @@ const switchTempHumi = () => {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin-top: 22px; margin-top: 11px;
position: relative; position: relative;
.set-reduce, .set-add { .set-reduce, .set-add {
width: 268px; width: 134px;
height: 268px; height: 134px;
img { img {
width: 100%; width: 100%;
@ -137,27 +219,27 @@ const switchTempHumi = () => {
font-family: Roboto-Regular, Roboto; font-family: Roboto-Regular, Roboto;
.current-value { .current-value {
font-size: 360px; font-size: 180px;
font-family: Roboto-Light, Roboto; font-family: Roboto-Light, Roboto;
font-weight: 300; font-weight: 300;
} }
.current-unit { .current-unit {
font-size: 100px; font-size: 50px;
position: absolute; position: absolute;
top: 35px; top: 17px;
right: 380px; right: 190px;
} }
.treat { .treat {
position: absolute; position: absolute;
bottom: 35px; bottom: 17px;
right: 280px; right: 140px;
font-size: 68px; font-size: 34px;
img { img {
width: 60px; width: 30px;
margin-left: 8px; margin-left: 4px;
} }
} }
} }
@ -167,31 +249,31 @@ const switchTempHumi = () => {
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin-top: 35px; margin-top: 17px;
img { img {
width: 60px; width: 30px;
height: 62px; height: 31px;
} }
span { span {
color: #D65659; color: #D65659;
font-size: 52px; font-size: 26px;
font-family: SourceHanSansCN-Regular, SourceHanSansCN; font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400; font-weight: 400;
margin: 0 6px 0 12px; margin: 0 3px 0 6px;
} }
} }
.setting-control { .setting-control {
margin-top: 86px; margin-top: 43px;
padding: 0 128px; padding: 0 64px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
.circle-card { .circle-card {
width: 220px; width: 110px;
height: 220px; height: 110px;
background: url('src/assets/imgs/device-detail/normal-mode/circle-bg@2x.png') no-repeat; background: url('src/assets/imgs/device-detail/normal-mode/circle-bg@2x.png') no-repeat;
background-size: 100% 100%; background-size: 100% 100%;
display: flex; display: flex;
@ -199,8 +281,8 @@ const switchTempHumi = () => {
justify-content: center; justify-content: center;
img { img {
width: 112px; width: 56px;
height: 112px; height: 56px;
} }
} }
} }

24
src/view/drop-down-menu/drop-down-menu.vue

@ -21,7 +21,7 @@
import {ref, onMounted} from 'vue'; import {ref, onMounted} from 'vue';
const funcList = ref<any[]>([]); const funcList = ref<any[]>([]);
const emit = defineEmits(['pullUp']) const emit = defineEmits(['pullUp']);
onMounted(() => { onMounted(() => {
funcList.value = [ funcList.value = [
@ -70,34 +70,34 @@ const pullUp = () => {
overflow: hidden; overflow: hidden;
.content-top { .content-top {
padding: 38px 48px; padding: 19px 24px;
padding-bottom: 0; padding-bottom: 0;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
flex-wrap: wrap; flex-wrap: wrap;
.func-wrapper { .func-wrapper {
width: 420px; width: 210px;
height: 400px; height: 200px;
border-radius: 32px; border-radius: 16px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
margin: 10px 0; margin: 5px 0;
background: #20252E; background: #20252E;
.func-img { .func-img {
width: 132px; width: 66px;
height: 132px; height: 66px;
} }
.func-text { .func-text {
font-size: 56px; font-size: 28px;
color: #FFF; color: #FFF;
font-family: SourceHanSansCN-Regular, SourceHanSansCN; font-family: SourceHanSansCN-Regular, SourceHanSansCN;
font-weight: 400; font-weight: 400;
margin-top: 84px; margin-top: 42px;
} }
} }
} }
@ -105,10 +105,10 @@ const pullUp = () => {
.content-btm { .content-btm {
width: 100vw; width: 100vw;
text-align: center; text-align: center;
padding-bottom: 12px; padding-bottom: 6px;
img { img {
width: 284px; width: 142px;
} }
} }
} }

52
src/view/tabs/device-control.vue

@ -152,7 +152,7 @@ const goToDetail = (item: any) => {
.title { .title {
width: 100%; width: 100%;
padding: 70px 0; padding: 35px 0;
position: relative; position: relative;
flex-shrink: 0; flex-shrink: 0;
@ -160,18 +160,18 @@ const goToDetail = (item: any) => {
text-align: center; text-align: center;
color: #FFF; color: #FFF;
font-weight: 400; font-weight: 400;
font-size: 80px; font-size: 40px;
} }
.all-close-btn { .all-close-btn {
color: #FFF; color: #FFF;
font-size: 64px; font-size: 32px;
padding: 28px 36px; padding: 14px 18px;
background: #394457; background: #394457;
border-radius: 32px; border-radius: 16px;
position: absolute; position: absolute;
top: 50px; top: 25px;
right: 48px; right: 24px;
} }
} }
@ -183,16 +183,16 @@ const goToDetail = (item: any) => {
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
padding: 0 48px; padding: 0 24px;
.device-card { .device-card {
box-sizing: border-box; box-sizing: border-box;
width: 620px; width: 326px;
height: 292px; height: 146px;
background: #20252E; background: #20252E;
border-radius: 32px; border-radius: 16px;
padding: 44px 48px 20px 48px; padding: 22px 24px 10px 24px;
margin-bottom: 40px; margin-bottom: 20px;
.content-top { .content-top {
display: flex; display: flex;
@ -200,15 +200,15 @@ const goToDetail = (item: any) => {
.device-name { .device-name {
color: #FFF; color: #FFF;
font-size: 48px; font-size: 24px;
margin-right: 20px; margin-right: 10px;
padding: 12px 0; padding: 6px 0;
} }
.status-border { .status-border {
font-size: 40px; font-size: 20px;
padding: 12px 20px; padding: 6px 10px;
border-radius: 32px; border-radius: 16px;
span { span {
display: inline-block; display: inline-block;
@ -227,7 +227,7 @@ const goToDetail = (item: any) => {
} }
.content-btm { .content-btm {
margin-top: 36px; margin-top: 18px;
font-family: Roboto-Light, Roboto; font-family: Roboto-Light, Roboto;
// //
@ -241,9 +241,9 @@ const goToDetail = (item: any) => {
} }
.status { .status {
font-size: 80px; font-size: 40px;
font-weight: 300; font-weight: 300;
margin-right: 8px; margin-right: 4px;
} }
.hot { .hot {
@ -255,12 +255,12 @@ const goToDetail = (item: any) => {
} }
.unit { .unit {
font-size: 36px; font-size: 18px;
font-weight: 400; font-weight: 400;
} }
.air-quality { .air-quality {
font-size: 80px; font-size: 40px;
} }
} }
@ -271,8 +271,8 @@ const goToDetail = (item: any) => {
align-items: center; align-items: center;
.close-btn { .close-btn {
width: 120px; width: 60px;
height: 120px; height: 60px;
img { img {
width: 100%; width: 100%;

Loading…
Cancel
Save