Browse Source

chore: update

xiaoxian521 2 years ago
parent
commit
0c12cba474
3 changed files with 40 additions and 17 deletions
  1. 22 0
      mock/list.ts
  2. 5 0
      src/api/list.ts
  3. 13 17
      src/views/welcome/index.vue

File diff suppressed because it is too large
+ 22 - 0
mock/list.ts


+ 5 - 0
src/api/list.ts

@@ -12,3 +12,8 @@ type Result = {
 export const getCardList = (data?: object) => {
   return http.request<Result>("post", "/getCardList", { data });
 };
+
+/** 版本日志 */
+export const getReleases = () => {
+  return http.request<Result>("get", "/releases");
+};

+ 13 - 17
src/views/welcome/index.vue

@@ -1,10 +1,10 @@
 <script setup lang="ts">
 import dayjs from "dayjs";
-import axios from "axios";
 import MdEditor from "md-editor-v3";
 import Bar from "./components/Bar.vue";
 import Pie from "./components/Pie.vue";
 import Line from "./components/Line.vue";
+import { getReleases } from "@/api/list";
 import TypeIt from "@/components/ReTypeit";
 import { useWindowSize } from "@vueuse/core";
 import { ref, computed, markRaw } from "vue";
@@ -29,23 +29,19 @@ setTimeout(() => {
   loading.value = !loading.value;
 }, 800);
 
-axios
-  .get(
-    "https://gitee.com/api/v5/repos/yiming_chang/vue-pure-admin/releases?page=1&per_page=50&direction=desc"
-  )
-  .then(res => {
-    list.value = res.data.map(v => {
-      return {
-        content: v.body,
-        timestamp: dayjs(v.published_at).format("YYYY/MM/DD hh:mm:ss A"),
-        icon: markRaw(
-          useRenderFlicker({
-            background: randomColor({ type: "hex" }) as string
-          })
-        )
-      };
-    });
+getReleases().then(({ data }) => {
+  list.value = data.list.map(v => {
+    return {
+      content: v.body,
+      timestamp: dayjs(v.published_at).format("YYYY/MM/DD hh:mm:ss A"),
+      icon: markRaw(
+        useRenderFlicker({
+          background: randomColor({ type: "hex" }) as string
+        })
+      )
+    };
   });
+});
 </script>
 
 <template>

Some files were not shown because too many files changed in this diff