2023-01-04 14:27:14 +08:00

231 lines
6.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<div class="zjsj-large-screen">
<div class="header">
<div class="info">
<div class="between">
<div class="project">中建科创大厦项目</div>
<div class="time-week">
<div class="time">{{currentTime}}</div>
<div class="week">{{weekday}}</div>
</div>
<div class="weather-date">
<div class="weather">多云 32</div>
<div class="date">{{monthAndDay}}</div>
</div>
</div>
<div class="title">中建四局数字建造管控平台</div>
<div class="between">
<div class="company"></div>
<div class="exit" @click="$router.push('/projectIndex')"></div>
</div>
</div>
<div class="tabs">
<div
class="tab"
:class="{ checked: $route.path === menu.modulePath }"
v-for="(menu, index) in menus"
:key="index"
@click="handleMenu(menu.modulePath)"
>
{{ menu.moduleName }}
</div>
</div>
</div>
<div class="content">
<router-view></router-view>
</div>
</div>
</template>
<script>
import moment from "moment";
import { getWeatherDataApi } from "@/assets/js/api/environmentManage";
export default {
data(){
return{
currentTime:"",
monthAndDay:"",
weekday:"",
cityCode:"",
}
},
created(){
this.getCurrentDate()
this.getCurrentTime()
this.getweekday()
if(this.$store.state.currentProDetail!=null){
this.cityCode = this.$store.state.currentProDetail.cityCode
this.getWeather()
}
},
methods: {
handleMenu(path) {
this.$router.push(path)
},
getWeather(){
getWeatherDataApi({ cityid: this.cityCode }).then((res) => {
var json = JSON.parse(res.result);
console.log('天气',json);
});
},
getCurrentTime() {
const timer = setInterval(() => {
this.currentTime = moment().format("HH:mm:ss");
}, 500);
// 通过$once来监听定时器在beforeDestroy钩子可以被清除。
this.$once("hook:beforeDestroy", () => {
clearInterval(timer);
});
},
getCurrentDate() {
const currentDate = moment().format("YYYY-MM-DD");
this.monthAndDay = currentDate
},
getweekday(){
// date例如:'2022-03-05'
var weekArray = new Array("星期日","星期一", "星期二", "星期三", "星期四", "星期五", "星期六")
this.weekday = weekArray[new Date(this.monthAndDay).getDay()]
}
},
computed: {
menus() {
const moduleList = this.$store.state.userInfo.menuAuthority.moduleList
return moduleList.filter(menu => menu.moduleType === 4)
}
}
}
</script>
<style lang="less" scoped>
@import url("./style.less");
.zjsj-large-screen {
width: 100%;
height: 100%;
color: #fff;
// background-color: #182337;
background-color: #2B528C;
.header {
width: 100%;
height: 110px;
.info {
height: calc(100% - 32px);
color: #fff;
display: flex;
background: url(./assets/images/header/bg-title.png) no-repeat;
background-size: contain;
background-position-y: 16px;
.between {
box-sizing: border-box;
padding: 16px 30px 0;
width: 450px;
height: 100%;
text-align: center;
display: flex;
align-items: center;
.project {
font-size: 21px;
color: #66d4d9;
}
.time-week {
margin: 0 45px;
font-size: 12px;
.time {
margin-bottom: 2px;
}
}
.weather-date {
font-size: 12px;
.weather {
display: flex;
align-items: center;
&::before {
content: '';
margin-right: 10px;
width: 20px;
height: 20px;
background-color: skyblue;
background: url(./assets/images/header/i-cloudy.png) no-repeat;
background-size: contain;
}
}
}
.company {
margin-left: 50px;
margin-right: auto;
width: 246px;
height: 28px;
background: url(./assets/images/header/bg-company.png) no-repeat;
background-size: contain;
}
.exit {
width: 24px;
height: 26px;
background: url(./assets/images/header/back2.png) no-repeat;
background-size: contain;
cursor: pointer;
}
}
.title {
box-sizing: border-box;
padding-top: 16px;
flex: 1;
height: 100%;
font-size: 32px;
font-weight: bold;
text-align: center;
}
}
.tabs {
display: flex;
justify-content: space-around;
.tab {
width: 170px;
height: 32px;
line-height: 32px;
text-align: center;
font-size: 18px;
color: #fff;
background: url(./assets/images/header/bg-tab.png) no-repeat;
background-size: 100% 100%;
cursor: pointer;
&.checked {
color: #fec303;
}
&:hover {
color: #fec303;
}
}
}
}
.content {
box-sizing: border-box;
padding: 12px 20px;
width: 100%;
height: calc(100% - 110px);
}
}
/* 全局滚动条样式 */
::v-deep ::-webkit-scrollbar {
/*滚动条整体样式*/
width: 3px !important;
color: #19394d !important;
/*高宽分别对应横竖滚动条的尺寸*/
height: 3px !important;
cursor: pointer !important;
}
::v-deep ::-webkit-scrollbar-thumb {
/*滚动条里面小方块*/
border-radius: 3px !important;
box-shadow: inset 0 0 10px rgba(144, 147, 153, 0.2) !important;
background: rgba(144, 147, 153, 0.5) !important;
cursor: pointer !important;
}
::v-deep ::-webkit-scrollbar-track {
/*滚动条里面轨道*/
box-shadow: inset 0 0 5px rgba(238, 238, 238, 0) !important;
border-radius: 10px !important;
/* background: #ededed; */
}
</style>