Header.vue 3.8 KB

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