Browse Source

添加release版本

徐勤民 2 months ago
parent
commit
66a8c8ba20

+ 3 - 1
src/api/index.js

@@ -33,5 +33,7 @@ export default {
   register: (params) => API.POSTJSON("/tenant/v1/create", params),
   login: (params) => API.POSTJSON("/user/v1/login", params),
   appList: (params) => API.POSTJSON("/manager/v1/list", params),
-  appCreate: (params) => API.POSTJSON("/manager/v1/create", params)
+  appCreate: (params) => API.POSTJSON("/manager/v1/create", params),
+  releaseList: (params) => API.POSTJSON("/release/v1/list", params),
+  releaseAdd: (params) => API.POSTJSON("/release/v1/add", params)
 }

+ 6 - 0
src/router/index.ts

@@ -5,6 +5,7 @@ import RegisterView from "@/views/RegisterView.vue"
 import MainView from "@/views/MainView.vue"
 import ImHomeView from "@/views/im/ImHomeView.vue"
 import AppHomeView from "@/views/app/AppHomeView.vue"
+import AppReleaseView from "@/views/app/AppReleaseView.vue"
 
 const router = createRouter({
   history: createWebHashHistory(),
@@ -54,6 +55,11 @@ const router = createRouter({
           path: "/appManager",
           name: "应用信息",
           component: AppHomeView
+        },
+        {
+          path: "/AppRelease",
+          name: "版本记录",
+          component: AppReleaseView
         }
       ]
     }

+ 11 - 0
src/stores/manager.ts

@@ -0,0 +1,11 @@
+import { ref, computed } from "vue"
+import { defineStore } from "pinia"
+
+export const useManagerStore = defineStore("token", () => {
+  const appId = ref(undefined)
+  function setAppId(t: string) {
+    appId.value = t
+  }
+
+  return { appId, setAppId }
+})

+ 1 - 0
src/views/MainView.vue

@@ -35,6 +35,7 @@
               <span>版本管理</span>
             </template>
             <el-menu-item index="/appManager">应用信息</el-menu-item>
+            <el-menu-item index="/AppRelease">版本记录</el-menu-item>
           </el-sub-menu>
         </el-menu>
       </el-aside>

+ 9 - 3
src/views/app/AppHomeView.vue

@@ -4,6 +4,12 @@ import API from "@/api/index.js"
 import { ref } from "vue"
 import { PriceTag } from "@element-plus/icons-vue"
 import { ElMessage } from "element-plus"
+import { useRouter } from "vue-router"
+import { useManagerStore } from "@/stores/manager"
+
+const router = useRouter()
+
+const manager = useManagerStore()
 
 const Api = API
 const appList = ref([])
@@ -35,9 +41,9 @@ const addApp = () => {
   packageName.value = undefined
   showDialog.value = true
 }
-const showApp = (scope) => {
-  detail.value = undefined
-  // showDetailsDialog.value = true
+const showApp = (item) => {
+  manager.setAppId(item.appId)
+  router.push("/AppRelease")
 }
 init()
 </script>

+ 113 - 0
src/views/app/AppReleaseView.vue

@@ -0,0 +1,113 @@
+<script setup lang="ts">
+// @ts-ignore
+import API from "@/api/index.js"
+import { ref } from "vue"
+import { PriceTag } from "@element-plus/icons-vue"
+import { ElMessage } from "element-plus"
+import { useManagerStore } from "@/stores/manager"
+
+const manager = useManagerStore()
+const Api = API
+const appList = ref([])
+const init = () => {
+  Api.appList({ pageNumber: 0, pageSize: 100 }).then((res) => {
+    appList.value = res.content
+  })
+}
+const appCreate = () => {
+  ElMessage.success("新建应用成功")
+  Api.appCreate({
+    downloadUrl: downloadUrl.value,
+    packageName: packageName.value,
+    appName: name.value
+  }).then(() => {
+    init()
+    showDialog.value = false
+  })
+}
+const name = ref(undefined)
+const downloadUrl = ref(undefined)
+const packageName = ref(undefined)
+const showDialog = ref(false)
+const detail = ref(undefined)
+const showDetailsDialog = ref(false)
+const addApp = () => {
+  name.value = undefined
+  downloadUrl.value = undefined
+  packageName.value = undefined
+  showDialog.value = true
+}
+const showApp = (scope) => {
+  detail.value = undefined
+  // showDetailsDialog.value = true
+}
+init()
+</script>
+
+<template>
+  <el-card style="margin-top: 20px">
+    <template #header>
+      <el-button @click="addApp">新建应用{{ manager.appId }}</el-button>
+    </template>
+    <el-table :data="appList" style="width: 100%">
+      <el-table-column type="index" width="150" label="序号" />
+      <el-table-column prop="appName" label="应用名称" />
+      <el-table-column prop="createTime" label="创建时间" />
+      <el-table-column fixed="right" label="操作" min-width="120">
+        <template #default="scope">
+          <el-button link type="primary" size="small" @click="showApp(scope.row)"> 详情 </el-button>
+          <el-button link type="primary" size="small">删除</el-button>
+        </template>
+      </el-table-column>
+    </el-table>
+  </el-card>
+  <el-dialog v-model="showDialog" title="新建应用" width="500">
+    <el-input
+      class="text item"
+      v-model="name"
+      style="width: 440px"
+      placeholder="请输入应用名称"
+      :prefix-icon="PriceTag"
+      :clearable="true"
+    />
+    <el-input
+      class="text item"
+      v-model="downloadUrl"
+      style="width: 440px; margin-top: 20px"
+      placeholder="请输入下载地址"
+      :prefix-icon="PriceTag"
+      :clearable="true"
+    />
+    <el-input
+      class="text item"
+      v-model="packageName"
+      style="width: 440px; margin-top: 20px"
+      placeholder="请输入应用包名"
+      :prefix-icon="PriceTag"
+      :clearable="true"
+    />
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button @click="showDialog = false">Cancel</el-button>
+        <el-button type="primary" @click="appCreate"> Confirm</el-button>
+      </div>
+    </template>
+  </el-dialog>
+  <el-dialog v-model="showDetailsDialog" title="应用信息" width="500">
+    <el-input
+      class="text item"
+      v-model="name"
+      style="width: 440px"
+      placeholder="请输入应用名称"
+      :prefix-icon="PriceTag"
+      :clearable="true"
+    />
+    <template #footer>
+      <div class="dialog-footer">
+        <el-button type="primary" @click="showDetailsDialog = false"> 关闭</el-button>
+      </div>
+    </template>
+  </el-dialog>
+</template>
+
+<style scoped></style>