Header.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  1. <template>
  2. <div class="header">
  3. <div class="left">
  4. <!-- <img class="first" src="../assets/three.png" alt="" />
  5. <div class="shu"></div> -->
  6. <img class="logo" src="../assets/white-logo.png" alt="" />
  7. <div
  8. class="ml20"
  9. style="color: #fff; font-size: 18px; height: 60px; padding-top: 30px"
  10. >
  11. version:{{ timelineData[0]?.version }}
  12. </div>
  13. </div>
  14. <div class="right">
  15. <img class="user-icon" src="../assets/user.png" alt="" />
  16. <div class="user">{{ contactName }}</div>
  17. <el-popover placement="bottom" trigger="hover" :width="280">
  18. <div
  19. style="
  20. width: 100%;
  21. height: 60vh;
  22. overflow-y: auto;
  23. padding-right: 10px;
  24. margin-right: 10px;
  25. "
  26. >
  27. <el-timeline>
  28. <el-timeline-item
  29. v-for="item in timelineData"
  30. :key="item"
  31. center
  32. :timestamp="item.timer"
  33. placement="top"
  34. >
  35. <div class="log-card">
  36. <p style="margin-bottom: 10px">Version: {{ item.version }}</p>
  37. <div
  38. style="margin-bottom: 5px; font-size: 12px"
  39. v-for="(item1, index) in item.remarks"
  40. :key="item1"
  41. >
  42. {{ index + 1 }}. {{ item1.text }}
  43. </div>
  44. </div>
  45. </el-timeline-item>
  46. </el-timeline>
  47. </div>
  48. <template #reference>
  49. <el-badge value="new">
  50. <div class="log">新功能日志</div>
  51. </el-badge>
  52. </template>
  53. </el-popover>
  54. <div class="quit" @click="quit">[退出]</div>
  55. </div>
  56. </div>
  57. </template>
  58. <script>
  59. import store from "../store";
  60. import router from "../router";
  61. import { onMounted, ref } from "vue";
  62. import { AnonymousLogin, tcb } from "../apis/cloudLogin";
  63. const db = tcb.database();
  64. const v = db.collection("huihenduo_versions");
  65. const __ = db.command;
  66. export default {
  67. setup() {
  68. let contactName = localStorage.contactName;
  69. function quit() {
  70. localStorage.clear();
  71. store.commit("changeLogin", false);
  72. router.push({ path: "/login" });
  73. }
  74. let timelineData = ref([]);
  75. onMounted(() => {
  76. cloudLogin();
  77. });
  78. async function getAbledVersions() {
  79. let res = await v
  80. .aggregate()
  81. .match({ deleted: __.neq(true) })
  82. .sort({
  83. createTime: -1,
  84. })
  85. .limit(10)
  86. .end();
  87. timelineData.value = res.data;
  88. }
  89. async function cloudLogin() {
  90. await AnonymousLogin();
  91. getAbledVersions();
  92. }
  93. return {
  94. quit,
  95. contactName,
  96. timelineData,
  97. };
  98. },
  99. };
  100. </script>
  101. <style scoped>
  102. .header {
  103. width: 100%;
  104. height: 60px;
  105. background: #212029;
  106. display: flex;
  107. align-items: center;
  108. justify-content: space-between;
  109. }
  110. .left,
  111. .right {
  112. display: flex;
  113. align-items: center;
  114. }
  115. .first {
  116. width: 22px;
  117. height: 20px;
  118. margin: 0 22px;
  119. }
  120. .shu {
  121. width: 1px;
  122. height: 60px;
  123. background: #101015;
  124. margin-right: 22px;
  125. }
  126. .logo {
  127. width: 120px;
  128. height: 40px;
  129. margin-left: 20px;
  130. }
  131. .title {
  132. font-size: 21px;
  133. font-family: PingFangSC-Regular, PingFang SC;
  134. font-weight: 400;
  135. color: #ffffff;
  136. margin-left: 26px;
  137. }
  138. .user,
  139. .quit,
  140. .log {
  141. font-size: 14px;
  142. font-family: PingFangSC-Medium, PingFang SC;
  143. font-weight: 500;
  144. color: #ffffff;
  145. cursor: pointer;
  146. margin-right: 16px;
  147. }
  148. .log-card p {
  149. font-size: 10px;
  150. }
  151. .user-icon {
  152. width: 18px;
  153. height: 18px;
  154. margin-right: 16px;
  155. }
  156. .log {
  157. margin-right: 4px;
  158. }
  159. .quit {
  160. margin-left: 26px;
  161. }
  162. </style>