|
@@ -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()
|