Browse Source

[web_demo] 首页显示构建版本号以及模型信息

yanxin 1 year ago
parent
commit
a8790dda54

+ 8 - 0
src/api/api.ts

@@ -41,6 +41,14 @@ export const GetVersion = (
   api: string
 ): Promise<string> => server.get(api);
 
+export const GetBuildTag = (
+  api: string
+): Promise<string> => server.get(api);
+
+export const GetModelInfo = (
+  api: string
+): Promise<string> => server.get(api);
+
 export const IMMagicColor = (
   api: string,
   data: FormData

File diff suppressed because it is too large
+ 86 - 86
src/dist/assets/index-1a9d3720.js


File diff suppressed because it is too large
+ 1 - 1
src/dist/assets/index-87b6234f.css


+ 2 - 2
src/dist/index.html

@@ -4,8 +4,8 @@
     <meta charset="UTF-8" />
     <meta name="viewport" content="width=device-width, initial-scale=1.0" />
     <title>DocumentAI Web Demo</title>
-    <script type="module" crossorigin src="./assets/index-1a9d3720.js"></script>
-    <link rel="stylesheet" href="./assets/index-87b6234f.css">
+    <script type="module" crossorigin src="./assets/index-17c8c42c.js"></script>
+    <link rel="stylesheet" href="./assets/index-e8be439a.css">
   </head>
   <body>
     <div id="app"></div>

+ 67 - 13
src/pages/main/views/homePage.vue

@@ -1,23 +1,77 @@
 <template>
   <h1>DocumentAI</h1>
+
+  <h3>构建版本号</h3>
+  <p class="italic">{{ build_tag }}</p>
+
+
+  <h3>模型信息</h3>
+  <p>模型个数:{{ model_num }}</p>
+  <el-table :data="model_data" style="width: 100%">
+    <el-table-column prop="key" label="Key" width="auto" />
+    <el-table-column prop="type" label="Type" width="auto" />
+    <el-table-column prop="subtype" label="Subtype" width="auto" />
+    <el-table-column prop="format" label="Format" width="auto" />
+    <el-table-column prop="version" label="Version" width="auto" />
+  </el-table>
 </template>
 
 <script setup lang="ts">
-import { openWindow } from "@/utils/openWindow";
-</script>
+import { onMounted, ref } from "vue";
+import { GetBuildTag, GetModelInfo } from '../../../api/api'
+import { storeToRefs } from 'pinia'
+import { useVersionStore } from '../../../store/Version';
 
-<style scoped lang="less">
-img {
-  width: 100%;
-  height: 200px;
-  background-position: center center;
-}
+const vr = useVersionStore();
+const { build_tag, model_info } = storeToRefs(vr);
 
-.blue {
-  background-color: #479AC7;
-}
+let model_num = ref(0)
+let model_data: any = ref([])
 
-.white_text {
-  color: white;
+onMounted(async () => {
+  if (build_tag.value == "") {
+    GetBuildTag("/v1/buildTag").then(res => {
+      build_tag.value = res;
+    })
+  }
+  if (model_info.value == "") {
+    GetModelInfo("/v1/modelInfo").then(res => {
+      model_info.value = res;
+      const model = JSON.parse(model_info.value)
+      model_num.value = model['model_num']
+      console.log(model['model_num'])
+      console.log(model['model_keys'])
+      const model_array = model['model_keys']
+      for (let i = 0; i < model_array.length; i++) {
+        model_data.value.push({
+          key: model_array[i]['model_key'],
+          type: model_array[i]['model_type'],
+          subtype: model_array[i]['model_sub_type'],
+          format: model_array[i]['model_format'],
+          version: model_array[i]['model_version'],
+        })
+      }
+    })
+  }
+  const model = JSON.parse(model_info.value)
+  model_num.value = model['model_num']
+  console.log(model['model_num'])
+  console.log(model['model_keys'])
+  const model_array = model['model_keys']
+  for (let i = 0; i < model_array.length; i++) {
+    model_data.value.push({
+      key: model_array[i]['model_key'],
+      type: model_array[i]['model_type'],
+      subtype: model_array[i]['model_sub_type'],
+      format: model_array[i]['model_format'],
+      version: model_array[i]['model_version'],
+    })
+  }
+})
+</script>
+
+<style scoped lang="less">
+.italic {
+  font-style: italic;
 }
 </style>

+ 5 - 1
src/store/Version.ts

@@ -3,9 +3,13 @@ import { ref } from 'vue'
 
 export const useVersionStore = defineStore('version', () => {
   const version = ref("")
+  const build_tag = ref("")
+  const model_info = ref("")
   function reset() {
     version.value = ""
+    build_tag.value = ""
+    model_info.value = ""
   }
 
-  return { version, reset }
+  return { version, build_tag, model_info, reset }
 })