Commit ebb9a85f authored by GuanHua's avatar GuanHua

merge

parents 131b9e74 53ba6f5f
...@@ -120,7 +120,7 @@ const MemberRoute = { ...@@ -120,7 +120,7 @@ const MemberRoute = {
key: 'addEquity', key: 'addEquity',
hideInMenu: true, hideInMenu: true,
component: '@/pages/member/memberLevel/addEquity', component: '@/pages/member/memberLevel/addEquity',
} },
] ]
} }
] ]
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
"moment": "^2.27.0", "moment": "^2.27.0",
"prettier": "^1.19.1", "prettier": "^1.19.1",
"qrcode": "^1.4.4", "qrcode": "^1.4.4",
"query-string": "^6.13.1",
"react": "^16.12.0", "react": "^16.12.0",
"react-dom": "^16.12.0", "react-dom": "^16.12.0",
"react-fontawesome": "^1.7.1", "react-fontawesome": "^1.7.1",
......
...@@ -2,6 +2,7 @@ import { IRoutes } from '.'; ...@@ -2,6 +2,7 @@ import { IRoutes } from '.';
import { history, RequestConfig, Redirect } from 'umi'; import { history, RequestConfig, Redirect } from 'umi';
import React from 'react' import React from 'react'
import MobxProvider from './store' import MobxProvider from './store'
import queryString from 'query-string'
import '@/global/styles/reset.less'; // 重置antd样式 import '@/global/styles/reset.less'; // 重置antd样式
import '@/global/styles/global.less'; // 导入全局样式 import '@/global/styles/global.less'; // 导入全局样式
...@@ -9,7 +10,7 @@ import '@/global/styles/global.less'; // 导入全局样式 ...@@ -9,7 +10,7 @@ import '@/global/styles/global.less'; // 导入全局样式
import 'antd/dist/antd.less' import 'antd/dist/antd.less'
import { isDev } from '@/constants' import { isDev } from '@/constants'
import { setup } from '@formily/antd-components'; import { setup } from '@formily/antd-components';
import { getRouters, getAuth, asyncRouter, setAuth, setRouters } from './utils/auth'; import { getRouters, getAuth, asyncRouter, setAuth, setRouters, removeAuth, removeRouters } from './utils/auth';
import { PublicApi } from './services/api'; import { PublicApi } from './services/api';
setup() setup()
...@@ -67,13 +68,20 @@ export function render(oldRender: Function) { ...@@ -67,13 +68,20 @@ export function render(oldRender: Function) {
if (authInfo) { if (authInfo) {
PublicApi.getMemberLoginReget().then(res => { PublicApi.getMemberLoginReget().then(res => {
const { data } = res const { data, code } = res
setAuth({ if (code === 1000) {
memberId: data.memberId, setAuth({
userId: data.userId, memberId: data.memberId,
token: data.token userId: data.userId,
}) token: data.token
setRouters(data.urls) })
setRouters(data.urls)
} else {
removeAuth()
removeRouters()
history.push('/user/login')
}
oldRender() oldRender()
}) })
} else { } else {
...@@ -90,19 +98,32 @@ export function render(oldRender: Function) { ...@@ -90,19 +98,32 @@ export function render(oldRender: Function) {
*/ */
export function onRouteChange({ routes, matchedRoutes, location, action }) { export function onRouteChange({ routes, matchedRoutes, location, action }) {
console.log('onRouteChange') console.log('onRouteChange')
if (isDev) {
return; // if (isDev) {
} // return;
// }
if (whiteLists.includes(location.pathname)) return; if (whiteLists.includes(location.pathname)) return;
const routeAuthUrls = getRouters() const routeAuthUrls = getRouters()
// 是否登录 // 是否登录
if (getAuth()) { if (getAuth()) {
if (routeAuthUrls.includes(location.pathname)) { const { query, pathname } = location
// 固定配置, 出现此参数说明需携带参数校验权限路由
} else { if (query.page_type && routeAuthUrls.find(authPath => {
// 无权限访问时 const parseUrl = queryString.parseUrl(authPath)
history.replace('/memberCenter/noAuth') const { query: selfQuery, url } = parseUrl
// 当页面出现参数page_type时, 需进入深度校验, 即对应的参数和路径匹配
return url === pathname && selfQuery.page_type === query.page_type
})) {
// 深度匹配成功, 可正常访问
return ;
}
// 是否在路由权限列表里
if (routeAuthUrls.includes(pathname)) {
return ;
} }
// 无权限访问时
history.replace('/memberCenter/noAuth')
} else { } else {
history.replace('/user/login') history.replace('/user/login')
} }
......
import React from 'react';
import { Radio, Tooltip } from 'antd';
const CustomCheckbox = props => {
const { layout } = props
return (
<Radio.Group value={props.value} onChange={props.onChange} className={layout === 'column' ? 'identityRadio' : 'businessRadio'} name={props.name}>
{
props.dataSource && props.dataSource.map((v, i) => <Tooltip title={v.label} placement='leftTop' key={v.value + i}><Radio.Button value={v.value} >{v.label}</Radio.Button></Tooltip>)
}
</Radio.Group>
)
}
export default CustomCheckbox
\ No newline at end of file
...@@ -3,12 +3,14 @@ import UploadImage from "@/components/UploadImage" ...@@ -3,12 +3,14 @@ import UploadImage from "@/components/UploadImage"
const CustomUpload = (props) => { const CustomUpload = (props) => {
const { mutators } = props const { mutators } = props
const uploadProps = props.props['x-component-props'] || {}
return <UploadImage return <UploadImage
imgUrl={props.value} imgUrl={props.value}
onChange={data => { onChange={data => {
// 这里能拿到change后的data值 // 这里能拿到change后的data值
mutators.change(data) mutators.change(data)
}} }}
{...uploadProps}
/> />
} }
......
import React from 'react'
import { Row, Input, Col, Button } from 'antd';
import useCountDown from '@/utils/hooks';
const Phone = (props) => {
const {text, isActive, start} = useCountDown({
maxTime: 60,
minTime: 0,
initText: '获取验证码',
onEnd: () => {},
decayRate: 1,
delay: 1 * 1000
})
const { value } = props
return (
<Row style={{width: '100%'}}>
<Col flex={1}>
<Input
value={value || ''}
onChange={e => props.mutators.change(e.target.value)}
{...props.props['x-component-props']}
/>
</Col>
<Col style={{marginLeft: 8}}>
<Button disabled={isActive} style={{minWidth: 110, marginLeft: 8}} size='large' onClick={start}>{text}</Button>
</Col>
</Row>
)
}
Phone.defaultProps = {}
Phone.isFieldComponent = true;
export default Phone
\ No newline at end of file
...@@ -18,8 +18,10 @@ import CustomRegistryPhone from './components/CustomRegistryPhone'; ...@@ -18,8 +18,10 @@ import CustomRegistryPhone from './components/CustomRegistryPhone';
import CustomRelevance from './components/CustomRelevance'; import CustomRelevance from './components/CustomRelevance';
import Children from './components/Children'; import Children from './components/Children';
import CircleBox from './components/CircleBox'; import CircleBox from './components/CircleBox';
import Phone from './components/Phone';
import CustomRadio from './components/CustomRadio';
import './index.less' import './index.less'
import { Input } from '@formily/antd-components'; import { Checkbox } from '@formily/antd-components';
export interface NiceFormProps extends IAntdSchemaFormProps {} export interface NiceFormProps extends IAntdSchemaFormProps {}
...@@ -78,10 +80,12 @@ const schemaLayout = createControllerBox("schemaLayout", (_props) => { ...@@ -78,10 +80,12 @@ const schemaLayout = createControllerBox("schemaLayout", (_props) => {
const NiceForm: React.FC<NiceFormProps> = props => { const NiceForm: React.FC<NiceFormProps> = props => {
const { children, components, ...reset } = props; const { children, components, ...reset } = props;
const customComponents = { const customComponents = {
CheckboxSingle: Checkbox,
CustomUpload, CustomUpload,
CustomStatus, CustomStatus,
CustomAddArray, CustomAddArray,
CustomSlider, CustomSlider,
CustomRadio,
Search, Search,
CustomInputSearch, CustomInputSearch,
Submit, Submit,
...@@ -93,7 +97,8 @@ const NiceForm: React.FC<NiceFormProps> = props => { ...@@ -93,7 +97,8 @@ const NiceForm: React.FC<NiceFormProps> = props => {
Children, Children,
CircleBox, CircleBox,
SchemaFormButtonGroup, SchemaFormButtonGroup,
FlexBox FlexBox,
Phone,
}; };
const defineComponents = Object.assign(customComponents, components); const defineComponents = Object.assign(customComponents, components);
......
...@@ -4,6 +4,7 @@ import { LoadingOutlined, PlusOutlined } from '@ant-design/icons' ...@@ -4,6 +4,7 @@ import { LoadingOutlined, PlusOutlined } from '@ant-design/icons'
import { UploadFile, UploadChangeParam } from 'antd/lib/upload/interface' import { UploadFile, UploadChangeParam } from 'antd/lib/upload/interface'
import cx from 'classnames' import cx from 'classnames'
import styles from './index.less' import styles from './index.less'
import { UPLOAD_TYPE } from '@/constants'
interface UploadImagePorpsType { interface UploadImagePorpsType {
imgUrl: string; imgUrl: string;
...@@ -12,10 +13,11 @@ interface UploadImagePorpsType { ...@@ -12,10 +13,11 @@ interface UploadImagePorpsType {
disabled?: boolean; disabled?: boolean;
large?: boolean; large?: boolean;
fileMaxSize?: number; fileMaxSize?: number;
showDesc?: boolean
} }
const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => { const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => {
const { imgUrl, onChange, size = "386x256", disabled = false, large = false, fileMaxSize = 200 } = props const { imgUrl, onChange, showDesc = true, size = "386x256", disabled = false, large = false, fileMaxSize = 200 } = props
const [loading, setLoading] = useState<boolean>(false) const [loading, setLoading] = useState<boolean>(false)
const beforeUpload = (file: UploadFile) => { const beforeUpload = (file: UploadFile) => {
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg'; const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png' || file.type === 'image/jpg';
...@@ -34,7 +36,7 @@ const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => { ...@@ -34,7 +36,7 @@ const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => {
action: '/api/file/file/upload', action: '/api/file/file/upload',
headers: {}, headers: {},
data: { data: {
fileType: 1 fileType: UPLOAD_TYPE
}, },
disabled: loading || disabled, disabled: loading || disabled,
showUploadList: false, showUploadList: false,
...@@ -72,9 +74,12 @@ const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => { ...@@ -72,9 +74,12 @@ const UploadImage: React.FC<UploadImagePorpsType> = forwardRef((props, ref) => {
} }
</div>} </div>}
</Upload> </Upload>
<div className={styles.size_require}> {
<p>支持JPG/PNG/JPEG, <br />最大不超过 {fileMaxSize}K, <br />尺寸:{size}</p> showDesc &&
</div> <div className={styles.size_require}>
<p>支持JPG/PNG/JPEG, <br />最大不超过 {fileMaxSize}K, <br />尺寸:{size}</p>
</div>
}
</div> </div>
) )
}) })
......
...@@ -10,6 +10,7 @@ export const MALL_TYPE = { ...@@ -10,6 +10,7 @@ export const MALL_TYPE = {
// 本地环境跳过权限校验 // 本地环境跳过权限校验
export const isDev = process.env.NODE_ENV === "development" export const isDev = process.env.NODE_ENV === "development"
// export const isDev = false
export const Environment_Status = { export const Environment_Status = {
0: "所有", 0: "所有",
......
...@@ -4,30 +4,40 @@ const { onFormInit$ } = FormEffectHooks ...@@ -4,30 +4,40 @@ const { onFormInit$ } = FormEffectHooks
/** /**
* @description 处理异步请求的下拉选择 * @description 处理异步请求的下拉选择
* @param name 待处理的表单路径 * @param {sting[]} name 待处理的表单路径
* @param service 触发的异步函数, 需返回一个{label: any, value: any}形式的数组 * @param {func} service 触发的异步函数, 需返回一个 { label: any, value: any }形式的数组
*/ */
export const useAsyncInitSelect = (name: string[], service?: () => Promise<any>) => { export const useAsyncInitSelect = (name: string[], service?: () => Promise<any>) => {
const { dispatch, setFieldState } = createFormActions() const { dispatch, setFieldState } = createFormActions();
const linkage = useLinkageUtils() const linkage = useLinkageUtils();
onFormInit$().subscribe(() => { onFormInit$().subscribe(() => {
setFieldState(name, state => { const nameStr: string = name.toString();
FormPath.setIn(state, 'props.x-props.hasFeedback', true) const formPath: string = `*(${nameStr})`;
})
name.forEach(v => linkage.loaded(v)) setFieldState(formPath, state => {
FormPath.setIn(state, 'props.x-props.hasFeedback', true);
});
linkage.loading(formPath);
service().then(res => { service().then(res => {
name.forEach(v => { if (res.code === 1000) {
linkage.loaded(v) linkage.loaded(formPath);
linkage.enum(v, res[v]) name.forEach(v => {
}) linkage.enum(v, res[v]);
//请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动 });
dispatch('requestAsyncSelect', { // 请求结束可以dispatch一个自定义事件收尾,方便后续针对该事件做联动
name, dispatch('requestAsyncSelect', {
payload: res name,
}) payload: res,
});
return;
}
linkage.loaded(formPath);
}).catch(err => { }).catch(err => {
// linkage.loaded(name) linkage.loaded(formPath);
// linkage.enum(name, []) });
})
}) })
} }
\ No newline at end of file
@import './mixins/layout.less'; @import './mixins/layout.less';
#root { #root {
// 去除input type为number时的箭头
.ant-input-number-handler-wrap {
display: none;
}
.common_checkbox { .common_checkbox {
&:hover, &:hover,
......
...@@ -8,7 +8,7 @@ export enum PageStatus { ...@@ -8,7 +8,7 @@ export enum PageStatus {
} }
export const usePageStatus = () => { export const usePageStatus = () => {
const { preview, id = '' } = history.location.query const { preview, id = '', ...rest } = history.location.query
// 默认预览状态 // 默认预览状态
let pageStatus = PageStatus.PREVIEW let pageStatus = PageStatus.PREVIEW
if (preview === '1') { if (preview === '1') {
...@@ -24,6 +24,7 @@ export const usePageStatus = () => { ...@@ -24,6 +24,7 @@ export const usePageStatus = () => {
return { return {
pageStatus, pageStatus,
id, id,
preview preview,
...rest,
} }
} }
\ No newline at end of file
...@@ -112,6 +112,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => { ...@@ -112,6 +112,7 @@ const BasicLayout: React.FC<BasicLayoutProps> = (props) => {
{titleDom} {titleDom}
</Link> </Link>
)} )}
collapsed={collapsed}
onCollapse={handleMenuCollapse} onCollapse={handleMenuCollapse}
breadcrumbRender={(routers = []) => [ breadcrumbRender={(routers = []) => [
......
...@@ -87,7 +87,7 @@ const AuthDetail: React.FC<PageProps> = (props: any) => { ...@@ -87,7 +87,7 @@ const AuthDetail: React.FC<PageProps> = (props: any) => {
customKey="id" customKey="id"
checkable checkable
actions={treeActions} actions={treeActions}
treeData={treeData} treeData={[]}
handleSelect={handleSelect} handleSelect={handleSelect}
disabled={pageStatus === PageStatus.PREVIEW} disabled={pageStatus === PageStatus.PREVIEW}
/> />
......
...@@ -17,15 +17,15 @@ const { TabPane } = Tabs; ...@@ -17,15 +17,15 @@ const { TabPane } = Tabs;
const { Step } = Steps; const { Step } = Steps;
const MemberDetail: React.FC<{}> = () => { const MemberDetail: React.FC<{}> = () => {
const { pageStatus, id } = usePageStatus(); const { pageStatus, id, validateId } = usePageStatus();
const [hActived, setHActived] = useState('3'); const [hActived, setHActived] = useState('3');
const [detailData, setDetailData] = useState<any>({}); const [detailData, setDetailData] = useState<any>({});
useEffect(() => { useEffect(() => {
const fetchDetailData = async () => { const fetchDetailData = async () => {
const { data } = await PublicApi.getMemberValidateCommitDetail({ const { data } = await PublicApi.getMemberValidateCommitDetail({
memberId: '2', memberId: id,
validateId: '63', validateId: validateId,
}); });
setDetailData(data); setDetailData(data);
}; };
......
...@@ -57,7 +57,7 @@ const memberMaintain: React.FC<[]> = () => { ...@@ -57,7 +57,7 @@ const memberMaintain: React.FC<[]> = () => {
key: 'name', key: 'name',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<EyePreview <EyePreview
url={`/memberCenter/memberAbility/manage/importDetail?id=${record.id}&preview=1`} url={`/memberCenter/memberAbility/manage/importDetail?id=${record.memberId}&validateId=${record.validateId}&preview=1`}
> >
{text} {text}
</EyePreview> </EyePreview>
......
...@@ -46,25 +46,25 @@ export const importSchema: ISchema = { ...@@ -46,25 +46,25 @@ export const importSchema: ISchema = {
properties: { properties: {
memberType: { memberType: {
type: 'string', type: 'string',
default: 0, default: undefined,
enum: [], enum: [],
'x-component-props': {}, 'x-component-props': {},
}, },
roleId: { roleId: {
type: 'string', type: 'string',
default: 0, default: undefined,
enum: [], enum: [],
'x-component-props': {}, 'x-component-props': {},
}, },
level: { level: {
type: 'string', type: 'string',
default: 0, default: undefined,
enum: [], enum: [],
'x-component-props': {}, 'x-component-props': {},
}, },
source: { source: {
type: 'string', type: 'string',
default: 0, default: undefined,
enum: [], enum: [],
'x-component-props': {}, 'x-component-props': {},
}, },
......
.headerTop {
display: flex;
align-items: center;
font-size: 20px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
&-icon {
width: 48px;
height: 48px;
line-height: 48px;
border-radius: 4px;
border: 1px solid #DFE1E6;
color: #fff;
text-align: center;
background-color: #8777D9;
}
&-level {
color: #172B4D;
margin: 0 8px 0 12px;
}
&-identity {
width: 72px;
height: 24px;
line-height: 24px;
background-color: #FFEBE6;
border-radius: 4px;
color: #E63F3B;
font-size: 14px;
font-weight: 400;
text-align: center;
}
}
.headerMain {
display: flex;
&-left {
flex: 6;
display: flex;
flex-wrap: wrap;
padding-left: 90px;
&-option {
display: flex;
width: calc(100% / 3);
margin-bottom: 17px;
font-size: 14px;
font-family: PingFangSC-Regular, PingFang SC;
font-weight: 400;
color: #6B778C;
padding-right: 20px;
&:nth-of-type(n + 4) {
margin: 0;
}
div {
flex: 1;
&:nth-last-of-type(1) {
flex: 2;
}
}
}
}
&-right {
flex: 1;
text-align: right;
.saveBtn {
color: #fff;
background: @main-color
}
}
}
.extra {
margin-bottom: 48px;
&-main {
display: flex;
&-content {
position: relative;
flex: 1;
height: 104px;
&:nth-last-of-type(1) {
flex: 2.5;
}
}
.left {
display: flex;
justify-content: center;
align-items: center;
.icon {
position: absolute;
left: 0;
top: 0;
width: 72px;
height: 24px;
color: #fff;
background-color: #42526E;
border-radius: 4px 0px 4px 0px;
text-align: center;
}
.input {
display: flex;
justify-content: center;
&-main {
position: relative;
width: 128px;
height: 38px;
padding-bottom: 8px;
&::after {
content: '';
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 1px;
background-color: #DFE1E6;
}
// :global {
// .ant-input {
// border: none;
// box-shadow: none;
// background-color: transparent;
// }
// }
&-com {
width: 100%;
height: 100%;
border: 0;
outline: none;
background-color: rgba(0, 0, 0, 0);
font-size: 32px;
font-weight: 500;
color: #172B4D;
&:focus {
border: none;
box-shadow: none;
background-color: transparent;
}
}
}
}
}
.right {
padding: 27px 40px;
}
}
}
import React, { ReactNode, useState, useRef } from 'react' import React, { ReactNode, useState, useRef } from 'react'
import { history } from 'umi' import { history } from 'umi'
import { Button, Popconfirm, Card, Input, Slider } from 'antd' import { Button, Popconfirm, Card, Input, Slider } from 'antd'
import { ColumnType } from 'antd/lib/table/interface'
import classNames from 'classnames'
import { PageHeaderWrapper } from '@ant-design/pro-layout' import { PageHeaderWrapper } from '@ant-design/pro-layout'
import { PlayCircleOutlined, ContainerOutlined } from '@ant-design/icons' import { PlayCircleOutlined, ContainerOutlined } from '@ant-design/icons'
import { StandardTable } from 'god' import { StandardTable } from 'god'
import { ColumnType } from 'antd/lib/table/interface' import styles from './addEquity.less'
import './index.less'
const data = [ const data = [
{ {
...@@ -143,69 +144,74 @@ const addEquity: React.FC<[]> = () => { ...@@ -143,69 +144,74 @@ const addEquity: React.FC<[]> = () => {
onBack={() => window.history.back()} onBack={() => window.history.back()}
title={ title={
<> <>
<div className='headerTop'> <div className={styles.headerTop}>
<div className='headerTop-icon'></div> <div className={styles['headerTop-icon']}></div>
<div className='headerTop-level'>钻石会员</div> <div className={styles['headerTop-level']}>钻石会员</div>
<div className='headerTop-identity'>商户会员</div> <div className={styles['headerTop-identity']}>商户会员</div>
</div> </div>
</> </>
} }
content={ content={
<div className='headerMain'> <div className={styles.headerMain}>
<div className='headerMain-left'> <div className={styles['headerMain-left']}>
<div className='headerMain-left-option'> <div className={styles['headerMain-left-option']}>
<div>会员等级:</div> <div>会员等级:</div>
<div>1</div> <div>1</div>
</div> </div>
<div className='headerMain-left-option'> <div className={styles['headerMain-left-option']}>
<div>升级分值标签:</div> <div>升级分值标签:</div>
<div>交易分</div> <div>交易分</div>
</div> </div>
<div className='headerMain-left-option'> <div className={styles['headerMain-left-option']}>
<div>角色类型:</div> <div>角色类型:</div>
<div>服务消费</div> <div>服务消费</div>
</div> </div>
<div className='headerMain-left-option'> <div className={styles['headerMain-left-option']}>
<div>会员等级说明:</div> <div>会员等级说明:</div>
<div>商户所属钻石会员</div> <div>商户所属钻石会员</div>
</div> </div>
<div className='headerMain-left-option'> <div className={styles['headerMain-left-option']}>
<div>会员角色名称:</div> <div>会员角色名称:</div>
<div>采购商</div> <div>采购商</div>
</div> </div>
<div className='headerMain-left-option'> <div className={styles['headerMain-left-option']}>
<div>会员类型:</div> <div>会员类型:</div>
<div>企业会员</div> <div>企业会员</div>
</div> </div>
</div> </div>
<div className='headerMain-right'> <div className={styles['headerMain-right']}>
<Button className='saveBtn' icon={<ContainerOutlined />}>保存</Button> <Button className={styles.saveBtn} icon={<ContainerOutlined />}>保存</Button>
</div> </div>
</div> </div>
} }
> >
<Card> <Card>
<StandardTable <StandardTable
tableProps={{
rowKey: 'id',
pagination: false,
}}
columns={columns} columns={columns}
currentRef={ref} currentRef={ref}
fetchTableData={(params: any) => fetchData(params)} fetchTableData={(params: any) => fetchData(params)}
controlRender={ controlRender={
<> <>
<div className='extra'> <div className={styles.extra}>
<h3>升级阀值</h3> <h3>升级阀值</h3>
<div className='extra-main'> <div className={styles['extra-main']}>
<div className='extra-main-content left'> <div className={classNames(styles['extra-main-content'], styles.left)}>
<div className='icon'>当前阀值</div> <div className={styles.icon}>当前阀值</div>
<div className='input'> <div className={styles.input}>
<div className='input-main'> <div className={styles['input-main']}>
<Input className='input-main-com' <Input
className={styles['input-main-com']}
value={thresholdValue} value={thresholdValue}
onChange={(e: any) => { e.persist(); setThresholdValue(e.target.value) }} onChange={(e: any) => { e.persist(); setThresholdValue(e.target.value) }}
/> />
</div> </div>
</div> </div>
</div> </div>
<div className='extra-main-content right'> <div className={classNames(styles['extra-main-content'], styles.right)}>
<Slider <Slider
marks={marks} marks={marks}
max={50000} max={50000}
......
...@@ -7,51 +7,6 @@ ...@@ -7,51 +7,6 @@
margin-left: 16px; margin-left: 16px;
} }
.headerMain {
display: flex;
&-left {
flex : 6;
display : flex;
flex-wrap : wrap;
padding-left: 90px;
&-option {
display : flex;
width : calc(100% / 3);
margin-bottom: 17px;
font-size : 14px;
font-family : PingFangSC-Regular, PingFang SC;
font-weight : 400;
color : #6B778C;
padding-right: 20px;
&:nth-of-type(n + 4) {
margin: 0;
}
div {
flex: 1;
&:nth-last-of-type(1) {
flex: 2;
}
}
}
}
&-right {
flex : 1;
text-align: right;
.saveBtn {
color : #fff;
background: @main-color
}
}
}
.nameCellTitle { .nameCellTitle {
color : @main-color; color : @main-color;
cursor: pointer; cursor: pointer;
...@@ -85,116 +40,7 @@ ...@@ -85,116 +40,7 @@
background-size: 24px 20px; background-size: 24px 20px;
} }
.headerTop {
display : flex;
align-items: center;
font-size : 20px;
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
&-icon {
width : 48px;
height : 48px;
line-height : 48px;
border-radius : 4px;
border : 1px solid #DFE1E6;
color : #fff;
text-align : center;
background-color: #8777D9;
}
&-level {
color : #172B4D;
margin: 0 8px 0 12px;
}
&-identity {
width : 72px;
height : 24px;
line-height : 24px;
background-color: #FFEBE6;
border-radius : 4px;
color : #E63F3B;
font-size : 14px;
font-weight : 400;
text-align : center;
}
}
h3 { h3 {
margin-bottom: 20px; margin-bottom: 20px;
}
.extra {
margin-bottom: 48px;
&-main {
display: flex;
&-content {
position: relative;
flex : 1;
height : 104px;
&:nth-last-of-type(1) {
flex: 2.5;
}
}
.left {
display : flex;
justify-content: center;
align-items : center;
.icon {
position : absolute;
left : 0;
top : 0;
width : 72px;
height : 24px;
color : #fff;
background-color: #42526E;
border-radius : 4px 0px 4px 0px;
text-align : center;
}
.input {
display : flex;
justify-content: center;
&-main {
position : relative;
width : 128px;
height : 38px;
padding-bottom: 8px;
&::after {
content : '';
position : absolute;
left : 0;
bottom : 0;
width : 100%;
height : 1px;
background-color: #DFE1E6;
}
&-com {
width : 100%;
height : 100%;
border : 0;
outline : none;
background-color: rgba(0, 0, 0, 0);
font-size : 32px;
font-family : PingFangSC-Medium, PingFang SC;
font-weight : 500;
color : #172B4D;
}
}
}
}
.right {
padding: 27px 40px;
}
}
} }
\ No newline at end of file
...@@ -46,7 +46,7 @@ const MemberLevel: React.FC<[]> = () => { ...@@ -46,7 +46,7 @@ const MemberLevel: React.FC<[]> = () => {
key: 'levelTag', key: 'levelTag',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<EyePreview <EyePreview
url={`/memberCenter/memberAbility/manage/addEquity?id=${record.id}&preview=1`} url={`/memberCenter/memberAbility/manage/level/addEquity?id=${record.id}&preview=1`}
> >
{text} {text}
</EyePreview> </EyePreview>
...@@ -109,7 +109,7 @@ const MemberLevel: React.FC<[]> = () => { ...@@ -109,7 +109,7 @@ const MemberLevel: React.FC<[]> = () => {
<Button <Button
type="link" type="link"
onClick={() => onClick={() =>
history.push(`/memberCenter/memberAbility/manage/addEquity?id=${record.id}`) history.push(`/memberCenter/memberAbility/manage/level/addEquity?id=${record.id}`)
} }
> >
设置 设置
......
...@@ -57,7 +57,7 @@ const memberMaintain: React.FC<[]> = () => { ...@@ -57,7 +57,7 @@ const memberMaintain: React.FC<[]> = () => {
key: 'name', key: 'name',
render: (text: any, record: any) => ( render: (text: any, record: any) => (
<EyePreview <EyePreview
url={`/memberCenter/memberAbility/manage/maintainDetail?id=${record.id}&preview=1`} url={`/memberCenter/memberAbility/manage/importDetail?id=${record.memberId}&validateId=${record.validateId}&preview=1`}
> >
{text} {text}
</EyePreview> </EyePreview>
......
...@@ -85,7 +85,7 @@ const LoginWrap: React.FC = () => { ...@@ -85,7 +85,7 @@ const LoginWrap: React.FC = () => {
</Form.Item>) </Form.Item>)
} }
<Form.Item> <Form.Item>
<Button type='primary' size='large' htmlType='submit' block>点击登录</Button> <Button type='primary' size='large' htmlType='submit' block>登录</Button>
</Form.Item> </Form.Item>
</Form> </Form>
} }
......
This diff is collapsed.
import { ISchema } from '@formily/antd';
import { PATTERN_MAPS } from '@/constants/regExp';
import { GlobalConfig } from '@/global/config';
export const registerStep0Schema: ISchema = {
type: 'object',
properties: {
REGISTER_STEP: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
className: 'registerForm',
full: true
},
properties: {
phone: {
type: 'string',
required: true,
"x-rules": [
{
pattern: PATTERN_MAPS.phone,
message: '请填写手机号'
}
],
"x-component-props": {
placeholder: '请输入您的手机号码',
size: 'large'
},
"x-props": {
addonBefore: "{{phoneBefore}}"
}
},
smsCode: {
type: 'string',
"x-component": 'Phone',
required: true,
"x-rules": [
{
pattern: PATTERN_MAPS.smsCode,
message: '请输入正确的6位验证码'
}
],
"x-component-props": {
size: 'large',
}
},
password: {
type: 'password',
required: true,
"x-rules": [
{
pattern: PATTERN_MAPS.password,
message: '请输入正确的密码'
}
],
"x-component-props": {
placeholder: '请设置你的登录密码',
size: 'large',
}
},
confirmPassword: {
type: 'password',
required: true,
"x-rules": [
{
pattern: PATTERN_MAPS.password,
message: '请输入正确的密码'
}
],
"x-component-props": {
placeholder: '请再次输入你的登录密码',
size: 'large',
}
},
email: {
type: 'string',
"x-rules": [
{
pattern: PATTERN_MAPS.email,
message: '请输入正确的邮箱'
}
],
"x-component-props": {
placeholder: '请输入你的邮箱(选填)',
size: 'large',
type: 'email'
}
},
isRead: {
required: true,
"x-component": 'CheckboxSingle',
"x-component-props": {
children: "{{checkBoxChildren}}"
}
}
}
},
}
}
export const registerStep1Schema: ISchema = {
type: 'object',
properties: {
REGISTER_STEP: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
className: 'formBoxStep2'
},
properties: {
BLOCK_LAYOUT1: {
type: 'object',
"x-component": 'block',
"x-component-props": {
title: "{{memberTypeTitle}}",
className: 'mr_t-40'
},
properties: {
typeId: {
type: 'string',
required: true,
"x-component": 'CustomRadio',
"x-component-props": {
layout: 'column'
},
enum: GlobalConfig.userRegister.useType.memberType.map(v => {
return {
value: v.id,
label: v.typeName
}
})
},
}
},
BLOCK_LAYOUT2: {
type: 'object',
"x-component": 'block',
"x-component-props": {
title: "{{businessTypeTitle}}",
className: 'mr_t-40'
},
properties: {
businessTypeId: {
type: 'string',
required: true,
"x-component": 'CustomRadio',
"x-component-props": {
layout: 'row'
},
enum: GlobalConfig.userRegister.useType.businessType.map(v => {
return {
value: v.id,
label: v.typeName
}
})
},
}
}
},
}
}
}
export default {
schema0: registerStep0Schema,
schema1: registerStep1Schema
}
\ No newline at end of file
import { ReactText } from 'react'; import React, { ReactText } from 'react';
import moment from 'moment'; import moment from 'moment';
import deepClone from 'clone' import deepClone from 'clone'
import { ISchema } from '@formily/antd';
import { UPLOAD_TYPE } from '@/constants';
import queryString from 'query-string'
function isArray(arr: any) { function isArray(arr: any) {
return Array.isArray(arr) return Array.isArray(arr)
...@@ -239,6 +242,102 @@ export const findTreeKeys = (arr: any[], keyword?: ReactText) => { ...@@ -239,6 +242,102 @@ export const findTreeKeys = (arr: any[], keyword?: ReactText) => {
return results return results
} }
// 转化object 成schema
export const transFormSchema = (data: any[]): ISchema => {
return {
type: 'object',
properties: {
'MEGA_LAYOUT2': {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
className: 'formBoxStep2'
},
properties: {
detail: {
type: 'object',
properties: data.reduce((prev, next, index) => {
prev[`NO_SUBMIT_BLOCK${index}`] = {
type: 'object',
"x-component": 'block',
"x-component-props": {
className: 'mr_t-40',
title: <span className={'commonPanelTitle'}>{next.groupName}</span>
},
properties: {
[`NO_SUBMIT_BLOCK_MEGA${index}`]: {
type: 'object',
"x-component": 'mega-layout',
"x-component-props": {
columns: 2,
grid: true,
autoRow: true,
size: 'large',
className: 'mr_t-24'
},
properties: next.elements.reduce((subP, subN, subI) => {
subP[subN.fieldName] = getFieldType(subN)
return subP
}, {})
}
}
}
return prev
}, {})
}
}
}
}
}
}
// 获取字段类型,改为schema可识别的
export const getFieldType = (field) => {
if (field.fieldType === 'upload') {
return {
type: 'string',
"x-component": "CustomUpload",
"x-mega-props": {
span: 2
},
required: field.fieldEmpty === 0,
title: field.fieldCNName,
"x-component-props": {
showDesc: false
}
}
} else {
return {
type: 'string',
"x-mega-props": {
span: 1
},
"x-component": "CustomInput",
required: field.fieldEmpty === 0,
"x-rules": field.checkRules.map(v => {
return {
message: v.msg,
pattern: v.rulePattern
}
}),
maxLength: field.fieldLength,
"x-component-props": {
help: field.fieldRemark,
placeholder: `请输入${field.fieldCNName}`,
size: 'large'
}
}
}
}
export const getQueryStringParams = (url?: string) => {
const nowUrl = url || window.location.href
const firstIndex = nowUrl.indexOf('?')
const searchParam = url ? url.substring(firstIndex) : window.location.search
return queryString.parse(searchParam)
}
export default { export default {
isArray, isArray,
isObject, isObject,
......
...@@ -115,11 +115,8 @@ class ApiRequest { ...@@ -115,11 +115,8 @@ class ApiRequest {
options.ctlType === 'message' && message.success(res.message) options.ctlType === 'message' && message.success(res.message)
resolve(res) resolve(res)
} else { } else {
// 未登录 // 使用resolve将数据返回, 请求时需手动处理data为null的情况
if (res.code === 1101) { resolve(res)
history.push('/user/login')
reject()
}
message.error(res.message) message.error(res.message)
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment