Переглянути джерело

新增项目管理页面对接

zmq 1 рік тому
батько
коміт
bf91111c27
3 змінених файлів з 139 додано та 82 видалено
  1. 92 2
      src/api/admin/data-contracts.ts
  2. 24 65
      src/api/admin/project.ts
  3. 23 15
      src/views/admin/project/index.vue

+ 92 - 2
src/api/admin/data-contracts.ts

@@ -4531,7 +4531,8 @@ export interface ViewUpdateInput {
    */
   id: number
 }
-/** 分页信息输入 */
+ 
+/** 项目请求分页信息输入 */
 export interface PageInputProjectGetPageDto {
   /**
    * 当前页标
@@ -4563,7 +4564,7 @@ export interface ResultOutputPageOutputProjectListOutput {
   /** 分页信息输出 */
   data?: PageOutputProjectListOutput
 }
-/** 分页信息输出 */
+/** 项目分页信息输出 */
 export interface PageOutputProjectListOutput {
   /**
    * 数据总数
@@ -4588,6 +4589,49 @@ export interface ProjectListOutput {
   /** 状态 */
   status?: string | null
 }
+/** 结果输出 */
+export interface ResultOutputProjectGetOutput {
+  /** 是否成功标记 */
+  success?: boolean
+  /** 编码 */
+  code?: string | null
+  /** 消息 */
+  msg?: string | null
+  data?: ProjectGetOutput
+}
+export interface ProjectGetOutput {
+  /**
+   * 项目名称   
+   */
+  name: string
+  /**
+   * 项目图标  
+   */
+  logo: string
+  /**
+   * 项目简介   
+   */
+  tips: string
+  /**
+   * 最高佣金   
+   */
+  maxPrice: number
+  /** 结算周期 */
+  settleDay: number
+  /** 视频教程 */
+  videoUrl?: string | null
+  /** 详情 */
+  detail: string | null
+  /** 作业要求 */
+  works?: string | null
+  /** 热词 多个词英文逗号分割, */
+  hotWords?: string | null
+  /** 项目Id */
+  id?: number | null
+  /** 价格 */
+  prices?: ProjectPriceAddInput[] | null
+}
+
 /** 添加项目 */
 export interface ProjectAddInput {
   /**
@@ -4627,6 +4671,45 @@ export interface ProjectAddInput {
   // 项目价格
   prices: ProjectPriceAddInput[]
 }
+/** 修改项目 */
+export interface ProjectUpdateInput {
+  /**
+   * 项目Id
+   * @format int64
+   */
+  id: number
+  /**
+   * 项目名称
+   * @minLength 1
+   */
+  name: string
+  /**
+   * 项目图标
+   * @minLength 1
+   */
+  logo: string
+  /** 项目简介 */
+  tips: string
+  /**
+   * 最高佣金
+   * @minLength 1
+   */
+  maxPrice: number
+  /**
+ * 结算周期
+ * @minLength 1
+ */
+  settleDay: number
+  /**
+   * 视频教程
+   * @minLength 1
+   */
+  videoUrl: string
+  /** 详情 */
+  detail: string
+  // 项目价格
+  prices: ProjectPriceAddInput[]
+}
 export interface ProjectPriceAddInput {
   /**
    * 项目价格Id
@@ -4645,6 +4728,13 @@ export interface ProjectPriceAddInput {
   price: number  
 }
 
+/** 设置项目状态 */
+export interface ProjectSetStatusInput {  
+  id?: number
+  /** 状态 2上架 3下架 4暂停 */
+  status?: number
+}
+
 /** 添加公告 */
 export interface NoticeAddInput {
   /**

+ 24 - 65
src/api/admin/project.ts

@@ -14,10 +14,10 @@ import {
     PageInputProjectGetPageDto,
     ResultOutputInt64,
     ResultOutputPageOutputProjectListOutput,
-    ResultOutputTenantGetOutput,
-    TenantAddInput,
-    TenantSetEnableInput,
-    TenantUpdateInput,
+    ResultOutputProjectGetOutput,
+    ProjectAddInput,
+    ProjectSetStatusInput,
+    ProjectUpdateInput,
 } from './data-contracts'
 import { ContentType, HttpClient, RequestParams } from './http-client'
 
@@ -38,7 +38,7 @@ export class ProjectApi<SecurityDataType = unknown> extends HttpClient<SecurityD
         },
         params: RequestParams = {}
     ) =>
-        this.request<ResultOutputTenantGetOutput, any>({
+        this.request<ResultOutputProjectGetOutput, any>({
             path: `/api/admin/project/get`,
             method: 'GET',
             query: query,
@@ -49,10 +49,10 @@ export class ProjectApi<SecurityDataType = unknown> extends HttpClient<SecurityD
     /**
      * No description
      *
-     * @tags tenant
+     * @tags project
      * @name GetPage
      * @summary 查询分页
-     * @request POST:/api/admin/tenant/get-page
+     * @request POST:/api/admin/project/get-page
      * @secure
      */
     getPage = (data: PageInputProjectGetPageDto, params: RequestParams = {}) =>
@@ -71,10 +71,10 @@ export class ProjectApi<SecurityDataType = unknown> extends HttpClient<SecurityD
      * @tags project
      * @name Add
      * @summary 新增
-     * @request POST:/api/admin/tenant/add
+     * @request POST:/api/admin/project/add
      * @secure
      */
-    add = (data: TenantAddInput, params: RequestParams = {}) =>
+    add = (data: ProjectAddInput, params: RequestParams = {}) =>
         this.request<ResultOutputInt64, any>({
             path: `/api/admin/project/add`,
             method: 'POST',
@@ -87,15 +87,15 @@ export class ProjectApi<SecurityDataType = unknown> extends HttpClient<SecurityD
     /**
      * No description
      *
-     * @tags tenant
+     * @tags project
      * @name Update
      * @summary 修改
-     * @request PUT:/api/admin/tenant/update
+     * @request PUT:/api/admin/project/update
      * @secure
      */
-    update = (data: TenantUpdateInput, params: RequestParams = {}) =>
+    update = (data: ProjectUpdateInput, params: RequestParams = {}) =>
         this.request<AxiosResponse, any>({
-            path: `/api/admin/tenant/update`,
+            path: `/api/admin/project/update`,
             method: 'PUT',
             body: data,
             secure: true,
@@ -105,33 +105,10 @@ export class ProjectApi<SecurityDataType = unknown> extends HttpClient<SecurityD
     /**
      * No description
      *
-     * @tags tenant
-     * @name Delete
-     * @summary 彻底删除
-     * @request DELETE:/api/admin/tenant/delete
-     * @secure
-     */
-    delete = (
-        query?: {
-            /** @format int64 */
-            id?: number
-        },
-        params: RequestParams = {}
-    ) =>
-        this.request<AxiosResponse, any>({
-            path: `/api/admin/tenant/delete`,
-            method: 'DELETE',
-            query: query,
-            secure: true,
-            ...params,
-        })
-    /**
-     * No description
-     *
-     * @tags tenant
+     * @tags project
      * @name SoftDelete
      * @summary 删除
-     * @request DELETE:/api/admin/tenant/soft-delete
+     * @request DELETE:/api/admin/project/soft-delete
      * @secure
      */
     softDelete = (
@@ -142,46 +119,28 @@ export class ProjectApi<SecurityDataType = unknown> extends HttpClient<SecurityD
         params: RequestParams = {}
     ) =>
         this.request<AxiosResponse, any>({
-            path: `/api/admin/tenant/soft-delete`,
+            path: `/api/admin/project/soft-delete`,
             method: 'DELETE',
             query: query,
             secure: true,
             ...params,
-        })
-    /**
-     * No description
-     *
-     * @tags tenant
-     * @name BatchSoftDelete
-     * @summary 批量删除
-     * @request PUT:/api/admin/tenant/batch-soft-delete
-     * @secure
-     */
-    batchSoftDelete = (data: number[], params: RequestParams = {}) =>
-        this.request<AxiosResponse, any>({
-            path: `/api/admin/tenant/batch-soft-delete`,
-            method: 'PUT',
-            body: data,
-            secure: true,
-            type: ContentType.Json,
-            ...params,
-        })
+        })    
     /**
      * No description
      *
-     * @tags tenant
+     * @tags project
      * @name SetEnable
-     * @summary 设置启用
-     * @request POST:/api/admin/tenant/set-enable
+     * @summary 设置状态
+     * @request PUT:/api/admin/project/update-status
      * @secure
      */
-    setEnable = (data: TenantSetEnableInput, params: RequestParams = {}) =>
+    setStates = (data: ProjectSetStatusInput, params: RequestParams = {}) =>
         this.request<AxiosResponse, any>({
-            path: `/api/admin/tenant/set-enable`,
-            method: 'POST',
+            path: `/api/admin/project/update-status`,
+            method: 'PUT',
             body: data,
             secure: true,
             type: ContentType.Json,
             ...params,
-        })
+        })    
 }

+ 23 - 15
src/views/admin/project/index.vue

@@ -9,8 +9,8 @@
                     <el-button type="primary" icon="ele-Search" @click="onQuery"> 查询 </el-button>
                     <el-button v-auth="'api:admin:project:add'" type="primary" icon="ele-Plus" @click="onAdd"> 新增
                     </el-button>
-                    <el-button type="primary" icon="ele-Plus" @click="onAdd"> 新增
-                        </el-button>
+                    <!-- <el-button type="primary" icon="ele-Plus" @click="onAdd"> 新增
+                        </el-button> -->
                 </el-form-item>
             </el-form>
         </el-card>
@@ -30,10 +30,14 @@
                         T+{{ row.settleDay }}
                     </template>
                 </el-table-column>
-                <el-table-column prop="status" label="状态" width="120" show-overflow-tooltip />             
+                <el-table-column prop="statusText" label="状态" width="120" show-overflow-tooltip />             
                 <el-table-column label="操作" width="180" header-align="center" align="center" fixed="right"> 
-                    <template #default="{ row }">
+                    <template #default="{ row }">                        
                         <el-button v-auth="'api:admin:project:update'" icon="ele-EditPen" size="small" text type="primary" @click="onEdit(row)">编辑</el-button>
+                        <el-button v-auth="'api:admin:project:update-status'" v-if="row.status == 1" size="small" text type="primary" @click="onEditStatus(row,2,'上架')">上架</el-button>
+                        <el-button v-auth="'api:admin:project:update-status'" v-if="row.status == 2" size="small" text type="primary" @click="onEditStatus(row,4, '暂停')">暂停</el-button>
+                        <el-button v-auth="'api:admin:project:update-status'" v-if="row.status == 4" size="small" text type="primary" @click="onEditStatus(row,2, '恢复')">恢复</el-button>
+                        <el-button v-auth="'api:admin:project:update-status'" v-if="row.status == 2" size="small" text type="primary" @click="onEditStatus(row,3, '下架')">下架</el-button>                        
                     </template>                   
                 </el-table-column>
             </el-table>
@@ -109,19 +113,23 @@ const onAdd = () => {
 }
 
 const onEdit = (row: ProjectListOutput) => {
-    state.ProjectFormTitle = '编辑项目'
-    projectFormRef.value.open(row)
+    proxy.$modal.msgError("待开发");
+    // state.ProjectFormTitle = '编辑项目'
+    // projectFormRef.value.open(row)
 }
 
-// const onDelete = (row: ProjectListOutput) => {
-//     proxy.$modal
-//         .confirmDelete(`确定要删除【${row.name}】?`)
-//         .then(async () => {
-//             await new ProjectApi().delete({ id: row.id }, { loading: true, showSuccessMessage: true })
-//             onQuery()
-//         })
-//         .catch(() => { })
-// }
+const onEditStatus = (row: ProjectListOutput, status: number, statusText: string) => {        
+    let info: string = `【${row.name}】下架后表示已完结,不可再从新上架,否确认下架?`;
+    if (status != 3)
+        info = `确定要${statusText}【${row.name}】?`;
+    proxy.$modal
+        .confirm(info)
+        .then(async () => {
+            await new ProjectApi().setStates({ id: row.id, status: status }, { loading: true, showSuccessMessage: true })
+            onQuery()
+        })
+        .catch(() => { })
+}
 
 const onSizeChange = (val: number) => {
     state.pageInput.pageSize = val