This commit is contained in:
wang_yp 2024-04-23 22:50:17 +08:00
parent c44f99684b
commit 2c167bf638
9 changed files with 247 additions and 137 deletions

View File

@ -1,4 +1,4 @@
import { Button, Space, Modal, Switch } from "antd"; import { Button, Space, Modal, Switch, Tooltip } from "antd";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import type { ColumnsType } from "antd/es/table"; import type { ColumnsType } from "antd/es/table";
import BTable from "@/components/BTable"; import BTable from "@/components/BTable";
@ -11,7 +11,7 @@ import React from "react";
import ActiveConfig from "@/service/apiConfig/active"; import ActiveConfig from "@/service/apiConfig/active";
import dayjs from "dayjs"; import dayjs from "dayjs";
const Active = (props: Store) => { const Active = (props: Store) => {
const { activeStore } = props; const { activityStore } = props;
const [projectConfig, setProjectConfig] = useState<any>([]); const [projectConfig, setProjectConfig] = useState<any>([]);
const [id, setId] = useState<any>(null); const [id, setId] = useState<any>(null);
const [record, setRecord] = useState<any>(null); const [record, setRecord] = useState<any>(null);
@ -20,64 +20,67 @@ const Active = (props: Store) => {
const columns: ColumnsType<UserDataType> = [ const columns: ColumnsType<UserDataType> = [
{ {
title: "活动标题", title: "活动标题",
dataIndex: "activeName", dataIndex: "title",
width: 200,
},
{
title: "活动描述",
dataIndex: "desc",
width: 200,
},
{
title: "活动图片",
dataIndex: "activeIcon",
width: 200,
ellipsis: {
showTitle: false,
},
render: (address) => (
<Tooltip placement="topLeft" title={address}>
{address}
</Tooltip>
),
},
{
title: "活动人数",
dataIndex: "peopleNum",
width: 200,
},
{
title: "活动地址",
dataIndex: "address",
width: 200,
}, },
// {
// title: "活动描述",
// dataIndex: "desc",
// },
// {
// title: "活动图片",
// dataIndex: "activeIcon",
// ellipsis: {
// showTitle: false,
// },
// render: (address) => (
// <Tooltip placement="topLeft" title={address}>
// {address}
// </Tooltip>
// ),
// },
// {
// title: "活动人数",
// dataIndex: "peopleNum",
// },
// {
// title: "活动地址",
// dataIndex: "address",
// },
{ {
title: "折扣", title: "折扣",
dataIndex: "discount", dataIndex: "discount",
width: 200,
}, },
{ {
title: "活动开始时间", title: "活动开始时间",
dataIndex: "startTime", dataIndex: "startTime",
width: 200,
}, },
{ {
title: "活动结束时间", title: "活动结束时间",
dataIndex: "endTime", dataIndex: "endTime",
width: 200,
}, },
{ {
title: "活动状态", title: "活动状态",
render: (any, record) => ( width: 200,
<div> render: (any, record) => <span>{record.status ? "开启" : "关闭"}</span>,
<span>{record.status ? "开启" : "关闭"}</span> },
</div> {
), width: 200,
title: "发起人",
dataIndex: "userId",
}, },
// {
// title: "发起人",
// dataIndex: "userId",
// },
{ {
title: "操作", title: "操作",
width: 200,
fixed: "right",
dataIndex: "id", dataIndex: "id",
ellipsis: {
showTitle: false,
},
render: (any, record) => ( render: (any, record) => (
<div> <div>
<Space direction="vertical"> <Space direction="vertical">
@ -93,7 +96,7 @@ const Active = (props: Store) => {
danger danger
size="small" size="small"
onClick={() => { onClick={() => {
activeStore.deleteItem(record.id); activityStore.deleteItem(record.id);
}} }}
> >
@ -123,7 +126,7 @@ const Active = (props: Store) => {
setId(record.id); setId(record.id);
}; };
const onChange = (bools, record) => { const onChange = (bools, record) => {
activeStore.putItem(record.id, { activityStore.putItem(record.id, {
status: bools, status: bools,
activeName: record.activeName, activeName: record.activeName,
discount: record.discount, discount: record.discount,
@ -161,15 +164,15 @@ const Active = (props: Store) => {
]; ];
useEffect(() => { useEffect(() => {
activeStore.getlist(ActiveConfig.LIST); activityStore.getlist(ActiveConfig.LIST);
}, [activeStore]); }, [activityStore]);
const onFinish = (values: any) => { const onFinish = (values: any) => {
values["startTime"] = values["startTime"].format("YYYY.MM.DD"); values["startTime"] = values["startTime"].format("YYYY.MM.DD");
values["endTime"] = values["endTime"].format("YYYY.MM.DD"); values["endTime"] = values["endTime"].format("YYYY.MM.DD");
if (!id) { if (!id) {
activeStore.add(values); activityStore.add(values);
} else { } else {
activeStore.putItem(id, values); activityStore.putItem(id, values);
} }
setIsModalOpen(false); setIsModalOpen(false);
}; };
@ -177,14 +180,17 @@ const Active = (props: Store) => {
const addAction = () => { const addAction = () => {
setProjectConfig(defaultConfig); setProjectConfig(defaultConfig);
setId(null); setId(null);
setRecord(null) setRecord(null);
setIsModalOpen(true); setIsModalOpen(true);
formRef.current?.setFieldsValue(record); formRef.current?.setFieldsValue(record);
}; };
return ( return (
<div className="projectContent"> <div style={{ padding: "10px" }}>
<Button className="projectContentAdd" onClick={() => addAction()}> <Button
style={{ marginBottom: "10px" }}
className="projectContentAdd"
onClick={() => addAction()}
>
</Button> </Button>
<Modal <Modal
@ -211,13 +217,13 @@ const Active = (props: Store) => {
</Modal> </Modal>
<Space direction="vertical" size="middle" style={{ display: "flex" }}> <Space direction="vertical" size="middle" style={{ display: "flex" }}>
<BTable <BTable
store={activeStore} store={activityStore}
columns={columns} columns={columns}
dataSource={activeStore.list} dataSource={activityStore.list}
/> />
</Space> </Space>
</div> </div>
); );
}; };
export default inject("activeStore")(observer(Active)); export default inject("activityStore")(observer(Active));

View File

@ -1,39 +1,32 @@
import { Space, Tabs, TabsProps } from "antd"; import { Space, Tabs, TabsProps } from "antd";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import { useEffect } from "react";
import { Store } from "antd/lib/form/interface"; import { Store } from "antd/lib/form/interface";
import PayConfig from "./config/pay-config"; import PayConfig from "./config/pay-config";
import PushConfig from "./config/push-config"; import PushConfig from "./config/push-config";
import ImConfig from "./config/im-config"; import ImConfig from "./config/im-config";
import React from "react";
const AppManageConfig = (props: Store) => { const AppManageConfig = (props: Store) => {
const { appStore } = props;
useEffect(() => {}, []);
const items: TabsProps["items"] = [ const items: TabsProps["items"] = [
{ {
key: "1", key: "1",
label: "支付配置", label: "支付配置",
children: <PayConfig /> children: <PayConfig />,
}, },
{ {
key: "2", key: "2",
label: "推送配置", label: "推送配置",
children: <PushConfig /> children: <PushConfig />,
}, },
{ {
key: "3", key: "3",
label: "im配置", label: "im配置",
children: <ImConfig /> children: <ImConfig />,
}, },
]; ];
const onChange = (key: string) => {
console.log(key);
};
return ( return (
<div className="contentBox"> <div className="contentBox">
<Space direction="vertical" size="middle" style={{ display: "flex" }}> <Space direction="vertical" size="middle" style={{ display: "flex" }}>
<Tabs defaultActiveKey="1" items={items} onChange={onChange} /> <Tabs defaultActiveKey="1" type="card" items={items} />
</Space> </Space>
</div> </div>
); );

View File

@ -41,6 +41,15 @@ const AppManageList = (props: Store) => {
> >
</Button> </Button>
<Button
type="dashed"
size="small"
onClick={() => {
navigate("/app/config/" + record.id);
}}
>
</Button>
<Button <Button
type="dashed" type="dashed"
danger danger
@ -51,11 +60,6 @@ const AppManageList = (props: Store) => {
> >
</Button> </Button>
<Button type="dashed" size="small" onClick={() => {
navigate("/app/config/" + record.id)
}}>
</Button>
</Space> </Space>
</Space> </Space>
</div> </div>
@ -118,6 +122,7 @@ const AppManageList = (props: Store) => {
<div className="contentBox"> <div className="contentBox">
<Button <Button
className="projectContentAdd" className="projectContentAdd"
style={{ marginBottom: "10px" }}
onClick={() => { onClick={() => {
setProjectConfig(defaultConfig); setProjectConfig(defaultConfig);
setIsModalOpen(true); setIsModalOpen(true);

View File

@ -1,69 +1,78 @@
import { Space } from "antd"; import { Button, FormInstance, Space } from "antd";
import { inject, observer } from "mobx-react"; import { inject, observer } from "mobx-react";
import { useEffect } from "react"; import { useEffect } from "react";
import { Store } from "antd/lib/form/interface"; import { Store } from "antd/lib/form/interface";
import SimpleForm from "@/components/form/simple_form"; import SimpleForm from "@/components/form/simple_form";
import React from "react";
import { useParams } from "react-router";
const PayConfig = (props: Store) => { const PayConfig = (props: Store) => {
const { appStore } = props; const { appStore } = props;
const { id } = useParams();
const wxformRef = React.useRef<FormInstance>(null);
const aliformRef = React.useRef<FormInstance>(null);
useEffect(() => {}, []); useEffect(() => {}, []);
const onFinishFailed = () => {}; const onFinishFailed = () => {};
const onFinish = (values: any) => { const onwxFinish = (values: any) => {
let ids = values.photosIds.map((item) => { appStore.setWechatConfig(id,values)
return item.id;
});
let appIcon = values.appIcon.map((item) => {
return item.id;
});
console.log(values);
values = {
...values,
photosIds: ids.join(","),
appIcon: appIcon.join(","),
}; };
const onAliFinish = (values: any) => {
appStore.setAlConfig(id,values)
}; };
return ( return (
<div className="contentBox"> <div className="contentBox">
<Space direction="vertical" size="middle" style={{ display: "flex" }}> <Space direction="vertical" size="middle" style={{ display: "flex" }}>
<div style={{ backgroundColor: "#fff", padding: "10px" }}> <div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p> <p></p>
<Button
type="primary"
onClick={() => {
wxformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm <SimpleForm
formName={""} formName={""}
colProps={0} colProps={0}
onFinish={onFinish} formRef={wxformRef}
onFinish={onwxFinish}
onFinishFailed={onFinishFailed} onFinishFailed={onFinishFailed}
formDatas={[ formDatas={[
{ {
type: "input", type: "input",
label: "AppId", label: "wechatAppid",
name: "appId", name: "wechatAppid",
value: "", value: "",
rules: [{ required: true, message: "请输入卡片名称!" }], rules: [{ required: true, message: "请输入卡片名称!" }],
}, },
{ {
type: "input", type: "input",
label: "AppSecret", label: "mchid",
name: "appSecret", name: "mchid",
value: "", value: "",
rules: [{ required: true, message: "请输入卡片名称!" }], rules: [{ required: true, message: "请输入卡片名称!" }],
}, },
{ {
type: "input", type: "input",
label: "MchID", label: "body",
name: "mchID", name: "body",
value: "", value: "",
rules: [{ required: true, message: "请输入卡片名称!" }], rules: [{ required: true, message: "请输入卡片名称!" }],
}, },
{ {
type: "input", type: "input",
label: "微信支付key", label: "notifyURL",
name: "WeixinPayKey", name: "notifyURL",
value: "", value: "",
rules: [{ required: true, message: "请输入卡片名称!" }], rules: [{ required: true, message: "请输入卡片名称!" }],
}, },
{ {
type: "input", type: "input",
label: "微信支付回调地址", label: "key",
name: "WeixinPayNotifyUrl", name: "key",
value: "", value: "",
rules: [{ required: true, message: "请输入卡片名称!" }], rules: [{ required: true, message: "请输入卡片名称!" }],
}, },
@ -71,17 +80,28 @@ const PayConfig = (props: Store) => {
/> />
</div> </div>
<div style={{ backgroundColor: "#fff", padding: "10px" }}> <div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p> <p></p>
<Button
type="primary"
onClick={() => {
aliformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm <SimpleForm
formRef={aliformRef}
formName={""} formName={""}
colProps={0} colProps={0}
onFinish={onFinish} onFinish={onAliFinish}
onFinishFailed={onFinishFailed} onFinishFailed={onFinishFailed}
formDatas={[ formDatas={[
{ {
type: "input", type: "input",
label: "AliAppId", label: "AliAppId",
name: "aliAppId", name: "appid",
value: "", value: "",
rules: [{ required: true, message: "请输入卡片名称!" }], rules: [{ required: true, message: "请输入卡片名称!" }],
}, },
@ -94,8 +114,15 @@ const PayConfig = (props: Store) => {
}, },
{ {
type: "input", type: "input",
label: "AliPayNotifyUrl", label: "returnUrl",
name: "aliPayNotifyUrl", name: "returnUrl",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},
{
type: "input",
label: "notifyURL",
name: "notifyURL",
value: "", value: "",
rules: [{ required: true, message: "请输入卡片名称!" }], rules: [{ required: true, message: "请输入卡片名称!" }],
}, },

View File

@ -15,28 +15,40 @@ const PushConfig = (props: Store) => {
const xmformRef = React.useRef<FormInstance>(null); const xmformRef = React.useRef<FormInstance>(null);
useEffect(() => { useEffect(() => {
appStore.getIosConfig(id) appStore.getIosConfig(id);
}, [appStore, id]); }, [appStore, id]);
const onFinishFailed = () => {}; const onFinishFailed = () => {};
const iosOnFinish = (values: any) => { const iosOnFinish = (values: any) => {
console.log(values); appStore.setIosConfig(id, values);
appStore.setIosConfig(id,values) };
const xmOnFinish = (values: any) => {
appStore.setXmConfig(id, values);
};
const hwOnFinish = (values: any) => {
appStore.setHwConfig(id, values);
};
const oppoOnFinish = (values: any) => {
appStore.setOPConfig(id, values);
};
const vivoOnFinish = (values: any) => {
appStore.setVivoConfig(id, values);
}; };
const xmOnFinish = (values: any) => {};
const hwOnFinish = (values: any) => {};
const oppoOnFinish = (values: any) => {};
const vivoOnFinish = (values: any) => {};
return ( return (
<div className="contentBox"> <div className="contentBox">
<Space direction="vertical" size="middle" style={{ display: "flex" }}> <Space direction="vertical" size="middle" style={{ display: "flex" }}>
<div style={{ backgroundColor: "#fff", padding: "10px" }}> <div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}> <div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p> <p></p>
<Button type="primary" onClick={()=>{ <Button
type="primary"
onClick={() => {
iosformRef.current?.submit(); iosformRef.current?.submit();
}}></Button> }}
>
</Button>
</div> </div>
<SimpleForm <SimpleForm
formRef={iosformRef} formRef={iosformRef}
@ -45,13 +57,6 @@ const PushConfig = (props: Store) => {
onFinish={iosOnFinish} onFinish={iosOnFinish}
onFinishFailed={onFinishFailed} onFinishFailed={onFinishFailed}
formDatas={[ formDatas={[
{
type: "input",
label: "AppId",
name: "appId",
value: "",
rules: [{ required: true, message: "请输入appId!" }],
},
{ {
type: "input", type: "input",
label: "appleBundleId", label: "appleBundleId",
@ -79,7 +84,14 @@ const PushConfig = (props: Store) => {
<div style={{ backgroundColor: "#fff", padding: "10px" }}> <div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}> <div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p> <p></p>
<Button type="primary"></Button> <Button
type="primary"
onClick={() => {
hwformRef.current?.submit();
}}
>
</Button>
</div> </div>
<SimpleForm <SimpleForm
formName={""} formName={""}
@ -108,7 +120,14 @@ const PushConfig = (props: Store) => {
<div style={{ backgroundColor: "#fff", padding: "10px" }}> <div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}> <div style={{ display: "flex", justifyContent: "space-between" }}>
<p>oppo推送</p> <p>oppo推送</p>
<Button type="primary"></Button> <Button
type="primary"
onClick={() => {
opformRef.current?.submit();
}}
>
</Button>
</div> </div>
<SimpleForm <SimpleForm
@ -138,7 +157,14 @@ const PushConfig = (props: Store) => {
<div style={{ backgroundColor: "#fff", padding: "10px" }}> <div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}> <div style={{ display: "flex", justifyContent: "space-between" }}>
<p>vivo推送</p> <p>vivo推送</p>
<Button type="primary"></Button> <Button
type="primary"
onClick={() => {
vivoformRef.current?.submit();
}}
>
</Button>
</div> </div>
<SimpleForm <SimpleForm
formRef={vivoformRef} formRef={vivoformRef}
@ -174,7 +200,14 @@ const PushConfig = (props: Store) => {
<div style={{ backgroundColor: "#fff", padding: "10px" }}> <div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}> <div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p> <p></p>
<Button type="primary"></Button> <Button
type="primary"
onClick={() => {
xmformRef.current?.submit();
}}
>
</Button>
</div> </div>
<SimpleForm <SimpleForm
formRef={xmformRef} formRef={xmformRef}

View File

@ -10,5 +10,7 @@ class AppConfig {
static HUAWEIAPPPUSH = "app/push/huawei/" // huawei推送配置信息 static HUAWEIAPPPUSH = "app/push/huawei/" // huawei推送配置信息
static IOSAPPPUSH = "app/push/ios/" // ios推送配置信息 static IOSAPPPUSH = "app/push/ios/" // ios推送配置信息
static WechatConfig = "app/wechatConfig/" // 微信配置信息 static WechatConfig = "app/wechatConfig/" // 微信配置信息
static ALCONFIG = "app/alConfig/" // 微信配置信息
} }
export default AppConfig; export default AppConfig;

View File

@ -1,12 +1,10 @@
import store from "@/store"; import store from "@/store";
import axios, { AxiosResponse } from "axios"; import axios, { AxiosResponse } from "axios";
// 添加请求拦截器 // 添加请求拦截器
axios.defaults.headers.common["CommonType"] = "shouka"; axios.defaults.headers.common["CommonType"] = "shouka";
axios.defaults.headers.common["Content-Type"] = "application/json; charset=utf8"; axios.defaults.headers.common["Content-Type"] = "application/json; charset=utf8";
axios.interceptors.request.use((config) => { axios.interceptors.request.use((config) => {
config.baseURL = "http://quwanya.cn:8899/v1/api/"; config.baseURL = "http://127.0.0.1:8899/v1/api/";
config.timeout = 5000; config.timeout = 5000;
let token = window.localStorage.getItem("token") let token = window.localStorage.getItem("token")
config.headers.Authorization = 'Bearer ' + token config.headers.Authorization = 'Bearer ' + token

View File

@ -1,17 +1,14 @@
import { CardDataType } from "@/util/model/interface"; import { CardDataType } from "@/util/model/interface";
import BaseStore from "../baseStore"; import BaseStore from "../baseStore";
import { action, makeObservable } from "mobx"; import { makeObservable } from "mobx";
import ActivityConfig from "@/service/apiConfig/activityConfig"; import ActivityConfig from "@/service/apiConfig/activityConfig";
class ActivityStore extends BaseStore<CardDataType>{ class ActivityStore extends BaseStore<CardDataType> {
constructor() { constructor() {
super(ActivityConfig) super(ActivityConfig)
makeObservable(this, { makeObservable(this, {
otherAction: action,
}) })
} }
otherAction() {
}
} }
export default new ActivityStore(); export default new ActivityStore();

View File

@ -8,20 +8,69 @@ class AppStore extends BaseStore<CardDataType> {
constructor() { constructor() {
super(AppConfig) super(AppConfig)
makeObservable(this, { makeObservable(this, {
otherAction: action,
getIosConfig: action, getIosConfig: action,
}) })
} }
otherAction() { // 设置Ios 配置
}
// 获取banner
async setIosConfig(id: number, param) { async setIosConfig(id: number, param) {
return await baseHttp.put(AppConfig.IOSAPPPUSH + "/" + id, param) return await baseHttp.put(AppConfig.IOSAPPPUSH + id, param)
} }
// 获取banner // 获取Ios 配置
async getIosConfig(id: number) { async getIosConfig(id: number) {
return await baseHttp.get(AppConfig.IOSAPPPUSH + "/" + id, {}) return await baseHttp.get(AppConfig.IOSAPPPUSH + "/" + id, {})
} }
// 设置hw 配置
async setHwConfig(id: number, param) {
return await baseHttp.put(AppConfig.HUAWEIAPPPUSH + id, param)
}
// 获取HW 配置
async getHwConfig(id: number) {
return await baseHttp.get(AppConfig.HUAWEIAPPPUSH + "/" + id, {})
}
// 设置op 配置
async setOPConfig(id: number, param) {
return await baseHttp.put(AppConfig.OPPOAPPPUSH + id, param)
}
// 获取op 配置
async getOpConfig(id: number) {
return await baseHttp.get(AppConfig.OPPOAPPPUSH + "/" + id, {})
}
// 设置op 配置
async setVivoConfig(id: number, param) {
return await baseHttp.put(AppConfig.VIVOAPPPUSH + id, param)
}
// 获取op 配置
async getVivoConfig(id: number) {
return await baseHttp.get(AppConfig.VIVOAPPPUSH + "/" + id, {})
}
// 设置wx 配置
async setWechatConfig(id: number, param) {
return await baseHttp.put(AppConfig.WechatConfig + id, param)
}
// 获取wx 配置
async getWechatConfig(id: number) {
return await baseHttp.get(AppConfig.WechatConfig + "/" + id, {})
}
// 设置wx 配置
async setXmConfig(id: number, param) {
return await baseHttp.put(AppConfig.XIAOMIAPPPUSH + id, param)
}
// 获取wx 配置
async getXmConfig(id: number) {
return await baseHttp.get(AppConfig.XIAOMIAPPPUSH + "/" + id, {})
}
// 设置wx 配置
async setAlConfig(id: number, param) {
return await baseHttp.put(AppConfig.ALCONFIG + id, param)
}
// 获取wx 配置
async getAlConfig(id: number) {
return await baseHttp.get(AppConfig.ALCONFIG + "/" + id, {})
}
} }
export default new AppStore(); export default new AppStore();