import React from 'react'; import { Link } from 'react-router-dom'; import './index.less'; import Page from '@src/containers/Page'; import Block from '@src/components/Block'; import FilterLayout from '@src/layouts/FilterLayout'; import ActionLayout from '@src/layouts/ActionLayout'; import TableLayout from '@src/layouts/TableLayout'; import { getMap, formatDate } from '@src/services/Tools'; import { asyncSMessage, asyncForm } from '@src/services/AsyncTools'; import { SwitchSelect, PassSelect, InputSelect, MobileArea } from '../../../../Constant'; import { User } from '../../../stores/user'; const SwitchSelectMap = getMap(SwitchSelect, 'value', 'label'); const PassSelectMap = getMap(PassSelect, 'value', 'label'); const InputSelectMap = getMap(InputSelect, 'value', 'label'); export default class extends Page { constructor(props) { super(props); this.filterF = null; } init() { this.actionList = [{ key: 'add', type: 'primary', name: '创建', }]; this.itemList = [{ key: 'id', type: 'hidden', }, { key: 'area', type: 'select', name: '国际码', select: MobileArea, required: true, }, { key: 'mobile', type: 'input', name: '手机号', placeholder: '请输入', required: true, option: { normalize: (value) => { if (!value) return value; if (this.mobile === value) return value; if (this.timeout) { clearTimeout(this.timeout); this.timeout = null; } this.timeout = setTimeout(() => { User.validMobile({ area: this.formF.getFieldValue('area'), mobile: value }).then(result => { this.mobile = value; this.itemList[2].suffix = !result ? '已注册' : '未注册'; this.formF.setFieldsValue({ load: true }); }); }, 1500); return value; }, }, }, { key: 'nickname', type: 'input', name: '昵称', }, { key: 'email', type: 'input', name: '邮箱', }]; this.filterForm = [{ key: 'keyword', type: 'input', name: 'ID/手机号', placeholder: '请输入', }, { key: 'real', type: 'select', allowClear: true, name: '实名认证', select: PassSelect, placeholder: '请选择', number: true, }, { key: 'wechat', type: 'select', allowClear: true, name: '绑定微信', select: SwitchSelect, placeholder: '请选择', number: true, }, { key: 'prepare', type: 'select', allowClear: true, name: '备考信息', select: InputSelect, placeholder: '请选择', number: true, }, { key: 'time', type: 'daterange', name: '注册时间', }]; this.columns = [{ title: 'ID', dataIndex: 'id', }, { title: '手机号', dataIndex: 'mobile', }, { title: '昵称', dataIndex: 'nickname', }, { title: '注册时间', sorter: true, dataIndex: 'createTime', render: (text) => { return formatDate(text, 'YYYY-MM-DD'); }, }, { title: '实名认证', dataIndex: 'realStatus', render: (text) => { return PassSelectMap[text ? 1 : 0]; }, }, { title: '绑定微信', dataIndex: 'wechatUnionid', render: (text) => { return SwitchSelectMap[text ? 1 : 0]; }, }, { title: '备考信息', dataIndex: 'prepareStatus', render: (text) => { return InputSelectMap[text ? 1 : 0]; }, }, { title: '操作', dataIndex: 'handler', render: (text, record) => { return