修改文件
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1,5 +1,5 @@
|
||||
import { outLogin } from '@/services/user/index';
|
||||
import { LogoutOutlined, SettingOutlined, UserOutlined } from '@ant-design/icons';
|
||||
import { LogoutOutlined, SettingOutlined, UserOutlined, SecurityScanOutlined } from '@ant-design/icons';
|
||||
import { history, useModel } from '@umijs/max';
|
||||
import { Spin } from 'antd';
|
||||
import { createStyles } from 'antd-style';
|
||||
@@ -72,6 +72,10 @@ export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, childre
|
||||
loginOut();
|
||||
return;
|
||||
}
|
||||
if (key === 'uppass') {
|
||||
history.push(`/system/uppass`);
|
||||
return;
|
||||
}
|
||||
history.push(`/account/${key}`);
|
||||
},
|
||||
[setInitialState],
|
||||
@@ -102,26 +106,32 @@ export const AvatarDropdown: React.FC<GlobalHeaderRightProps> = ({ menu, childre
|
||||
const menuItems = [
|
||||
...(menu
|
||||
? [
|
||||
{
|
||||
key: 'center',
|
||||
icon: <UserOutlined />,
|
||||
label: '个人中心',
|
||||
},
|
||||
{
|
||||
key: 'settings',
|
||||
icon: <SettingOutlined />,
|
||||
label: '个人设置',
|
||||
},
|
||||
{
|
||||
type: 'divider' as const,
|
||||
},
|
||||
]
|
||||
{
|
||||
key: 'center',
|
||||
icon: <UserOutlined />,
|
||||
label: '个人中心',
|
||||
},
|
||||
{
|
||||
key: 'settings',
|
||||
icon: <SettingOutlined />,
|
||||
label: '个人设置',
|
||||
},
|
||||
{
|
||||
type: 'divider' as const,
|
||||
},
|
||||
]
|
||||
: []),
|
||||
{
|
||||
key: 'uppass',
|
||||
icon: <SecurityScanOutlined />,
|
||||
label: '修改密码',
|
||||
},
|
||||
{
|
||||
key: 'logout',
|
||||
icon: <LogoutOutlined />,
|
||||
label: '退出登录',
|
||||
},
|
||||
|
||||
];
|
||||
|
||||
return (
|
||||
|
||||
@@ -103,7 +103,7 @@ const MenuTableList: React.FC = () => {
|
||||
title: '标题',
|
||||
dataIndex: 'title',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
title: '图片',
|
||||
|
||||
@@ -81,12 +81,46 @@ const LogTableList: React.FC = () => {
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
},
|
||||
// {
|
||||
// title: '来源',
|
||||
// dataIndex: 'sourceType',
|
||||
// valueType: 'text',
|
||||
// search: false,
|
||||
// },
|
||||
{
|
||||
title: '来源',
|
||||
dataIndex: 'sourceType',
|
||||
valueType: 'text',
|
||||
search: true,
|
||||
render: (_: any, record: any) => {
|
||||
return record?.sourceType == 1 ? '订单' : record?.sourceType == 2 ? '充电桩服务费' : record?.sourceType == 3 ? '充值' : record?.sourceType == 4 ? '提现' : '-'
|
||||
},
|
||||
renderFormItem: (
|
||||
_,
|
||||
{ type, defaultRender, formItemProps, fieldProps, ...rest },
|
||||
form,
|
||||
) => {
|
||||
return <Select
|
||||
{...fieldProps}
|
||||
allowClear
|
||||
style={{ width: "100%" }}
|
||||
filterOption={false}
|
||||
fieldNames={{
|
||||
label: "name",
|
||||
value: "id"
|
||||
}}
|
||||
options={[
|
||||
{
|
||||
name: '订单',
|
||||
id: 1
|
||||
}, {
|
||||
name: '充电桩服务费',
|
||||
id: 2
|
||||
}, {
|
||||
name: '充值',
|
||||
id: 3
|
||||
}, {
|
||||
name: '提现',
|
||||
id: 4
|
||||
}
|
||||
]}
|
||||
/>
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '记录类型',
|
||||
dataIndex: 'type',
|
||||
@@ -94,7 +128,7 @@ const LogTableList: React.FC = () => {
|
||||
search: true,
|
||||
render: (_: any, record: any) => {
|
||||
let list = moneyType
|
||||
return list.find((val) => val.id == record.sourceType)?.name
|
||||
return list.find((val) => val.id == record.type)?.name
|
||||
},
|
||||
renderFormItem: (
|
||||
_,
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
import { integralPage } from '@/services/finance/index';
|
||||
|
||||
|
||||
import React, { useRef, useEffect } from 'react';
|
||||
import React, { useRef, useEffect,useState } from 'react';
|
||||
import { useIntl, useAccess } from '@umijs/max';
|
||||
import { message, Tag } from 'antd';
|
||||
import { message, Tag,Select } from 'antd';
|
||||
import { ActionType, PageContainer, ProTable } from '@ant-design/pro-components';
|
||||
import { usersPage } from '@/services/user/user';
|
||||
|
||||
|
||||
|
||||
|
||||
const LogTableList: React.FC = () => {
|
||||
const actionRef = useRef<ActionType>();
|
||||
const [shopOption, setShopOption] = useState([]);
|
||||
|
||||
|
||||
const searchShop = async (value) => {
|
||||
const { success, data } = await usersPage({
|
||||
userName: value
|
||||
});
|
||||
data.records.map((i) => {
|
||||
i.userName = i.userName + ' ' + i.phone
|
||||
})
|
||||
setShopOption(data.records)
|
||||
}
|
||||
|
||||
const columns = [
|
||||
{
|
||||
@@ -20,10 +33,57 @@ const LogTableList: React.FC = () => {
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '用户ID',
|
||||
title: '用户信息',
|
||||
dataIndex: 'userId',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
render: (_: any, record: any) => {
|
||||
return <div>
|
||||
<div>用户ID:{record?.userId}</div>
|
||||
<div>用户名:{record?.userName}</div>
|
||||
<div>手机号:{record?.phone}</div>
|
||||
</div>
|
||||
},
|
||||
renderFormItem: (
|
||||
_,
|
||||
{ type, defaultRender, formItemProps, fieldProps, ...rest },
|
||||
form,
|
||||
) => {
|
||||
return <Select
|
||||
{...fieldProps}
|
||||
allowClear
|
||||
showSearch
|
||||
placeholder="请输入用户名"
|
||||
style={{ width: "100%" }}
|
||||
filterOption={false}
|
||||
onSearch={
|
||||
(e) => {
|
||||
if (!e) {
|
||||
return;
|
||||
}
|
||||
searchShop(e);
|
||||
}
|
||||
}
|
||||
fieldNames={{
|
||||
label: "userName",
|
||||
value: "id"
|
||||
}}
|
||||
options={shopOption}
|
||||
/>
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '用户名',
|
||||
dataIndex: 'userName',
|
||||
valueType: 'text',
|
||||
search: true,
|
||||
hidden:true
|
||||
},
|
||||
{
|
||||
title: '手机号',
|
||||
dataIndex: 'phone',
|
||||
valueType: 'text',
|
||||
search: true,
|
||||
hidden:true
|
||||
},
|
||||
{
|
||||
title: '钱包',
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { variationPage,recordExtract } from '@/services/finance/index';
|
||||
import { variationPage, recordExtract } from '@/services/finance/index';
|
||||
import { exportData } from '@/utils/func';
|
||||
|
||||
import React, { useRef, useEffect, useState } from 'react';
|
||||
import { useIntl, useAccess } from '@umijs/max';
|
||||
import { message, Tag, Select,Button } from 'antd';
|
||||
import { message, Tag, Select, Button } from 'antd';
|
||||
import { ActionType, PageContainer, ProTable, ProFormSelect } from '@ant-design/pro-components';
|
||||
import moneyType from '@/assets/json/moneyType.json'
|
||||
import { usersPage } from '@/services/user/user';
|
||||
@@ -75,23 +75,57 @@ const LogTableList: React.FC = () => {
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '当前积分余额',
|
||||
title: '当前余额',
|
||||
dataIndex: 'curPoints',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '积分变动',
|
||||
title: '余额变动',
|
||||
dataIndex: 'points',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
},
|
||||
// {
|
||||
// title: '来源',
|
||||
// dataIndex: 'sourceType',
|
||||
// valueType: 'text',
|
||||
// search: false,
|
||||
// },
|
||||
{
|
||||
title: '来源',
|
||||
dataIndex: 'sourceType',
|
||||
valueType: 'text',
|
||||
search: true,
|
||||
render: (_: any, record: any) => {
|
||||
return record?.sourceType == 1 ? '订单' : record?.sourceType == 2 ? '充电桩服务费' : record?.sourceType == 3 ? '充值' : record?.sourceType == 4 ? '提现' : '-'
|
||||
},
|
||||
renderFormItem: (
|
||||
_,
|
||||
{ type, defaultRender, formItemProps, fieldProps, ...rest },
|
||||
form,
|
||||
) => {
|
||||
return <Select
|
||||
{...fieldProps}
|
||||
allowClear
|
||||
style={{ width: "100%" }}
|
||||
filterOption={false}
|
||||
fieldNames={{
|
||||
label: "name",
|
||||
value: "id"
|
||||
}}
|
||||
options={[
|
||||
{
|
||||
name: '订单',
|
||||
id: 1
|
||||
}, {
|
||||
name: '充电桩服务费',
|
||||
id: 2
|
||||
}, {
|
||||
name: '充值',
|
||||
id: 3
|
||||
}, {
|
||||
name: '提现',
|
||||
id: 4
|
||||
}
|
||||
]}
|
||||
/>
|
||||
},
|
||||
},
|
||||
{
|
||||
title: '记录类型',
|
||||
dataIndex: 'type',
|
||||
@@ -99,7 +133,7 @@ const LogTableList: React.FC = () => {
|
||||
search: true,
|
||||
render: (_: any, record: any) => {
|
||||
let list = moneyType
|
||||
return list.find((val) => val.id == record.sourceType)?.name
|
||||
return list.find((val) => val.id == record.type)?.name
|
||||
},
|
||||
renderFormItem: (
|
||||
_,
|
||||
|
||||
@@ -23,7 +23,7 @@ const GoodsTableList: React.FC = () => {
|
||||
title: '商品名称',
|
||||
dataIndex: 'goodsName',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
title: '功率',
|
||||
@@ -136,6 +136,7 @@ const GoodsTableList: React.FC = () => {
|
||||
key="goodsList"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
defaultCollapsed: false,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
|
||||
@@ -20,10 +20,10 @@ const GoodsSetMealTableList: React.FC = () => {
|
||||
search: false,
|
||||
},
|
||||
{
|
||||
title: '商品名称',
|
||||
dataIndex: 'goodsName',
|
||||
title: '套餐名称',
|
||||
dataIndex: 'packagesName',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
title: '功率',
|
||||
@@ -143,6 +143,7 @@ const GoodsSetMealTableList: React.FC = () => {
|
||||
key="goodsSetMealList"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
defaultCollapsed: false,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
|
||||
@@ -25,7 +25,6 @@ const handleAdd = async (fields) => {
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('添加失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -44,7 +43,6 @@ const handleUpdate = async (fields: API.System.Menu) => {
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('修改失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -60,7 +58,6 @@ const handleRemoveOne = async (selectedRow: API.System.Menu) => {
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -101,7 +98,7 @@ const MenuTableList: React.FC = () => {
|
||||
title: '标题',
|
||||
dataIndex: 'title',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
title: '封面图',
|
||||
|
||||
@@ -62,15 +62,21 @@ const LogTableList: React.FC = () => {
|
||||
search: false,
|
||||
render: (_: any, record: any) => {
|
||||
return record.ordersGoodsList ? record.ordersGoodsList.map((i) => {
|
||||
let _Img = i?.goodsSnapshot?.picture ? JSON.parse(i?.goodsSnapshot?.picture)[0] : ''
|
||||
return <div className={'flex'} key={i.id}>
|
||||
<Image width={60} src={_Img} height={60}></Image>
|
||||
let _Img = null
|
||||
if (i?.sourceType == 1){
|
||||
_Img = i?.goodsSnapshot?.picture ? JSON.parse(i?.goodsSnapshot?.picture)[0] : ''
|
||||
}else{
|
||||
_Img = i?.goodsPackagesSnapshot?.picture ? JSON.parse(i?.goodsPackagesSnapshot?.picture)[0] : ''
|
||||
}
|
||||
|
||||
return <div className={'flex items-center'} key={i.id}>
|
||||
<Image width={60} src={_Img} height={60}></Image>
|
||||
<div>
|
||||
<div>
|
||||
商品名称:{i.goodsSnapshot?.goodsName}
|
||||
商品名称:{i?.sourceType == 1 ? i?.goodsSnapshot?.goodsName : i?.goodsPackagesSnapshot.packagesName}
|
||||
</div>
|
||||
<div>
|
||||
商品价格:{i.salePrice}
|
||||
商品价格:{i?.sourceType == 1 ? i?.goodsSnapshot?.salePrice : i?.goodsPackagesSnapshot.salePrice}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -128,7 +134,7 @@ const LogTableList: React.FC = () => {
|
||||
search: true,
|
||||
render: (_: any, record: any) => {
|
||||
let colors = ['gold', 'green', 'volcano', 'red', 'magenta']
|
||||
return <Tag color={colors[record.status]}>{record.status == 0 ? '待支付' : record.status == 1 ? '支付成功' : record.status == -1 ? '取消' : record.status == -2 ? '退款中' : record.status == -3 ? '退款完成' : ''}</Tag>
|
||||
return <Tag color={colors[record.status]}>{record.status == 0 ? '待支付' : record.status == 1 ? '支付成功' : record.status == -1 ? '取消' : record.status == -2 ? '退款' : ''}</Tag>
|
||||
},
|
||||
renderFormItem: (
|
||||
_,
|
||||
@@ -197,6 +203,7 @@ const LogTableList: React.FC = () => {
|
||||
key="logList"
|
||||
search={{
|
||||
labelWidth: 120,
|
||||
defaultCollapsed: false,
|
||||
}}
|
||||
toolBarRender={() => [
|
||||
<Button
|
||||
|
||||
@@ -29,7 +29,7 @@ const LogTableList: React.FC = () => {
|
||||
title: '设备号',
|
||||
dataIndex: 'deviceNo',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
search: true,
|
||||
render: (_: any, record: any) => {
|
||||
return <div className={'flex items-center'}>
|
||||
{record.deviceNo || '-'}
|
||||
@@ -41,16 +41,19 @@ const LogTableList: React.FC = () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '订单号',
|
||||
title: '订单ID',
|
||||
dataIndex: 'orderId',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
search: true,
|
||||
},
|
||||
{
|
||||
title: '设备类型',
|
||||
dataIndex: 'deviceType',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
render: (_: any, record: any) => {
|
||||
return record?.deviceType + 'W'
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
@@ -92,6 +95,9 @@ const LogTableList: React.FC = () => {
|
||||
dataIndex: 'deliverDate',
|
||||
valueType: 'text',
|
||||
search: false,
|
||||
render: (_: any, record: any) => {
|
||||
return record?.deliverDate + '天'
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '分账有效期',
|
||||
|
||||
@@ -128,11 +128,20 @@ const MenuForm: React.FC<MenuFormProps> = (props) => {
|
||||
/>
|
||||
<ProFormRadio.Group
|
||||
name="menuType"
|
||||
valueEnum={{
|
||||
M: '目录',
|
||||
C: '菜单',
|
||||
F: '按钮',
|
||||
}}
|
||||
options={[
|
||||
{
|
||||
label: '目录',
|
||||
value: 'M',
|
||||
},
|
||||
{
|
||||
label: '菜单',
|
||||
value: 'C',
|
||||
},
|
||||
{
|
||||
label: '按钮',
|
||||
value: 'F',
|
||||
},
|
||||
]}
|
||||
label={'菜单类型'}
|
||||
placeholder="请输入菜单类型"
|
||||
rules={[
|
||||
|
||||
75
src/pages/system/uppass/index.tsx
Normal file
75
src/pages/system/uppass/index.tsx
Normal file
@@ -0,0 +1,75 @@
|
||||
|
||||
import { InputNumber, Space, message, Popconfirm } from 'antd';
|
||||
import {
|
||||
PageContainer,
|
||||
ProForm,
|
||||
ProFormText,
|
||||
} from '@ant-design/pro-components';
|
||||
|
||||
import { history, useModel } from '@umijs/max';
|
||||
import { stringify } from 'querystring';
|
||||
import { resetPwd } from '@/services/system/user';
|
||||
|
||||
export default () => {
|
||||
|
||||
const handleCreate = async (fields) => {
|
||||
let data = JSON.parse(JSON.stringify(fields))
|
||||
const { success } = await resetPwd({ ...data });
|
||||
if (success) {
|
||||
message.success('修改成功,请重新登录')
|
||||
const { search, pathname } = window.location;
|
||||
const urlParams = new URL(window.location.href).searchParams;
|
||||
/** 此方法会跳转到 redirect 参数所在的位置 */
|
||||
const redirect = urlParams.get('redirect');
|
||||
// Note: There may be security issues, please note
|
||||
localStorage.removeItem('token')
|
||||
if (window.location.pathname !== '/user/login' && !redirect) {
|
||||
history.replace({
|
||||
pathname: '/user/login',
|
||||
search: stringify({
|
||||
redirect: pathname + search,
|
||||
}),
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
return (
|
||||
<PageContainer
|
||||
header={{
|
||||
title: '重置密码',
|
||||
}}
|
||||
>
|
||||
<>
|
||||
<ProForm
|
||||
onFinish={(values) => {
|
||||
handleCreate(values)
|
||||
}}
|
||||
>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '请输入!' }]}
|
||||
width={300}
|
||||
name="oldPassword"
|
||||
label="原密码"
|
||||
placeholder="原密码"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '请输入!' }]}
|
||||
width={300}
|
||||
name="newPassword"
|
||||
label="新密码"
|
||||
placeholder="新密码"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '请输入!' }]}
|
||||
width={300}
|
||||
name="passwordSure"
|
||||
label="确认密码"
|
||||
placeholder="确认密码"
|
||||
/>
|
||||
</ProForm>
|
||||
</>
|
||||
</PageContainer>
|
||||
);
|
||||
};
|
||||
@@ -20,6 +20,9 @@ const UserForm: React.FC = (props: any) => {
|
||||
|
||||
const { values } = props;
|
||||
|
||||
console.log(values, 'valuesvaluesvaluesvalues');
|
||||
|
||||
|
||||
useEffect(() => {
|
||||
form.resetFields();
|
||||
form.setFieldsValue(values);
|
||||
@@ -89,6 +92,7 @@ const UserForm: React.FC = (props: any) => {
|
||||
label={'用户密码'}
|
||||
colProps={{ md: 12, xl: 12 }}
|
||||
placeholder="请输入用户密码"
|
||||
hidden={values?.id}
|
||||
rules={[
|
||||
{
|
||||
required: values?.id ? false : true,
|
||||
@@ -108,20 +112,12 @@ const UserForm: React.FC = (props: any) => {
|
||||
},
|
||||
]}
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
name="email"
|
||||
label={'邮箱'}
|
||||
colProps={{ md: 12, xl: 12 }}
|
||||
placeholder="请输入邮箱"
|
||||
/>
|
||||
{/* <ProFormText
|
||||
name="loginIp"
|
||||
label={'登录IP'}
|
||||
colProps={{ md: 12, xl: 12 }}
|
||||
placeholder="登录IP"
|
||||
/> */}
|
||||
</ProForm.Group>
|
||||
<ProForm.Group>
|
||||
<ProFormSelect
|
||||
@@ -141,12 +137,6 @@ const UserForm: React.FC = (props: any) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
message: <FormattedMessage id="请选择角色!" defaultMessage="请选择角色!" />,
|
||||
},
|
||||
]}
|
||||
request={async () => {
|
||||
let { data } = await findAllSysRole()
|
||||
return data
|
||||
@@ -158,29 +148,33 @@ const UserForm: React.FC = (props: any) => {
|
||||
|
||||
<ProFormRadio.Group
|
||||
name="userType"
|
||||
valueEnum={{
|
||||
0: '系统用户',
|
||||
}}
|
||||
initialValue="1"
|
||||
options={[
|
||||
{
|
||||
label: '系统用户',
|
||||
value: 0,
|
||||
},
|
||||
]}
|
||||
label={'用户类型'}
|
||||
colProps={{ md: 12, xl: 12 }}
|
||||
fieldProps={{
|
||||
defaultValue: 0
|
||||
}}
|
||||
/>
|
||||
<ProFormRadio.Group
|
||||
name="sex"
|
||||
valueEnum={{
|
||||
0: '男',
|
||||
1: '女',
|
||||
2: '未知',
|
||||
}}
|
||||
initialValue="1"
|
||||
options={[
|
||||
{
|
||||
label: '男',
|
||||
value: 0,
|
||||
},
|
||||
{
|
||||
label: '女',
|
||||
value: 1,
|
||||
},
|
||||
{
|
||||
label: '未知',
|
||||
value: 2,
|
||||
},
|
||||
]}
|
||||
label={'性别'}
|
||||
colProps={{ md: 12, xl: 12 }}
|
||||
fieldProps={{
|
||||
defaultValue: 0
|
||||
}}
|
||||
/>
|
||||
</ProForm>
|
||||
</Modal>
|
||||
|
||||
@@ -3,7 +3,7 @@ import { userPage, userUpPwd, userInfo, userUpdate, userAdd, userDelete } from '
|
||||
|
||||
import React, { useState, useRef, useEffect } from 'react';
|
||||
import { useIntl, FormattedMessage, useAccess } from '@umijs/max';
|
||||
import { Button, message, Modal, Tag,Image } from 'antd';
|
||||
import { Button, message, Modal, Tag, Image } from 'antd';
|
||||
import { ActionType, PageContainer, ProColumns, ProTable } from '@ant-design/pro-components';
|
||||
import { PlusOutlined } from '@ant-design/icons';
|
||||
import UpdateForm from './edit';
|
||||
@@ -102,7 +102,7 @@ const UserTableList: React.FC = () => {
|
||||
search: false,
|
||||
render: (_: any, record: any) => {
|
||||
return <div className='flex'>
|
||||
<Image src={record.avatar} width={45} height={45}></Image>
|
||||
<Image src={record.avatar} width={45} height={45}></Image>
|
||||
<div>
|
||||
<div>
|
||||
昵称:{record.nickName}
|
||||
@@ -223,6 +223,16 @@ const UserTableList: React.FC = () => {
|
||||
}}
|
||||
>
|
||||
<PlusOutlined /> 新增
|
||||
</Button>,
|
||||
<Button
|
||||
type="primary"
|
||||
key="add"
|
||||
onClick={async () => {
|
||||
setCurrentRow(undefined);
|
||||
setModalVisible(true);
|
||||
}}
|
||||
>
|
||||
修改密码
|
||||
</Button>
|
||||
]}
|
||||
request={async (params, sorter, filter) => {
|
||||
|
||||
85
src/pages/user/user/components/TradeFormModal.tsx
Normal file
85
src/pages/user/user/components/TradeFormModal.tsx
Normal file
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* @Note:
|
||||
* @Author: 2058827620@qq.com
|
||||
* @Date: 2022-04-03 17:02:15
|
||||
*/
|
||||
|
||||
import { ProForm, ModalForm, ProFormSelect, ProFormText, ProFormTextArea, ProFormInstance } from '@ant-design/pro-components';
|
||||
import { Divider } from 'antd';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import FilesManager from '@/components/FilesManage/index';
|
||||
|
||||
export default ({ modalOpenState, onModalOpenState, onSubmit }) => {
|
||||
const restFormRef = useRef<ProFormInstance>();
|
||||
|
||||
useEffect(() => {
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<>
|
||||
<ModalForm
|
||||
title="用户-账号变更"
|
||||
formRef={restFormRef}
|
||||
submitter={{
|
||||
searchConfig: {
|
||||
resetText: '重置',
|
||||
},
|
||||
resetButtonProps: {
|
||||
onClick: () => {
|
||||
restFormRef.current?.resetFields();
|
||||
},
|
||||
},
|
||||
}}
|
||||
onFinish={async(e)=>{
|
||||
onSubmit(e)
|
||||
restFormRef.current?.resetFields();
|
||||
}}
|
||||
open={modalOpenState}
|
||||
onOpenChange={onModalOpenState}
|
||||
>
|
||||
<Divider>原投资人,用户名、手机号</Divider>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '请输入' }]}
|
||||
width="md"
|
||||
name="userNameOld"
|
||||
label="用户名(原)"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '请输入' }]}
|
||||
width="md"
|
||||
name="phoneOld"
|
||||
label="手机号(原)"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<Divider>新投资人,用户名、手机号</Divider>
|
||||
<ProForm.Group>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '请输入' }]}
|
||||
width="md"
|
||||
name="userNameNew"
|
||||
label="用户名(新)"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
<ProFormText
|
||||
rules={[{ required: true, message: '请输入' }]}
|
||||
width="md"
|
||||
name="phoneNew"
|
||||
label="手机号(新)"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</ProForm.Group>
|
||||
<ProFormTextArea
|
||||
rules={[{ required: true, message: '请输入' }]}
|
||||
width="md"
|
||||
name="remark"
|
||||
label="备注"
|
||||
placeholder="请输入"
|
||||
/>
|
||||
</ModalForm>
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { usersPage, usersAdd, usersDelete, usersUpdate, updateUserLevel, userTransferHanging, exportUser, userRecharge } from '@/services/user/user';
|
||||
import { usersPage, usersAdd, usersDelete, usersUpdate, updateUserLevel, userTransferHanging, exportUser, userRecharge,accountChange } from '@/services/user/user';
|
||||
|
||||
|
||||
import React, { useRef, useEffect, useState } from 'react';
|
||||
@@ -12,7 +12,7 @@ import LevelFormModal from './components/LevelFormModal';
|
||||
import TempFormModal from './components/TempFormModal';
|
||||
import ShopModal from './components/ShopModal';
|
||||
import MoneyFormModal from './components/MoneyFormModal';
|
||||
|
||||
import TradeFormModal from './components/TradeFormModal';
|
||||
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@ const handleAdd = async (fields) => {
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('添加失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -50,7 +49,6 @@ const handleUpdate = async (fields: API.System.Menu) => {
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('修改失败请重试!');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -66,7 +64,6 @@ const handleRemoveOne = async (selectedRow) => {
|
||||
return true;
|
||||
} catch (error) {
|
||||
hide();
|
||||
message.error('删除失败,请重试');
|
||||
return false;
|
||||
}
|
||||
};
|
||||
@@ -85,7 +82,7 @@ const LogTableList: React.FC = () => {
|
||||
const [shopModal, setBonusFormModal] = useState(false);
|
||||
const [row, setRow] = useState();
|
||||
const [moneyFormModal, setMoneyFormModal] = useState(false);
|
||||
|
||||
const [tradeFormModal, setTradeFormModal] = useState(false);
|
||||
|
||||
|
||||
// 更改等级
|
||||
@@ -249,9 +246,27 @@ const LogTableList: React.FC = () => {
|
||||
// },
|
||||
];
|
||||
|
||||
const handleTrade = async (fields) => {
|
||||
|
||||
const { success } = await accountChange(fields);
|
||||
if (success) {
|
||||
actionRef.current?.reload();
|
||||
setTradeFormModal(false);
|
||||
message.success('变更成功');
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
return (
|
||||
<PageContainer>
|
||||
<div style={{ width: '100%', float: 'right' }}>
|
||||
<TradeFormModal
|
||||
modalOpenState={tradeFormModal}
|
||||
onModalOpenState={setTradeFormModal}
|
||||
onSubmit={handleTrade}
|
||||
/>
|
||||
|
||||
<ShopModal
|
||||
values={row}
|
||||
modalOpenState={shopModal}
|
||||
|
||||
@@ -129,7 +129,9 @@ export const errorConfig: RequestConfig = {
|
||||
const headers = { Authorization };
|
||||
// let url = config.url;
|
||||
// const url = config?.url;
|
||||
let url = `https://iadminapi.zhongshuai2023.com` + config.url;
|
||||
console.log(process.env.API_BASEURL);
|
||||
|
||||
let url = `${process.env.API_BASEURL ? process.env.API_BASEURL : ''}` + config.url;
|
||||
if (config.url.includes('https://')) {
|
||||
url = config.url;
|
||||
}
|
||||
|
||||
@@ -68,4 +68,15 @@ export async function userDelete(params: any) {
|
||||
}
|
||||
|
||||
|
||||
// 重置绵绵
|
||||
|
||||
export async function resetPwd(params: any) {
|
||||
return request('/api/sys/user/resetPwd', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
data: params,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -101,3 +101,13 @@ export async function smsCode() {
|
||||
});
|
||||
}
|
||||
|
||||
export async function accountChange(body) {
|
||||
return request(`/api/users/accountChange`, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json;charset=UTF-8',
|
||||
},
|
||||
data: body || {},
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user