wechat login

This commit is contained in:
wang_yp 2024-05-22 14:04:13 +08:00
parent dc37129ad3
commit 27cfbbd201
4 changed files with 41 additions and 52 deletions

View File

@ -1,28 +1,29 @@
import { Form, Select } from "antd"; import { Form, Select } from "antd";
import { FormDatas } from "./interface"; import { FormDatas } from "./interface";
import { useEffect, useState } from "react"; import { useState } from "react";
import baseHttp from "@/service/base";
const { Option } = Select;
export const FormSelect = (v: FormDatas) => { export const FormSelect = (v: FormDatas) => {
const [list, setList] = useState([]); const [list] = useState([
useEffect(() => { {
baseHttp value: 1,
.get(`${v.selectUrl}/?pageSize=100&pageNum=1` ?? "", "") label: "卡片一",
.then((res) => { },
setList(res.data.list ?? []); {
}); value: 2,
}, [v.selectUrl]); label: "卡片二",
},
{
value: 3,
label: "卡片三",
},
{
value: 4,
label: "卡片四",
},
]);
return ( return (
<Form.Item key={v.label} label={v.label} name={v.name} rules={v.rules}> <Form.Item key={v.label} label={v.label} name={v.name} rules={v.rules}>
<Select placeholder=""> <Select placeholder="" options={list} value={v.value} />
{list?.map((v: any) => {
return (
<Option key={v.id} value={v.id}>
{v.productTypeName}
</Option>
);
})}
</Select>
</Form.Item> </Form.Item>
); );
}; };

View File

@ -1,4 +1,4 @@
import { Checkbox, DatePicker, Form, Input, Radio } from "antd"; import { Checkbox, DatePicker, Form, Input, Radio, Switch } from "antd";
import { useEffect } from "react"; import { useEffect } from "react";
import { SimpleFormData } from "./interface"; import { SimpleFormData } from "./interface";
import { FormSelect } from "./select"; import { FormSelect } from "./select";
@ -6,7 +6,6 @@ import AliUpload from "../aliUpload";
const { TextArea } = Input; const { TextArea } = Input;
const SimpleForm = (props: SimpleFormData) => { const SimpleForm = (props: SimpleFormData) => {
const [form] = Form.useForm(); const [form] = Form.useForm();
const { RangePicker } = DatePicker;
const onFinish = (values: any) => { const onFinish = (values: any) => {
props.onFinish(values); props.onFinish(values);
}; };
@ -117,6 +116,17 @@ const SimpleForm = (props: SimpleFormData) => {
</Radio.Group> </Radio.Group>
</Form.Item> </Form.Item>
); );
case "switch":
return (
<Form.Item
key={v.label}
label={v.label}
name={v.name}
rules={v.rules}
>
<Switch/>
</Form.Item>
);
case "Date": case "Date":
return ( return (
<Form.Item <Form.Item
@ -128,6 +138,7 @@ const SimpleForm = (props: SimpleFormData) => {
<DatePicker /> <DatePicker />
</Form.Item> </Form.Item>
); );
default: default:
return ( return (
<Form.Item <Form.Item

View File

@ -22,30 +22,6 @@ const Active = (props: Store) => {
title: "活动标题", title: "活动标题",
dataIndex: "activeName", dataIndex: "activeName",
}, },
// {
// title: "活动描述",
// dataIndex: "desc",
// },
// {
// title: "活动图片",
// dataIndex: "activeIcon",
// ellipsis: {
// showTitle: false,
// },
// render: (address) => (
// <Tooltip placement="topLeft" title={address}>
// {address}
// </Tooltip>
// ),
// },
// {
// title: "活动人数",
// dataIndex: "peopleNum",
// },
// {
// title: "活动地址",
// dataIndex: "address",
// },
{ {
title: "折扣", title: "折扣",
dataIndex: "discount", dataIndex: "discount",
@ -67,11 +43,6 @@ const Active = (props: Store) => {
</div> </div>
), ),
}, },
// {
// title: "发起人",
// dataIndex: "userId",
// },
{ {
title: "操作", title: "操作",
dataIndex: "id", dataIndex: "id",
@ -158,6 +129,12 @@ const Active = (props: Store) => {
name: "endTime", name: "endTime",
value: "", value: "",
}, },
{
type: "switch",
label: "是否开启",
name: "status",
value: false,
},
]; ];
useEffect(() => { useEffect(() => {

View File

@ -112,7 +112,7 @@ const CardPageList = (props) => {
type: "select", type: "select",
label: "请选择卡片类型", label: "请选择卡片类型",
name: "cardType", name: "cardType",
value: "", value: ""
}, },
] ]