fix(api):iop
This commit is contained in:
parent
66a3d55f14
commit
8a7b183c7c
|
@ -1,11 +1,8 @@
|
|||
import { inject, observer } from "mobx-react";
|
||||
import LayOut from "./components/layout/layout";
|
||||
import "antd/dist/antd.css";
|
||||
import Login from "./pages/login/login";
|
||||
import Home from "./pages/home";
|
||||
const App = (props: any) => {
|
||||
const { usrStore } = props;
|
||||
const user = usrStore.userInfo;
|
||||
return user?.token ? <LayOut userStore={usrStore} /> : <Login />;
|
||||
return <Home />
|
||||
};
|
||||
|
||||
export default inject("usrStore")(observer(App));
|
||||
|
|
|
@ -1,61 +1,10 @@
|
|||
import { Outlet, useNavigate } from "react-router-dom";
|
||||
import { Layout, Menu } from "antd";
|
||||
import "./layout.less";
|
||||
import { MenuFoldOutlined, MenuUnfoldOutlined } from "@ant-design/icons";
|
||||
import { useState } from "react";
|
||||
import type { MenuProps } from 'antd';
|
||||
import React from "react";
|
||||
import menuList from "../menu";
|
||||
const LayOut = (props: any) => {
|
||||
const { Header, Sider } = Layout;
|
||||
const [collapsed, setCollapsed] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const [openKeys, setOpenKeys] = useState(["/"]);
|
||||
const rootSubmenuKeys = ['/', '/user-manage', '/dynamic-manage',"/active","/merchant-manage","/system","/rbac"];
|
||||
const onOpenChange:MenuProps['onOpenChange'] = (keys) => {
|
||||
const latestOpenKey = keys.find((key) => openKeys.indexOf(key) === -1);
|
||||
if (latestOpenKey && rootSubmenuKeys.indexOf(latestOpenKey!) === -1) {
|
||||
setOpenKeys(keys);
|
||||
} else {
|
||||
setOpenKeys(latestOpenKey ? [latestOpenKey] : []);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="layout">
|
||||
<Layout>
|
||||
<Sider trigger={null} collapsible collapsed={collapsed}>
|
||||
<div className="logo" />
|
||||
<Menu
|
||||
theme="dark"
|
||||
mode="inline"
|
||||
openKeys={openKeys}
|
||||
defaultSelectedKeys={["1"]}
|
||||
onClick={(key) => navigate(key.key)}
|
||||
onOpenChange={onOpenChange}
|
||||
items={menuList}
|
||||
/>
|
||||
</Sider>
|
||||
<Layout className="site-layout">
|
||||
<Header className="site-layout-background" style={{ padding: 0 }}>
|
||||
{React.createElement(
|
||||
collapsed ? MenuUnfoldOutlined : MenuFoldOutlined,
|
||||
{
|
||||
className: "trigger",
|
||||
onClick: () => setCollapsed(!collapsed),
|
||||
}
|
||||
)}
|
||||
<div
|
||||
className="loginOut"
|
||||
onClick={() => {
|
||||
props.userStore.logOut();
|
||||
}}
|
||||
>
|
||||
退出登录
|
||||
</div>
|
||||
</Header>
|
||||
<Outlet />
|
||||
</Layout>
|
||||
</Layout>
|
||||
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
import {
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const activeMenu = {
|
||||
key: "/active",
|
||||
icon: <UserOutlined />,
|
||||
label: "活动管理",
|
||||
children: [
|
||||
{
|
||||
key: "/active-list",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "活动列表",
|
||||
},
|
||||
{
|
||||
key: "/active-type-list",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "活动类型列表",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default activeMenu;
|
|
@ -1,18 +0,0 @@
|
|||
import {
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const appMenu = {
|
||||
key: "/app",
|
||||
icon: <UserOutlined />,
|
||||
label: "app管理",
|
||||
children: [
|
||||
{
|
||||
key: "/app/list",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "app列表",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default appMenu;
|
|
@ -1,29 +0,0 @@
|
|||
import {
|
||||
UserOutlined,
|
||||
VideoCameraOutlined
|
||||
} from '@ant-design/icons';
|
||||
const cardMenu =
|
||||
{
|
||||
key: '/card',
|
||||
icon: <UserOutlined />,
|
||||
label: '卡片管理',
|
||||
children: [
|
||||
{
|
||||
key: '/card/list',
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: '用户卡片',
|
||||
},
|
||||
{
|
||||
key: '/card/character',
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: '人物卡片',
|
||||
},
|
||||
{
|
||||
key: '/card/currentEvent',
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: '实事卡片',
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
export default cardMenu;
|
|
@ -1,24 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const communityMenu = {
|
||||
key: "/xiaoqu",
|
||||
icon: <UserOutlined />,
|
||||
label: "小区管理",
|
||||
children: [
|
||||
{
|
||||
key: "/project2",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "go to home",
|
||||
},
|
||||
{
|
||||
key: "/project3",
|
||||
icon: <UploadOutlined />,
|
||||
label: "go test",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default communityMenu;
|
|
@ -1,24 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const contentMenu = {
|
||||
key: "/project12",
|
||||
icon: <UserOutlined />,
|
||||
label: "内容管理",
|
||||
children: [
|
||||
{
|
||||
key: "/project13",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "go to home",
|
||||
},
|
||||
{
|
||||
key: "/project14",
|
||||
icon: <UploadOutlined />,
|
||||
label: "go test",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default contentMenu;
|
|
@ -1,24 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const demand = {
|
||||
key: "/demand",
|
||||
icon: <UserOutlined />,
|
||||
label: "需求池",
|
||||
children: [
|
||||
{
|
||||
key: "/shop1",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "go to home",
|
||||
},
|
||||
{
|
||||
key: "/shop2",
|
||||
icon: <UploadOutlined />,
|
||||
label: "go test",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default demand;
|
|
@ -1,18 +0,0 @@
|
|||
import {
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const dynimacStateMenu = {
|
||||
key: "/dynamic-manage",
|
||||
icon: <UserOutlined />,
|
||||
label: "动态管理",
|
||||
children: [
|
||||
{
|
||||
key: "/dynamic-list",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "动态列表",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default dynimacStateMenu;
|
|
@ -1,24 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const goodsMenu = {
|
||||
key: "/shop",
|
||||
icon: <UserOutlined />,
|
||||
label: "商品管理",
|
||||
children: [
|
||||
{
|
||||
key: "/shop1",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "go to home",
|
||||
},
|
||||
{
|
||||
key: "/shop2",
|
||||
icon: <UploadOutlined />,
|
||||
label: "go test",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default goodsMenu;
|
|
@ -1,32 +0,0 @@
|
|||
import { ItemType } from "antd/lib/menu/hooks/useItems";
|
||||
import { UserOutlined } from "@ant-design/icons";
|
||||
import userMenu from "./user";
|
||||
import activeMenu from "./active";
|
||||
import taskMenu from "./task";
|
||||
import contentMenu from "./content_menu";
|
||||
import system from "./system";
|
||||
import merchant from "./merchant";
|
||||
import dynimacStateMenu from "./dynimac_state";
|
||||
import rbac from "./rbac";
|
||||
import app from "./app";
|
||||
import demand from "./demand";
|
||||
// demand
|
||||
const menuList: ItemType[] = [
|
||||
{
|
||||
key: "/",
|
||||
icon: <UserOutlined />,
|
||||
label: "首页",
|
||||
},
|
||||
userMenu,
|
||||
demand,
|
||||
contentMenu,
|
||||
dynimacStateMenu,
|
||||
activeMenu,
|
||||
merchant,
|
||||
system,
|
||||
rbac,
|
||||
taskMenu,
|
||||
app,
|
||||
];
|
||||
|
||||
export default menuList;
|
|
@ -1,35 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const merchant = {
|
||||
key: "/merchant-manage",
|
||||
icon: <UserOutlined />,
|
||||
label: "商户管理",
|
||||
children: [
|
||||
{
|
||||
key: "/merchant",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "商家管理",
|
||||
},
|
||||
{
|
||||
key: "/project",
|
||||
icon: <UploadOutlined />,
|
||||
label: "商品管理",
|
||||
},
|
||||
{
|
||||
key: "/productType",
|
||||
icon: <UploadOutlined />,
|
||||
label: "类型设置",
|
||||
},
|
||||
{
|
||||
key: "/productUnit",
|
||||
icon: <UploadOutlined />,
|
||||
label: "单位设置",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default merchant;
|
||||
|
|
@ -1,30 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from '@ant-design/icons';
|
||||
const permissionMenu =
|
||||
{
|
||||
key: '/project15',
|
||||
icon: <UserOutlined />,
|
||||
label: 'rbac',
|
||||
children: [
|
||||
{
|
||||
key: '/role',
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: '角色管理',
|
||||
},
|
||||
{
|
||||
key: '/premission',
|
||||
icon: <UploadOutlined />,
|
||||
label: '权限管理',
|
||||
},
|
||||
{
|
||||
key: '/keyword',
|
||||
icon: <UploadOutlined />,
|
||||
label: '关键字',
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
export default permissionMenu;
|
|
@ -1,24 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const projectMenu = {
|
||||
key: "/projectManagement",
|
||||
icon: <UserOutlined />,
|
||||
label: "产品管理",
|
||||
children: [
|
||||
{
|
||||
key: "/project",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "go to home",
|
||||
},
|
||||
{
|
||||
key: "/project1",
|
||||
icon: <UploadOutlined />,
|
||||
label: "go test",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default projectMenu;
|
|
@ -1,24 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const rbac = {
|
||||
key: "/rbac",
|
||||
icon: <UserOutlined />,
|
||||
label: "权限管理",
|
||||
children: [
|
||||
{
|
||||
key: "/rule",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "角色管理",
|
||||
},
|
||||
{
|
||||
key: "/permission",
|
||||
icon: <UploadOutlined />,
|
||||
label: "权限管理",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default rbac;
|
|
@ -1,25 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from '@ant-design/icons';
|
||||
const stadiumMenu =
|
||||
{
|
||||
key: '/project6',
|
||||
icon: <UserOutlined />,
|
||||
label: '分类管理',
|
||||
children: [
|
||||
{
|
||||
key: '/project4',
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: '球场列表',
|
||||
},
|
||||
{
|
||||
key: '/project5',
|
||||
icon: <UploadOutlined />,
|
||||
label: '球场列表',
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
export default stadiumMenu;
|
|
@ -1,29 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const system = {
|
||||
key: "/system",
|
||||
icon: <UserOutlined />,
|
||||
label: "系统管理",
|
||||
children: [
|
||||
{
|
||||
key: "/banner",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "banner",
|
||||
},
|
||||
{
|
||||
key: "/logs",
|
||||
icon: <UploadOutlined />,
|
||||
label: "日志管理",
|
||||
},
|
||||
{
|
||||
key: "/keywork",
|
||||
icon: <UploadOutlined />,
|
||||
label: "关键字",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default system;
|
|
@ -1,28 +0,0 @@
|
|||
import {
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const taskMenu = {
|
||||
key: "/task",
|
||||
icon: <UserOutlined />,
|
||||
label: "任务管理",
|
||||
children: [
|
||||
{
|
||||
key: "/task-list",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "任务列表",
|
||||
},
|
||||
{
|
||||
key: "/task-type-list",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "任务类型管理",
|
||||
},
|
||||
{
|
||||
key: "/task-type",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "任务紧急",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default taskMenu;
|
|
@ -1,19 +0,0 @@
|
|||
import {
|
||||
UserOutlined,
|
||||
VideoCameraOutlined
|
||||
} from '@ant-design/icons';
|
||||
const userMenu =
|
||||
{
|
||||
key: '/user-manage',
|
||||
icon: <UserOutlined />,
|
||||
label: '用户管理',
|
||||
children: [
|
||||
{
|
||||
key: '/user',
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: '用户列表',
|
||||
},
|
||||
]
|
||||
};
|
||||
|
||||
export default userMenu;
|
|
@ -1,24 +0,0 @@
|
|||
import {
|
||||
UploadOutlined,
|
||||
UserOutlined,
|
||||
VideoCameraOutlined,
|
||||
} from "@ant-design/icons";
|
||||
const videoMenu = {
|
||||
key: "/project9",
|
||||
icon: <UserOutlined />,
|
||||
label: "视频管理",
|
||||
children: [
|
||||
{
|
||||
key: "/project10",
|
||||
icon: <VideoCameraOutlined />,
|
||||
label: "go to home",
|
||||
},
|
||||
{
|
||||
key: "/tesproject11t",
|
||||
icon: <UploadOutlined />,
|
||||
label: "go test",
|
||||
},
|
||||
],
|
||||
};
|
||||
|
||||
export default videoMenu;
|
|
@ -1,229 +0,0 @@
|
|||
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/b_table";
|
||||
import { useEffect, useState } from "react";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import { FormInstance } from "antd/es/form/Form";
|
||||
import React from "react";
|
||||
import ActiveConfig from "@/service/apiConfig/active";
|
||||
import dayjs from "dayjs";
|
||||
const Active = (props: Store) => {
|
||||
const { activityStore } = props;
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const [id, setId] = useState<any>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const columns: ColumnsType<UserDataType> = [
|
||||
{
|
||||
title: "活动标题",
|
||||
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: "discount",
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: "活动开始时间",
|
||||
dataIndex: "startTime",
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: "活动结束时间",
|
||||
dataIndex: "endTime",
|
||||
width: 200,
|
||||
},
|
||||
{
|
||||
title: "活动状态",
|
||||
width: 200,
|
||||
render: (any, record) => <span>{record.status ? "开启" : "关闭"}</span>,
|
||||
},
|
||||
{
|
||||
width: 200,
|
||||
title: "发起人",
|
||||
dataIndex: "userId",
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
width: 200,
|
||||
fixed: "right",
|
||||
dataIndex: "id",
|
||||
render: (any, record) => (
|
||||
<div>
|
||||
<Space direction="vertical">
|
||||
<Space wrap>
|
||||
<Switch
|
||||
defaultChecked
|
||||
onChange={(bools) => {
|
||||
onChange(bools, record);
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => {
|
||||
activityStore.deleteItem(record.id);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
editAction(record);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
const editAction = (record) => {
|
||||
record.startTime = dayjs(record.startTime, "YYYY-MM-DD");
|
||||
record.endTime = dayjs(record.endTime, "YYYY-MM-DD");
|
||||
setProjectConfig(defaultConfig);
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
};
|
||||
const onChange = (bools, record) => {
|
||||
activityStore.putItem(record.id, {
|
||||
status: bools,
|
||||
activeName: record.activeName,
|
||||
discount: record.discount,
|
||||
startTime: record.startTime,
|
||||
endTime: record.endTime,
|
||||
});
|
||||
};
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
label: "活动名称",
|
||||
name: "activeName",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入活动名称!" }],
|
||||
},
|
||||
|
||||
{
|
||||
type: "input",
|
||||
label: "折扣",
|
||||
name: "discount",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
type: "Date",
|
||||
label: "活动开始时间",
|
||||
name: "startTime",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
type: "Date",
|
||||
label: "活动结束时间",
|
||||
name: "endTime",
|
||||
value: "",
|
||||
},
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
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) {
|
||||
activityStore.add(values);
|
||||
} else {
|
||||
activityStore.putItem(id, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
const onFinishFailed = () => {};
|
||||
const addAction = () => {
|
||||
setProjectConfig(defaultConfig);
|
||||
setId(null);
|
||||
setRecord(null);
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
};
|
||||
return (
|
||||
<div style={{ padding: "10px" }}>
|
||||
<Button
|
||||
style={{ marginBottom: "10px" }}
|
||||
className="projectContentAdd"
|
||||
onClick={() => addAction()}
|
||||
>
|
||||
添加活动
|
||||
</Button>
|
||||
<Modal
|
||||
title="活动信息"
|
||||
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={activityStore}
|
||||
columns={columns}
|
||||
dataSource={activityStore.list}
|
||||
/>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("activityStore")(observer(Active));
|
|
@ -1,158 +0,0 @@
|
|||
import { Button, Space, Modal, FormInstance } from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import BTable from "@/components/b_table";
|
||||
import { useEffect, useState } from "react";
|
||||
import UserConfig from "@/service/apiConfig/user_config";
|
||||
import { UserDataType } from "@/model/userModel";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import React from "react";
|
||||
|
||||
const ActiveType = (props: Store) => {
|
||||
const { activityTypeStore } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const [userId, setId] = useState<Number | null>(null);
|
||||
const columns: ColumnsType<UserDataType> = [
|
||||
{ title: "类型名称", dataIndex: "name" },
|
||||
{ title: "类型描述", dataIndex: "desc" },
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "id",
|
||||
ellipsis: {
|
||||
showTitle: false,
|
||||
},
|
||||
render: (any, record) => (
|
||||
<div>
|
||||
<Space direction="vertical">
|
||||
<Space wrap>
|
||||
<EditBtn />
|
||||
<DeBtn />
|
||||
</Space>
|
||||
</Space>
|
||||
</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) => {
|
||||
record = {
|
||||
...record,
|
||||
imageUrl: [{ url: record.imageUrl }],
|
||||
};
|
||||
setProjectConfig(defaultConfig);
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
};
|
||||
const onFinish = (values: any) => {
|
||||
values = {
|
||||
...values,
|
||||
};
|
||||
if (!userId) {
|
||||
activityTypeStore.add(values);
|
||||
} else {
|
||||
activityTypeStore.putItem(userId, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
activityTypeStore.getlist(UserConfig.LIST);
|
||||
}, [activityTypeStore]);
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
label: "类型名称",
|
||||
name: "name",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入类型名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "类型描述",
|
||||
name: "desc",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入类型描述" }],
|
||||
},
|
||||
];
|
||||
const onFinishFailed = () => {};
|
||||
const addAction = () => {
|
||||
setRecord({});
|
||||
setProjectConfig(defaultConfig);
|
||||
setId(null);
|
||||
setIsModalOpen(true);
|
||||
};
|
||||
const onCancel = () => {
|
||||
setId(null);
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||
<Button type="default" onClick={addAction}>
|
||||
添加类型
|
||||
</Button>
|
||||
<BTable
|
||||
store={activityTypeStore}
|
||||
columns={columns}
|
||||
dataSource={activityTypeStore.list}
|
||||
/>
|
||||
<Modal
|
||||
title={!userId ? "添加类型" : "编辑类型"}
|
||||
width={600}
|
||||
open={isModalOpen}
|
||||
afterClose={() => formRef.current?.resetFields()}
|
||||
onOk={() => formRef.current?.submit()}
|
||||
onCancel={onCancel}
|
||||
>
|
||||
<SimpleForm
|
||||
formRef={formRef}
|
||||
createCallback={() => {
|
||||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formName="card_basic"
|
||||
colProps={4}
|
||||
subBtnName="提交"
|
||||
formDatas={projectConfig}
|
||||
onFinish={onFinish}
|
||||
initialValues={true}
|
||||
onFinishFailed={onFinishFailed}
|
||||
/>
|
||||
</Modal>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("activityTypeStore")(observer(ActiveType));
|
|
@ -1,44 +0,0 @@
|
|||
import { Space, Tabs, TabsProps } from "antd";
|
||||
import { inject, observer } from "mobx-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 { useEffect } from "react";
|
||||
import { useParams } from "react-router";
|
||||
const AppManageConfig = (props: Store) => {
|
||||
const { appStore } = props
|
||||
const { id } = useParams();
|
||||
useEffect(()=>{
|
||||
appStore.getApp(id)
|
||||
},[appStore,id])
|
||||
const items: TabsProps["items"] = [
|
||||
{
|
||||
key: "1",
|
||||
label: "支付配置",
|
||||
children: <PayConfig />,
|
||||
},
|
||||
{
|
||||
key: "2",
|
||||
label: "推送配置",
|
||||
children: <PushConfig />,
|
||||
},
|
||||
{
|
||||
key: "3",
|
||||
label: "im配置",
|
||||
children: <ImConfig />,
|
||||
},
|
||||
];
|
||||
const onChange = ()=>{
|
||||
appStore.getApp(id)
|
||||
}
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<Space direction="vertical" size="middle" style={{ display: "flex" }}>
|
||||
<Tabs defaultActiveKey="1" type="card" items={items} onChange={onChange}/>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("appStore")(observer(AppManageConfig));
|
|
@ -1,162 +0,0 @@
|
|||
import { Space, Button, FormInstance } from "antd";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import BTable from "@/components/b_table";
|
||||
import { useEffect, useState } from "react";
|
||||
import UserConfig from "@/service/apiConfig/user_config";
|
||||
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"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
navigate("/app/config/" + 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 (
|
||||
<div className="contentBox">
|
||||
<Button
|
||||
className="projectContentAdd"
|
||||
style={{ marginBottom: "10px" }}
|
||||
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));
|
|
@ -1,19 +0,0 @@
|
|||
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) => {
|
||||
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));
|
|
@ -1,139 +0,0 @@
|
|||
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(() => {
|
||||
wxformRef.current?.setFieldsValue(appStore.item?.wechat)
|
||||
aliformRef.current?.setFieldsValue(appStore.item?.ali)
|
||||
}, [appStore.item,id]);
|
||||
const onFinishFailed = () => {};
|
||||
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}
|
||||
formRef={wxformRef}
|
||||
onFinish={onwxFinish}
|
||||
onFinishFailed={onFinishFailed}
|
||||
formDatas={[
|
||||
{
|
||||
type: "input",
|
||||
label: "wechatAppid",
|
||||
name: "wechatAppid",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "mchid",
|
||||
name: "mchid",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "body",
|
||||
name: "body",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "notifyURL",
|
||||
name: "notifyURL",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "key",
|
||||
name: "key",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ backgroundColor: "#fff", padding: "10px" }}>
|
||||
<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={onAliFinish}
|
||||
onFinishFailed={onFinishFailed}
|
||||
formDatas={[
|
||||
{
|
||||
type: "input",
|
||||
label: "AliAppId",
|
||||
name: "appid",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "AliKey",
|
||||
name: "aliKey",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "returnUrl",
|
||||
name: "returnUrl",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "notifyURL",
|
||||
name: "notifyURL",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片名称!" }],
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</div>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("appStore")(observer(PayConfig));
|
|
@ -1,259 +0,0 @@
|
|||
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(() => {
|
||||
hwformRef.current?.setFieldsValue(appStore.item.pushHwawei);
|
||||
iosformRef.current?.setFieldsValue(appStore.item.pushIos);
|
||||
opformRef.current?.setFieldsValue(appStore.item.pushOppo);
|
||||
vivoformRef.current?.setFieldsValue(appStore.item.pushVivo);
|
||||
xmformRef.current?.setFieldsValue(appStore.item.pushXiaomi);
|
||||
}, [appStore.item, id]);
|
||||
|
||||
const onFinishFailed = () => {};
|
||||
|
||||
const iosOnFinish = (values: any) => {
|
||||
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);
|
||||
};
|
||||
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: "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"
|
||||
onClick={() => {
|
||||
hwformRef.current?.submit();
|
||||
}}
|
||||
>
|
||||
保存
|
||||
</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"
|
||||
onClick={() => {
|
||||
opformRef.current?.submit();
|
||||
}}
|
||||
>
|
||||
保存
|
||||
</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"
|
||||
onClick={() => {
|
||||
vivoformRef.current?.submit();
|
||||
}}
|
||||
>
|
||||
保存
|
||||
</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"
|
||||
onClick={() => {
|
||||
xmformRef.current?.submit();
|
||||
}}
|
||||
>
|
||||
保存
|
||||
</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,10 +0,0 @@
|
|||
import { Outlet } from "react-router";
|
||||
const AppManage = () => {
|
||||
return (
|
||||
<div className="contentBox">
|
||||
<Outlet></Outlet>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AppManage;
|
|
@ -1,166 +0,0 @@
|
|||
import { Button, Space, Modal, FormInstance } from "antd";
|
||||
import type { ColumnsType } from 'antd/es/table';
|
||||
import { CardDataType } from "@/util/model/interface";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import BTable from "@/components/b_table";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import "./index.less"
|
||||
import { useEffect, useState } from "react";
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import CardConfig from "@/service/apiConfig/card_config";
|
||||
const CardPageList = (props) => {
|
||||
const { cardStore } = props;
|
||||
const [projectConfig, setProjectConfig] = useState<any>([])
|
||||
const [id, setId] = useState<any>(null)
|
||||
const [record, setRecord] = useState<any>(null)
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const columns: ColumnsType<CardDataType> = [
|
||||
{
|
||||
title: '卡片编号',
|
||||
dataIndex: 'id',
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'name',
|
||||
},
|
||||
{
|
||||
title: '内容',
|
||||
dataIndex: 'content',
|
||||
width: 140,
|
||||
ellipsis: true,
|
||||
},
|
||||
{
|
||||
title: '作者',
|
||||
dataIndex: 'author',
|
||||
},
|
||||
{
|
||||
title: '引文',
|
||||
dataIndex: 'extract',
|
||||
},
|
||||
{
|
||||
title: '类型',
|
||||
dataIndex: 'cardType',
|
||||
render: (cardType, record) => (
|
||||
<div>
|
||||
{
|
||||
cardType === "1" ? "卡片一" : (cardType === "2" ? "卡片二" : (cardType === "3" ? "卡片三" : (cardType === "4" ? "卡片四" : '暂无')))
|
||||
}
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
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={() => {
|
||||
cardStore.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: "卡片名称",
|
||||
name: "name",
|
||||
value: "",
|
||||
rules: [{ required: true, message: '请输入卡片名称!' }]
|
||||
},
|
||||
{
|
||||
type: "textArea",
|
||||
label: "请输入卡片内容",
|
||||
name: "content",
|
||||
value: "",
|
||||
}, {
|
||||
type: "input",
|
||||
label: "请输入卡片作者",
|
||||
name: "author",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "请输入卡片引文",
|
||||
name: "extract",
|
||||
value: "",
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
label: "请选择卡片类型",
|
||||
name: "cardType",
|
||||
value: "",
|
||||
},
|
||||
]
|
||||
|
||||
const onFinish = (values: any) => {
|
||||
if (!id) {
|
||||
cardStore.add(values);
|
||||
} else {
|
||||
cardStore.putItem(id, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
cardStore.getlist(CardConfig.CardConfig.LIST)
|
||||
}, [cardStore]);
|
||||
|
||||
const onFinishFailed = () => { }
|
||||
return (
|
||||
<div className="projectContent">
|
||||
<Button className="projectContentAdd" onClick={() => {
|
||||
setProjectConfig(defaultConfig)
|
||||
setId(null)
|
||||
setIsModalOpen(true)
|
||||
}}>添加卡片</Button>
|
||||
<Modal title="卡片信息"
|
||||
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>
|
||||
<div className="editContentBox">
|
||||
<BTable columns={columns} store={cardStore} dataSource={cardStore.list} />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("cardStore")(observer(CardPageList));;
|
|
@ -1,11 +0,0 @@
|
|||
import "./index.less"
|
||||
import { Outlet } from "react-router-dom";
|
||||
const CardPage = () => {
|
||||
return (
|
||||
<div className="projectContent">
|
||||
<Outlet></Outlet>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default CardPage;
|
|
@ -1,193 +0,0 @@
|
|||
import { Button, Space, Modal, FormInstance } from "antd";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import { CardDataType } from "@/util/model/interface";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import BTable from "@/components/b_table";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import "./index.less";
|
||||
|
||||
import { useEffect, useState } from "react";
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import CardConfig from "@/service/apiConfig/card_config";
|
||||
const CharacterPageList = (props) => {
|
||||
const { characterStore } = props;
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const [id, setId] = useState<any>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const columns: ColumnsType<CardDataType> = [
|
||||
{ title: "人物卡片编号", dataIndex: "id" },
|
||||
{ title: "名称", dataIndex: "name" },
|
||||
{ title: "描述", dataIndex: "desc" },
|
||||
{
|
||||
title: "封面",
|
||||
dataIndex: "imageUrl",
|
||||
render: (any, record) => (
|
||||
<div>
|
||||
<img
|
||||
src={record.imageUrl}
|
||||
alt="avatar"
|
||||
style={{ width: "80px", height: "80px" }}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
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"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
characterStore.item = record;
|
||||
navigate("/card/editors/" + record.id + "/2");
|
||||
}}
|
||||
>
|
||||
内容编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => {
|
||||
characterStore.deleteItem(record.id);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
const edit = (record) => {
|
||||
record = {
|
||||
...record,
|
||||
imageUrl: [{ url: record.imageUrl }],
|
||||
};
|
||||
setProjectConfig(defaultConfig);
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
};
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
label: "人物名称",
|
||||
name: "name",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入人物名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "请输入人物描述",
|
||||
name: "desc",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片内容" }],
|
||||
},
|
||||
{
|
||||
type: "upload",
|
||||
label: "请上传人物封面",
|
||||
name: "imageUrl",
|
||||
value: [],
|
||||
},
|
||||
];
|
||||
|
||||
const onFinish = (values: any) => {
|
||||
|
||||
let images = values.imageUrl?.map((item) => {
|
||||
return item.response.data.url;
|
||||
});
|
||||
values = {
|
||||
...values,
|
||||
imageUrl: images.join(","),
|
||||
};
|
||||
if (!id) {
|
||||
characterStore.add(values);
|
||||
} else {
|
||||
characterStore.putItem(id, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
characterStore.getlist(CardConfig.CardConfig.LIST);
|
||||
}, [characterStore]);
|
||||
|
||||
const onFinishFailed = () => {};
|
||||
return (
|
||||
<div className="projectContent">
|
||||
<Button
|
||||
className="projectContentAdd"
|
||||
onClick={() => {
|
||||
setProjectConfig(defaultConfig);
|
||||
setId(null);
|
||||
setIsModalOpen(true);
|
||||
}}
|
||||
>
|
||||
添加人物
|
||||
</Button>
|
||||
<Modal
|
||||
title="人物信息"
|
||||
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>
|
||||
<div className="editContentBox">
|
||||
<BTable
|
||||
columns={columns}
|
||||
store={characterStore}
|
||||
dataSource={characterStore.list}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("characterStore")(observer(CharacterPageList));
|
|
@ -1,192 +0,0 @@
|
|||
import { Button, Space, Modal, FormInstance } from "antd";
|
||||
import "./index.less";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import { CardDataType } from "@/util/model/interface";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import BTable from "@/components/b_table";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import { useEffect, useState } from "react";
|
||||
import React from "react";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import CardConfig from "@/service/apiConfig/card_config";
|
||||
const CurrentEventPageList = (props) => {
|
||||
const currentEventStore = props.currentEventStore;
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const [id, setId] = useState<any>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const navigate = useNavigate();
|
||||
const columns: ColumnsType<CardDataType> = [
|
||||
{ title: "时事卡片编号", dataIndex: "id" },
|
||||
{ title: "名称", dataIndex: "title" },
|
||||
{ title: "标签", dataIndex: "tag" },
|
||||
{
|
||||
title: "封面",
|
||||
dataIndex: "imageUrl",
|
||||
render: (any, record) => (
|
||||
<div>
|
||||
<img
|
||||
src={record.imageUrl}
|
||||
alt="avatar"
|
||||
style={{ width: "80px", height: "80px" }}
|
||||
/>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
{
|
||||
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"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
currentEventStore.item = record;
|
||||
navigate("/card/editors/" + record.id + "/1");
|
||||
}}
|
||||
>
|
||||
内容编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => {
|
||||
currentEventStore.deleteItem(record.id);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</Space>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
const edit = (record) => {
|
||||
record = {
|
||||
...record,
|
||||
imageUrl: [{ url: record.imageUrl }],
|
||||
};
|
||||
setProjectConfig(defaultConfig);
|
||||
setIsModalOpen(true);
|
||||
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
};
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
label: "时事标题",
|
||||
name: "title",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入时事标题!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "请输入标签",
|
||||
name: "tag",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入卡片标签" }],
|
||||
},
|
||||
{
|
||||
type: "upload",
|
||||
label: "请上传封面图",
|
||||
name: "imageUrl",
|
||||
value: [],
|
||||
},
|
||||
];
|
||||
|
||||
const onFinish = (values: any) => {
|
||||
let images = values.imageUrl.map((item) => {
|
||||
return item.response.data.url;
|
||||
});
|
||||
values = {
|
||||
...values,
|
||||
imageUrl: images.join(","),
|
||||
};
|
||||
if (!id) {
|
||||
currentEventStore.add(values);
|
||||
} else {
|
||||
currentEventStore.putItem(id, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
|
||||
useEffect(() => {
|
||||
currentEventStore.getlist(CardConfig.CardConfig.LIST);
|
||||
}, [currentEventStore]);
|
||||
const onFinishFailed = () => {};
|
||||
return (
|
||||
<div className="projectContent">
|
||||
<Button
|
||||
className="projectContentAdd"
|
||||
onClick={() => {
|
||||
setProjectConfig(defaultConfig);
|
||||
setId(null);
|
||||
setIsModalOpen(true);
|
||||
}}
|
||||
>
|
||||
添加人物
|
||||
</Button>
|
||||
|
||||
<div className="editContentBox">
|
||||
<BTable
|
||||
columns={columns}
|
||||
store={currentEventStore}
|
||||
dataSource={currentEventStore.list}
|
||||
/>
|
||||
</div>
|
||||
<Modal
|
||||
title="人物信息"
|
||||
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>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("currentEventStore")(observer(CurrentEventPageList));
|
|
@ -1,98 +0,0 @@
|
|||
import { useEffect, useState } from "react";
|
||||
import "./index.less"
|
||||
import baseHttp from "@/service/base";
|
||||
|
||||
import { Editor } from '@tinymce/tinymce-react';
|
||||
import Button from "antd/lib/button";
|
||||
import { useNavigate, useParams } from "react-router-dom";
|
||||
import { inject, observer } from "mobx-react";
|
||||
const Editors = (props) => {
|
||||
const { characterStore, currentEventStore } = props;
|
||||
const [value, setValue] = useState<any>("");
|
||||
const [savevalue, setSaceValue] = useState<any>("");
|
||||
const { id, type } = useParams()
|
||||
const navigate = useNavigate();
|
||||
useEffect(() => {
|
||||
if (type === "1") {
|
||||
setValue(currentEventStore.item.content)
|
||||
} else {
|
||||
setValue(characterStore.item.content)
|
||||
}
|
||||
}, [characterStore.item.content, currentEventStore.item.content, type])
|
||||
const handleEditorChange = (content, editor) => {
|
||||
setSaceValue(content);
|
||||
}
|
||||
const imagesUploadHandler = async (blobInfo, progress) => {
|
||||
var data = new FormData();
|
||||
data.append('attachments', blobInfo.blob(), blobInfo.filename());
|
||||
let url = "http://81.68.81.205:1234/apis/v1/attachment";
|
||||
let res = await baseHttp.upload(url,data)
|
||||
return res.data.url
|
||||
}
|
||||
return (
|
||||
<div className="projectContent">
|
||||
<div className="editContentBox">
|
||||
<Button className="editBtn" onClick={() => {
|
||||
if (type === "1") {
|
||||
let item = currentEventStore.item
|
||||
item.content = savevalue;
|
||||
currentEventStore.putItem(id, item);
|
||||
} else {
|
||||
let item = characterStore.item
|
||||
item.content = savevalue;
|
||||
characterStore.putItem(id, item);
|
||||
}
|
||||
navigate(-1)
|
||||
}}>保存</Button>
|
||||
<Editor
|
||||
initialValue={value}
|
||||
apiKey="hq72bjfug6s56a5qxa2oxpbqsxc58nv4v7nfruyd5ndpgu72"
|
||||
init={{
|
||||
menubar: false,
|
||||
statusbar: false, // 隐藏底部状态栏
|
||||
branding: false, // 隐藏tinymce右下角水印
|
||||
resize: false, //右下角调整编辑器大小,false关闭,true开启只改变高度,'both' 宽高都能改变
|
||||
plugins: [
|
||||
'autolink',
|
||||
'link',
|
||||
'image ',
|
||||
'lists',
|
||||
'charmap',
|
||||
'preview',
|
||||
'anchor',
|
||||
'pagebreak',
|
||||
'visualblocks',
|
||||
'visualchars',
|
||||
'fullscreen',
|
||||
'insertdatetime',
|
||||
'nonbreaking',
|
||||
'directionality',
|
||||
'template',
|
||||
"searchreplace",
|
||||
"hr",
|
||||
"advlist",
|
||||
"textpattern",
|
||||
"help",
|
||||
"autosave",
|
||||
"bdmap",
|
||||
"autoresize",
|
||||
"formatpainter",
|
||||
"paragraph"
|
||||
],
|
||||
toolbar: [
|
||||
' blocks | paragraph |styleselect| blockquote | hr bold underline italic alignleft aligncenter alignright | forecolor backcolor | fontsize lineheight | bullist numlist outdent indent | link image | undo redo | fullscreen | bdmap',
|
||||
],
|
||||
font_size_formats: '8px 10px 12px 14px 18px 24px 36px',
|
||||
line_height_formats: '1 1.2 1.4 1.6 2',
|
||||
height: 600,
|
||||
min_height: 600,
|
||||
images_upload_handler: imagesUploadHandler
|
||||
}}
|
||||
onEditorChange={handleEditorChange}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("characterStore","currentEventStore")(observer(Editors));
|
|
@ -1,22 +0,0 @@
|
|||
.projectContent {
|
||||
box-sizing: border-box;
|
||||
margin: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
|
||||
.projectContentAdd {
|
||||
margin-left: 10px;
|
||||
margin-top: 10px;
|
||||
margin-bottom: 10px;
|
||||
width: 90px;
|
||||
}
|
||||
.editContentBox {
|
||||
background-color: #fff;
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
.editBtn {
|
||||
margin: 10px;
|
||||
}
|
||||
}
|
|
@ -1,81 +0,0 @@
|
|||
import { Button, Modal, Popconfirm } from "antd";
|
||||
import type { ColumnsType } from "antd/es/table";
|
||||
import { CardDataType } from "@/util/model/interface";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import BTable from "@/components/b_table";
|
||||
import "./index.less";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useParams } from "react-router-dom";
|
||||
const Componsition = (props) => {
|
||||
const { componSitionStore } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState(false);
|
||||
const { id } = useParams();
|
||||
const columns: ColumnsType<CardDataType> = [
|
||||
{
|
||||
title: "作文编号",
|
||||
dataIndex: "compositionId",
|
||||
},
|
||||
{
|
||||
title: "作文名称",
|
||||
dataIndex: "title",
|
||||
},
|
||||
{
|
||||
title: "作者",
|
||||
dataIndex: "username",
|
||||
},
|
||||
{
|
||||
title: "点赞数",
|
||||
dataIndex: "count",
|
||||
},
|
||||
{
|
||||
title: "内容",
|
||||
dataIndex: "content",
|
||||
width: 350,
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "compositionId",
|
||||
ellipsis: {
|
||||
showTitle: false,
|
||||
},
|
||||
render: (ids, record) => (
|
||||
<div>
|
||||
<Popconfirm
|
||||
title="是否确认删除?"
|
||||
okText="Yes"
|
||||
cancelText="No"
|
||||
onConfirm={() => {
|
||||
componSitionStore.delete(ids);
|
||||
componSitionStore.list(id);
|
||||
}}
|
||||
>
|
||||
<Button type="dashed" danger size="small">
|
||||
删除
|
||||
</Button>
|
||||
</Popconfirm>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
|
||||
useEffect(() => {
|
||||
componSitionStore.list(id);
|
||||
}, [componSitionStore, id]);
|
||||
return (
|
||||
<div className="projectContent">
|
||||
<Modal
|
||||
title="作文内容"
|
||||
width={800}
|
||||
open={isModalOpen}
|
||||
onCancel={() => setIsModalOpen(false)}
|
||||
></Modal>
|
||||
<BTable
|
||||
columns={columns}
|
||||
store={componSitionStore}
|
||||
dataSource={componSitionStore.datalist}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("componSitionStore")(observer(Componsition));
|
|
@ -1,12 +0,0 @@
|
|||
.projectContent{
|
||||
box-sizing: border-box;
|
||||
margin: 10px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 100%;
|
||||
overflow: auto;
|
||||
.projectContentAdd{
|
||||
margin-left:10px ;
|
||||
margin-top:10px ;
|
||||
}
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
import BTable from "@/components/b_table";
|
||||
import { Button, Space } from "antd";
|
||||
import { ColumnsType } from "antd/lib/table";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import { useEffect } from "react";
|
||||
|
||||
const DymiticState = (props: Store) => {
|
||||
const { dynamicStore } = props;
|
||||
const columns: ColumnsType = [
|
||||
{ title: "用户昵称", dataIndex: "desc" },
|
||||
{ title: "动态内容", dataIndex: "desc" },
|
||||
{ title: "动态图片", dataIndex: "desc" },
|
||||
{ title: "发布地址", dataIndex: "address" },
|
||||
{ title: "点赞数", dataIndex: "likeNum" },
|
||||
{ title: "话题", dataIndex: "topicName" },
|
||||
{ title: "操作", dataIndex: "id", render: (id: any) => render(id) },
|
||||
];
|
||||
const render = (id) => (
|
||||
<div >
|
||||
<Space align="center">
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={()=>{
|
||||
dynamicStore.deleteItem(id)
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
);
|
||||
useEffect(() => {
|
||||
dynamicStore.getlist();
|
||||
}, [dynamicStore]);
|
||||
return (
|
||||
<div style={{ margin: 10 }} className="projectContent">
|
||||
<BTable
|
||||
loading={dynamicStore.listStatus}
|
||||
columns={columns}
|
||||
store={dynamicStore}
|
||||
dataSource={dynamicStore.list}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default inject("dynamicStore")(observer(DymiticState));
|
|
@ -3,9 +3,7 @@ import "./home.less"
|
|||
const Home = observer(() => {
|
||||
return (
|
||||
<div className="contents_center">
|
||||
<div className="centerbox">
|
||||
<p>测试</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
import React, { useEffect } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
|
||||
const Logs = (props: Store) => {
|
||||
const { systemStore } = props;
|
||||
useEffect(() => {}, [systemStore]);
|
||||
|
||||
return <div style={{ margin: 10 }}>日志管理</div>;
|
||||
};
|
||||
|
||||
export default inject("systemStore")(observer(Logs));
|
|
@ -1,191 +0,0 @@
|
|||
import BTable from "@/components/b_table";
|
||||
import { Button, FormInstance, Modal, Space } from "antd";
|
||||
import { ColumnsType } from "antd/lib/table";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import { useEffect, useState } from "react";
|
||||
import merchantsConfig from "@/service/apiConfig/merchants_config";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import React from "react";
|
||||
import EditorComponent from "@/components/edittor";
|
||||
|
||||
const Merchant = (props: Store) => {
|
||||
const { merchantStore } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [productDesc, setProductDesc] = useState<any>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const [merchantId, setId] = useState<Number | null>(null);
|
||||
const columns: ColumnsType = [
|
||||
{ title: "商家名称", dataIndex: "merchantsName" },
|
||||
{ title: "商家地址", dataIndex: "address" },
|
||||
{ title: "审核状态", dataIndex: "examineStatus" },
|
||||
{ title: "运营范围", dataIndex: "radius" },
|
||||
{ title: "风险等级", dataIndex: "riskLevel" },
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "id",
|
||||
ellipsis: { showTitle: false },
|
||||
render: (any, record: any) => (
|
||||
<div>
|
||||
<Space align="center">
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
edit(record);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => {
|
||||
merchantStore.deleteItem(record.id);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
const edit = (record) => {
|
||||
const myrecord = {
|
||||
...record,
|
||||
licenseImgId: record.licenseImgList,
|
||||
};
|
||||
setProjectConfig(defaultConfig);
|
||||
setIsModalOpen(true);
|
||||
setRecord(myrecord);
|
||||
formRef.current?.setFieldsValue(myrecord);
|
||||
setId(myrecord.id);
|
||||
setProductDesc(myrecord.desc);
|
||||
};
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
label: "商家名称",
|
||||
name: "merchantsName",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入商家名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "商家电话",
|
||||
name: "merchantsPhone",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入商家电话" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "商家实际办公地点",
|
||||
name: "address",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入商家实际办公地点" }],
|
||||
},
|
||||
{
|
||||
type: "inpput",
|
||||
label: "运营范围",
|
||||
name: "radius",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入运营范围" }],
|
||||
},
|
||||
{
|
||||
type: "upload",
|
||||
label: "营业执照",
|
||||
name: "licenseImgList",
|
||||
value: [],
|
||||
rules: [{ required: true, message: "请上传营业执照" }],
|
||||
},
|
||||
];
|
||||
const onFinish = (values: any) => {
|
||||
let ids = values.licenseImgList.map((item) => {
|
||||
return item.id;
|
||||
});
|
||||
console.log(values);
|
||||
values = {
|
||||
...values,
|
||||
licenseImgId: ids.join(","),
|
||||
desc: productDesc,
|
||||
};
|
||||
if (!merchantId) {
|
||||
merchantStore.add(values);
|
||||
} else {
|
||||
merchantStore.putItem(merchantId, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
merchantStore.getlist(merchantsConfig.LIST);
|
||||
}, [merchantStore]);
|
||||
const onFinishFailed = () => {};
|
||||
return (
|
||||
<div style={{ margin: 10 }}>
|
||||
<Button
|
||||
style={{ marginBottom: 10 }}
|
||||
type="default"
|
||||
onClick={() => {
|
||||
setProjectConfig(defaultConfig);
|
||||
setId(null);
|
||||
setIsModalOpen(true);
|
||||
}}
|
||||
>
|
||||
添加商户
|
||||
</Button>
|
||||
<BTable
|
||||
columns={columns}
|
||||
store={merchantStore}
|
||||
dataSource={merchantStore.list}
|
||||
/>
|
||||
<Modal
|
||||
title={!merchantId ? "添加商户" : "编辑商户"}
|
||||
width={1200}
|
||||
open={isModalOpen}
|
||||
afterClose={() => formRef.current?.resetFields()}
|
||||
onOk={() => formRef.current?.submit()}
|
||||
onCancel={() => {
|
||||
setId(null);
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
>
|
||||
<SimpleForm
|
||||
formRef={formRef}
|
||||
createCallback={() => {
|
||||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formName="card_basic"
|
||||
colProps={3}
|
||||
subBtnName="提交"
|
||||
formDatas={projectConfig}
|
||||
onFinish={onFinish}
|
||||
initialValues={true}
|
||||
onFinishFailed={onFinishFailed}
|
||||
/>
|
||||
<Space align="start">
|
||||
<span
|
||||
style={{
|
||||
width: "130px",
|
||||
marginRight: "5px",
|
||||
display: "inline-block",
|
||||
textAlign: "end",
|
||||
}}
|
||||
>
|
||||
图文介绍:
|
||||
</span>
|
||||
<EditorComponent
|
||||
data={productDesc}
|
||||
updateChange={(v) => {
|
||||
setProductDesc(v);
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default inject("merchantStore")(observer(Merchant));
|
|
@ -1,141 +0,0 @@
|
|||
import BTable from "@/components/b_table";
|
||||
import { Button, FormInstance, Modal, Space } from "antd";
|
||||
import { ColumnsType } from "antd/lib/table";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import { useEffect, useState } from "react";
|
||||
import merchantsConfig from "@/service/apiConfig/merchants_config";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import React from "react";
|
||||
|
||||
const ProductType = (props: Store) => {
|
||||
const { projectTypeStore } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const [merchantId, setId] = useState<Number | null>(null);
|
||||
const columns: ColumnsType = [
|
||||
{ title: "商品类型名称", dataIndex: "productTypeName" },
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "id",
|
||||
ellipsis: { showTitle: false },
|
||||
render: (any, record: any) => (
|
||||
<div>
|
||||
<Space align="center">
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
edit(record);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => {
|
||||
projectTypeStore.deleteItem(record.id);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
const edit = (record) => {
|
||||
record = {
|
||||
...record,
|
||||
imageUrl: [{ url: record.imageUrl }],
|
||||
};
|
||||
setProjectConfig(defaultConfig);
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
};
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
label: "商品类型名称",
|
||||
name: "productTypeName",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入商家名称!" }],
|
||||
},
|
||||
// {
|
||||
// type: "input",
|
||||
// label: "商家电话",
|
||||
// name: "merchantsPhone",
|
||||
// value: "",
|
||||
// rules: [{ required: true, message: "请输入商家电话" }],
|
||||
// },
|
||||
];
|
||||
const onFinish = (values: any) => {
|
||||
values = {
|
||||
...values,
|
||||
};
|
||||
console.log(merchantId);
|
||||
|
||||
if (!merchantId) {
|
||||
projectTypeStore.add(values);
|
||||
} else {
|
||||
projectTypeStore.putItem(merchantId, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
projectTypeStore.getlist(merchantsConfig.LIST);
|
||||
}, [projectTypeStore]);
|
||||
const onFinishFailed = () => {};
|
||||
return (
|
||||
<div style={{ margin: 10 }}>
|
||||
<Button
|
||||
style={{ marginBottom: 10 }}
|
||||
type="default"
|
||||
onClick={() => {
|
||||
setProjectConfig(defaultConfig);
|
||||
setId(null);
|
||||
setIsModalOpen(true);
|
||||
}}
|
||||
>
|
||||
添加商品类型
|
||||
</Button>
|
||||
<BTable
|
||||
columns={columns}
|
||||
store={projectTypeStore}
|
||||
dataSource={projectTypeStore.list}
|
||||
/>
|
||||
<Modal
|
||||
title={!merchantId ? "添加商品类型" : "编辑商品类型"}
|
||||
width={800}
|
||||
open={isModalOpen}
|
||||
afterClose={() => formRef.current?.resetFields()}
|
||||
onOk={() => formRef.current?.submit()}
|
||||
onCancel={() => {
|
||||
setId(null);
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
>
|
||||
<SimpleForm
|
||||
formRef={formRef}
|
||||
createCallback={() => {
|
||||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formName="card_basic"
|
||||
colProps={4}
|
||||
subBtnName="提交"
|
||||
formDatas={projectConfig}
|
||||
onFinish={onFinish}
|
||||
initialValues={true}
|
||||
onFinishFailed={onFinishFailed}
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default inject("projectTypeStore")(observer(ProductType));
|
|
@ -1,140 +0,0 @@
|
|||
|
||||
import BTable from "@/components/b_table";
|
||||
import { Button, FormInstance, Modal, Space } from "antd";
|
||||
import { ColumnsType } from "antd/lib/table";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import { useEffect, useState } from "react";
|
||||
import merchantsConfig from "@/service/apiConfig/merchants_config";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import React from "react";
|
||||
|
||||
const ProductUnit = (props: Store) => {
|
||||
const { productUnitStore } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const [merchantId, setId] = useState<Number | null>(null);
|
||||
const columns: ColumnsType = [
|
||||
{ title: "单位名称", dataIndex: "productUnitName" },
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "id",
|
||||
ellipsis: { showTitle: false },
|
||||
render: (any, record: any) => (
|
||||
<div>
|
||||
<Space align="center">
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
edit(record);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => {
|
||||
productUnitStore.deleteItem(record.id);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
const edit = (record) => {
|
||||
record = {
|
||||
...record,
|
||||
imageUrl: [{ url: record.imageUrl }],
|
||||
};
|
||||
setProjectConfig(defaultConfig);
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
};
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
label: "单位名称",
|
||||
name: "productUnitName",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入单位名称!" }],
|
||||
},
|
||||
// {
|
||||
// type: "input",
|
||||
// label: "商家电话",
|
||||
// name: "merchantsPhone",
|
||||
// value: "",
|
||||
// rules: [{ required: true, message: "请输入商家电话" }],
|
||||
// },
|
||||
];
|
||||
const onFinish = (values: any) => {
|
||||
values = {
|
||||
...values,
|
||||
};
|
||||
if (!merchantId) {
|
||||
productUnitStore.add(values);
|
||||
} else {
|
||||
productUnitStore.putItem(merchantId, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
productUnitStore.getlist(merchantsConfig.LIST);
|
||||
}, [productUnitStore]);
|
||||
const onFinishFailed = () => {};
|
||||
return (
|
||||
<div style={{ margin: 10 }}>
|
||||
<Button
|
||||
style={{ marginBottom: 10 }}
|
||||
type="default"
|
||||
onClick={() => {
|
||||
setProjectConfig(defaultConfig);
|
||||
setId(null);
|
||||
setIsModalOpen(true);
|
||||
}}
|
||||
>
|
||||
添加商品类型
|
||||
</Button>
|
||||
<BTable
|
||||
columns={columns}
|
||||
store={productUnitStore}
|
||||
dataSource={productUnitStore.list}
|
||||
/>
|
||||
<Modal
|
||||
title={!merchantId ? "添加商品类型" : "编辑商品类型"}
|
||||
width={800}
|
||||
open={isModalOpen}
|
||||
afterClose={() => formRef.current?.resetFields()}
|
||||
onOk={() => formRef.current?.submit()}
|
||||
onCancel={() => {
|
||||
setId(null);
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
>
|
||||
<SimpleForm
|
||||
formRef={formRef}
|
||||
createCallback={() => {
|
||||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formName="card_basic"
|
||||
colProps={4}
|
||||
subBtnName="提交"
|
||||
formDatas={projectConfig}
|
||||
onFinish={onFinish}
|
||||
initialValues={true}
|
||||
onFinishFailed={onFinishFailed}
|
||||
/>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default inject("productUnitStore")(observer(ProductUnit));
|
|
@ -1,12 +0,0 @@
|
|||
import React, { useEffect } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
|
||||
const Permission = (props: Store) => {
|
||||
const { systemStore } = props;
|
||||
useEffect(() => {}, [systemStore]);
|
||||
|
||||
return <div style={{ margin: 10 }}>权限管理</div>;
|
||||
};
|
||||
|
||||
export default inject("systemStore")(observer(Permission));
|
|
@ -1,6 +0,0 @@
|
|||
.projectContent{
|
||||
.projectContentAdd{
|
||||
margin-left:10px ;
|
||||
margin-top:10px ;
|
||||
}
|
||||
}
|
|
@ -1,189 +0,0 @@
|
|||
import BTable from "@/components/b_table";
|
||||
import { Button, FormInstance, Modal, Space } from "antd";
|
||||
import { ColumnsType } from "antd/lib/table";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import { useEffect, useState } from "react";
|
||||
import merchantsConfig from "@/service/apiConfig/merchants_config";
|
||||
import SimpleForm from "@/components/form/simple_form";
|
||||
import React from "react";
|
||||
import EditorComponent from "@/components/edittor";
|
||||
import projectTypeConfig from "@/service/apiConfig/project_type_config";
|
||||
|
||||
const Project = (props: Store) => {
|
||||
const { projectStore } = props;
|
||||
const [isModalOpen, setIsModalOpen] = useState<boolean>(false);
|
||||
const [projectConfig, setProjectConfig] = useState<any>([]);
|
||||
const formRef = React.useRef<FormInstance>(null);
|
||||
const [record, setRecord] = useState<any>(null);
|
||||
const [productDesc, setProductDesc] = useState<any>(null);
|
||||
const [merchantId, setId] = useState<Number | null>(null);
|
||||
const columns: ColumnsType = [
|
||||
{ title: "名称", dataIndex: "productName" },
|
||||
{ title: "简介", dataIndex: "productIntro" },
|
||||
{ title: "所属类型", dataIndex: "productTypeName" },
|
||||
{ title: "价格", dataIndex: "productPrice" },
|
||||
{ title: "库存", dataIndex: "productInventory" },
|
||||
{
|
||||
title: "操作",
|
||||
dataIndex: "id",
|
||||
ellipsis: { showTitle: false },
|
||||
render: (any, record: any) => (
|
||||
<div>
|
||||
<Space align="center">
|
||||
<Button
|
||||
type="dashed"
|
||||
size="small"
|
||||
onClick={() => {
|
||||
edit(record);
|
||||
}}
|
||||
>
|
||||
编辑
|
||||
</Button>
|
||||
<Button
|
||||
type="dashed"
|
||||
danger
|
||||
size="small"
|
||||
onClick={() => {
|
||||
projectStore.deleteItem(record.id);
|
||||
}}
|
||||
>
|
||||
删除
|
||||
</Button>
|
||||
</Space>
|
||||
</div>
|
||||
),
|
||||
},
|
||||
];
|
||||
const edit = (record) => {
|
||||
record = {
|
||||
...record,
|
||||
imageUrl: [{ url: record.imageUrl }],
|
||||
};
|
||||
setProjectConfig(defaultConfig);
|
||||
setIsModalOpen(true);
|
||||
formRef.current?.setFieldsValue(record);
|
||||
setRecord(record);
|
||||
setId(record.id);
|
||||
setProductDesc(record.productDesc);
|
||||
};
|
||||
const defaultConfig = [
|
||||
{
|
||||
type: "input",
|
||||
label: "名称",
|
||||
name: "productName",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入名称!" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "简介",
|
||||
name: "productIntro",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入简介" }],
|
||||
},
|
||||
{
|
||||
type: "input",
|
||||
label: "价格",
|
||||
name: "productPrice",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入价格" }],
|
||||
},
|
||||
{
|
||||
type: "select",
|
||||
label: "所属类型",
|
||||
name: "productTypeId",
|
||||
value: "",
|
||||
selectUrl: projectTypeConfig.LIST,
|
||||
rules: [{ required: true, message: "请选择类型" }],
|
||||
},
|
||||
{
|
||||
type: "inpput",
|
||||
label: "库存",
|
||||
name: "productInventory",
|
||||
value: "",
|
||||
rules: [{ required: true, message: "请输入库存" }],
|
||||
},
|
||||
];
|
||||
const onFinish = (values: any) => {
|
||||
// let images = values.imageUrl.map((item) => {
|
||||
// return item.response.data.url;
|
||||
// });
|
||||
|
||||
values = {
|
||||
...values,
|
||||
headImg: "cascas", //images.join(","),
|
||||
productDesc: productDesc,
|
||||
};
|
||||
if (!merchantId) {
|
||||
projectStore.add(values);
|
||||
} else {
|
||||
projectStore.putItem(merchantId, values);
|
||||
}
|
||||
setIsModalOpen(false);
|
||||
};
|
||||
useEffect(() => {
|
||||
projectStore.getlist(merchantsConfig.LIST);
|
||||
}, [projectStore]);
|
||||
const onFinishFailed = () => {};
|
||||
const addAction = () => {
|
||||
setProjectConfig(defaultConfig);
|
||||
setId(null);
|
||||
setIsModalOpen(true);
|
||||
};
|
||||
return (
|
||||
<div style={{ margin: 10 }}>
|
||||
<Button style={{ marginBottom: 10 }} type="default" onClick={addAction}>
|
||||
添加商品
|
||||
</Button>
|
||||
<BTable
|
||||
columns={columns}
|
||||
store={projectStore}
|
||||
dataSource={projectStore.list}
|
||||
/>
|
||||
<Modal
|
||||
title={!merchantId ? "添加商品" : "编辑商品"}
|
||||
width={1200}
|
||||
open={isModalOpen}
|
||||
afterClose={() => formRef.current?.resetFields()}
|
||||
onOk={() => formRef.current?.submit()}
|
||||
onCancel={() => {
|
||||
setId(null);
|
||||
setIsModalOpen(false);
|
||||
}}
|
||||
>
|
||||
<SimpleForm
|
||||
formRef={formRef}
|
||||
createCallback={() => {
|
||||
formRef.current?.setFieldsValue(record);
|
||||
}}
|
||||
formName="card_basic"
|
||||
colProps={3}
|
||||
subBtnName="提交"
|
||||
formDatas={projectConfig}
|
||||
onFinish={onFinish}
|
||||
initialValues={true}
|
||||
onFinishFailed={onFinishFailed}
|
||||
/>
|
||||
<Space align="start">
|
||||
<span
|
||||
style={{
|
||||
width: "130px",
|
||||
display: "inline-block",
|
||||
textAlign: "end",
|
||||
}}
|
||||
>
|
||||
图文介绍
|
||||
</span>
|
||||
<EditorComponent
|
||||
data={productDesc}
|
||||
updateChange={(v) => {
|
||||
setProductDesc(v);
|
||||
}}
|
||||
/>
|
||||
</Space>
|
||||
</Modal>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
export default inject("projectStore")(observer(Project));
|
|
@ -1,12 +0,0 @@
|
|||
import React, { useEffect } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
|
||||
const Rule = (props: Store) => {
|
||||
const { systemStore } = props;
|
||||
useEffect(() => {}, [systemStore]);
|
||||
|
||||
return <div style={{ margin: 10 }}>角色管理</div>;
|
||||
};
|
||||
|
||||
export default inject("systemStore")(observer(Rule));
|
|
@ -1,32 +0,0 @@
|
|||
import React, { useEffect, useState } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import AliUpload from "@/components/ali_upload";
|
||||
import { UploadFile } from "antd";
|
||||
|
||||
const Banner = (props: Store) => {
|
||||
const { systemStore } = props;
|
||||
const [fileList, setFileList] = useState<UploadFile[]>([]);
|
||||
useEffect(() => {
|
||||
systemStore.getBanner().then((res) => {
|
||||
res?.data.list.forEach((element) => {
|
||||
element.url = element.bannerUrl;
|
||||
element.name = element.bannerName;
|
||||
});
|
||||
setFileList(res?.data.list);
|
||||
});
|
||||
}, [systemStore]);
|
||||
|
||||
return (
|
||||
<div style={{ margin: 10 }}>
|
||||
<AliUpload
|
||||
imgList={fileList}
|
||||
onChnage={(res) => {
|
||||
systemStore.addBanner(res);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("systemStore")(observer(Banner));
|
|
@ -1,36 +0,0 @@
|
|||
import React, { useEffect, useState } from "react";
|
||||
import { inject, observer } from "mobx-react";
|
||||
import { Store } from "antd/lib/form/interface";
|
||||
import AliUpload from "@/components/ali_upload";
|
||||
import { UploadFile } from "antd";
|
||||
|
||||
const Logs = (props: Store) => {
|
||||
const { systemStore } = props;
|
||||
const [fileList, setFileList] = useState<UploadFile[]>([]);
|
||||
useEffect(() => {
|
||||
systemStore.getBanner().then((res) => {
|
||||
res?.data.list.forEach((element) => {
|
||||
element.url = element.bannerUrl;
|
||||
element.name = element.bannerName;
|
||||
});
|
||||
setFileList(res?.data.list);
|
||||
});
|
||||
}, [systemStore]);
|
||||
|
||||
return (
|
||||
<div style={{ margin: 10 }}>
|
||||
<AliUpload
|
||||
imgList={fileList}
|
||||
onChnage={(res) => {
|
||||
systemStore.addImage({ url: res.url }).then((resp) => {
|
||||
res.systemImageId = resp.data.id;
|
||||
fileList.push(res);
|
||||
setFileList(fileList);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default inject("systemStore")(observer(Logs));
|
|
@ -3,32 +3,12 @@ import App from "@/App";
|
|||
import ErrorPage from "@/pages/errorPage";
|
||||
import Login from "@/pages/login/login";
|
||||
import { homeRouter } from "@/router/routers/home_router"
|
||||
import { cardRouter } from "@/router/routers/card_router"
|
||||
import { userRouter } from "@/router/routers/user_router"
|
||||
import { projectRouter } from "@/router/routers/project_router"
|
||||
import { systemRouter } from "@/router/routers/system_router";
|
||||
import { merchantRouter } from "@/router/routers/merchant-router";
|
||||
import { activeRouter } from "@/router/routers/active_router";
|
||||
import { dymiticStateRouter } from "@/router/routers/dymitic_state_router";
|
||||
import { rbacRouter } from "./routers/rbac_router";
|
||||
import { taskRouter } from "./routers/task";
|
||||
import { appRouter } from "./routers/app";
|
||||
const routers = createHashRouter([
|
||||
{
|
||||
path: "/",
|
||||
element: <App />,
|
||||
children: [
|
||||
...homeRouter,
|
||||
...cardRouter,
|
||||
...userRouter,
|
||||
...projectRouter,
|
||||
...systemRouter,
|
||||
...merchantRouter,
|
||||
...activeRouter,
|
||||
...dymiticStateRouter,
|
||||
...rbacRouter,
|
||||
...taskRouter,
|
||||
...appRouter,
|
||||
]
|
||||
},
|
||||
{
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
import { Suspense, lazy } from "react";
|
||||
const Active = lazy(() => import("@/pages/active"));
|
||||
const ActiveType = lazy(() => import("@/pages/activeType"));
|
||||
export const activeRouter = [
|
||||
{
|
||||
path: "/active-list",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<Active />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "/active-type-list",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<ActiveType />,
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
];
|
|
@ -1,28 +0,0 @@
|
|||
import { Suspense, lazy } from "react";
|
||||
const AppManageList = lazy(() => import("@/pages/app/app-list"));
|
||||
const AppManageConfig = lazy(() => import("@/pages/app/app-config"));
|
||||
export const appRouter = [
|
||||
{
|
||||
path: "/app",
|
||||
children: [
|
||||
{
|
||||
path: "/app/list",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<AppManageList />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "/app/config/:id",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<AppManageConfig />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
|
@ -1,52 +0,0 @@
|
|||
// import Editors from "@/pages/card/editor";
|
||||
import { Suspense, lazy } from "react";
|
||||
|
||||
const CardPageList = lazy(() => import("@/pages/card/card-list"))
|
||||
const CurrentEventPageList = lazy(() => import("@/pages/card/currentEvent"))
|
||||
const CharacterPageList = lazy(() => import("@/pages/card/character"))
|
||||
const Componsition = lazy(() => import("@/pages/componsition/componsition"))
|
||||
const Editors = lazy(() => import("@/pages/card/editor"))
|
||||
|
||||
export const cardRouter = [
|
||||
{
|
||||
path: "/card",
|
||||
children: [
|
||||
{
|
||||
path: "/card/list",
|
||||
index: true,
|
||||
element: <Suspense>
|
||||
<CardPageList />
|
||||
</Suspense>
|
||||
},
|
||||
{
|
||||
path: "/card/currentEvent",
|
||||
index: true,
|
||||
element: <Suspense>
|
||||
<CurrentEventPageList />
|
||||
</Suspense>
|
||||
|
||||
},
|
||||
{
|
||||
path: "/card/character",
|
||||
index: true,
|
||||
element: <Suspense>
|
||||
<CharacterPageList />
|
||||
</Suspense>
|
||||
},
|
||||
{
|
||||
path: "/card/componsition/:id",
|
||||
index: true,
|
||||
element: <Suspense>
|
||||
<Componsition />
|
||||
</Suspense>
|
||||
},
|
||||
{
|
||||
path: "/card/editors/:id/:type",
|
||||
index: true,
|
||||
element: <Suspense>
|
||||
<Editors />
|
||||
</Suspense>
|
||||
},
|
||||
]
|
||||
},
|
||||
];
|
|
@ -1,13 +0,0 @@
|
|||
import { Suspense, lazy } from "react";
|
||||
const DymiticState = lazy(() => import("@/pages/dymiticState"));
|
||||
export const dymiticStateRouter = [
|
||||
{
|
||||
path: "/dynamic-list",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<DymiticState />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
];
|
|
@ -4,7 +4,8 @@ export const homeRouter = [
|
|||
{
|
||||
path: "/",
|
||||
index: true,
|
||||
element: <Navigate to="/dashbord" replace />
|
||||
element: <Home />
|
||||
// element: <Navigate to="/dashbord" replace />
|
||||
},
|
||||
{
|
||||
path: "/dashbord",
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
import { Suspense, lazy } from "react";
|
||||
const Merchant = lazy(() => import("@/pages/merchants"));
|
||||
const ProductType = lazy(() => import("@/pages/merchants/productType"));
|
||||
const ProductUnit = lazy(() => import("@/pages/merchants/productUnit"));
|
||||
const Project = lazy(() => import("@/pages/project"));
|
||||
|
||||
export const merchantRouter = [
|
||||
{
|
||||
path: "/merchant",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<Merchant />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "/project",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<Project />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "/productType",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<ProductType />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
{
|
||||
path: "/productUnit",
|
||||
index: true,
|
||||
element: (
|
||||
<Suspense>
|
||||
<ProductUnit />
|
||||
</Suspense>
|
||||
),
|
||||
},
|
||||
];
|
|
@ -1,8 +0,0 @@
|
|||
import Project from "@/pages/project/index";
|
||||
export const projectRouter = [
|
||||
{
|
||||
path: "/project",
|
||||
index: true,
|
||||
element: <Project />
|
||||
},
|
||||
];
|
|
@ -1,14 +0,0 @@
|
|||
import Permission from "@/pages/permission";
|
||||
import Rule from "@/pages/rule";
|
||||
export const rbacRouter = [
|
||||
{
|
||||
path: "/rule",
|
||||
index: true,
|
||||
element: <Rule />
|
||||
},
|
||||
{
|
||||
path: "/permission",
|
||||
index: true,
|
||||
element: <Permission />
|
||||
},
|
||||
];
|
|
@ -1,16 +0,0 @@
|
|||
import Logs from "@/pages/logs";
|
||||
import Banner from "@/pages/system/banner";
|
||||
|
||||
export const systemRouter = [
|
||||
{
|
||||
path: "/banner",
|
||||
index: true,
|
||||
element: <Banner />
|
||||
},
|
||||
{
|
||||
path: "/logs",
|
||||
index: true,
|
||||
element: <Logs />
|
||||
},
|
||||
];
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
import Active from "@/pages/active";
|
||||
import ActiveType from "@/pages/activeType";
|
||||
export const taskRouter = [
|
||||
{
|
||||
path: "/task-list",
|
||||
index: true,
|
||||
element: <Active />
|
||||
},
|
||||
{
|
||||
path: "/task-type-list",
|
||||
index: true,
|
||||
element: <ActiveType />
|
||||
},
|
||||
];
|
|
@ -1,8 +0,0 @@
|
|||
import User from "@/pages/user/user";
|
||||
export const userRouter = [
|
||||
{
|
||||
path: "/user",
|
||||
index: true,
|
||||
element: <User />
|
||||
},
|
||||
];
|
Loading…
Reference in New Issue