map.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <template>
  2. <div class="map">
  3. <div class="back"></div>
  4. <div class="security-days">
  5. <div class="text">安全天数:</div>
  6. <div class="num">
  7. <span class="font-num">1,945</span>
  8. <span class="unit">天</span>
  9. </div>
  10. </div>
  11. <div class="tab-box">
  12. <div class="tab-item" v-for="(tab, index) of tabs" :key="index" :class="{'active': activeTab == index}"
  13. @click="selectTab(index)">
  14. <span class="svg-icon svg-icon-sm" :class="activeTab == index ? 'svg-icon-green' : 'svg-icon-write'">
  15. <SvgIcon :svgid="tab.icon"></SvgIcon>
  16. </span>
  17. <span>{{tab.text}}</span>
  18. </div>
  19. </div>
  20. <div class="map-img">
  21. <SvgMap></SvgMap>
  22. </div>
  23. </div>
  24. </template>
  25. <script>
  26. import SvgIcon from '@com/coms/icon/svg-icon.vue';
  27. import SvgMap from "./map/svg-map.vue";
  28. export default {
  29. // 名称
  30. name: "Map",
  31. // 使用组件
  32. components: {
  33. SvgIcon,
  34. SvgMap,
  35. },
  36. // 数据
  37. data() {
  38. return {
  39. tabs: [{
  40. icon: 'svg-all',
  41. text: '全部'
  42. },
  43. {
  44. icon: 'svg-wind-site',
  45. text: '风场'
  46. },
  47. {
  48. icon: 'svg-photovoltaic',
  49. text: '电站'
  50. },
  51. ],
  52. activeTab: 0,
  53. img: require("@assets/map/map-nx.png"),
  54. nxSvgFile: require("@assets/map/map-nx.svg"),
  55. }
  56. },
  57. // 函数
  58. methods: {
  59. selectTab: function(index) {
  60. this.activeTab = index;
  61. }
  62. },
  63. // 生命周期钩子
  64. beforeCreate() {
  65. // 创建前
  66. },
  67. created() {
  68. // 创建后
  69. },
  70. beforeMount() {
  71. // 渲染前
  72. },
  73. mounted() {
  74. // 渲染后
  75. },
  76. beforeUpdate() {
  77. // 数据更新前
  78. },
  79. updated() {
  80. // 数据更新后
  81. },
  82. }
  83. </script>
  84. <style lang="less" scoped>
  85. .map {
  86. position: relative;
  87. width: 100%;
  88. height: 100%;
  89. .back {
  90. position: fixed;
  91. z-index: -1;
  92. width: 100vw;
  93. height: 100vh;
  94. top: 0;
  95. left: 0;
  96. background: url(../../../assets/background-home.png) no-repeat;
  97. background-size: 100% 100%;
  98. }
  99. .security-days {
  100. margin: 1.852vh;
  101. .text {
  102. font-size: 2.222vh;
  103. color: @write;
  104. }
  105. .num {
  106. color: @green;
  107. font-size: 3.704vh;
  108. .unit {
  109. font-size: 2.222vh;
  110. position: relative;
  111. margin-left: 0.556vh;
  112. top: -0.185vh;
  113. }
  114. }
  115. }
  116. .tab-box {
  117. margin: 1.852vh 2.778vh;
  118. .tab-item {
  119. display: flex;
  120. align-items: center;
  121. justify-content: center;
  122. font-size: @fontsize-l;
  123. cursor: pointer;
  124. width: 6.481vh;
  125. padding: 0.741vh 0;
  126. &.active {
  127. color: @green;
  128. position: relative;
  129. background-image: @greenLinearTop;
  130. &::after {
  131. content: "";
  132. position: absolute;
  133. width: 100%;
  134. height: 0.463vh;
  135. border: 0.093vh solid @green;
  136. border-top: 0;
  137. left: 0;
  138. bottom: 0;
  139. box-sizing: border-box;
  140. }
  141. }
  142. .svg-icon {
  143. margin-right: 0.556vh;
  144. }
  145. }
  146. }
  147. .map-img {
  148. width: calc(100% - 14.815vh);
  149. height: calc(100% - 14.815vh);
  150. margin: 7.407vh;
  151. position: absolute;
  152. z-index: 1;
  153. top: 0;
  154. left: 0;
  155. @keyframes rotate
  156. {
  157. from {transform: rotateX(70deg);}
  158. to {transform: rotateX(0deg);}
  159. }
  160. img {
  161. width: 100%;
  162. animation: rotate 3s;
  163. animation-direction: alternate;
  164. animation-iteration-count: infinite;
  165. }
  166. }
  167. }
  168. </style>