Procházet zdrojové kódy

更新 版本日志获取

wzh před 3 roky
rodič
revize
3caec50f9d
2 změnil soubory, kde provedl 34 přidání a 4 odebrání
  1. 16 0
      src/apis/cloudLogin.js
  2. 18 4
      src/components/Header.vue

+ 16 - 0
src/apis/cloudLogin.js

@@ -0,0 +1,16 @@
+import cloudbase from "@cloudbase/js-sdk";
+
+const tcb = cloudbase.init({
+  env: "huihenduo-2gx127w7f837b584",
+});
+
+const auth = tcb.auth({
+  persistence: "local",
+});
+
+async function AnonymousLogin() {
+  await auth.anonymousAuthProvider().signIn();
+  const loginState = await auth.getLoginState();
+}
+AnonymousLogin();
+export default tcb;

+ 18 - 4
src/components/Header.vue

@@ -8,7 +8,7 @@
         class="ml20"
         style="color: #fff; font-size: 18px; height: 60px; padding-top: 50px"
       >
-        version:{{ timelineData[0].version }}
+        version:{{ timelineData[0]?.version }}
       </div>
     </div>
     <div class="right">
@@ -28,7 +28,7 @@
                 style="margin-bottom: 5px; font-size: 12px"
                 v-for="(item1, index) in item.remarks"
               >
-                {{ index + 1 }}. {{ item1 }}
+                {{ index + 1 }}. {{ item1.text }}
               </div>
             </div>
           </el-timeline-item>
@@ -46,7 +46,11 @@
 <script>
 import store from "../store";
 import router from "../router";
-import { ref } from "vue";
+import { onMounted, ref } from "vue";
+import tcb from "../apis/cloudLogin";
+const db = tcb.database();
+const v = db.collection("huihenduo_versions");
+const __ = db.command;
 
 export default {
   setup() {
@@ -92,7 +96,17 @@ export default {
       },
     ];
     let timelineData = ref([]);
-    timelineData.value = vs.reverse();
+    // timelineData.value = vs.reverse();
+    onMounted(() => {
+      getAbledVersions();
+    });
+    async function getAbledVersions() {
+      let res = await v
+        .where({ disabled: false, deleted: __.neq(true) })
+        .limit(6)
+        .get();
+      timelineData.value = res.data.reverse();
+    }
     return {
       quit,
       contactName,