2022-08-23 13:40:02 +08:00

150 lines
4.1 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="dataBoardPage">
<div class="headerBox">
<div class="topTit">
<div class="leftmodel">
<img class="wetherImg" src="../../../assets/images/projectImg/sun.png" alt />
<div class="wether">多云 32</div>
<img class="logo" src="../../../assets/images/projectImg/logo.png" alt />
</div>
<div class="centermodel">
<h1 class="title">{{'金林湾项目监管平台'}}</h1>
</div>
<div class="rightmodel">
<div class="time">
<span>{{currentDate}}</span>
<span>{{currentWeek}}</span>
<span>{{currentTime}}</span>
<img
class="backImg"
@click="toBack()"
src="../../../assets/images/projectImg/back.png"
alt
/>
</div>
</div>
</div>
<div class="menuBox">
<ul class="left">
<li
v-for="(item, index) in menuList"
:key="index"
:class="{
right: index > (menuList.length - 1) / 2,
active: $route.path == item.modulePath,
}"
@click="menuClick(item, index)"
>{{ item.moduleName }}</li>
</ul>
</div>
</div>
<div class="dataBoardContent">
<router-view></router-view>
</div>
</div>
</template>
<script>
import moment from "moment";
export default {
data() {
return {
menuList: [],
currentDate: "",
currentTime: "",
currentWeek: ""
};
},
mounted() {
this.getAllModule();
this.getCurrentTime();
this.getTime();
this.getWeek();
},
methods: {
getTime() {
this.currentDate = moment().format("yyyy-MM-DD");
this.currentTime = moment().format("HH:mm:ss");
},
getCurrentTime() {
const timer = setInterval(() => {
this.getTime();
}, 500);
// 通过$once来监听定时器在beforeDestroy钩子可以被清除。
this.$once("hook:beforeDestroy", () => {
clearInterval(timer);
});
},
getWeek() {
var dt = new Date();
let weekDay = [
"星期天",
"星期一",
"星期二",
"星期三",
"星期四",
"星期五",
"星期六"
];
this.currentWeek = weekDay[dt.getDay()];
},
getAllModule() {
var half = this.$store.state.userInfo.menuAuthority.moduleList;
console.log(half);
half.forEach(element => {
console.log(element.moduleName);
if (element.moduleType == 4) {
console.log(element);
this.menuList.push(element);
}
});
},
toBack() {
this.$router.push({ path: "/projectIndex" });
},
menuClick(item, index) {
console.log("item", item);
this.menuIndex = index;
if (
item.modulePath.includes("http://") ||
item.modulePath.includes("https://")
) {
return window.open(item.modulePath);
} else {
this.$router.push(item.modulePath);
}
if (item.moduleName == "智能安全帽") {
let NodeRSA = require("node-rsa");
//请求参数
let params = JSON.stringify({
// account: '妇幼保健院',
account: this.$store.state.userInfo.account,
page_flag: 3
});
//公钥
const pubKey = `
-----BEGIN PUBLIC KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDcmP0ug4NTHwW2oeHxheZjmYPDxVGFP770eECdLwRtaH0pPWvsXG6MSO/kCzgjEVEo1K1bvRxkkasQRu02fhI+gsZa8wvVeo3s4zJDA48Oj99JAXsx56/WN1RlNh+tsXcH9oQWy3gbX5cDkheuVZj8gsV7Ez59Ucj4e78zNJrUDwIDAQAB
-----END PUBLIC KEY-----`;
var publicKey = new NodeRSA(pubKey);
var async_key = publicKey.encrypt(params, "base64");
window.open(
"http://58.210.96.206:91/async_danzhou.html?async_key=" + async_key
);
// window.location.href = "http://58.210.96.206:91/async_danzhou.html?async_key="+async_key;
} else {
this.$router.push(item.modulePath);
}
}
}
};
</script>
<style lang="less" scoped>
@import url("./style.less");
</style>