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 type { ColumnsType } from "antd/es/table";
import BTable from "@/components/BTable";
@ -11,7 +11,7 @@ import React from "react";
import ActiveConfig from "@/service/apiConfig/active";
import dayjs from "dayjs";
const Active = (props: Store) => {
const { activeStore } = props;
const { activityStore } = props;
const [projectConfig, setProjectConfig] = useState<any>([]);
const [id, setId] = useState<any>(null);
const [record, setRecord] = useState<any>(null);
@ -20,64 +20,67 @@ const Active = (props: Store) => {
const columns: ColumnsType<UserDataType> = [
{
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: "折扣",
dataIndex: "discount",
width: 200,
},
{
title: "活动开始时间",
dataIndex: "startTime",
width: 200,
},
{
title: "活动结束时间",
dataIndex: "endTime",
width: 200,
},
{
title: "活动状态",
render: (any, record) => (
<div>
<span>{record.status ? "开启" : "关闭"}</span>
</div>
),
width: 200,
render: (any, record) => <span>{record.status ? "开启" : "关闭"}</span>,
},
{
width: 200,
title: "发起人",
dataIndex: "userId",
},
// {
// title: "发起人",
// dataIndex: "userId",
// },
{
title: "操作",
width: 200,
fixed: "right",
dataIndex: "id",
ellipsis: {
showTitle: false,
},
render: (any, record) => (
<div>
<Space direction="vertical">
@ -93,7 +96,7 @@ const Active = (props: Store) => {
danger
size="small"
onClick={() => {
activeStore.deleteItem(record.id);
activityStore.deleteItem(record.id);
}}
>
@ -123,7 +126,7 @@ const Active = (props: Store) => {
setId(record.id);
};
const onChange = (bools, record) => {
activeStore.putItem(record.id, {
activityStore.putItem(record.id, {
status: bools,
activeName: record.activeName,
discount: record.discount,
@ -161,15 +164,15 @@ const Active = (props: Store) => {
];
useEffect(() => {
activeStore.getlist(ActiveConfig.LIST);
}, [activeStore]);
activityStore.getlist(ActiveConfig.LIST);
}, [activityStore]);
const onFinish = (values: any) => {
values["startTime"] = values["startTime"].format("YYYY.MM.DD");
values["endTime"] = values["endTime"].format("YYYY.MM.DD");
if (!id) {
activeStore.add(values);
activityStore.add(values);
} else {
activeStore.putItem(id, values);
activityStore.putItem(id, values);
}
setIsModalOpen(false);
};
@ -177,14 +180,17 @@ const Active = (props: Store) => {
const addAction = () => {
setProjectConfig(defaultConfig);
setId(null);
setRecord(null)
setRecord(null);
setIsModalOpen(true);
formRef.current?.setFieldsValue(record);
};
return (
<div className="projectContent">
<Button className="projectContentAdd" onClick={() => addAction()}>
<div style={{ padding: "10px" }}>
<Button
style={{ marginBottom: "10px" }}
className="projectContentAdd"
onClick={() => addAction()}
>
</Button>
<Modal
@ -211,13 +217,13 @@ const Active = (props: Store) => {
</Modal>
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
<BTable
store={activeStore}
store={activityStore}
columns={columns}
dataSource={activeStore.list}
dataSource={activityStore.list}
/>
</Space>
</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 { 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 />
children: <PayConfig />,
},
{
key: "2",
label: "推送配置",
children: <PushConfig />
children: <PushConfig />,
},
{
key: "3",
label: "im配置",
children: <ImConfig />
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} />
<Tabs defaultActiveKey="1" type="card" items={items} />
</Space>
</div>
);

View File

@ -41,6 +41,15 @@ const AppManageList = (props: Store) => {
>
</Button>
<Button
type="dashed"
size="small"
onClick={() => {
navigate("/app/config/" + record.id);
}}
>
</Button>
<Button
type="dashed"
danger
@ -51,11 +60,6 @@ const AppManageList = (props: Store) => {
>
</Button>
<Button type="dashed" size="small" onClick={() => {
navigate("/app/config/" + record.id)
}}>
</Button>
</Space>
</Space>
</div>
@ -118,6 +122,7 @@ const AppManageList = (props: Store) => {
<div className="contentBox">
<Button
className="projectContentAdd"
style={{ marginBottom: "10px" }}
onClick={() => {
setProjectConfig(defaultConfig);
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 { 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 PayConfig = (props: Store) => {
const { appStore } = props;
const { id } = useParams();
const wxformRef = React.useRef<FormInstance>(null);
const aliformRef = React.useRef<FormInstance>(null);
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(","),
};
const onwxFinish = (values: any) => {
appStore.setWechatConfig(id,values)
};
const onAliFinish = (values: any) => {
appStore.setAlConfig(id,values)
};
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={() => {
wxformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm
formName={""}
colProps={0}
onFinish={onFinish}
formRef={wxformRef}
onFinish={onwxFinish}
onFinishFailed={onFinishFailed}
formDatas={[
{
type: "input",
label: "AppId",
name: "appId",
label: "wechatAppid",
name: "wechatAppid",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},
{
type: "input",
label: "AppSecret",
name: "appSecret",
label: "mchid",
name: "mchid",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},
{
type: "input",
label: "MchID",
name: "mchID",
label: "body",
name: "body",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},
{
type: "input",
label: "微信支付key",
name: "WeixinPayKey",
label: "notifyURL",
name: "notifyURL",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},
{
type: "input",
label: "微信支付回调地址",
name: "WeixinPayNotifyUrl",
label: "key",
name: "key",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},
@ -71,17 +80,28 @@ const PayConfig = (props: Store) => {
/>
</div>
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
<p></p>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p>
<Button
type="primary"
onClick={() => {
aliformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm
formRef={aliformRef}
formName={""}
colProps={0}
onFinish={onFinish}
onFinish={onAliFinish}
onFinishFailed={onFinishFailed}
formDatas={[
{
type: "input",
label: "AliAppId",
name: "aliAppId",
name: "appid",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},
@ -94,8 +114,15 @@ const PayConfig = (props: Store) => {
},
{
type: "input",
label: "AliPayNotifyUrl",
name: "aliPayNotifyUrl",
label: "returnUrl",
name: "returnUrl",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},
{
type: "input",
label: "notifyURL",
name: "notifyURL",
value: "",
rules: [{ required: true, message: "请输入卡片名称!" }],
},

View File

@ -15,28 +15,40 @@ const PushConfig = (props: Store) => {
const xmformRef = React.useRef<FormInstance>(null);
useEffect(() => {
appStore.getIosConfig(id)
appStore.getIosConfig(id);
}, [appStore, id]);
const onFinishFailed = () => {};
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 (
<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>
<Button
type="primary"
onClick={() => {
iosformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm
formRef={iosformRef}
@ -45,13 +57,6 @@ const PushConfig = (props: Store) => {
onFinish={iosOnFinish}
onFinishFailed={onFinishFailed}
formDatas={[
{
type: "input",
label: "AppId",
name: "appId",
value: "",
rules: [{ required: true, message: "请输入appId!" }],
},
{
type: "input",
label: "appleBundleId",
@ -79,7 +84,14 @@ const PushConfig = (props: Store) => {
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p>
<Button type="primary"></Button>
<Button
type="primary"
onClick={() => {
hwformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm
formName={""}
@ -108,7 +120,14 @@ const PushConfig = (props: Store) => {
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<p>oppo推送</p>
<Button type="primary"></Button>
<Button
type="primary"
onClick={() => {
opformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm
@ -138,7 +157,14 @@ const PushConfig = (props: Store) => {
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<p>vivo推送</p>
<Button type="primary"></Button>
<Button
type="primary"
onClick={() => {
vivoformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm
formRef={vivoformRef}
@ -174,7 +200,14 @@ const PushConfig = (props: Store) => {
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
<div style={{ display: "flex", justifyContent: "space-between" }}>
<p></p>
<Button type="primary"></Button>
<Button
type="primary"
onClick={() => {
xmformRef.current?.submit();
}}
>
</Button>
</div>
<SimpleForm
formRef={xmformRef}

View File

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

View File

@ -1,12 +1,10 @@
import store from "@/store";
import axios, { AxiosResponse } from "axios";
// 添加请求拦截器
axios.defaults.headers.common["CommonType"] = "shouka";
axios.defaults.headers.common["Content-Type"] = "application/json; charset=utf8";
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;
let token = window.localStorage.getItem("token")
config.headers.Authorization = 'Bearer ' + token

View File

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

View File

@ -8,20 +8,69 @@ class AppStore extends BaseStore<CardDataType> {
constructor() {
super(AppConfig)
makeObservable(this, {
otherAction: action,
getIosConfig: action,
})
}
otherAction() {
}
// 获取banner
// 设置Ios 配置
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) {
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();