index.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <header>
  3. <el-row class="headerRowBox">
  4. <el-col>{{ dateDay }}</el-col>
  5. <el-col class="time">{{ dataTime }}</el-col>
  6. <el-col class="weather">
  7. <!-- <img v-if="weatherObj.weather_pic" :src="weatherObj.weather_pic || ''" alt="" /> -->
  8. <!-- <span v-if="weatherObj.weather">{{ weatherObj.weather }} {{ weatherObj.temperature }}℃</span> -->
  9. <img src="../../../assets/image/header-AF.png" alt="" />
  10. </el-col>
  11. <el-col>多云 23℃</el-col>
  12. </el-row>
  13. <el-row class="headerCenterBox">永天科技-智能物联网设备</el-row>
  14. <el-row class="headerRowBox">
  15. </el-row>
  16. </header>
  17. </template>
  18. <script>
  19. export default {
  20. data() {
  21. return {
  22. dateDay: "",
  23. dataTime: "",
  24. timeArea: "",
  25. weatherObj: {},
  26. dataWeekList: ["一", "二", "三", "四", "五", "六", "七"],
  27. };
  28. },
  29. created() {},
  30. mounted() {
  31. this.getData();
  32. setInterval(() => {
  33. let day = new Date();
  34. this.dateDay =
  35. day.getFullYear() +
  36. "年" +
  37. (day.getMonth() + 1 < 10
  38. ? "0" + (day.getMonth() + 1)
  39. : "" + (day.getMonth() + 1)) +
  40. "月" +
  41. (day.getDate() < 10 ? "0" + day.getDate() : day.getDate()) +
  42. "日 " +
  43. " 星期" +
  44. this.dataWeekList[day.getDay()];
  45. this.dataTime =
  46. (day.getHours() < 10 ? "0" + day.getHours() : day.getHours()) +
  47. ":" +
  48. (day.getMinutes() < 10 ? "0" + day.getMinutes() : day.getMinutes()) +
  49. ":" +
  50. (day.getSeconds() < 10 ? "0" + day.getSeconds() : day.getSeconds());
  51. }, 1000);
  52. },
  53. methods: {
  54. async getData() {
  55. },
  56. async getWeather() {
  57. let res = await this.$axios.get("/aliWeather");
  58. if (res.showapi_res_code === 0) {
  59. this.weatherObj = res.showapi_res_body.now;
  60. }
  61. },
  62. },
  63. };
  64. </script>
  65. <style lang="scss" scoped>
  66. header {
  67. width: 100%;
  68. padding: 0 20px;
  69. display: flex;
  70. background: url("../../../assets/image/header.png");
  71. background-size: 100% 100%;
  72. font-size: 14px;
  73. box-sizing: border-box;
  74. .headerRowBox {
  75. width: 34%;
  76. display: flex;
  77. padding-top: 12px;
  78. height: 100%;
  79. &::before{
  80. display: none;
  81. }
  82. .el-col {
  83. flex: none;
  84. width: auto;
  85. height: auto;
  86. margin-right: 20px;
  87. line-height: 30px;
  88. span{
  89. font-size: 20px;
  90. color: #F6D311;
  91. margin-left: 10px;
  92. }
  93. }
  94. .time {
  95. margin-left: 10px;
  96. font-size: 28px;
  97. width: 90px;
  98. font-family: "DS", "DS-B", "DS-BB", "DS-BS";
  99. }
  100. .weather {
  101. display: flex;
  102. img {
  103. width: 28px;
  104. height: 28px;
  105. display: block;
  106. }
  107. }
  108. }
  109. .headerCenterBox{
  110. flex: 1;
  111. display: flex;
  112. align-items: center;
  113. justify-content: center;
  114. font-size: 32px;
  115. font-family: "DS", "DS-B", "DS-BB", "DS-BS";
  116. font-weight: 700;
  117. letter-spacing: 1px;
  118. background-image:-webkit-linear-gradient(top,#fafeff,#59c8ff,);
  119. -webkit-background-clip:text;
  120. -webkit-text-fill-color:transparent;
  121. }
  122. // .headerRightBox {
  123. // width: 34%;
  124. // display: flex;
  125. // align-items: center;
  126. // height: 100%;
  127. // .el-col {
  128. // flex: none;
  129. // width: auto;
  130. // height: auto;
  131. // margin-right: 30px;
  132. // }
  133. // }
  134. }
  135. </style>