Browse Source

添加release版本

徐勤民 4 months ago
parent
commit
829f60fc06
1 changed files with 80 additions and 30 deletions
  1. 80 30
      src/views/app/AppReleaseView.vue

+ 80 - 30
src/views/app/AppReleaseView.vue

@@ -8,36 +8,54 @@ import { useManagerStore } from "@/stores/manager"
 
 const manager = useManagerStore()
 const Api = API
-const appList = ref([])
+const releaseList = ref([])
 const init = () => {
-  Api.appList({ pageNumber: 0, pageSize: 100 }).then((res) => {
-    appList.value = res.content
+  Api.releaseList({ appId: manager.appId, pageNumber: 0, pageSize: 100 }).then((res) => {
+    releaseList.value = res.content
   })
 }
-const appCreate = () => {
+const releaseCreate = () => {
   ElMessage.success("新建应用成功")
-  Api.appCreate({
-    downloadUrl: downloadUrl.value,
-    packageName: packageName.value,
-    appName: name.value
-  }).then(() => {
+  Api.releaseAdd(releaseData.value).then(() => {
     init()
     showDialog.value = false
   })
 }
-const name = ref(undefined)
-const downloadUrl = ref(undefined)
-const packageName = ref(undefined)
+const releaseData = ref({
+  appId: manager.appId,
+  huawei: false,
+  xiaomi: false,
+  meizu: false,
+  rongyao: false,
+  oppo: false,
+  vivo: false,
+  google: false,
+  url: undefined,
+  versionCode: undefined,
+  versionName: undefined,
+  content: undefined
+})
 const showDialog = ref(false)
 const detail = ref(undefined)
 const showDetailsDialog = ref(false)
-const addApp = () => {
-  name.value = undefined
-  downloadUrl.value = undefined
-  packageName.value = undefined
+const addRelease = () => {
+  releaseData.value = {
+    appId: manager.appId,
+    huawei: false,
+    xiaomi: false,
+    meizu: false,
+    rongyao: false,
+    oppo: false,
+    vivo: false,
+    google: false,
+    url: undefined,
+    versionCode: undefined,
+    versionName: undefined,
+    content: undefined
+  }
   showDialog.value = true
 }
-const showApp = (scope) => {
+const showRelease = (scope) => {
   detail.value = undefined
   // showDetailsDialog.value = true
 }
@@ -47,49 +65,81 @@ init()
 <template>
   <el-card style="margin-top: 20px">
     <template #header>
-      <el-button @click="addApp">新建应用{{ manager.appId }}</el-button>
+      <el-button @click="addRelease">新建版本</el-button>
     </template>
-    <el-table :data="appList" style="width: 100%">
+    <el-table :data="releaseList" style="width: 100%">
       <el-table-column type="index" width="150" label="序号" />
-      <el-table-column prop="appName" label="应用名称" />
+      <el-table-column prop="versionName" label="版本名称" />
+      <el-table-column prop="versionCode" label="版本号" />
+      <el-table-column prop="content" 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" @click="showRelease(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-dialog v-model="showDialog" title="新建应用">
     <el-input
       class="text item"
-      v-model="name"
+      v-model="releaseData.versionName"
       style="width: 440px"
-      placeholder="请输入应用名称"
+      placeholder="版本名称"
       :prefix-icon="PriceTag"
       :clearable="true"
     />
     <el-input
       class="text item"
-      v-model="downloadUrl"
+      v-model="releaseData.versionCode"
       style="width: 440px; margin-top: 20px"
-      placeholder="请输入下载地址"
+      placeholder="版本号"
       :prefix-icon="PriceTag"
       :clearable="true"
     />
     <el-input
       class="text item"
-      v-model="packageName"
+      v-model="releaseData.url"
       style="width: 440px; margin-top: 20px"
-      placeholder="请输入应用包名"
-      :prefix-icon="PriceTag"
+      placeholder="安装包下载地址"
       :clearable="true"
     />
+    <el-input
+      v-model="releaseData.content"
+      style="width: 440px; margin-top: 20px"
+      placeholder="更新内容"
+      :autosize="{ minRows: 2, maxRows: 6 }"
+      type="textarea"
+      maxlength="50"
+      show-word-limit
+    />
+    <el-descriptions style="margin-top: 40px" title="商店配置" border>
+      <el-descriptions-item label="华为">
+        <el-switch v-model="releaseData.huawei" size="large" />
+      </el-descriptions-item>
+      <el-descriptions-item label="小米">
+        <el-switch v-model="releaseData.xiaomi" size="large" />
+      </el-descriptions-item>
+      <el-descriptions-item label="OPPO">
+        <el-switch v-model="releaseData.oppo" size="large" />
+      </el-descriptions-item>
+      <el-descriptions-item label="VIVO">
+        <el-switch v-model="releaseData.vivo" size="large" />
+      </el-descriptions-item>
+      <el-descriptions-item label="魅族">
+        <el-switch v-model="releaseData.meizu" size="large" />
+      </el-descriptions-item>
+      <el-descriptions-item label="Google">
+        <el-switch v-model="releaseData.google" size="large" />
+      </el-descriptions-item>
+    </el-descriptions>
     <template #footer>
       <div class="dialog-footer">
         <el-button @click="showDialog = false">Cancel</el-button>
-        <el-button type="primary" @click="appCreate"> Confirm</el-button>
+        <el-button type="primary" @click="releaseCreate"> Confirm</el-button>
       </div>
     </template>
   </el-dialog>