Pārlūkot izejas kodu

Merge branch 'feature/second' of Web/ad-alliance into main

lidongsheng 1 gadu atpakaļ
vecāks
revīzija
979f8f329b

+ 3 - 3
src/pages/Manage/components/AdManage/components/ContentTable/index.tsx

@@ -32,11 +32,11 @@ export default function ContentTable ({
  
   const columns:ColumnsType<RowDataType> = [
     {
-      title: '广告名称',
+      title: '广告名称',
       dataIndex: 'unionAdName',
     },
     {
-      title: '广告ID',
+      title: '广告ID',
       dataIndex: 'unionAdId',
     },
     {
@@ -44,7 +44,7 @@ export default function ContentTable ({
       dataIndex: 'unionAppName',
     },
     {
-      title: '广告类型',
+      title: '广告类型',
       dataIndex: 'unionAdPosition',
       render: (v) => adTypes[v] || v
     },

+ 7 - 7
src/pages/Manage/components/AdManage/components/CreateModal/index.tsx

@@ -30,8 +30,8 @@ const CreateModal = forwardRef(({ allAppList, onCreate, onUpdate }:PropsType, re
       if (editRow) {
         const {
           applicationId, // 应用id
-          unionAdName, // 广告名称
-          unionAdPosition // 广告类型
+          unionAdName, // 广告名称
+          unionAdPosition // 广告类型
         } =  editRow 
         form.setFieldsValue({
           applicationId,
@@ -97,15 +97,15 @@ const CreateModal = forwardRef(({ allAppList, onCreate, onUpdate }:PropsType, re
         </Item>
         <Item
           name='unionAdName'
-          label='广告名称'
-          rules={[{ required: true, message: '请输入广告名称' }]}
+          label='广告名称'
+          rules={[{ required: true, message: '请输入广告名称' }]}
         >
-          <Input placeholder='请输入广告名称' showCount maxLength={ 20 } />
+          <Input placeholder='请输入广告名称' showCount maxLength={ 20 } />
         </Item>
         <Item
           name='unionAdPosition'
-          label='广告类型'
-          rules={[{ required: true, message: '请选择广告类型' }]}
+          label='广告类型'
+          rules={[{ required: true, message: '请选择广告类型' }]}
         >
           <Radio.Group options={adTypesOptions} />
         </Item>

+ 1 - 1
src/pages/Manage/components/AdManage/components/HeaderFilter/index.tsx

@@ -22,7 +22,7 @@ export default function HeaderFilter({ onCreate }:PropsType) {
               type='primary'
               icon={<PlusOutlined />} 
               onClick={createApp}
-            >新建广告</Button>
+            >新建广告</Button>
           </>
         }
       />

+ 2 - 1
src/pages/Manage/components/AdManage/const.ts

@@ -1,5 +1,6 @@
 export const adTypes:MapType<string> =  {
-  0: '视频插屏广告'
+  0: '视频广告',
+  1: '图片广告'
 }
 
 

+ 5 - 7
src/pages/Manage/components/AdManage/index.tsx

@@ -18,14 +18,14 @@ import type {
   RefType, 
   FormDataType 
 } from './components/CreateModal/types'
-import { AllAppListItemType } from './types'
+import type { AllAppListItemType } from './types'
 
 
 
 export function AdManage(){
   const [tableData, setTableData] = useState<RowDataType[]>([])
   const [total, setTotal] = useState(0)
-  const [paginationParams, setPaginationParams] = useState<PaginationParamsType>({ pageNumber: 1, pageSize: 10})
+  const [paginationParams, setPaginationParams] = useState<PaginationParamsType>({ pageNumber:1, pageSize:10})
   const [allAppList, setAllAppList] = useState<AllAppListItemType[]>([])
   const createModalRef = useRef<RefType>()
   const setloading = useGlobalStateUpdate()
@@ -58,7 +58,7 @@ export function AdManage(){
     setloading(false)
   }
 
-  const onPaginationChange =async (params: PaginationParamsType) => {
+  const onPaginationChange =async (params:PaginationParamsType) => {
     setPaginationParams(params)
   }
 
@@ -67,17 +67,15 @@ export function AdManage(){
   }
 
   const onSwitchStatus = async ({row, checked}:{row:RowDataType, checked:boolean}) => {
-    console.log(row, checked)
     setloading(true)
     const res =  checked ? await openAd(row.id) : await clsoeAd(row.id)
     setloading(false)
     if (res) {
       getTableData()
     }
-
   }
 
-  const createAd = async (form: FormDataType, cb:EventFunctionType<[]>) => {
+  const createAd = async (form:FormDataType, cb:EventFunctionType<[]>) => {
     setloading(true)
     const res = await createAdRequest(form)
     setloading(false)
@@ -87,7 +85,7 @@ export function AdManage(){
     }
   }
 
-  const updateAd = (form: RowDataType,  cb:EventFunctionType<[]>) => {
+  const updateAd = (form:RowDataType,  cb:EventFunctionType<[]>) => {
     console.log('更新',form)
     // TODO 更新接口
     cb()

+ 1 - 1
src/pages/Manage/index.tsx

@@ -55,7 +55,7 @@ const items: MenuItem[] = [
         key: '/manage/app-manage'
       },
       {
-        label: '广告列表',
+        label: '广告列表',
         key: '/manage/ad-manage',
       }
     ]