Browse Source

轮播图相关

zmq 1 year ago
parent
commit
b90dbf2a97
3 changed files with 74 additions and 15 deletions
  1. 26 3
      src/api/admin/Banner.ts
  2. 47 11
      src/views/admin/banner/index.vue
  3. 1 1
      src/views/admin/projectprice/index.vue

+ 26 - 3
src/api/admin/Banner.ts

@@ -112,7 +112,7 @@ export class BannerApi<SecurityDataType = unknown> extends HttpClient<SecurityDa
      * @tags banner
      * @name SoftDelete
      * @summary 修改状态
-     * @request DELETE:/api/admin/notice/soft-delete
+     * @request DELETE:/api/admin/banner/soft-delete
      * @secure
      */
     updateStatus = (
@@ -124,11 +124,34 @@ export class BannerApi<SecurityDataType = unknown> extends HttpClient<SecurityDa
         params: RequestParams = {}
     ) =>
         this.request<AxiosResponse, any>({
-            path: `/api/admin/notice/soft-delete`,
+            path: `/api/admin/banner/update-status`,
             method: 'get',
             query: query,
             secure: true,
             ...params,
-        })    
+        })
+    /**
+   * No description
+   *
+   * @tags dict
+   * @name SoftDelete
+   * @summary 删除
+   * @request DELETE:/api/admin/banner/soft-delete
+   * @secure
+   */
+    softDelete = (
+        query?: {
+            /** @format int64 */
+            id?: number
+        },
+        params: RequestParams = {}
+    ) =>
+        this.request<AxiosResponse, any>({
+            path: `/api/admin/banner/soft-delete`,
+            method: 'DELETE',
+            query: query,
+            secure: true,
+            ...params,
+        })
 }
 

+ 47 - 11
src/views/admin/banner/index.vue

@@ -20,16 +20,30 @@
     <el-card class="my-fill mt8" shadow="never">
       <el-table v-loading="state.loading" :data="state.listData" row-key="id" height="'100%'"
         style="width: 100%; height: 100%">
-        <el-table-column prop="name" label="活动名称" min-width="120" show-overflow-tooltip />
-        <el-table-column prop="imgUrl" label="活动图片" width="180" show-overflow-tooltip />
-        <el-table-column prop="status" label="状态" width="180" show-overflow-tooltip />
+        <el-table-column prop="name" label="活动名称" min-width="180" show-overflow-tooltip />
+        <el-table-column label="活动图片" min-width="180" show-overflow-tooltip >
+           <template #default="{ row }">
+              <el-image style="width: 150px; height: 100px" :src="row.imgUrl" ></el-image>        
+            </template>
+        </el-table-column>
+        <el-table-column prop="status" label="状态" width="180" show-overflow-tooltip >
+           <template #default="{ row }">              
+              <span v-if="row.status==0">待上架</span>
+              <span v-if="row.status == 1">上架</span>
+              <span v-if="row.status == 2">下架</span>
+            </template>
+          </el-table-column>
         <el-table-column prop="rank" label="排序" width="120" show-overflow-tooltip />
-        <el-table-column label="操作" width="140" header-align="center" align="center" fixed="right">
+        <el-table-column label="操作" width="180" header-align="center" align="center" fixed="right">
           <template #default="{ row }">
-            <el-button v-auth="'api:admin:banner:update'" icon="ele-EditPen" size="small" text type="primary"
+            <el-button v-if="row.status == 0 || row.status == 2" v-auth="'api:admin:banner:update'" icon="ele-EditPen" size="small" text type="primary"
               @click="onEdit(row)">编辑</el-button>
-              <el-button v-auth="'api:admin:banner:soft-delete'" icon="ele-Delete" size="small" text type="danger"
-                @click="onDelete(row)">删除</el-button>            
+            <el-button v-if="row.status == 0 || row.status == 2" v-auth="'api:admin:banner:soft-delete'" icon="ele-Delete" size="small" text type="danger"
+              @click="onDelete(row)">删除</el-button>            
+            <el-button v-if="row.status==0 || row.status==2" v-auth="'api:admin:banner:update-status'" size="small" text type="primary"
+              @click="onLine(row)">上架</el-button>
+            <el-button v-if="row.status == 1" v-auth="'api:admin:banner:update-status'" size="small" text type="primary"
+              @click="offLine(row)">下架</el-button>
           </template>
         </el-table-column>
       </el-table>
@@ -54,7 +68,6 @@ import { auth } from '/@/utils/authFunction'
 
 // 引入组件
 const bannerForm = defineAsyncComponent(() => import('./components/banner-form.vue'))
-const MyDropdownMore = defineAsyncComponent(() => import('/@/components/my-dropdown-more/index.vue'))
 
 const { proxy } = getCurrentInstance() as any
 
@@ -103,20 +116,43 @@ const onAdd = () => {
   bannerFormRef.value.open()
 }
 
-const onEdit = (row: bannerGetPageOutput) => {
+const onEdit = (row: BannerListOutput) => {
   state.bannerFormTitle = '编辑轮播图'
   bannerFormRef.value.open(row)
 }
+// 删除
+const onDelete = (row: BannerListOutput) => {
 
-const onDelete = (row: bannerGetPageOutput) => {
   proxy.$modal
-    .confirmDelete(`确定要删除【${row.title}】?`)
+    .confirmDelete(`确定要删除【${row.name}】?`)
     .then(async () => {
       await new BannerApi().softDelete({ id: row.id }, { loading: true, showSuccessMessage: true })
       onQuery()
     })
     .catch(() => { })
 }
+// 上架
+const onLine = (row: BannerListOutput) => {
+
+  proxy.$modal
+    .confirmDelete(`确定要上架【${row.name}】?`)
+    .then(async () => {
+      await new BannerApi().updateStatus({ id: row.id,status:1 }, { loading: true, showSuccessMessage: true })
+      onQuery()
+    })
+    .catch(() => { })
+}
+//下架
+const offLine = (row: BannerListOutput) => {
+
+  proxy.$modal
+    .confirmDelete(`确定要删除【${row.name}】?`)
+    .then(async () => {
+      await new BannerApi().updateStatus({ id: row.id, status: 2 }, { loading: true, showSuccessMessage: true })
+      onQuery()
+    })
+    .catch(() => { })
+}
 
 const onSizeChange = (val: number) => {
   state.pageInput.pageSize = val

+ 1 - 1
src/views/admin/projectprice/index.vue

@@ -4,7 +4,7 @@
             <el-form :inline="true" @submit.stop.prevent>                
                 <el-form-item>                    
                     <p>所有项目默认抽成比例<span style="color:red;">{{ state.companydraw.currentRatio }}%</span> (抽成金额精确到小数点后一位)</p>                    
-                    <p v-if="state.companydraw.nextRatio != 0">修改所有项目默认抽成比例为<span style="color:red;"> {{state.companydraw.nextRatio}}% 于{{ state.companydraw.nextEffectDate}} </span>生效</p>                    
+                    <p v-if="state.companydraw.nextRatio != null">修改所有项目默认抽成比例为<span style="color:red;"> {{state.companydraw.nextRatio}}% 于{{ state.companydraw.nextEffectDate}} </span>生效</p>                    
                 </el-form-item>
                 <el-form-item>                    
                     <el-button type="text" @click="onCompanyEdit"> 修改 </el-button>