houyaf пре 3 година
родитељ
комит
8004788503

+ 26 - 3
src/router/modules/app.center.ts

@@ -9,7 +9,7 @@ const routes: RouteRecordRaw[] = [
     redirect: '/app-center/store',
     name: 'app_center',
     meta: {
-      title: '应用中心',
+      title: '应用商店',
       icon: 'ri:function-line',
     },
     children: [
@@ -54,7 +54,7 @@ const routes: RouteRecordRaw[] = [
     path: '/app-center/publish',
     component: Layout,
     redirect: '/app-center/publish/index',
-    name: 'daas_database',
+    name: 'appPublish',
     meta: {
       title: '应用发布',
       icon: 'bx:bxs-component',
@@ -62,7 +62,7 @@ const routes: RouteRecordRaw[] = [
     children: [
       {
         path: 'index',
-        name: 'daas_database_index',
+        name: 'appPublishIndex',
         component: () => import('@/views/app_center/publish/index.vue'),
         meta: {
           title: '应用发布',
@@ -73,5 +73,28 @@ const routes: RouteRecordRaw[] = [
       },
     ],
   },
+  {
+    path: '/app-center/removed',
+    component: Layout,
+    redirect: '/app-center/removed/index',
+    name: 'appRemoved',
+    meta: {
+      title: '已下架',
+      icon: 'ep:delete',
+    },
+    children: [
+      {
+        path: 'index',
+        name: 'appRemovedIndex',
+        component: () => import('@/views/app_center/removed/index.vue'),
+        meta: {
+          title: '已下架',
+          sidebar: false,
+          breadcrumb: false,
+          activeMenu: '/app-center/removed',
+        },
+      },
+    ],
+  },
 ]
 export default routes

+ 1 - 0
src/types/components.d.ts

@@ -9,6 +9,7 @@ export {}
 
 declare module '@vue/runtime-core' {
   export interface GlobalComponents {
+    AppSelector: typeof import('./../components/AppSelector/index.vue')['default']
     Auth: typeof import('./../components/Auth/index.vue')['default']
     AuthAll: typeof import('./../components/AuthAll/index.vue')['default']
     BatchActionBar: typeof import('./../components/BatchActionBar/index.vue')['default']

+ 34 - 1
src/views/app_center/app_store/index.vue

@@ -4,8 +4,9 @@ meta:
 </route>
 
 <script lang="ts" setup>
+import { ElMessage, ElMessageBox } from 'element-plus'
 import App from './components/App.vue'
-import { getAppByList } from '@/api/apps/appApi'
+import { getAppByList, updateApp } from '@/api/apps/appApi'
 const tabbar = useTabbar()
 
 const state = reactive({
@@ -42,6 +43,24 @@ const onAppPermit = (data: any) => {
     },
   })
 }
+
+const onAppPublish = () => {
+  tabbar.open({
+    name: 'appPublish',
+    params: { },
+  })
+}
+
+const onAppRemove = (data: any) => {
+  ElMessageBox.confirm(`确认下架「${data.appTitle}」吗?`, '确认信息').then(async () => {
+    await updateApp({ appId: data.appId, ifStore: 0 })
+    await getData()
+    ElMessage.success({
+      message: '删除成功',
+      center: true,
+    })
+  }).catch(() => {})
+}
 </script>
 
 <template>
@@ -52,6 +71,17 @@ const onAppPermit = (data: any) => {
           便捷管理发布的应用软件或应用服务
         </div>
       </template>
+
+      <el-button-group>
+        <el-button type="primary" size="large" plain @click="onAppPublish">
+          <template #icon>
+            <el-icon>
+              <svg-icon name="ep:plus" />
+            </el-icon>
+          </template>
+          发布应用
+        </el-button>
+      </el-button-group>
     </page-header>
 
     <el-row :gutter="20" style="margin: 0 10px;">
@@ -77,6 +107,9 @@ const onAppPermit = (data: any) => {
             <el-button text @click="onAppPermit(item)">
               权限配置
             </el-button>
+            <el-button text @click="onAppRemove(item)">
+              下架
+            </el-button>
           </div>
         </el-card>
       </el-col>

+ 116 - 0
src/views/app_center/removed/index.vue

@@ -0,0 +1,116 @@
+<script lang="ts" setup name="AppRemoved">
+import { ElMessage, ElMessageBox } from 'element-plus'
+import { deleteAppById, getAppByList, updateApp } from '@/api/apps/appApi'
+
+const state = reactive({
+  loading: false,
+  // 表格是否自适应高度
+  tableAutoHeight: false,
+  // 搜索
+  search: {
+    ifStore: 0,
+    keywords: '',
+  },
+  // 列表数据
+  dataList: [],
+})
+
+const appRemovedTableRef = ref()
+const getDataList = async () => {
+  state.loading = true
+  const { data } = await getAppByList(state.search)
+  state.dataList = data
+  state.loading = false
+}
+
+onMounted(() => {
+  getDataList()
+})
+
+function onAppPublish(row: any) {
+  ElMessageBox.confirm(`确认上架「${row.appTitle}」吗?`, '确认信息').then(async () => {
+    await updateApp({ appId: row.appId, ifStore: 1 })
+    await getDataList()
+    ElMessage.success({
+      message: '上架成功',
+      center: true,
+    })
+  }).catch(() => {})
+}
+
+function onAppDel(row: any) {
+  ElMessageBox.confirm(`确认删除「${row.appTitle}」吗?`, '确认信息').then(async () => {
+    await deleteAppById(row.appId)
+    await getDataList()
+    ElMessage.success({
+      message: '删除成功',
+      center: true,
+    })
+  }).catch(() => {})
+}
+</script>
+
+<template>
+  <div :class="{ 'absolute-container': state.tableAutoHeight }">
+    <page-header title="已下架应用">
+      <template #content>
+        <div>
+          系统支持管理应用市场中已下架的应用
+        </div>
+      </template>
+    </page-header>
+
+    <page-main>
+      <el-table ref="appRemovedTableRef" v-loading="state.loading" class="list-table" :data="state.dataList" border stripe highlight-current-row height="100%">
+        <el-table-column type="index" label="序号" width="60" header-align="center" align="center" />
+
+        <el-table-column prop="appTitle" label="名称" header-align="center" align="center" width="200" />
+
+        <el-table-column prop="appCatTitle" label="分类" />
+
+        <el-table-column prop="appKey" label="app Key" />
+
+        <el-table-column prop="appSecret" label="app Secret" />
+
+        <el-table-column prop="appDesc" label="说明" />
+
+        <el-table-column label="操作" width="250" align="center" fixed="right">
+          <template #default="scope">
+            <el-button type="primary" size="small" plain @click="onAppPublish(scope.row)">
+              重新上架
+            </el-button>
+            <el-button v-if="!scope.row.isFixed" type="danger" size="small" plain @click="onAppDel(scope.row)">
+              删除
+            </el-button>
+          </template>
+        </el-table-column>
+      </el-table>
+    </page-main>
+  </div>
+</template>
+
+<style lang="scss" scoped>
+.absolute-container {
+  position: absolute;
+  width: 100%;
+  height: 100%;
+  display: flex;
+  flex-direction: column;
+
+  .page-header {
+    margin-bottom: 0;
+  }
+
+  .page-main {
+    // 让 page-main 的高度自适应
+    flex: 1;
+    overflow: auto;
+    display: flex;
+    flex-direction: column;
+
+    .search-container {
+      margin-bottom: 0;
+    }
+  }
+}
+</style>