This commit is contained in:
parent
c76d3d3f1f
commit
c44f99684b
|
@ -1,4 +1,4 @@
|
||||||
import { PaginationProps, Table } from "antd";
|
import { Pagination, PaginationProps, Table } from "antd";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
const BTable = (props: any) => {
|
const BTable = (props: any) => {
|
||||||
const { store, dataSource } = props;
|
const { store, dataSource } = props;
|
||||||
|
@ -24,21 +24,27 @@ const BTable = (props: any) => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
return (
|
return (
|
||||||
<Table
|
<>
|
||||||
pagination={{
|
<Table
|
||||||
size: "small",
|
style={{height:"100%",overflow:"auto"}}
|
||||||
total: store.total,
|
pagination={false}
|
||||||
defaultCurrent: 1,
|
loading={store.listStatus}
|
||||||
pageSize: 20,
|
rowSelection={rowSelection}
|
||||||
showSizeChanger: true,
|
columns={props.columns}
|
||||||
onShowSizeChange: onShowSizeChange,
|
dataSource={dataSource}
|
||||||
onChange: onChange,
|
/>
|
||||||
}}
|
<div style={{textAlign:"right",padding:"10px"}}>
|
||||||
rowSelection={rowSelection}
|
<Pagination
|
||||||
columns={props.columns}
|
size="small"
|
||||||
dataSource={dataSource}
|
defaultCurrent={1}
|
||||||
|
pageSize={20}
|
||||||
/>
|
showSizeChanger={true}
|
||||||
|
total={store.total}
|
||||||
|
onShowSizeChange= {onShowSizeChange}
|
||||||
|
onChange={onChange}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,6 @@ import AliUpload from "../aliUpload";
|
||||||
const { TextArea } = Input;
|
const { TextArea } = Input;
|
||||||
const SimpleForm = (props: SimpleFormData) => {
|
const SimpleForm = (props: SimpleFormData) => {
|
||||||
const [form] = Form.useForm();
|
const [form] = Form.useForm();
|
||||||
const { RangePicker } = DatePicker;
|
|
||||||
const onFinish = (values: any) => {
|
const onFinish = (values: any) => {
|
||||||
props.onFinish(values);
|
props.onFinish(values);
|
||||||
};
|
};
|
||||||
|
@ -21,9 +20,10 @@ const SimpleForm = (props: SimpleFormData) => {
|
||||||
name={props.formName}
|
name={props.formName}
|
||||||
ref={props.formRef}
|
ref={props.formRef}
|
||||||
form={form}
|
form={form}
|
||||||
|
labelCol={{ span: 4 }}
|
||||||
|
wrapperCol={{ span: 8 }}
|
||||||
|
layout="horizontal"
|
||||||
initialValues={{ menubar: true }}
|
initialValues={{ menubar: true }}
|
||||||
labelCol={{ span: props.colProps }}
|
|
||||||
wrapperCol={{ span: 16 }}
|
|
||||||
onFinish={onFinish}
|
onFinish={onFinish}
|
||||||
autoComplete="on"
|
autoComplete="on"
|
||||||
>
|
>
|
||||||
|
@ -36,6 +36,7 @@ const SimpleForm = (props: SimpleFormData) => {
|
||||||
label={v.label}
|
label={v.label}
|
||||||
name={v.name}
|
name={v.name}
|
||||||
rules={v.rules}
|
rules={v.rules}
|
||||||
|
|
||||||
>
|
>
|
||||||
<Input defaultValue={v.value} value={v.value} />
|
<Input defaultValue={v.value} value={v.value} />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
|
|
|
@ -8,7 +8,7 @@ const appMenu = {
|
||||||
label: "app管理",
|
label: "app管理",
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
key: "/app-list",
|
key: "/app/list",
|
||||||
icon: <VideoCameraOutlined />,
|
icon: <VideoCameraOutlined />,
|
||||||
label: "app列表",
|
label: "app列表",
|
||||||
},
|
},
|
||||||
|
|
|
@ -10,7 +10,14 @@ body {
|
||||||
#root{
|
#root{
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
.projectContent {
|
||||||
|
box-sizing: border-box;
|
||||||
|
margin: 10px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
height: 100%;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
code {
|
code {
|
||||||
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
|
||||||
monospace;
|
monospace;
|
||||||
|
|
|
@ -17,15 +17,8 @@ const ActiveType = (props: Store) => {
|
||||||
const [record, setRecord] = useState<any>(null);
|
const [record, setRecord] = useState<any>(null);
|
||||||
const [userId, setId] = useState<Number | null>(null);
|
const [userId, setId] = useState<Number | null>(null);
|
||||||
const columns: ColumnsType<UserDataType> = [
|
const columns: ColumnsType<UserDataType> = [
|
||||||
{
|
{ title: "类型名称", dataIndex: "name" },
|
||||||
title: "类型名称",
|
{ title: "类型描述", dataIndex: "desc" },
|
||||||
dataIndex: "name",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "类型描述",
|
|
||||||
dataIndex: "desc",
|
|
||||||
},
|
|
||||||
|
|
||||||
{
|
{
|
||||||
title: "操作",
|
title: "操作",
|
||||||
dataIndex: "id",
|
dataIndex: "id",
|
||||||
|
@ -36,32 +29,41 @@ const ActiveType = (props: Store) => {
|
||||||
<div>
|
<div>
|
||||||
<Space direction="vertical">
|
<Space direction="vertical">
|
||||||
<Space wrap>
|
<Space wrap>
|
||||||
<Button
|
<EditBtn />
|
||||||
type="dashed"
|
<DeBtn />
|
||||||
size="small"
|
|
||||||
onClick={() => {
|
|
||||||
edit(record);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
编辑
|
|
||||||
</Button>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
type="dashed"
|
|
||||||
danger
|
|
||||||
size="small"
|
|
||||||
onClick={() => {
|
|
||||||
activityTypeStore.deleteItem(record.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</Space>
|
</Space>
|
||||||
</Space>
|
</Space>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
const EditBtn = () => {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
edit(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
const DeBtn = () => {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
danger
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
activityTypeStore.deleteItem(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
};
|
||||||
const edit = (record) => {
|
const edit = (record) => {
|
||||||
record = {
|
record = {
|
||||||
...record,
|
...record,
|
||||||
|
@ -84,6 +86,7 @@ const ActiveType = (props: Store) => {
|
||||||
}
|
}
|
||||||
setIsModalOpen(false);
|
setIsModalOpen(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
activityTypeStore.getlist(UserConfig.LIST);
|
activityTypeStore.getlist(UserConfig.LIST);
|
||||||
}, [activityTypeStore]);
|
}, [activityTypeStore]);
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
import { Space, Tabs, TabsProps } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import PayConfig from "./config/pay-config";
|
||||||
|
import PushConfig from "./config/push-config";
|
||||||
|
import ImConfig from "./config/im-config";
|
||||||
|
import React from "react";
|
||||||
|
const AppManageConfig = (props: Store) => {
|
||||||
|
const { appStore } = props;
|
||||||
|
|
||||||
|
useEffect(() => {}, []);
|
||||||
|
const items: TabsProps["items"] = [
|
||||||
|
{
|
||||||
|
key: "1",
|
||||||
|
label: "支付配置",
|
||||||
|
children: <PayConfig />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "2",
|
||||||
|
label: "推送配置",
|
||||||
|
children: <PushConfig />
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "3",
|
||||||
|
label: "im配置",
|
||||||
|
children: <ImConfig />
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const onChange = (key: string) => {
|
||||||
|
console.log(key);
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<Tabs defaultActiveKey="1" items={items} onChange={onChange} />
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("appStore")(observer(AppManageConfig));
|
|
@ -0,0 +1,157 @@
|
||||||
|
import { Space, Button, FormInstance } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import type { ColumnsType } from "antd/es/table";
|
||||||
|
import BTable from "@/components/BTable";
|
||||||
|
import { useEffect, useState } from "react";
|
||||||
|
import UserConfig from "@/service/apiConfig/userConfig";
|
||||||
|
import { UserDataType } from "@/model/userModel";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import Modal from "antd/lib/modal/Modal";
|
||||||
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
|
import React from "react";
|
||||||
|
import { useNavigate } from "react-router";
|
||||||
|
const AppManageList = (props: Store) => {
|
||||||
|
const { appStore } = props;
|
||||||
|
const navigate = useNavigate();
|
||||||
|
const [id, setId] = useState<any>(null);
|
||||||
|
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||||
|
const [record, setRecord] = useState<any>(null);
|
||||||
|
const formRef = React.useRef<FormInstance>(null);
|
||||||
|
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||||
|
const columns: ColumnsType<UserDataType> = [
|
||||||
|
{ title: "app名称", dataIndex: "appName" },
|
||||||
|
{ title: "图标", dataIndex: "appIcon" },
|
||||||
|
{ title: "预览图片", dataIndex: "activeIcon" },
|
||||||
|
{
|
||||||
|
title: "操作",
|
||||||
|
dataIndex: "id",
|
||||||
|
ellipsis: {
|
||||||
|
showTitle: false,
|
||||||
|
},
|
||||||
|
render: (any, record) => (
|
||||||
|
<div>
|
||||||
|
<Space direction="vertical">
|
||||||
|
<Space wrap>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
edit(record);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
编辑
|
||||||
|
</Button>
|
||||||
|
<Button
|
||||||
|
type="dashed"
|
||||||
|
danger
|
||||||
|
size="small"
|
||||||
|
onClick={() => {
|
||||||
|
appStore.deleteItem(record.id);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
删除
|
||||||
|
</Button>
|
||||||
|
<Button type="dashed" size="small" onClick={() => {
|
||||||
|
navigate("/app/config/" + record.id)
|
||||||
|
}}>
|
||||||
|
信息配置
|
||||||
|
</Button>
|
||||||
|
</Space>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
];
|
||||||
|
const edit = (record) => {
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
formRef.current?.setFieldsValue(record);
|
||||||
|
setRecord(record);
|
||||||
|
setId(record.id);
|
||||||
|
};
|
||||||
|
const defaultConfig = [
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "app名称",
|
||||||
|
name: "appName",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "upload",
|
||||||
|
label: "icon",
|
||||||
|
name: "appIcon",
|
||||||
|
value: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "upload",
|
||||||
|
label: "图片",
|
||||||
|
name: "photosIds",
|
||||||
|
value: [],
|
||||||
|
},
|
||||||
|
];
|
||||||
|
useEffect(() => {
|
||||||
|
appStore.getlist(UserConfig.LIST);
|
||||||
|
}, [appStore]);
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
let ids = values.photosIds.map((item) => {
|
||||||
|
return item.id;
|
||||||
|
});
|
||||||
|
let appIcon = values.appIcon.map((item) => {
|
||||||
|
return item.id;
|
||||||
|
});
|
||||||
|
console.log(values);
|
||||||
|
values = {
|
||||||
|
...values,
|
||||||
|
photosIds: ids.join(","),
|
||||||
|
appIcon: appIcon.join(","),
|
||||||
|
};
|
||||||
|
if (!id) {
|
||||||
|
appStore.add(values);
|
||||||
|
} else {
|
||||||
|
appStore.putItem(id, values);
|
||||||
|
}
|
||||||
|
setIsModalOpen(false);
|
||||||
|
};
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Button
|
||||||
|
className="projectContentAdd"
|
||||||
|
onClick={() => {
|
||||||
|
setProjectConfig(defaultConfig);
|
||||||
|
setIsModalOpen(true);
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
添加app
|
||||||
|
</Button>
|
||||||
|
<Modal
|
||||||
|
title="app信息"
|
||||||
|
width={800}
|
||||||
|
open={isModalOpen}
|
||||||
|
onCancel={() => setIsModalOpen(false)}
|
||||||
|
afterClose={() => formRef.current?.resetFields()}
|
||||||
|
onOk={() => formRef.current?.submit()}
|
||||||
|
>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={formRef}
|
||||||
|
createCallback={() => {
|
||||||
|
formRef.current?.setFieldsValue(record);
|
||||||
|
}}
|
||||||
|
formName="card_basic"
|
||||||
|
colProps={4}
|
||||||
|
subBtnName="提交"
|
||||||
|
formDatas={projectConfig}
|
||||||
|
onFinish={onFinish}
|
||||||
|
initialValues={true}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
/>
|
||||||
|
</Modal>
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<BTable store={appStore} columns={columns} dataSource={appStore.list} />
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("appStore")(observer(AppManageList));
|
|
@ -0,0 +1,20 @@
|
||||||
|
import { Space } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
const ImConfig = (props: Store) => {
|
||||||
|
const { appStore } = props;
|
||||||
|
useEffect(() => {
|
||||||
|
console.log("im");
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
im配置
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("appStore")(observer(ImConfig));
|
|
@ -0,0 +1,110 @@
|
||||||
|
import { Space } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
|
const PayConfig = (props: Store) => {
|
||||||
|
const { appStore } = props;
|
||||||
|
useEffect(() => {}, []);
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
const onFinish = (values: any) => {
|
||||||
|
let ids = values.photosIds.map((item) => {
|
||||||
|
return item.id;
|
||||||
|
});
|
||||||
|
let appIcon = values.appIcon.map((item) => {
|
||||||
|
return item.id;
|
||||||
|
});
|
||||||
|
console.log(values);
|
||||||
|
values = {
|
||||||
|
...values,
|
||||||
|
photosIds: ids.join(","),
|
||||||
|
appIcon: appIcon.join(","),
|
||||||
|
};
|
||||||
|
};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
|
||||||
|
<p>微信支付</p>
|
||||||
|
<SimpleForm
|
||||||
|
formName={""}
|
||||||
|
colProps={0}
|
||||||
|
onFinish={onFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
formDatas={[
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "AppId",
|
||||||
|
name: "appId",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "AppSecret",
|
||||||
|
name: "appSecret",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "MchID",
|
||||||
|
name: "mchID",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "微信支付key",
|
||||||
|
name: "WeixinPayKey",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "微信支付回调地址",
|
||||||
|
name: "WeixinPayNotifyUrl",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
|
||||||
|
<p>支付宝支付</p>
|
||||||
|
<SimpleForm
|
||||||
|
formName={""}
|
||||||
|
colProps={0}
|
||||||
|
onFinish={onFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
formDatas={[
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "AliAppId",
|
||||||
|
name: "aliAppId",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "AliKey",
|
||||||
|
name: "aliKey",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "AliPayNotifyUrl",
|
||||||
|
name: "aliPayNotifyUrl",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("appStore")(observer(PayConfig));
|
|
@ -0,0 +1,222 @@
|
||||||
|
import { Button, FormInstance, Space } from "antd";
|
||||||
|
import { inject, observer } from "mobx-react";
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { Store } from "antd/lib/form/interface";
|
||||||
|
import SimpleForm from "@/components/form/simple_form";
|
||||||
|
import React from "react";
|
||||||
|
import { useParams } from "react-router";
|
||||||
|
const PushConfig = (props: Store) => {
|
||||||
|
const { appStore } = props;
|
||||||
|
const { id } = useParams();
|
||||||
|
const hwformRef = React.useRef<FormInstance>(null);
|
||||||
|
const iosformRef = React.useRef<FormInstance>(null);
|
||||||
|
const opformRef = React.useRef<FormInstance>(null);
|
||||||
|
const vivoformRef = React.useRef<FormInstance>(null);
|
||||||
|
const xmformRef = React.useRef<FormInstance>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
appStore.getIosConfig(id)
|
||||||
|
}, [appStore, id]);
|
||||||
|
|
||||||
|
const onFinishFailed = () => {};
|
||||||
|
|
||||||
|
const iosOnFinish = (values: any) => {
|
||||||
|
console.log(values);
|
||||||
|
appStore.setIosConfig(id,values)
|
||||||
|
};
|
||||||
|
const xmOnFinish = (values: any) => {};
|
||||||
|
const hwOnFinish = (values: any) => {};
|
||||||
|
const oppoOnFinish = (values: any) => {};
|
||||||
|
const vivoOnFinish = (values: any) => {};
|
||||||
|
return (
|
||||||
|
<div className="contentBox">
|
||||||
|
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||||
|
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
|
||||||
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
||||||
|
<p>苹果推送</p>
|
||||||
|
<Button type="primary" onClick={()=>{
|
||||||
|
iosformRef.current?.submit();
|
||||||
|
}}>保存</Button>
|
||||||
|
</div>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={iosformRef}
|
||||||
|
formName={""}
|
||||||
|
colProps={0}
|
||||||
|
onFinish={iosOnFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
formDatas={[
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "AppId",
|
||||||
|
name: "appId",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入appId!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "appleBundleId",
|
||||||
|
name: "appleBundleId",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入appleBundleId!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "password",
|
||||||
|
name: "password",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入推送密码!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "upload",
|
||||||
|
label: "推送证书",
|
||||||
|
name: "centerFile",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请上传推送证书!" }],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
|
||||||
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
||||||
|
<p>华为推送</p>
|
||||||
|
<Button type="primary">保存</Button>
|
||||||
|
</div>
|
||||||
|
<SimpleForm
|
||||||
|
formName={""}
|
||||||
|
formRef={hwformRef}
|
||||||
|
colProps={0}
|
||||||
|
onFinish={hwOnFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
formDatas={[
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "huaWeiClientID",
|
||||||
|
name: "huaWeiClientID",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "huaWeiClientSecret",
|
||||||
|
name: "huaWeiClientSecret",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
|
||||||
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
||||||
|
<p>oppo推送</p>
|
||||||
|
<Button type="primary">保存</Button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<SimpleForm
|
||||||
|
formRef={opformRef}
|
||||||
|
formName={""}
|
||||||
|
colProps={0}
|
||||||
|
onFinish={oppoOnFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
formDatas={[
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "oppoAppKey",
|
||||||
|
name: "oppoAppKey",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "oppoMasterSecret",
|
||||||
|
name: "oppoMasterSecret",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
|
||||||
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
||||||
|
<p>vivo推送</p>
|
||||||
|
<Button type="primary">保存</Button>
|
||||||
|
</div>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={vivoformRef}
|
||||||
|
formName={""}
|
||||||
|
colProps={0}
|
||||||
|
onFinish={vivoOnFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
formDatas={[
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "vivoappId",
|
||||||
|
name: "vivoappId",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "vivoAppKey",
|
||||||
|
name: "vivoAppKey",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "vivoAppSecret",
|
||||||
|
name: "vivoAppSecret",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
|
||||||
|
<div style={{ display: "flex", justifyContent: "space-between" }}>
|
||||||
|
<p>小米推送</p>
|
||||||
|
<Button type="primary">保存</Button>
|
||||||
|
</div>
|
||||||
|
<SimpleForm
|
||||||
|
formRef={xmformRef}
|
||||||
|
formName={""}
|
||||||
|
colProps={0}
|
||||||
|
onFinish={xmOnFinish}
|
||||||
|
onFinishFailed={onFinishFailed}
|
||||||
|
formDatas={[
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "xiaoMiappId",
|
||||||
|
name: "xiaoMiappId",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "xiaoMiAppKey",
|
||||||
|
name: "xiaoMiAppKey",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "xiaoMiAppSecret",
|
||||||
|
name: "xiaoMiAppSecret",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
type: "input",
|
||||||
|
label: "xiaoMiAppChannelId",
|
||||||
|
name: "xiaoMiAppChannelId",
|
||||||
|
value: "",
|
||||||
|
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Space>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
export default inject("appStore")(observer(PushConfig));
|
|
@ -1,170 +1,10 @@
|
||||||
import { Tooltip, Space, Button, FormInstance } from "antd";
|
import { Outlet } from "react-router";
|
||||||
import { inject, observer } from "mobx-react";
|
const AppManage = () => {
|
||||||
import type { ColumnsType } from "antd/es/table";
|
|
||||||
import BTable from "@/components/BTable";
|
|
||||||
import { useEffect, useState } from "react";
|
|
||||||
import UserConfig from "@/service/apiConfig/userConfig";
|
|
||||||
import { UserDataType } from "@/model/userModel";
|
|
||||||
import { Store } from "antd/lib/form/interface";
|
|
||||||
import Modal from "antd/lib/modal/Modal";
|
|
||||||
import SimpleForm from "@/components/form/simple_form";
|
|
||||||
import React from "react";
|
|
||||||
const AppManage = (props: Store) => {
|
|
||||||
const { appStore } = props;
|
|
||||||
const [id, setId] = useState<any>(null);
|
|
||||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
|
||||||
const [record, setRecord] = useState<any>(null);
|
|
||||||
const formRef = React.useRef<FormInstance>(null);
|
|
||||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
|
||||||
const columns: ColumnsType<UserDataType> = [
|
|
||||||
{
|
|
||||||
title: "app名称",
|
|
||||||
dataIndex: "appName",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "图标",
|
|
||||||
dataIndex: "appIcon",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "预览图片",
|
|
||||||
dataIndex: "activeIcon",
|
|
||||||
ellipsis: {
|
|
||||||
showTitle: false,
|
|
||||||
},
|
|
||||||
render: (address) => (
|
|
||||||
<Tooltip placement="topLeft" title={address}>
|
|
||||||
{address}
|
|
||||||
</Tooltip>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
title: "操作",
|
|
||||||
dataIndex: "id",
|
|
||||||
ellipsis: {
|
|
||||||
showTitle: false,
|
|
||||||
},
|
|
||||||
render: (any, record) => (
|
|
||||||
<div>
|
|
||||||
<Space direction="vertical">
|
|
||||||
<Space wrap>
|
|
||||||
<Button
|
|
||||||
type="dashed"
|
|
||||||
size="small"
|
|
||||||
onClick={() => {
|
|
||||||
edit(record);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
编辑
|
|
||||||
</Button>
|
|
||||||
{/* <Button type="dashed" size="small" onClick={() => {
|
|
||||||
navigate("/card/componsition/" + record.id)
|
|
||||||
}}>用户作文</Button> */}
|
|
||||||
<Button
|
|
||||||
type="dashed"
|
|
||||||
danger
|
|
||||||
size="small"
|
|
||||||
onClick={() => {
|
|
||||||
appStore.deleteItem(record.id);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
删除
|
|
||||||
</Button>
|
|
||||||
</Space>
|
|
||||||
</Space>
|
|
||||||
</div>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
];
|
|
||||||
const edit = (record) => {
|
|
||||||
setProjectConfig(defaultConfig);
|
|
||||||
setIsModalOpen(true);
|
|
||||||
formRef.current?.setFieldsValue(record);
|
|
||||||
setRecord(record);
|
|
||||||
setId(record.id);
|
|
||||||
};
|
|
||||||
const defaultConfig = [
|
|
||||||
{
|
|
||||||
type: "input",
|
|
||||||
label: "app名称",
|
|
||||||
name: "appName",
|
|
||||||
value: "",
|
|
||||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "upload",
|
|
||||||
label: "icon",
|
|
||||||
name: "appIcon",
|
|
||||||
value: [],
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type: "upload",
|
|
||||||
label: "图片",
|
|
||||||
name: "photosIds",
|
|
||||||
value: [],
|
|
||||||
},
|
|
||||||
];
|
|
||||||
useEffect(() => {
|
|
||||||
appStore.getlist(UserConfig.LIST);
|
|
||||||
}, [appStore]);
|
|
||||||
const onFinish = (values: any) => {
|
|
||||||
let ids = values.photosIds.map((item) => {
|
|
||||||
return item.id;
|
|
||||||
});
|
|
||||||
let appIcon = values.appIcon.map((item) => {
|
|
||||||
return item.id;
|
|
||||||
});
|
|
||||||
console.log(values);
|
|
||||||
values = {
|
|
||||||
...values,
|
|
||||||
photosIds: ids.join(","),
|
|
||||||
appIcon: appIcon.join(","),
|
|
||||||
};
|
|
||||||
if (!id) {
|
|
||||||
appStore.add(values);
|
|
||||||
} else {
|
|
||||||
appStore.putItem(id, values);
|
|
||||||
}
|
|
||||||
setIsModalOpen(false);
|
|
||||||
};
|
|
||||||
const onFinishFailed = () => {};
|
|
||||||
return (
|
return (
|
||||||
<div className="contentBox">
|
<div className="contentBox">
|
||||||
<Button
|
<Outlet></Outlet>
|
||||||
className="projectContentAdd"
|
|
||||||
onClick={() => {
|
|
||||||
setProjectConfig(defaultConfig);
|
|
||||||
setIsModalOpen(true);
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
添加app
|
|
||||||
</Button>
|
|
||||||
<Modal
|
|
||||||
title="app信息"
|
|
||||||
width={800}
|
|
||||||
open={isModalOpen}
|
|
||||||
onCancel={() => setIsModalOpen(false)}
|
|
||||||
afterClose={() => formRef.current?.resetFields()}
|
|
||||||
onOk={() => formRef.current?.submit()}
|
|
||||||
>
|
|
||||||
<SimpleForm
|
|
||||||
formRef={formRef}
|
|
||||||
createCallback={() => {
|
|
||||||
formRef.current?.setFieldsValue(record);
|
|
||||||
}}
|
|
||||||
formName="card_basic"
|
|
||||||
colProps={4}
|
|
||||||
subBtnName="提交"
|
|
||||||
formDatas={projectConfig}
|
|
||||||
onFinish={onFinish}
|
|
||||||
initialValues={true}
|
|
||||||
onFinishFailed={onFinishFailed}
|
|
||||||
/>
|
|
||||||
</Modal>
|
|
||||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
|
||||||
<BTable store={appStore} columns={columns} dataSource={appStore.list} />
|
|
||||||
</Space>
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export default inject("appStore")(observer(AppManage));
|
export default AppManage;
|
||||||
|
|
|
@ -17,7 +17,7 @@ const DymiticState = (props: Store) => {
|
||||||
{ title: "操作", dataIndex: "id", render: (id: any) => render(id) },
|
{ title: "操作", dataIndex: "id", render: (id: any) => render(id) },
|
||||||
];
|
];
|
||||||
const render = (id) => (
|
const render = (id) => (
|
||||||
<div>
|
<div >
|
||||||
<Space align="center">
|
<Space align="center">
|
||||||
<Button
|
<Button
|
||||||
type="dashed"
|
type="dashed"
|
||||||
|
@ -36,8 +36,9 @@ const DymiticState = (props: Store) => {
|
||||||
dynamicStore.getlist();
|
dynamicStore.getlist();
|
||||||
}, [dynamicStore]);
|
}, [dynamicStore]);
|
||||||
return (
|
return (
|
||||||
<div style={{ margin: 10 }}>
|
<div style={{ margin: 10 }} className="projectContent">
|
||||||
<BTable
|
<BTable
|
||||||
|
loading={dynamicStore.listStatus}
|
||||||
columns={columns}
|
columns={columns}
|
||||||
store={dynamicStore}
|
store={dynamicStore}
|
||||||
dataSource={dynamicStore.list}
|
dataSource={dynamicStore.list}
|
||||||
|
|
|
@ -1,13 +1,28 @@
|
||||||
import { Suspense, lazy } from "react";
|
import { Suspense, lazy } from "react";
|
||||||
const AppManage = lazy(() => import("@/pages/app"));
|
const AppManageList = lazy(() => import("@/pages/app/app-list"));
|
||||||
|
const AppManageConfig = lazy(() => import("@/pages/app/app-config"));
|
||||||
export const appRouter = [
|
export const appRouter = [
|
||||||
{
|
{
|
||||||
path: "/app-list",
|
path: "/app",
|
||||||
index: true,
|
children: [
|
||||||
element: (
|
{
|
||||||
<Suspense>
|
path: "/app/list",
|
||||||
<AppManage />
|
index: true,
|
||||||
</Suspense>
|
element: (
|
||||||
),
|
<Suspense>
|
||||||
|
<AppManageList />
|
||||||
|
</Suspense>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path: "/app/config/:id",
|
||||||
|
index: true,
|
||||||
|
element: (
|
||||||
|
<Suspense>
|
||||||
|
<AppManageConfig />
|
||||||
|
</Suspense>
|
||||||
|
),
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
|
@ -5,10 +5,10 @@ class AppConfig {
|
||||||
static DELETE = "app"
|
static DELETE = "app"
|
||||||
static EDIT = "app"
|
static EDIT = "app"
|
||||||
static XIAOMIAPPPUSH = "app/push/xiaomi/" // 小米推送配置信息
|
static XIAOMIAPPPUSH = "app/push/xiaomi/" // 小米推送配置信息
|
||||||
static VIVOAPPPUSH = "app/push/vivo/" // 小米推送配置信息
|
static VIVOAPPPUSH = "app/push/vivo/" // vivo推送配置信息
|
||||||
static OPPOAPPPUSH = "app/push/oppo/" // 小米推送配置信息
|
static OPPOAPPPUSH = "app/push/oppo/" // oppo推送配置信息
|
||||||
static HUAWEIAPPPUSH = "app/push/huawei/" // 小米推送配置信息
|
static HUAWEIAPPPUSH = "app/push/huawei/" // huawei推送配置信息
|
||||||
static IOSAPPPUSH = "app/push/ios/" // 小米推送配置信息
|
static IOSAPPPUSH = "app/push/ios/" // ios推送配置信息
|
||||||
static WechatConfig = "app/wechatConfig/" // 小米推送配置信息
|
static WechatConfig = "app/wechatConfig/" // 微信配置信息
|
||||||
}
|
}
|
||||||
export default AppConfig;
|
export default AppConfig;
|
|
@ -1,17 +1,27 @@
|
||||||
import { CardDataType } from "@/util/model/interface";
|
import { CardDataType } from "@/util/model/interface";
|
||||||
import BaseStore from "../baseStore";
|
import BaseStore from "../baseStore";
|
||||||
|
import baseHttp from "@/service/base";
|
||||||
import { action, makeObservable } from "mobx";
|
import { action, makeObservable } from "mobx";
|
||||||
import AppConfig from "@/service/apiConfig/appConfig";
|
import AppConfig from "@/service/apiConfig/appConfig";
|
||||||
|
|
||||||
class AppStore extends BaseStore<CardDataType>{
|
class AppStore extends BaseStore<CardDataType> {
|
||||||
constructor() {
|
constructor() {
|
||||||
super(AppConfig)
|
super(AppConfig)
|
||||||
makeObservable(this, {
|
makeObservable(this, {
|
||||||
otherAction: action,
|
otherAction: action,
|
||||||
|
getIosConfig: action,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
otherAction() {
|
otherAction() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
// 获取banner
|
||||||
|
async setIosConfig(id: number, param) {
|
||||||
|
return await baseHttp.put(AppConfig.IOSAPPPUSH + "/" + id, param)
|
||||||
|
}
|
||||||
|
// 获取banner
|
||||||
|
async getIosConfig(id: number) {
|
||||||
|
return await baseHttp.get(AppConfig.IOSAPPPUSH + "/" + id, {})
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export default new AppStore();
|
export default new AppStore();
|
|
@ -11,6 +11,7 @@ interface BaseStoreInterface<T> {
|
||||||
total: number
|
total: number
|
||||||
page: Pages
|
page: Pages
|
||||||
setPages(pages: Pages): any
|
setPages(pages: Pages): any
|
||||||
|
listStatus:boolean | null | undefined
|
||||||
}
|
}
|
||||||
|
|
||||||
class BaseStore<B> implements BaseStoreInterface<B> {
|
class BaseStore<B> implements BaseStoreInterface<B> {
|
||||||
|
@ -25,10 +26,12 @@ class BaseStore<B> implements BaseStoreInterface<B> {
|
||||||
item: observable,
|
item: observable,
|
||||||
total: observable,
|
total: observable,
|
||||||
page: observable,
|
page: observable,
|
||||||
add: action
|
add: action,
|
||||||
|
listStatus:observable,
|
||||||
})
|
})
|
||||||
this.urlConfig = urlConfig;
|
this.urlConfig = urlConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 删除
|
// 删除
|
||||||
async deleteItem(id: number) {
|
async deleteItem(id: number) {
|
||||||
await baseHttp.delete(this.urlConfig.DELETE + "/" + id, {})
|
await baseHttp.delete(this.urlConfig.DELETE + "/" + id, {})
|
||||||
|
@ -53,6 +56,7 @@ class BaseStore<B> implements BaseStoreInterface<B> {
|
||||||
|
|
||||||
// 获取列表
|
// 获取列表
|
||||||
async getlist() {
|
async getlist() {
|
||||||
|
this.listStatus = true;
|
||||||
let res = await baseHttp.get(this.urlConfig.LIST, {
|
let res = await baseHttp.get(this.urlConfig.LIST, {
|
||||||
pageNum: this.page?.PageNum | 1,
|
pageNum: this.page?.PageNum | 1,
|
||||||
pageSize: this.page?.PageSize | 20,
|
pageSize: this.page?.PageSize | 20,
|
||||||
|
@ -80,11 +84,13 @@ class BaseStore<B> implements BaseStoreInterface<B> {
|
||||||
this.list = data;
|
this.list = data;
|
||||||
this.total = res.data.total | res.data.totals
|
this.total = res.data.total | res.data.totals
|
||||||
})
|
})
|
||||||
|
this.listStatus = false;
|
||||||
}
|
}
|
||||||
list!: Array<B>;
|
list!: Array<B>;
|
||||||
item!: B | null | string
|
item!: B | null | string
|
||||||
total!: number;
|
total!: number;
|
||||||
page!: Pages;
|
page!: Pages;
|
||||||
|
listStatus: boolean | null | undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default BaseStore
|
export default BaseStore
|
Loading…
Reference in New Issue