head.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363
  1. <template>
  2. <el-row class="content">
  3. <!-- <el-row class="weather">
  4. <img
  5. v-if="weatherObj.weather_pic"
  6. :src="weatherObj.weather_pic || ''"
  7. alt=""
  8. />
  9. <span v-if="weatherObj.weather"
  10. >{{ weatherObj.weather }} {{ weatherObj.temperature }}℃</span
  11. >
  12. </el-row> -->
  13. <el-row class="title" v-if="title">闵行区消防管理与应急救援数字平台</el-row>
  14. <el-row class="title2" v-if="!title">进博会消防安保平台</el-row>
  15. <el-row class="title3" v-if="!title">(火灾防控)</el-row>
  16. <div class="nowTime">
  17. <div class="day">{{ dateDay }}</div>
  18. <div class="time">{{ dataTime }}</div>
  19. </div>
  20. <el-row class="nav">
  21. <el-row class="btnBox btnBoxLeft">
  22. <el-col
  23. class="btn btn1"
  24. v-for="(item, index) in btnList.slice(0, 4)"
  25. @click="btnClick(item)"
  26. :key="index"
  27. :class="{
  28. active: public_store.$state.routeInfo === item.router,
  29. }"
  30. >
  31. {{ item.name }}
  32. </el-col>
  33. </el-row>
  34. <el-row class="btnBox btnBoxRight">
  35. <el-col
  36. class="btn btn2"
  37. v-for="(item, index) in btnList.slice(4)"
  38. @click="btnClick(item)"
  39. :key="index"
  40. :class="{
  41. active: public_store.$state.routeInfo === item.router,
  42. }"
  43. >
  44. {{ item.name }}
  45. </el-col>
  46. </el-row>
  47. </el-row>
  48. <div class="homeIcon" @click="fanhui" v-if="!title">
  49. <HomeFilled style="width: 0.8em; height: 0.8em; margin-right: 0px" />
  50. </div>
  51. <!-- <div class="homeIcon" v-if="$route.fullPath !== '/'">
  52. <img src="~@a/img/icon/close.png" alt="" class="timeImage2" @click="fanhui" />
  53. </div> -->
  54. </el-row>
  55. </template>
  56. <script setup>
  57. import { useStore, mapGetters } from "vuex";
  58. import publicStore from "@/store/modules/public.js";
  59. import { useRoute, useRouter } from "vue-router";
  60. import {
  61. defineAsyncComponent,
  62. defineComponent,
  63. ref,
  64. onMounted,
  65. watch,
  66. } from "vue";
  67. import { ElMessage, ElMessageBox } from "element-plus";
  68. const public_store = publicStore(); //公共store
  69. const route = useRoute();
  70. const router = useRouter();
  71. const title = ref(true)
  72. const dateDay = ref("");
  73. const dataTime = ref("");
  74. const weatherObj = ref({});
  75. const dataWeekList = ref(["一", "二", "三", "四", "五", "六", "七"]);
  76. const valueTime = ref([]);
  77. const defaultTime = ref([
  78. new Date(2000, 1, 1, 0, 0, 0),
  79. new Date(2000, 2, 1, 23, 59, 59),
  80. ]); // '00:00:00', '23:59:59'
  81. const btnList = ref([])
  82. console.log(window.location.href.split("#"))
  83. // if(
  84. // window.location.href.indexOf("fire-signs") ||
  85. // window.location.href.indexOf("self-management") ||
  86. // window.location.href.indexOf("enforcement-dynamic") ||
  87. // window.location.href.indexOf("fire-data-analysis") ||
  88. // window.location.href.indexOf("rescue-station") ||
  89. // window.location.href.indexOf("water-sources") ||
  90. // window.location.href.indexOf("comprehensive-disposal") ||
  91. // window.location.href.indexOf("security-plan") ||
  92. // window.location.href.split("#")[1] == "/"
  93. // ){
  94. // btnList.value = [
  95. // { name: "城市消防体征", router: "/fire-signs" },
  96. // { name: "企业自主管理", router: "/self-management" },
  97. // { name: "消防执法动态", router: "/enforcement-dynamic" },
  98. // { name: "火灾数据分析", router: "/fire-data-analysis" },
  99. // { name: "消防救援站点", router: "/rescue-station" },
  100. // { name: "消防水源情况", router: "/water-sources" },
  101. // { name: "警情综合处置", router: "/comprehensive-disposal" },
  102. // { name: "大型安保预案", router: "/security-plan" },
  103. // ]
  104. // }else{
  105. // btnList.value = []
  106. // }
  107. if(window.location.href.split("#")[1] == "/security" ){
  108. btnList.value = []
  109. title.value = false
  110. }else{
  111. btnList.value = [
  112. { name: "城市消防体征", router: "/fire-signs" },
  113. { name: "企业自主管理", router: "/self-management" },
  114. { name: "消防执法动态", router: "/enforcement-dynamic" },
  115. { name: "火灾数据分析", router: "/fire-data-analysis" },
  116. { name: "消防救援站点", router: "/rescue-station" },
  117. { name: "消防水源情况", router: "/water-sources" },
  118. { name: "警情综合处置", router: "/comprehensive-disposal" },
  119. { name: "大型安保预案", router: "/security-plan" },
  120. ]
  121. title.value = true
  122. }
  123. valueTime.value = public_store.$state.timeList.map((val) => {
  124. return val;
  125. });
  126. //返回
  127. // function fanhui() {
  128. // router.go(-1);
  129. // }
  130. //天气
  131. async function getWeather() {
  132. // let res = await this.$axios.get("/service-fire/aliWeather");
  133. // if (JSON.parse(res.data).showapi_res_code === 0) {
  134. // weatherObj.value = JSON.parse(res.data).showapi_res_body.now;
  135. // }
  136. }
  137. //路由跳转
  138. function btnClick(val) {
  139. if (val.router === public_store.$state.routeInfo) {
  140. router.push({
  141. path: "/",
  142. });
  143. } else {
  144. router.push({
  145. path: val.router,
  146. });
  147. }
  148. }
  149. function fanhui(){
  150. window.location.href = "http://32.1.7.96:8010/zhts_mh_20231011_v1/#/ciieSecurity"
  151. // window.location.href = "http://www.baidu.com"
  152. }
  153. onMounted(() => {
  154. //当前年月日时分秒
  155. setInterval(() => {
  156. let day = new Date();
  157. dateDay.value =
  158. day.getFullYear() +
  159. "-" +
  160. (day.getMonth() + 1 < 10
  161. ? "0" + (day.getMonth() + 1)
  162. : "" + (day.getMonth() + 1)) +
  163. "-" +
  164. (day.getDate() < 10 ? "0" + day.getDate() : day.getDate());
  165. dataTime.value =
  166. (day.getHours() < 10 ? "0" + day.getHours() : day.getHours()) +
  167. ":" +
  168. (day.getMinutes() < 10
  169. ? "0" + day.getMinutes()
  170. : day.getMinutes()) +
  171. ":" +
  172. (day.getSeconds() < 10 ? "0" + day.getSeconds() : day.getSeconds());
  173. }, 1000);
  174. });
  175. watch(
  176. () => route,
  177. (to, from) => {
  178. // console.log(from); //从哪来
  179. // console.log(to); //到哪去
  180. public_store.$state.routeInfo = to.path;
  181. },
  182. { deep: true, immediate: true }
  183. );
  184. watch(
  185. () => public_store.$state.timeList,
  186. (val) => {
  187. valueTime.value = val.map((value) => {
  188. return value;
  189. });
  190. },
  191. { deep: true, immediate: true }
  192. );
  193. </script>
  194. <style lang="scss" scoped>
  195. @import "@/assets/scss/color.scss";
  196. .content {
  197. width: 100%;
  198. height: 0.9375rem;
  199. position: relative;
  200. background-image: url(~@a/img/topBackground.png);
  201. background-size: 100% 100%;
  202. background-color: transparent;
  203. z-index: 100;
  204. .weather {
  205. position: absolute;
  206. left: 0.375rem;
  207. top: 0.18rem;
  208. display: flex;
  209. justify-content: center;
  210. align-items: center;
  211. img {
  212. width: 0.375rem;
  213. }
  214. span {
  215. font-size: 0.2rem;
  216. margin-left: 0.135rem;
  217. @include color_primary($color-primary2);
  218. }
  219. }
  220. .nowTime {
  221. .day {
  222. position: absolute;
  223. top: 0.16rem;
  224. left: 0.125rem;
  225. width: auto;
  226. height: auto;
  227. font-size: 0.2rem;
  228. font-weight: 400;
  229. @include color_primary($color-primary3);
  230. }
  231. .time {
  232. position: absolute;
  233. top: 0.16rem;
  234. left: 1.3rem;
  235. font-size: 0.2rem;
  236. //font-weight: 700;
  237. @include color_primary($color-primary3);
  238. }
  239. }
  240. .title {
  241. position: absolute;
  242. left: 0;
  243. right: 0;
  244. margin: auto;
  245. top: 0.1rem;
  246. font-size: 0.375rem;
  247. font-weight: 700;
  248. width: fit-content;
  249. @include color_primary($color-primary1);
  250. background: linear-gradient(to bottom, #b4dffc, #fbfeff);
  251. -webkit-background-clip: text;
  252. color: transparent;
  253. font-family: syhtB !important;
  254. }
  255. .title2 {
  256. position: absolute;
  257. left: 0;
  258. right: 0;
  259. margin: auto;
  260. top: 0rem;
  261. font-size: 0.355rem;
  262. letter-spacing: 4px;
  263. font-weight: 700;
  264. width: fit-content;
  265. @include color_primary($color-primary1);
  266. background: linear-gradient(to bottom, #b4dffc, #fbfeff);
  267. -webkit-background-clip: text;
  268. color: transparent;
  269. font-family: syhtB !important;
  270. >p{
  271. font-size: 0.25rem;
  272. }
  273. // 转变为行内块元素 文字
  274. }
  275. .title3 {
  276. position: absolute;
  277. left: 0;
  278. right: 0;
  279. margin: auto;
  280. top: 0.45rem;
  281. font-size: 0.25rem;
  282. letter-spacing: 4px;
  283. font-weight: 700;
  284. width: fit-content;
  285. @include color_primary($color-primary1);
  286. background: linear-gradient(to bottom, #b4dffc, #fbfeff);
  287. -webkit-background-clip: text;
  288. color: transparent;
  289. font-family: syhtB !important;
  290. >p{
  291. font-size: 0.25rem;
  292. }
  293. // 转变为行内块元素 文字
  294. }
  295. .nav {
  296. .btnBox {
  297. display: flex;
  298. justify-content: space-between;
  299. flex: none;
  300. // background: red;
  301. .btn {
  302. overflow: hidden !important;
  303. white-space: nowrap !important;
  304. text-overflow: ellipsis !important;
  305. width: 1.325rem;
  306. // height: 0.3rem;
  307. // background: blue;
  308. background-size: 100% 100%;
  309. font-size: 0.2rem;
  310. @include color_primary($color-primary3);
  311. text-align: center;
  312. // line-height: 0.625rem;
  313. line-height: 0.6rem;
  314. flex: none;
  315. cursor: pointer;
  316. @include user_select();
  317. }
  318. .btn1 {
  319. margin: 0rem 0 0 0.275rem;
  320. }
  321. .btn2 {
  322. margin: 0rem 0.275rem 0 0;
  323. }
  324. .active {
  325. @include color_primary($color-primary1);
  326. border-bottom: 0.025rem solid #01d1ff;
  327. border-image: linear-gradient(to right, #01d1ff, #2969e8) 1;
  328. }
  329. }
  330. .btnBoxLeft {
  331. position: fixed;
  332. left: 9.8%;
  333. }
  334. .btnBoxRight {
  335. position: fixed;
  336. right: 9.8%;
  337. }
  338. }
  339. .homeIcon {
  340. position: absolute;
  341. right: 10px;
  342. top: -10px;
  343. font-size: 0.625rem;
  344. color: #28bcfa;
  345. }
  346. }
  347. .timeImage2 {
  348. width: 0.5rem;
  349. }
  350. </style>