From 2c167bf6386e747e9d72d4e5f916fb949f3c761e Mon Sep 17 00:00:00 2001 From: wang_yp Date: Tue, 23 Apr 2024 22:50:17 +0800 Subject: [PATCH] app --- src/pages/active/index.tsx | 114 ++++++++++++++------------- src/pages/app/app-config.tsx | 17 ++-- src/pages/app/app-list.tsx | 15 ++-- src/pages/app/config/pay-config.tsx | 87 +++++++++++++------- src/pages/app/config/push-config.tsx | 75 +++++++++++++----- src/service/apiConfig/appConfig.ts | 2 + src/service/base.ts | 4 +- src/store/activityStore/index.ts | 7 +- src/store/appStore/index.ts | 63 +++++++++++++-- 9 files changed, 247 insertions(+), 137 deletions(-) diff --git a/src/pages/active/index.tsx b/src/pages/active/index.tsx index 22b37cb..d393504 100644 --- a/src/pages/active/index.tsx +++ b/src/pages/active/index.tsx @@ -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([]); const [id, setId] = useState(null); const [record, setRecord] = useState(null); @@ -20,64 +20,67 @@ const Active = (props: Store) => { const columns: ColumnsType = [ { title: "活动标题", - dataIndex: "activeName", + dataIndex: "title", + width: 200, + }, + { + title: "活动描述", + dataIndex: "desc", + width: 200, + }, + { + title: "活动图片", + dataIndex: "activeIcon", + width: 200, + ellipsis: { + showTitle: false, + }, + render: (address) => ( + + {address} + + ), + }, + { + title: "活动人数", + dataIndex: "peopleNum", + width: 200, + }, + { + title: "活动地址", + dataIndex: "address", + width: 200, }, - // { - // title: "活动描述", - // dataIndex: "desc", - // }, - // { - // title: "活动图片", - // dataIndex: "activeIcon", - // ellipsis: { - // showTitle: false, - // }, - // render: (address) => ( - // - // {address} - // - // ), - // }, - // { - // 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) => ( -
- {record.status ? "开启" : "关闭"} -
- ), + width: 200, + render: (any, record) => {record.status ? "开启" : "关闭"}, + }, + { + width: 200, + title: "发起人", + dataIndex: "userId", }, - // { - // title: "发起人", - // dataIndex: "userId", - // }, - { title: "操作", + width: 200, + fixed: "right", dataIndex: "id", - ellipsis: { - showTitle: false, - }, render: (any, record) => (
@@ -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 ( -
- {
); }; -export default inject("activeStore")(observer(Active)); +export default inject("activityStore")(observer(Active)); diff --git a/src/pages/app/app-config.tsx b/src/pages/app/app-config.tsx index 0b67150..961aa29 100644 --- a/src/pages/app/app-config.tsx +++ b/src/pages/app/app-config.tsx @@ -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: + children: , }, { key: "2", label: "推送配置", - children: + children: , }, { key: "3", label: "im配置", - children: + children: , }, ]; - const onChange = (key: string) => { - console.log(key); - }; + return (
- +
); diff --git a/src/pages/app/app-list.tsx b/src/pages/app/app-list.tsx index 792e96d..0c88f17 100644 --- a/src/pages/app/app-list.tsx +++ b/src/pages/app/app-list.tsx @@ -41,6 +41,15 @@ const AppManageList = (props: Store) => { > 编辑 + -
@@ -118,6 +122,7 @@ const AppManageList = (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: "请输入卡片名称!" }], }, diff --git a/src/pages/app/config/push-config.tsx b/src/pages/app/config/push-config.tsx index 258bb9a..9bc235e 100644 --- a/src/pages/app/config/push-config.tsx +++ b/src/pages/app/config/push-config.tsx @@ -15,28 +15,40 @@ const PushConfig = (props: Store) => { const xmformRef = React.useRef(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 (

苹果推送

- +
{ 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) => {

华为推送

- +
{

oppo推送

- +
{

vivo推送

- +
{

小米推送

- +
{ - 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 diff --git a/src/store/activityStore/index.ts b/src/store/activityStore/index.ts index 01d2b0e..6e79bb8 100644 --- a/src/store/activityStore/index.ts +++ b/src/store/activityStore/index.ts @@ -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{ +class ActivityStore extends BaseStore { constructor() { super(ActivityConfig) makeObservable(this, { - otherAction: action, }) } - otherAction() { - } } export default new ActivityStore(); \ No newline at end of file diff --git a/src/store/appStore/index.ts b/src/store/appStore/index.ts index 4dacff4..4299203 100644 --- a/src/store/appStore/index.ts +++ b/src/store/appStore/index.ts @@ -8,20 +8,69 @@ class AppStore extends BaseStore { 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(); \ No newline at end of file