2025-07-03 17:39:09 +08:00
|
|
|
<template>
|
|
|
|
|
<div class="header_top">
|
|
|
|
|
<!-- <svg-icon icon-class="Head" :class-name="['headItem']"></svg-icon> -->
|
2025-10-21 16:20:22 +08:00
|
|
|
<img v-if="!headImage" class="header_img" alt="" />
|
2025-11-14 09:42:30 +08:00
|
|
|
<img v-else-if="headImage === 'default'" class="header_img" :src="require('@/assets/images/shijingjun/' + skinInfo + '/head.png')" alt="" />
|
2025-10-21 16:20:22 +08:00
|
|
|
<img v-else class="header_img" :src="headImage" alt="" />
|
2025-07-03 17:39:09 +08:00
|
|
|
<div class="dateTime">
|
|
|
|
|
<span>{{ date.ymd }}</span>
|
|
|
|
|
<span>{{ $t("headerTitles.week")[date.week] }}</span>
|
|
|
|
|
<span>{{ batteryInfo }}</span>
|
2025-07-17 18:54:05 +08:00
|
|
|
<div @click="openWeather">
|
|
|
|
|
<svg-icon style="width: 20px;height: 20px;cursor: pointer;" icon-class="weather" ></svg-icon>
|
|
|
|
|
</div>
|
2025-07-03 17:39:09 +08:00
|
|
|
</div>
|
|
|
|
|
<setTool ref="setTool"></setTool>
|
|
|
|
|
<systemPopup ref="systemPopup" v-if="showSystem"></systemPopup>
|
2025-07-17 18:54:05 +08:00
|
|
|
<weather ref="weather"></weather>
|
2025-07-03 17:39:09 +08:00
|
|
|
<!-- <headButton class="headButton"></headButton> -->
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
|
|
|
|
// 右侧按钮弹框
|
|
|
|
|
import setTool from "./setTool/setTool.vue";
|
|
|
|
|
// 系统设置弹框
|
|
|
|
|
import systemPopup from "./systemPopup/systemPopup.vue";
|
|
|
|
|
// btn
|
|
|
|
|
// import headButton from "./headButton/buttonMenu.vue";
|
2025-07-17 18:54:05 +08:00
|
|
|
import weather from "./weather/index.vue";
|
2025-07-03 17:39:09 +08:00
|
|
|
|
|
|
|
|
export default {
|
|
|
|
|
name: "index",
|
|
|
|
|
components: {
|
|
|
|
|
setTool,
|
|
|
|
|
systemPopup,
|
2025-07-17 18:54:05 +08:00
|
|
|
weather
|
2025-07-03 17:39:09 +08:00
|
|
|
// headButton
|
|
|
|
|
},
|
|
|
|
|
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
xxx: "pause",
|
|
|
|
|
date: {
|
|
|
|
|
ymd: "2023/11/20",
|
|
|
|
|
week: "1",
|
|
|
|
|
},
|
2025-10-21 16:20:22 +08:00
|
|
|
flag: false,
|
2025-07-03 17:39:09 +08:00
|
|
|
showSystem: false, //设置框
|
2025-10-21 16:20:22 +08:00
|
|
|
head: null,
|
2025-07-03 17:39:09 +08:00
|
|
|
skinInfo: JSON.parse(localStorage.getItem("systemSetting")).skinInfo,
|
|
|
|
|
appVersion: localStorage.getItem("appVersion"),
|
|
|
|
|
batteryInfo: "",
|
2025-10-21 16:20:22 +08:00
|
|
|
headImage: ''
|
2025-07-03 17:39:09 +08:00
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
beforeMount() {
|
|
|
|
|
// this.$sendElectronChanel("getHead");
|
|
|
|
|
// this.$recvElectronChanel("headRes", (e, res) => {
|
|
|
|
|
//
|
|
|
|
|
// this.head = res;
|
|
|
|
|
// });
|
2025-10-21 16:20:22 +08:00
|
|
|
let header = localStorage.getItem("header")
|
|
|
|
|
if (header) {
|
|
|
|
|
this.head = JSON.parse(header)
|
|
|
|
|
}
|
2025-07-03 17:39:09 +08:00
|
|
|
},
|
|
|
|
|
mounted() {
|
|
|
|
|
// this.setTime()
|
|
|
|
|
this.setTime();
|
|
|
|
|
// console.log("dsfdsad", process.env.Head)
|
|
|
|
|
setInterval(() => {
|
|
|
|
|
this.setTime();
|
|
|
|
|
}, 1000);
|
|
|
|
|
const that = this;
|
|
|
|
|
window.addEventListener("setItemEvent", (e) => {
|
|
|
|
|
if (e.key == "systemSetting") {
|
|
|
|
|
let obj = JSON.parse(e.newValue);
|
|
|
|
|
that.skinInfo = obj.skinInfo;
|
2025-10-21 16:20:22 +08:00
|
|
|
if(this.head) {
|
|
|
|
|
switch (that.skinInfo) {
|
|
|
|
|
case 'yingguangse':
|
|
|
|
|
that.headImage = that.head.header1
|
|
|
|
|
break;
|
|
|
|
|
case 'gonganlan':
|
|
|
|
|
that.headImage = that.head.header2
|
|
|
|
|
break;
|
|
|
|
|
case 'hong':
|
|
|
|
|
that.headImage = that.head.header3
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
that.headImage = 'default'
|
|
|
|
|
}
|
2025-07-03 17:39:09 +08:00
|
|
|
}
|
|
|
|
|
});
|
2025-10-21 16:20:22 +08:00
|
|
|
this.$recvChanel("header", () => {
|
|
|
|
|
let header = localStorage.getItem("header")
|
|
|
|
|
that.head = JSON.parse(header)
|
|
|
|
|
if (that.head) {
|
|
|
|
|
switch (that.skinInfo) {
|
|
|
|
|
case 'yingguangse':
|
|
|
|
|
that.headImage = that.head.header1
|
|
|
|
|
break;
|
|
|
|
|
case 'gonganlan':
|
|
|
|
|
that.headImage = that.head.header2
|
|
|
|
|
break;
|
|
|
|
|
case 'hong':
|
|
|
|
|
that.headImage = that.head.header3
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
that.headImage = 'default'
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
})
|
2025-07-03 17:39:09 +08:00
|
|
|
this.$recvChanel("batteryInfo", (data) => {
|
|
|
|
|
if (data.isShow) {
|
|
|
|
|
this.batteryInfo = data.title;
|
|
|
|
|
} else {
|
|
|
|
|
this.batteryInfo = "";
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2025-07-17 18:54:05 +08:00
|
|
|
openWeather(){
|
|
|
|
|
this.$changeComponentShow(".my_weather", true);
|
|
|
|
|
},
|
2025-07-03 17:39:09 +08:00
|
|
|
setTime() {
|
|
|
|
|
let date = new Date();
|
|
|
|
|
let year = date.getFullYear();
|
|
|
|
|
let month = date.getMonth() + 1;
|
|
|
|
|
let day = date.getDate();
|
|
|
|
|
let hours = date.getHours();
|
|
|
|
|
if (hours < 10) {
|
|
|
|
|
hours = "0" + hours;
|
|
|
|
|
}
|
|
|
|
|
let minutes = date.getMinutes();
|
|
|
|
|
if (minutes < 10) {
|
|
|
|
|
minutes = "0" + minutes;
|
|
|
|
|
}
|
|
|
|
|
let seconds = date.getSeconds();
|
|
|
|
|
if (seconds < 10) {
|
|
|
|
|
seconds = "0" + seconds;
|
|
|
|
|
}
|
|
|
|
|
this.date.ymd =
|
|
|
|
|
year +
|
|
|
|
|
"/" +
|
|
|
|
|
month +
|
|
|
|
|
"/" +
|
|
|
|
|
day +
|
|
|
|
|
" " +
|
|
|
|
|
hours +
|
|
|
|
|
":" +
|
|
|
|
|
minutes +
|
|
|
|
|
":" +
|
|
|
|
|
seconds;
|
|
|
|
|
this.date.week = date.getDay();
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
.header_top {
|
|
|
|
|
width: 100%;
|
|
|
|
|
//height: 120px;
|
|
|
|
|
height: 6.25vw;
|
|
|
|
|
position: fixed;
|
|
|
|
|
top: 0;
|
|
|
|
|
left: 0;
|
|
|
|
|
z-index: 19;
|
2025-10-21 16:20:22 +08:00
|
|
|
.header_img {
|
|
|
|
|
width:100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
}
|
|
|
|
|
.header_img:not([src]){
|
|
|
|
|
opacity:0;
|
|
|
|
|
}
|
2025-07-03 17:39:09 +08:00
|
|
|
|
|
|
|
|
.dateTime {
|
|
|
|
|
position: absolute;
|
|
|
|
|
left: 20px;
|
|
|
|
|
//top: 15px;
|
|
|
|
|
top: 0.35vw;
|
|
|
|
|
height: 36px;
|
|
|
|
|
//border: 1px solid red;
|
|
|
|
|
//width: 200px;
|
|
|
|
|
color: var(--svg-headColor3);
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
font-size: 18px;
|
|
|
|
|
|
|
|
|
|
>span {
|
|
|
|
|
margin: 0 5px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
&>span:first-child {
|
|
|
|
|
letter-spacing: 1px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.headButton {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 80px;
|
|
|
|
|
left: 50%;
|
|
|
|
|
transform: translate(-50%, 0);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
</style>
|