index.vue 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226
  1. <template>
  2. <div class="home_container">
  3. <!-- 头部 -->
  4. <div class="home_container_header">
  5. <div class="home_container_header-left">
  6. <div class="home_container_header-left_time">
  7. <img class="time_icon" src="../assets/img/risk_info_icon-1.png" alt="">
  8. <div class="clock">{{ currentTime }}</div>
  9. </div>
  10. <div class="home_container_header-left_tab">
  11. <div class="button-container">
  12. <div v-for="(item, index) in buttons" :key="index" class="parallelogram-button"
  13. :class="{ 'highlight': activeIndex === index }" @click="setActive(index,item)">
  14. <div class="text-container" :class="{ 'text-container-highlight': activeIndex === index }">{{ item.title
  15. }}</div>
  16. </div>
  17. </div>
  18. </div>
  19. </div>
  20. </div>
  21. <!-- 两侧 -->
  22. <div class="home_content_left">
  23. <LeftPage :activeIndex="activeIndex"></LeftPage>
  24. </div>
  25. <div class="home_content_right">
  26. <RightPage :activeIndex="activeIndex"></RightPage>
  27. </div>
  28. </div>
  29. </template>
  30. <script setup>
  31. import LeftPage from './left/index.vue'
  32. import RightPage from './right/index.vue'
  33. import { storeToRefs } from 'pinia'
  34. import { useUserStore } from '../store/user'
  35. import { useCommonStore } from '../store/common.js'
  36. import { ref, reactive, toRefs, onBeforeMount, onMounted, onUnmounted } from 'vue'
  37. let userStore = useUserStore()
  38. let commonStore = useCommonStore()
  39. console.log(userStore, 'useUserStore')
  40. let { name, age } = storeToRefs(userStore)
  41. const currentTime = ref('');
  42. // 更新当前时间的函数
  43. // 更新当前时间的函数
  44. const updateTime = () => {
  45. const now = new Date();
  46. // 格式化为 2025-02-25 10:39:05
  47. const year = now.getFullYear();
  48. const month = String(now.getMonth() + 1).padStart(2, '0'); // 月份从 0 开始,需加 1
  49. const day = String(now.getDate()).padStart(2, '0');
  50. const hours = String(now.getHours()).padStart(2, '0');
  51. const minutes = String(now.getMinutes()).padStart(2, '0');
  52. const seconds = String(now.getSeconds()).padStart(2, '0');
  53. currentTime.value = `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`;
  54. };
  55. // 设置定时器每秒更新一次
  56. let timer;
  57. onMounted(() => {
  58. updateTime(); // 初始化时更新时间
  59. timer = setInterval(updateTime, 1000); // 每秒更新
  60. });
  61. // 清理定时器
  62. onUnmounted(() => {
  63. clearInterval(timer);
  64. });
  65. let buttons = ref([{ id: 0, title: '报告处置', active: true }, { id: 1, title: '处置进展', active: false }])
  66. let activeIndex = ref(0) // 存储当前高亮按钮的索引
  67. function setActive (index,item) {
  68. // 切换高亮按钮,点击时高亮切换
  69. activeIndex.value = index
  70. commonStore.setActiveIndex(index)
  71. }
  72. </script>
  73. <style lang="scss" scoped>
  74. .home_container {
  75. width: 100vw;
  76. height: 100vh;
  77. background: url(../assets/img/1-1综合态势-市级.png) no-repeat;
  78. background-size: 100% 100%;
  79. position: relative;
  80. margin: 0 !important;
  81. overflow: hidden;
  82. }
  83. // 头部样式
  84. .home_container_header {
  85. width: 100%;
  86. height: 165px;
  87. background: url(../assets/img/大标题.png) no-repeat;
  88. background-size: 100% 100%;
  89. position: relative;
  90. .home_container_header-left {
  91. position: absolute;
  92. left: 31px;
  93. top: 30px;
  94. display: flex;
  95. align-items: center;
  96. .home_container_header-left_time {
  97. display: flex;
  98. align-items: center;
  99. margin-right: 143px;
  100. .time_icon {
  101. width: 36px;
  102. height: 36px;
  103. margin-right: 12px;
  104. }
  105. .clock {
  106. font-family: Alibaba PuHuiTi 3.0, Alibaba PuHuiTi 30;
  107. font-weight: normal;
  108. font-size: 20px;
  109. color: #FFFFFF;
  110. line-height: 16px;
  111. text-shadow: 0px 0px 7px #0091FF, 0px 0px 3px #0091FF;
  112. text-align: right;
  113. font-style: normal;
  114. text-transform: none;
  115. }
  116. }
  117. .home_container_header-left_tab {
  118. .button-container {
  119. display: flex;
  120. justify-content: center;
  121. align-items: center;
  122. // gap: 10px;
  123. /* 按钮之间的间隙 */
  124. }
  125. .parallelogram-button {
  126. width: 210px;
  127. height: 50px;
  128. border-radius: 15px;
  129. background: url(../assets/img/page_tab.png) no-repeat;
  130. background-size: 100% 100%;
  131. color: white;
  132. text-align: center;
  133. line-height: 50px;
  134. font-family: Alibaba PuHuiTi 3.0, Alibaba PuHuiTi 30;
  135. font-weight: normal;
  136. font-size: 24px;
  137. color: #FFFFFF;
  138. line-height: 50px;
  139. text-shadow: 0px 0px 7px #0091FF, 0px 0px 3px #0091FF;
  140. text-align: center;
  141. font-style: normal;
  142. text-transform: none;
  143. cursor: pointer;
  144. transform: skew(10deg);
  145. /* 使按钮向左倾斜(调整倾斜度) */
  146. transition: all 0.3s ease;
  147. /* 动画过渡 */
  148. .text-container {
  149. transform: skew(-10deg) !important;
  150. /* 让文字保持竖直 */
  151. text-align: center;
  152. line-height: 50px;
  153. font-family: Alibaba PuHuiTi 3.0, Alibaba PuHuiTi 30;
  154. font-weight: normal;
  155. font-size: 24px;
  156. color: #FFFFFF;
  157. text-shadow: 0px 0px 7px #0091FF, 0px 0px 3px #0091FF;
  158. font-style: normal;
  159. text-transform: none;
  160. }
  161. .text-container-highlight {
  162. color: #FFFFFF;
  163. text-shadow: 0px 0px 7px #0091FF, 0px 0px 3px #0091FF;
  164. }
  165. }
  166. .parallelogram-button.highlight {
  167. width: 210px;
  168. height: 50px;
  169. /* 高亮时按钮颜色 */
  170. // transform: skew(25deg) scale(1.1);
  171. /* 高亮时略微放大 */
  172. border-radius: 15px;
  173. background: url(../assets/img/page_tab_active.png) no-repeat;
  174. background-size: 100% 100%;
  175. }
  176. .parallelogram-button:hover {
  177. // background-color: #2980b9;
  178. // transform: skew(30deg) scale(1.05);
  179. /* 悬浮时略微放大 */
  180. }
  181. }
  182. }
  183. }
  184. // 左侧样式
  185. .home_content_left {
  186. position: absolute;
  187. left: 31px;
  188. top: 108px;
  189. width: 1124px;
  190. height: 945px;
  191. // background-color: pink;
  192. }
  193. // 右侧
  194. .home_content_right {
  195. position: absolute;
  196. right: 31px;
  197. top: 108px;
  198. min-width: 1124px;
  199. height: 945px;
  200. }
  201. </style>