|
@@ -1,6 +1,57 @@
|
|
|
|
+import { ActionType, PageContainer, ProTable } from "@ant-design/pro-components"
|
|
|
|
+import { columns } from "./tableConfig"
|
|
|
|
+import { useAjax } from "@/Hook/useAjax"
|
|
|
|
+import { useModel } from "@umijs/max"
|
|
|
|
+import { wechatMiniappUserDel, wechatMiniappUserListOfPage, wechatMiniappUserUpdateEnabled } from "@/services/miniApp/miniAppUser/weChat"
|
|
|
|
+import { useCallback, useRef } from "react"
|
|
|
|
+import { message } from "antd"
|
|
|
|
|
|
-function Page(){
|
|
|
|
- return <>微信小程序用户管理</>
|
|
|
|
-}
|
|
|
|
|
|
+const Page: React.FC = () => {
|
|
|
|
+ let { initialState } = useModel("@@initialState")
|
|
|
|
+ const actionRef = useRef<ActionType>();
|
|
|
|
+ let { enumList } = useModel("global", (model) => ({
|
|
|
|
+ enumList: model.state.enumList
|
|
|
|
+ }))
|
|
|
|
+ let getList = useAjax((params) => wechatMiniappUserListOfPage(params), { type: 'table' })
|
|
|
|
+ let delApi = useAjax((id) => wechatMiniappUserDel(id))
|
|
|
|
+ let upDateApi = useAjax((params) => wechatMiniappUserUpdateEnabled(params))
|
|
|
|
+
|
|
|
|
+ const upDate = useCallback((params: { id: any, enabled: boolean }) => {
|
|
|
|
+ upDateApi.run(params).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ message.success("修改状态成功!")
|
|
|
|
+ actionRef.current?.reload()//刷新
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }, [])
|
|
|
|
+ const del = useCallback((id: any) => {
|
|
|
|
+ delApi.run(id).then(res => {
|
|
|
|
+ if (res.code === 200) {
|
|
|
|
+ message.success("删除成功!")
|
|
|
|
+ actionRef.current?.reload()//刷新
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ }, [])
|
|
|
|
+ return <PageContainer title={false}
|
|
|
|
+ >
|
|
|
|
+ <ProTable<any, any>
|
|
|
|
+ actionRef={actionRef}
|
|
|
|
+ scroll={{ x: true }}
|
|
|
|
+ params={{
|
|
|
|
+ appId: initialState?.selectApp?.id || "",
|
|
|
|
+ }}
|
|
|
|
+ headerTitle={"微信小程序用户列表"}
|
|
|
|
+ rowKey={(r) => r.id}
|
|
|
|
+ search={{
|
|
|
|
+ labelWidth: 120,
|
|
|
|
+ }}
|
|
|
|
+ request={async (params) => {
|
|
|
|
+ return await getList.run(params)
|
|
|
|
+ }}
|
|
|
|
+ columns={columns({ enumList: enumList || [], del, upDate })}
|
|
|
|
+ // bordered
|
|
|
|
+ />
|
|
|
|
+ </PageContainer>
|
|
|
|
|
|
|
|
+}
|
|
export default Page
|
|
export default Page
|