diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryInput.cs b/Api/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryInput.cs index 7a97453..096f601 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryInput.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseQuery/Dto/HouseQueryInput.cs @@ -1,6 +1,7 @@ using Ewide.Core; using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -11,4 +12,10 @@ namespace Ewide.Application { } + + public class HouseQueryDetailInput + { + [Required(ErrorMessage = "Id不能为空")] + public string Id { get; set; } + } } diff --git a/Api/Ewide.Application/Service/HouseSafety/HouseQuery/HouseQueryService.cs b/Api/Ewide.Application/Service/HouseSafety/HouseQuery/HouseQueryService.cs index 453fd84..5800149 100644 --- a/Api/Ewide.Application/Service/HouseSafety/HouseQuery/HouseQueryService.cs +++ b/Api/Ewide.Application/Service/HouseSafety/HouseQuery/HouseQueryService.cs @@ -3,7 +3,9 @@ using Ewide.Core.Extension; using Furion.DatabaseAccessor; using Furion.DependencyInjection; using Furion.DynamicApiController; +using Mapster; using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; using System; using System.Collections.Generic; using System.Linq; @@ -77,5 +79,32 @@ WHERE 1=1"; "TotalFloor" }); } + + [HttpGet("/houseQuery/detail")] + public async Task Detail([FromQuery] HouseQueryDetailInput input) + { + var houseCodeOutputAsync = await _dapperRepository.QueryAsync( + @"SELECT HC.Id,HC.Address,HC.ProjectId,HC.ZoneId,HC.Type,AA.Name AreaName,RA.Name RoadName,CA.Name CommName,O.Name ZoneName,Proj.Note ProjectNote,CONCAT(Proj.Name,'(',Proj.Note,')') ProjectFullName,HC.HouseCode,HC.Lng,HC.Lat,HC.No FROM bs_house_code HC +LEFT JOIN bs_house_projectinfo Proj ON Proj.Id=HC.ProjectId +LEFT JOIN sys_org O ON HC.ZoneId = O.Id +LEFT JOIN sys_area_code CA ON CA.Code = Proj.AreaCode +LEFT JOIN sys_area_code RA ON RA.AdCode = SUBSTR(CA.AdCode,1,9) +LEFT JOIN sys_area_code AA ON AA.AdCode = SUBSTR(CA.AdCode,1,6) +WHERE HC.Id=@Id", new { input.Id } + ); + + var houseCodeOutput = houseCodeOutputAsync.SingleOrDefault(); + + + var houseInfoOutputForDetailPage = new HouseInfoOutputForDetailPage + { + HouseCode = houseCodeOutput + }; + + var houseInfoOutput = (await _houseInfoRep.DetachedEntities.FirstOrDefaultAsync(p => p.HouseCodeId == houseCodeOutput.Id)).Adapt(); + houseInfoOutputForDetailPage.HouseInfo = houseInfoOutput; + + return houseInfoOutputForDetailPage; + } } } diff --git a/Api/Ewide.Core/Extension/RestfulResultProvider.cs b/Api/Ewide.Core/Extension/RestfulResultProvider.cs index 9216ce0..7181e07 100644 --- a/Api/Ewide.Core/Extension/RestfulResultProvider.cs +++ b/Api/Ewide.Core/Extension/RestfulResultProvider.cs @@ -41,6 +41,20 @@ namespace Ewide.Core // 解析异常信息 var (StatusCode, ErrorCode, Errors) = UnifyContext.GetExceptionMetadata(context); + // 如果是代码自行抛出的异常,视为接口调用成功,返回结果失败 + if (context.Exception.GetType() == typeof(Furion.FriendlyException.AppFriendlyException)) + { + return DisplayJson(new RestfulResult + { + Code = StatusCodes.Status200OK, + Success = false, + Data = null, + Message = Errors, + Extras = UnifyContext.Take(), + Timestamp = DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() + }); + } + return DisplayJson(new RestfulResult { Code = StatusCode, diff --git a/Api/Ewide.Core/Service/User/SysUserService.cs b/Api/Ewide.Core/Service/User/SysUserService.cs index d028ee9..e32a508 100644 --- a/Api/Ewide.Core/Service/User/SysUserService.cs +++ b/Api/Ewide.Core/Service/User/SysUserService.cs @@ -431,7 +431,7 @@ namespace Ewide.Core.Service /// ///发送验证码 /// - [HttpPost("/sysUser/SendCode")] + [HttpPost("/sysUser/sendCode")] public async Task SendCode(Usermailphone input) { var Orgcode_Key = "ewide_Orgcode"; @@ -505,7 +505,7 @@ namespace Ewide.Core.Service /// ///检验验证码并且绑定 /// - [HttpPost("/sysUser/CheckBindcode")] + [HttpPost("/sysUser/checkBindcode")] public async Task CheckBindcode(Usermailphone input) { var Orgcode_Key = "ewide_Orgcode"; diff --git a/Api/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs b/Api/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs index 6bdaca5..8dac982 100644 --- a/Api/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs +++ b/Api/Ewide.EntityFramework.Core/DbContexts/DefaultDbContext.cs @@ -168,6 +168,7 @@ namespace Ewide.EntityFramework.Core base.OnModelCreating(modelBuilder); if (App.HostEnvironment.EnvironmentName == "Testing") return; //集成测试下面代码会报错 +#if DEBUG XmlSerializerUtil xmlHandler = new XmlSerializerUtil(); Dictionary dic = xmlHandler.ReaderALL(); foreach (KeyValuePair item in dic) @@ -183,6 +184,7 @@ namespace Ewide.EntityFramework.Core } modelBuilder.Entity(item.Key).HasData(data); } +#endif } } } \ No newline at end of file diff --git a/Api/Ewide.Web.Entry/Properties/PublishProfiles/FolderProfile.pubxml b/Api/Ewide.Web.Entry/Properties/PublishProfiles/FolderProfile.pubxml new file mode 100644 index 0000000..040b013 --- /dev/null +++ b/Api/Ewide.Web.Entry/Properties/PublishProfiles/FolderProfile.pubxml @@ -0,0 +1,16 @@ + + + + + False + False + True + Release + Any CPU + FileSystem + bin\Release\net5.0\publish\ + FileSystem + + \ No newline at end of file diff --git a/web-react/.env.development b/web-react/.env.development new file mode 100644 index 0000000..b8402ce --- /dev/null +++ b/web-react/.env.development @@ -0,0 +1 @@ +REACT_APP_BASE_URL=http://localhost:5566/ \ No newline at end of file diff --git a/web-react/.env.production b/web-react/.env.production new file mode 100644 index 0000000..a7692b7 --- /dev/null +++ b/web-react/.env.production @@ -0,0 +1 @@ +REACT_APP_BASE_URL=http://118.178.224.202:90/ \ No newline at end of file diff --git a/web-react/package.json b/web-react/package.json index 8f2e44b..3a99c4e 100644 --- a/web-react/package.json +++ b/web-react/package.json @@ -20,6 +20,7 @@ "photoswipe": "^4.1.3", "react": "^17.0.2", "react-color": "^2.19.3", + "react-cropper": "^2.1.8", "react-dom": "^17.0.2", "react-json-view": "^1.21.3", "react-monaco-editor": "^0.43.0", @@ -44,6 +45,7 @@ "rules": { "eqeqeq": "off", "no-unused-vars": "off", + "no-sparse-arrays": "off", "array-callback-return": "off", "jsx-a11y/anchor-is-valid": "off" } diff --git a/web-react/public/favicon.ico b/web-react/public/favicon.ico index a11777c..ae7c797 100644 Binary files a/web-react/public/favicon.ico and b/web-react/public/favicon.ico differ diff --git a/web-react/public/index.html b/web-react/public/index.html index b92c542..fb47694 100644 --- a/web-react/public/index.html +++ b/web-react/public/index.html @@ -24,7 +24,7 @@ work correctly both with client-side routing and a non-root public URL. Learn how to configure a non-root public URL by running `npm run build`. --> - React App + 宽易科技 diff --git a/web-react/src/assets/style/lib/anchor.less b/web-react/src/assets/style/lib/anchor.less index 198ee0d..e37e90f 100644 --- a/web-react/src/assets/style/lib/anchor.less +++ b/web-react/src/assets/style/lib/anchor.less @@ -9,6 +9,3 @@ border-radius: 0; background-color: @primary-color; } -.ant-anchor-link-active { - background: linear-gradient(90deg, #fff, transparent); -} diff --git a/web-react/src/assets/style/lib/form.less b/web-react/src/assets/style/lib/form.less index c587a27..4efbe7a 100644 --- a/web-react/src/assets/style/lib/form.less +++ b/web-react/src/assets/style/lib/form.less @@ -220,6 +220,23 @@ color: fade(@black, 50%); } } + &.yo-form--no-border { + .ant-form-item { + padding: @padding-md 0; + + border-right: 0; + border-left: 0; + &:first-child { + border-top: 0; + } + &:last-child { + border-bottom: 0; + } + } + .yo-form-group { + margin-bottom: 0; + } + } } .yo-modal-form { .ant-modal-body { diff --git a/web-react/src/common/api/index.js b/web-react/src/common/api/index.js index 0f80ffc..e9d7915 100644 --- a/web-react/src/common/api/index.js +++ b/web-react/src/common/api/index.js @@ -13,11 +13,11 @@ import status from './status' * api.getItemGroupType(parmas).then(...) */ import urls from './requests' -import { notification } from 'antd' +import { message as Message, notification } from 'antd' const STATUS = status -axios.defaults.baseURL = '/api' +axios.defaults.baseURL = process.env.NODE_ENV === 'development' ? '/api' : process.env.REACT_APP_BASE_URL const initInstance = (options) => { const instance = axios @@ -64,6 +64,10 @@ const errorNotification = ({ code, message }) => { } } +const errorMessage = (message) => { + Message.error(message) +} + const handlerUnauthorized = () => { token.value = '' window.location.replace('/login') @@ -125,13 +129,28 @@ for (let key in urls) { api[`${key}Await`](params) .then((res) => { const { data } = res + const isFile = [ArrayBuffer, Blob].includes(data.constructor) + const result = isFile ? res : data + + // 错误的返回码,以通知的形式弹出 if (errerCodes.indexOf(data.code) >= 0) { errorNotification(data) - reject([ArrayBuffer, Blob].indexOf(data.constructor) > -1 ? res : data) - } else if (data.code === STATUS.Unauthorized) { + reject(result) + } + + // 非文件,返回码正确,但是结果失败,以消息的形式弹出 + else if (!isFile && !data.success) { + errorMessage(data.message) + reject(result) + } + + // 未登录 + else if (data.code === STATUS.Unauthorized) { handlerUnauthorized() - } else { - reslove([ArrayBuffer, Blob].indexOf(data.constructor) > -1 ? res : data) + } + + else { + reslove(result) } }) .catch(({ response }) => { diff --git a/web-react/src/common/api/requests/business/houseSafety/houseQuery.js b/web-react/src/common/api/requests/business/houseSafety/houseQuery.js index 6357a36..4749d9d 100644 --- a/web-react/src/common/api/requests/business/houseSafety/houseQuery.js +++ b/web-react/src/common/api/requests/business/houseSafety/houseQuery.js @@ -1,5 +1,6 @@ const urls = { houseQueryPage: ['/houseQuery/page', 'post'], + houseQueryDetail: ['/houseQuery/detail', 'get'], } export default urls \ No newline at end of file diff --git a/web-react/src/common/api/requests/sys/userManage.js b/web-react/src/common/api/requests/sys/userManage.js index af29f3f..2d9a478 100644 --- a/web-react/src/common/api/requests/sys/userManage.js +++ b/web-react/src/common/api/requests/sys/userManage.js @@ -78,12 +78,12 @@ const urls = { /** * 发送验证码 */ - SendCode: ['/sysUser/SendCode', 'post'], + sysUserSendCode: ['/sysUser/sendCode', 'post'], /** * 绑定/验证 */ - CheckBindcode: ['/sysUser/CheckBindcode', 'post'], + sysUserCheckBindcode: ['/sysUser/checkBindcode', 'post'], } diff --git a/web-react/src/components/authority-view/index.jsx b/web-react/src/components/authority-view/index.jsx index 58cf93d..0bac500 100644 --- a/web-react/src/components/authority-view/index.jsx +++ b/web-react/src/components/authority-view/index.jsx @@ -78,28 +78,26 @@ function renderItem(data) { } function renderCheckbox(data) { - return ( + const grid = ( ) + return data.remark ? ( + + {grid} + + ) : ( + grid + ) } export default class AuthorityView extends Component { diff --git a/web-react/src/components/container/index.jsx b/web-react/src/components/container/index.jsx index d3c57fb..c2edbdc 100644 --- a/web-react/src/components/container/index.jsx +++ b/web-react/src/components/container/index.jsx @@ -1,29 +1,23 @@ import React, { Component } from 'react' export default class Container extends Component { - getMode(mode) { const c = 'container' - switch (mode) { - case 'sm': - return c + '-sm' - case 'md': - return c + '-md' - case 'fluid': - return c + '-fluid' - default: - return c + const modes = ['xxs', 'xs', 'sm', 'md', 'fluid'] + if (modes.includes(mode)) { + return `${c}-${mode}` } + return c } render() { - let className = this.getMode(this.props.mode) - if (this.props.className) { - className += ` ${this.props.className}` + const { mode, className, children } = this.props + + let containerName = this.getMode(mode) + if (className) { + containerName = [containerName, className].join(' ') } - return ( -
{this.props.children}
- ) + return
{children}
} } diff --git a/web-react/src/components/image/index.jsx b/web-react/src/components/image/index.jsx index 2b2c6c5..d84dc6a 100644 --- a/web-react/src/components/image/index.jsx +++ b/web-react/src/components/image/index.jsx @@ -3,7 +3,7 @@ import { Avatar } from 'antd' import { isEqual } from 'lodash' import { PreviewFileBase64 } from 'util/file' -const getSrc = async (id) => { +const getSrc = async id => { if (id) { const base64 = await PreviewFileBase64(id) return base64 @@ -12,9 +12,8 @@ const getSrc = async (id) => { } export default class Image extends Component { - state = { - src: '' + src: '', } id = '' @@ -25,9 +24,9 @@ export default class Image extends Component { this.setSrc() } - shouldComponentUpdate(props) { + shouldComponentUpdate(props, state) { // props变更或state.src变更时进行渲染 - return !isEqual(this.props, props) || !this.state.src + return !isEqual(this.props, props) || this.state.src !== state.src } componentDidUpdate() { @@ -46,13 +45,9 @@ export default class Image extends Component { render() { if (this.props.type === 'avatar') { - return ( - - ) + return } else { - return ( - - ) + return } } } diff --git a/web-react/src/components/index.js b/web-react/src/components/index.js index b66489e..6ed3ee0 100644 --- a/web-react/src/components/index.js +++ b/web-react/src/components/index.js @@ -1,4 +1,4 @@ -export { default as AntIcon } from 'components/ant-icon' +export { default as AntIcon } from './ant-icon' export { default as AuthorityView } from './authority-view' export { default as Auth } from './authorized' export { default as ColorSelector } from './form/color-selector' diff --git a/web-react/src/components/query-table/index.jsx b/web-react/src/components/query-table/index.jsx index f1c3049..71e29ba 100644 --- a/web-react/src/components/query-table/index.jsx +++ b/web-react/src/components/query-table/index.jsx @@ -222,31 +222,33 @@ export default class QueryTable extends Component { this.query = this.props.queryInitialValues } - const res = await this.loadData( - { - pageIndex: this.pagination.current, - pageSize: this.pagination.pageSize, - ...this.sorter, - }, - cloneDeep(this.query) - ) - if (res.rows || res.data || res.items) { - this.setState({ - type: 'table', - dataSource: res.rows || res.data || res.items, - }) + try { + const res = await this.loadData( + { + pageIndex: this.pagination.current, + pageSize: this.pagination.pageSize, + ...this.sorter, + }, + cloneDeep(this.query) + ) + if (res.rows || res.data || res.items) { + this.setState({ + type: 'table', + dataSource: res.rows || res.data || res.items, + }) - this.pagination.total = res.totalCount - } else if (res) { - this.setState({ - type: 'tree', - dataSource: clearChildren(res), - }) + this.pagination.total = res.totalCount + } else if (res) { + this.setState({ + type: 'tree', + dataSource: clearChildren(res), + }) - this.pagination = false + this.pagination = false + } + } finally { + this.onLoaded() } - - this.onLoaded() } /** diff --git a/web-react/src/pages/business/house/query/detail.jsx b/web-react/src/pages/business/house/query/detail.jsx new file mode 100644 index 0000000..60c4d18 --- /dev/null +++ b/web-react/src/pages/business/house/query/detail.jsx @@ -0,0 +1,35 @@ +import React, { Component } from 'react' +import { Card } from 'antd' +import Container from 'components/container' +import { api } from 'common/api' +import ReactJson from 'react-json-view' + +export default class detail extends Component { + state = { + loading: false, + record: null, + } + + componentDidMount() { + // 获取详细数据 + const { id } = this.props.param + if (id) { + api.houseQueryDetail({ id }).then(({ data }) => { + this.setState({ + record: data, + loading: false, + }) + }) + } + } + + render() { + return ( + + + + + + ) + } +} diff --git a/web-react/src/pages/business/house/query/index.jsx b/web-react/src/pages/business/house/query/index.jsx index 0c03ce9..937dc5b 100644 --- a/web-react/src/pages/business/house/query/index.jsx +++ b/web-react/src/pages/business/house/query/index.jsx @@ -12,7 +12,14 @@ import { Row, Tag, } from 'antd' -import { AntIcon, Auth, Container, InputNumberRange, QueryTable } from 'components' +import { + AntIcon, + Auth, + Container, + InputNumberRange, + QueryTable, + QueryTableActions, +} from 'components' import { api } from 'common/api' import auth from 'components/authorized/handler' import { first, isEqual, last } from 'lodash' @@ -46,6 +53,9 @@ const authName = 'houseQuery' export default class index extends Component { state = { codes: { + houseStatus: [], + houseType: [], + houseIndustry: [], houseUsedStatus: [], housePropertyRights: [], landAttribute: [], @@ -95,10 +105,11 @@ export default class index extends Component { sorter: true, }, { - title: '任务截止时间', - dataIndex: 'endTime', + title: '建档状态', + dataIndex: 'state', sorter: true, - width: 150, + width: 100, + render: text => this.bindCodeValue(text, 'house_status'), }, ] @@ -109,7 +120,22 @@ export default class index extends Component { constructor(props) { super(props) - const flag = auth({ [authName]: [['edit'], ['delete']] }) + const flag = auth({ [authName]: 'detail' }) + + if (flag) { + this.columns.push({ + title: '操作', + width: 150, + dataIndex: 'actions', + render: (text, record) => ( + + + this.onOpen(record.id)}>查看 + + + ), + }) + } } /** @@ -132,6 +158,9 @@ export default class index extends Component { const { onLoading, onLoadData } = this.table.current onLoading() getDictData( + 'house_status', + 'house_type', + 'house_industry', 'house_used_status', 'house_property_rights', 'land_attribute', @@ -198,8 +227,12 @@ export default class index extends Component { * @param {*} modal * @param {*} id */ - onOpen(modal, id) { - modal.current.open({ id }) + onOpen(id) { + window.openContentWindow({ + title: '房屋详情', + path: 'business/house/query/detail', + param: { id }, + }) } /** diff --git a/web-react/src/pages/business/house/task/index.jsx b/web-react/src/pages/business/house/task/index.jsx index 635eded..ff9fcb6 100644 --- a/web-react/src/pages/business/house/task/index.jsx +++ b/web-react/src/pages/business/house/task/index.jsx @@ -28,14 +28,7 @@ const authName = 'houseTask' export default class index extends Component { state = { codes: { - status: [ - { code: -1, value: '审核退回' }, - { code: 0, value: '待处理' }, - { code: 1, value: '暂存' }, - { code: 2, value: '待提交' }, - { code: 3, value: '审核中' }, - { code: 6, value: '审核通过' }, - ], + houseStatus: [], houseType: [], houseIndustry: [], }, @@ -92,7 +85,7 @@ export default class index extends Component { dataIndex: 'state', sorter: true, width: 100, - render: text => this.bindCodeValue(text, 'status'), + render: text => this.bindCodeValue(text, 'house_status'), }, ] @@ -146,7 +139,7 @@ export default class index extends Component { componentDidMount() { const { onLoading, onLoadData } = this.table.current onLoading() - getDictData('house_type', 'house_industry').then(codes => { + getDictData('house_status', 'house_type', 'house_industry').then(codes => { this.setState({ codes: { ...this.state.codes, ...codes } }, () => { onLoadData() }) @@ -295,8 +288,8 @@ export default class index extends Component { - - - {info.name} - - - - - - - - - 保密 - - - - - - - - - - - - - - - - - - - + ) } } diff --git a/web-react/src/pages/system/account/setting/satety/index.jsx b/web-react/src/pages/system/account/setting/satety/index.jsx index df20c83..e6ab368 100644 --- a/web-react/src/pages/system/account/setting/satety/index.jsx +++ b/web-react/src/pages/system/account/setting/satety/index.jsx @@ -1,179 +1,126 @@ import React, { Component } from 'react' -import { Button, DatePicker, Form, Input, List, message as Message, Spin } from 'antd' +import { List } from 'antd' import { api } from 'common/api' -import { cloneDeep } from 'lodash' -import { AntIcon, Container, IconSelector, Image, ModalForm } from 'components' -import store from 'store' -import moment from 'moment' -import Item from 'antd/lib/list/Item' +import { AntIcon, ModalForm, QueryTableActions } from 'components' import PasswordForm from './password' + import Mail from './mail' import Phone from './phone' -const { getState } = store + const apiAction = { - update: api.sysUserUpdatePwd, + updatePwd: api.sysUserUpdatePwd, } export default class form extends Component { - state = { - saving: false, - info: [], - loading: true, - } - form = React.createRef() - // 新增窗口实例 - updateForm = React.createRef() - MailForm = React.createRef() - PhoneForm = React.createRef() - /** - * 对表格上的操作进行统一处理 - * [异步] - * @param {*} action - * @param {*} successMessage - */ - async onAction(action, successMessage) { - const { onLoading, onLoaded, onReloadData } = this.table.current - onLoading() - try { - if (action) { - await action - } - if (successMessage) { - Message.success(successMessage) - } - onReloadData() - } catch { - onLoaded() - } + updatePwdForm = React.createRef() + mailForm = React.createRef() + mhoneForm = React.createRef() + + onOpen(modal) { + modal.current.open() } - /** - * 打开新增/编辑弹窗 - * @param {*} modal - * @param {*} record - */ - onOpen(modal, record) { - modal.current.open({ - record, - }) - } - - componentDidMount() { - api.getLoginUser().then(({ data }) => { - this.setState({ - loading: true, - }) - let index = [] - //密码 - index.push({ - title: '登录密码', - description: - '安全性高的密码可以使帐号更安全。建议您定期更换密码,设置一个包含字母,符号或数字中至少两项且长度超过6位的密码。', - extra: ( -
- 当前密码强度为: - { - [ - , - , - , - ][data.securityLevel - 1] - } -
- ), - done: true, - action: () => { - this.onOpen(this.updateForm) - }, - }) - //手机 - index.push({ - title: '手机绑定(发送验证码到手机,未实现)', - description: ( -
- 手机号可以直接用于登录、找回密码等。 - {data.phone && ( - - 您已绑定了手机{data.phone} - - )} -
- ), - done: !!data.phone, - action: () => { - this.onOpen(this.PhoneForm) - }, - }) - //邮箱 - index.push({ - title: '邮箱绑定(发送验证码到邮箱,未实现)', - description: ( -
- 安全邮箱可以直接用于登录、找回密码等。 - {data.email && ( - - 您已绑定了邮箱{data.email} - - )} -
- ), - done: !!data.email, - action: () => { - this.onOpen(this.MailForm) - }, - }) - this.setState({ - info: index, - loading: false, - }) - }) - } render() { + const { user, loadData } = this.props + + const index = [] + //密码 + index.push({ + title: '登录密码', + description: + '安全性高的密码可以使帐号更安全。建议您定期更换密码,设置一个包含字母,符号或数字中至少两项且长度超过6位的密码。', + // extra: ( + //
+ // 当前密码强度为: + // { + // [ + // , + // , + // , + // ][user.securityLevel - 1] + // } + //
+ // ), + done: true, + action: () => { + this.onOpen(this.updatePwdForm) + }, + }) + //手机 + index.push({ + title: '手机绑定', + description: ( +
+ 手机号可以直接用于登录、找回密码等。 + {user.phone && ( + <> + 您已绑定了手机{user.phone} + + )} +
+ ), + done: !!user.phone, + action: () => { + this.onOpen(this.mhoneForm) + }, + }) + //邮箱 + index.push({ + title: '邮箱绑定', + description: ( +
+ 安全邮箱可以直接用于登录、找回密码等。 + {user.email && ( + <> + 您已绑定了邮箱{user.email} + + )} +
+ ), + done: !!user.email, + action: () => { + this.onOpen(this.mailForm) + }, + }) + return ( - - }> -
-

安全设置

-
- ( - - {item.done == true ? ( - <> - + <> + ( + + 已设置 - - 修改 - - + 修改 + ) : ( - <> - + + 未设置 - - 设置 - - - )} - - - )} - /> -
- - - - - -
-
+ 设置 + + ), + ]} + > + + + )} + /> + + + + + + ) } } diff --git a/web-react/src/pages/system/account/setting/satety/mail.jsx b/web-react/src/pages/system/account/setting/satety/mail.jsx index e391cc0..4a8467a 100644 --- a/web-react/src/pages/system/account/setting/satety/mail.jsx +++ b/web-react/src/pages/system/account/setting/satety/mail.jsx @@ -1,454 +1,376 @@ import React, { Component } from 'react' -import { - Form, - Input, - InputNumber, - Modal, - Spin, - Steps, - Button, - Row, - Col, - message, - Select, -} from 'antd' -import { AntIcon, Container, IconSelector } from 'components' -import { cloneDeep, indexOf } from 'lodash' +import { Form, Input, Modal, Spin, Steps, Button, Row, Col, message as Message, Select } from 'antd' +import { AntIcon } from 'components' import { api } from 'common/api' import { COUNT_DWON_KEY } from 'common/storage' -import { Option } from 'antd/lib/mentions' -import { set } from 'nprogress' -import { getKeyThenIncreaseKey } from 'antd/lib/message' +import store from 'store' +import { cloneDeep } from 'lodash' -const initialValues = { - orgcode: '', - target: '', - code: '', - type: null, +const { getState } = store + +const steps = [ + { + title: '验证', + }, + { + title: '绑定', + }, +] + +const reg = /^([a-zA-Z]|[0-9])(\w|)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/ + +const initState = { + visible: false, + loading: false, + + // 可用于验证的类型 + types: [], + // 当前步骤 + currentStep: 0, + + nextDisabled: true, + // 正在发送验证码 + sendingCode: false, + // 冷却时间 + countDown: 0, } -var tempcode = '' -const { Step } = Steps + export default class form extends Component { - state = { - buttondisabled: true, - visible: false, - loading: false, - codeLoading: false, - current: 0, - countdown: 0, - sendOrNo: true, - type: [], - } + state = cloneDeep(initState) + form = React.createRef() - //发送验证码 - sendcode(data) { - this.setState({ - codeLoading: true, - }) - var reg = /^([a-zA-Z]|[0-9])(\w|)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/ - let { target } = data.current.getFieldsValue() - let { type } = data.current.getFieldsValue() - let { code } = data.current.getFieldsValue() - let { orgcode } = data.current.getFieldsValue() - if (!reg.test(target) && type != '1' && type != '2') { - message.warn('请输入正确的邮箱') - this.setState({ - codeLoading: true, + + orgCode = '' + + //打开窗口 + open = () => { + this.setState({ visible: true }) + + this.showCountDown() + + const data = getState('user') + const types = [] + data.phone && + types.push({ + title: `使用手机号${data.phone}进行验证`, + value: 1, }) - return - } - api.SendCode({ - target: target, - type: type, - code: code, - orgcode: orgcode, - }) - .then(res => { - if (res.success) { - this.addTime() - this.showcountdown() - } - }) - .finally(() => { - this.setState({ - codeLoading: false, - }) + data.email && + types.push({ + title: `使用邮箱${data.email}进行验证`, + value: 2, }) + + this.setState({ types }) } - //进入下一步 - next(data) { - this.setState({ - loading: true, - }) - let { target } = data.current.getFieldsValue() - let { type } = data.current.getFieldsValue() - let { code } = data.current.getFieldsValue() - let { orgcode } = data.current.getFieldsValue() - tempcode = data.current.getFieldsValue() - let form = { - target: target, - type: type, - code: code, - orgcode: orgcode, - } - api.CheckBindcode(form) - .then(res => { - if (res.data) { - window.localStorage.removeItem(COUNT_DWON_KEY) - let current = this.state.current + 1 - this.setState({ - form: { - ...form, - type: null, - }, - buttondisabled: true, - current: current, - }) - } - }) - .finally(() => { - this.setState({ - loading: false, - }) - }) + + close() { + this.setState(cloneDeep(initState)) } + /** * 将倒计时添加入到本地 */ addTime() { - const now = Date.now() - var date = now + 60 * 1000 + 500 - window.localStorage.setItem(COUNT_DWON_KEY, date) + const now = Date.now() + 60 * 1000 + window.localStorage.setItem(COUNT_DWON_KEY, now) } /** * 显示倒计时 */ - showcountdown() { - let _this = this - var Furdate = window.localStorage.getItem(COUNT_DWON_KEY) - var nowdate = new Date().getTime() - if (Furdate >= nowdate) { + showCountDown() { + const surplusTime = window.localStorage.getItem(COUNT_DWON_KEY) + const nowTime = Date.now() + if (surplusTime >= nowTime) { this.setState({ - sendOrNo: false, - countdown: parseInt((Furdate - nowdate) / 1000), + countDown: parseInt((surplusTime - nowTime) / 1000), }) setTimeout(() => { - _this.showcountdown() + this.showCountDown() }, 1000) } else { - this.setState({ - sendOrNo: true, - }) + this.setState({ countDown: 0 }) } } - //打开窗口 - open = (data = {}) => { - this.setState({ visible: true, loading: true }) - api.getLoginUser().then(({ data }) => { - let index = [] - data.phone && - index.push({ - Title: '使用手机号' + data.phone + '进行验证 ', - Value: 1, - }) - data.email && - index.push({ - Title: '使用邮箱' + data.email + '进行验证', - Value: 2, - }) + + //发送验证码 + async onSendCode() { + const form = this.form.current + + const valid = await form.validateFields() + if (!valid) { + return + } + + this.setState({ sendingCode: true }) + + const data = form.getFieldsValue() + try { + await api.sysUserSendCode(data) + const typeName = data.type ? [, '手机', '邮箱'][data.type] : '手机' + Message.success(`已发送验证码到${typeName},请注意查收`) + this.addTime() + this.showCountDown() + } finally { + this.setState({ sendingCode: false }) + } + } + + // 下一步 + async onNext() { + this.setState({ loading: true }) + const data = this.form.current.getFieldsValue() + this.orgCode = data.orgCode + + try { + await api.sysUserCheckBindcode(data) + window.localStorage.removeItem(COUNT_DWON_KEY) this.setState({ - type: index, + nextDisabled: true, + currentStep: this.state.currentStep + 1, }) - if (index.length > 0) { - this.form.current.setFieldsValue({ - type: index[0].Value, - }) - } + } finally { this.setState({ loading: false }) - }) - } - // 前一步 - prev() { - window.localStorage.removeItem(COUNT_DWON_KEY) - let current = this.state.current - 1 - this.setState({ - current: current, - }) - } - //完成 - complete(data) { - let { target } = data.current.getFieldsValue() - let { code } = data.current.getFieldsValue() - let { orgcode } = tempcode - api.CheckBindcode({ - target: target, - type: null, - code: code, - orgcode: orgcode, - }).then(res => { - if (res.data) { - window.localStorage.removeItem(COUNT_DWON_KEY) - message.success('改绑完成') - this.onResetFields() - } - }) - } - onResetFields() { - setTimeout(() => { - this.setState({ visible: false }) - this.setState({ current: 0 }) - //window.localStorage.removeItem(COUNT_DWON_KEY) - /** 在这里可以初始化当前组件中其他属性 */ - /* ... */ - }, 300) - } - render() { - let steps = [ - { - title: '验证', - }, - { - title: '绑定', - }, - ] - const close = () => { - this.setState({ - visible: false, - current: 0, - }) } + } + + // 上一步 + onPrev() { + window.localStorage.removeItem(COUNT_DWON_KEY) + this.setState({ + currentStep: this.state.currentStep - 1, + }) + } + + //完成 + async onComplete() { + this.setState({ loading: true }) + try { + await api.sysUserCheckBindcode({ + ...this.form.current.getFieldsValue(), + orgCode: this.orgCode, + }) + await this.props.loadData() + window.localStorage.removeItem(COUNT_DWON_KEY) + Message.success('绑定邮箱成功') + this.close() + } finally { + this.setState({ loading: false }) + } + } + + renderForm() { + const { nextDisabled, sendingCode, countDown } = this.state + return ( - - +
{ + this.setState({ + nextDisabled: !(allValues.target && allValues.code), + }) + }} > - }> -
- {this.state.type.length !== 0 ? ( -
-
- - - - - {steps.map(item => ( - - ))} - - - - -
- { - this.setState({ - buttondisabled: !( - allValues.orgcode || - (allValues.target && allValues.code) - ), - }) - }} - > -
- {this.state.current == 0 && ( -
- - - - - - - - - - {this.state.sendOrNo ? ( - - ) : ( - - )} - - - -
- )} - {this.state.current == 1 && ( -
- - - - - - - - - - {this.state.sendOrNo ? ( - - ) : ( - - )} - - - -
- )} -
- -
-
- {this.state.current == 0 && ( - <> -
- -
-
- - )} - {this.state.current == 1 && ( - <> - {this.state.current > 0 && ( - - )} - - - )} -
-
- ) : ( -
-
{ - this.setState({ - buttondisabled: !( - allValues.target && allValues.code - ), - }) - }} - > - - + + + + + + + + + + + + {countDown ? ( + + ) : ( + + )} + + + + +
+ +
+
+ ) + } + + renderStepForm() { + const { types, currentStep, sendingCode, countDown } = this.state + + return ( +
+ + + + {steps.map(item => ( + + ))} + + + +
{ + this.setState({ + nextDisabled: !( + allValues.orgCode || + (allValues.target && allValues.code) + ), + }) + }} + > + {currentStep === 0 && ( + <> + + + + + + + + - - - - - - - {this.state.sendOrNo ? ( - - ) : ( - - )} - - - - -
- - - - - - - -
-
- )} -
-
-
-
+ ) : ( + + )} + + + + + )} + {currentStep === 1 && ( + <> + + + + + + + + + + + + {countDown ? ( + + ) : ( + + )} + + + + + )} + +
+ {currentStep === 0 && ( + <> + + + )} + {currentStep === 1 && ( + <> + + + + )} +
+ + ) + } + + render() { + const { visible, loading, types } = this.state + + return ( + this.close()} + visible={visible} + className="yo-modal-form" + title="绑定邮箱" + > + }> +
+ {types.length ? this.renderStepForm() : this.renderForm()} +
+
+
) } } diff --git a/web-react/src/pages/system/account/setting/satety/password.jsx b/web-react/src/pages/system/account/setting/satety/password.jsx index 0616fc1..6e0c9db 100644 --- a/web-react/src/pages/system/account/setting/satety/password.jsx +++ b/web-react/src/pages/system/account/setting/satety/password.jsx @@ -1,15 +1,9 @@ import React, { Component } from 'react' -import { Form, Input, InputNumber, Spin } from 'antd' -import { AntIcon, IconSelector } from 'components' -import { cloneDeep } from 'lodash' +import { Form, Input } from 'antd' -const initialValues = { - sort: 100, -} export default class form extends Component { state = { // 加载状态 - loading: true, exist: false, } // 表单实例 @@ -31,25 +25,7 @@ export default class form extends Component { * [异步,必要] * @param {*} params */ - async fillData(params) { - this.record = cloneDeep(params.record) - //#region 从后端转换成前段所需格式 - const exist = !!params.record - this.setState({ - exist, - }) - - this.record = { - ...this.record, - } - //#endregion - - this.form.current.setFieldsValue(this.record) - - this.setState({ - loading: false, - }) - } + async fillData() {} /** * 获取数据 @@ -63,9 +39,6 @@ export default class form extends Component { const valid = await form.validateFields() if (valid) { const postData = form.getFieldsValue() - if (this.record) { - postData.id = this.record.id - } //#region 从前段转换后端所需格式 //#endregion return postData @@ -75,32 +48,39 @@ export default class form extends Component { render() { return (
- - {/* */} -
- - - - - - - - - -
-
+
+ + + + + + + ({ + validator(_, value) { + if (!value || getFieldValue('newPassword') === value) { + return Promise.resolve() + } + return Promise.reject(new Error('确认新密码不匹配')) + }, + }), + ]} + name="confirm" + > + + +
) } diff --git a/web-react/src/pages/system/account/setting/satety/phone.jsx b/web-react/src/pages/system/account/setting/satety/phone.jsx index d5ebb56..f0bb4e9 100644 --- a/web-react/src/pages/system/account/setting/satety/phone.jsx +++ b/web-react/src/pages/system/account/setting/satety/phone.jsx @@ -1,455 +1,376 @@ import React, { Component } from 'react' -import { - Form, - Input, - InputNumber, - Modal, - Spin, - Steps, - Button, - Row, - Col, - message, - Select, -} from 'antd' -import { AntIcon, Container, IconSelector } from 'components' -import { cloneDeep, indexOf } from 'lodash' +import { Form, Input, Modal, Spin, Steps, Button, Row, Col, message as Message, Select } from 'antd' +import { AntIcon } from 'components' import { api } from 'common/api' import { COUNT_DWON_KEY } from 'common/storage' -import { Option } from 'antd/lib/mentions' -import { set } from 'nprogress' -import { getKeyThenIncreaseKey } from 'antd/lib/message' +import store from 'store' +import { cloneDeep } from 'lodash' -const initialValues = { - orgcode: '', - target: '', - code: '', - type: null, +const { getState } = store + +const steps = [ + { + title: '验证', + }, + { + title: '绑定', + }, +] + +const reg = /^((13[0-9])|(14[5,7])|(15[^4,\\D])|(17[0,1,3,6-8])|(18[0-9])|(19[8,9])|(166))[0-9]{8}$/ + +const initState = { + visible: false, + loading: false, + + // 可用于验证的类型 + types: [], + // 当前步骤 + currentStep: 0, + + nextDisabled: true, + // 正在发送验证码 + sendingCode: false, + // 冷却时间 + countDown: 0, } -var tempcode = '' -const { Step } = Steps + export default class form extends Component { - state = { - buttondisabled: true, - visible: false, - loading: false, - codeLoading: false, - current: 0, - countdown: 0, - sendOrNo: true, - type: [], - } + state = cloneDeep(initState) + form = React.createRef() - //发送验证码 - sendcode(data) { - this.setState({ - codeLoading: true, - }) - var reg = - /^((13[0-9])|(14[5,7])|(15[^4,\\D])|(17[0,1,3,6-8])|(18[0-9])|(19[8,9])|(166))[0-9]{8}$/ - let { target } = data.current.getFieldsValue() - let { type } = data.current.getFieldsValue() - let { code } = data.current.getFieldsValue() - let { orgcode } = data.current.getFieldsValue() - if (!reg.test(target) && type != '1' && type != '2') { - message.warn('请输入正确的手机号码') - this.setState({ - codeLoading: true, + + orgCode = '' + + //打开窗口 + open = () => { + this.setState({ visible: true }) + + this.showCountDown() + + const data = getState('user') + const types = [] + data.phone && + types.push({ + title: `使用手机号${data.phone}进行验证`, + value: 1, }) - return - } - api.SendCode({ - target: target, - type: type, - code: code, - orgcode: orgcode, - }) - .then(res => { - if (res.success) { - this.addTime() - this.showcountdown() - } - }) - .finally(() => { - this.setState({ - codeLoading: false, - }) + data.email && + types.push({ + title: `使用邮箱${data.email}进行验证`, + value: 2, }) + + this.setState({ types }) } - //进入下一步 - next(data) { - this.setState({ - loading: true, - }) - let { target } = data.current.getFieldsValue() - let { type } = data.current.getFieldsValue() - let { code } = data.current.getFieldsValue() - let { orgcode } = data.current.getFieldsValue() - tempcode = data.current.getFieldsValue() - let form = { - target: target, - type: type, - code: code, - orgcode: orgcode, - } - api.CheckBindcode(form) - .then(res => { - if (res.data) { - window.localStorage.removeItem(COUNT_DWON_KEY) - let current = this.state.current + 1 - this.setState({ - form: { - ...form, - type: null, - }, - buttondisabled: true, - current: current, - }) - } - }) - .finally(() => { - this.setState({ - loading: false, - }) - }) + + close() { + this.setState(cloneDeep(initState)) } + /** * 将倒计时添加入到本地 */ addTime() { - const now = Date.now() - var date = now + 60 * 1000 + 500 - window.localStorage.setItem(COUNT_DWON_KEY, date) + const now = Date.now() + 60 * 1000 + window.localStorage.setItem(COUNT_DWON_KEY, now) } /** * 显示倒计时 */ - showcountdown() { - let _this = this - var Furdate = window.localStorage.getItem(COUNT_DWON_KEY) - var nowdate = new Date().getTime() - if (Furdate >= nowdate) { + showCountDown() { + const surplusTime = window.localStorage.getItem(COUNT_DWON_KEY) + const nowTime = Date.now() + if (surplusTime >= nowTime) { this.setState({ - sendOrNo: false, - countdown: parseInt((Furdate - nowdate) / 1000), + countDown: parseInt((surplusTime - nowTime) / 1000), }) setTimeout(() => { - _this.showcountdown() + this.showCountDown() }, 1000) } else { - this.setState({ - sendOrNo: true, - }) + this.setState({ countDown: 0 }) } } - //打开窗口 - open = (data = {}) => { - this.setState({ visible: true, loading: true }) - api.getLoginUser().then(({ data }) => { - let index = [] - data.phone && - index.push({ - Title: '使用手机号' + data.phone + '进行验证 ', - Value: 1, - }) - data.email && - index.push({ - Title: '使用邮箱' + data.email + '进行验证', - Value: 2, - }) + + //发送验证码 + async onSendCode() { + const form = this.form.current + + const valid = await form.validateFields() + if (!valid) { + return + } + + this.setState({ sendingCode: true }) + + const data = form.getFieldsValue() + try { + await api.sysUserSendCode(data) + const typeName = data.type ? [, '手机', '邮箱'][data.type] : '手机' + Message.success(`已发送验证码到${typeName},请注意查收`) + this.addTime() + this.showCountDown() + } finally { + this.setState({ sendingCode: false }) + } + } + + // 下一步 + async onNext() { + this.setState({ loading: true }) + const data = this.form.current.getFieldsValue() + this.orgCode = data.orgCode + + try { + await api.sysUserCheckBindcode(data) + window.localStorage.removeItem(COUNT_DWON_KEY) this.setState({ - type: index, + nextDisabled: true, + currentStep: this.state.currentStep + 1, }) - if (index.length > 0) { - this.form.current.setFieldsValue({ - type: index[0].Value, - }) - } + } finally { this.setState({ loading: false }) - }) - } - // 前一步 - prev() { - window.localStorage.removeItem(COUNT_DWON_KEY) - let current = this.state.current - 1 - this.setState({ - current: current, - }) - } - //完成 - complete(data) { - let { target } = data.current.getFieldsValue() - let { code } = data.current.getFieldsValue() - let { orgcode } = tempcode - api.CheckBindcode({ - target: target, - type: null, - code: code, - orgcode: orgcode, - }).then(res => { - if (res.data) { - window.localStorage.removeItem(COUNT_DWON_KEY) - message.success('改绑完成') - this.onResetFields() - } - }) - } - onResetFields() { - setTimeout(() => { - this.setState({ visible: false }) - this.setState({ current: 0 }) - //window.localStorage.removeItem(COUNT_DWON_KEY) - /** 在这里可以初始化当前组件中其他属性 */ - /* ... */ - }, 300) - } - render() { - let steps = [ - { - title: '验证', - }, - { - title: '绑定', - }, - ] - const close = () => { - this.setState({ - visible: false, - current: 0, - }) } + } + + // 上一步 + onPrev() { + window.localStorage.removeItem(COUNT_DWON_KEY) + this.setState({ + currentStep: this.state.currentStep - 1, + }) + } + + //完成 + async onComplete() { + this.setState({ loading: true }) + try { + await api.sysUserCheckBindcode({ + ...this.form.current.getFieldsValue(), + orgCode: this.orgCode, + }) + await this.props.loadData() + window.localStorage.removeItem(COUNT_DWON_KEY) + Message.success('绑定手机号成功') + this.close() + } finally { + this.setState({ loading: false }) + } + } + + renderForm() { + const { nextDisabled, sendingCode, countDown } = this.state + return ( - - +
{ + this.setState({ + nextDisabled: !(allValues.target && allValues.code), + }) + }} > - }> -
- {this.state.type.length !== 0 ? ( -
-
- - - - - {steps.map(item => ( - - ))} - - - - -
- { - this.setState({ - buttondisabled: !( - allValues.orgcode || - (allValues.target && allValues.code) - ), - }) - }} - > -
- {this.state.current == 0 && ( -
- - - - - - - - - - {this.state.sendOrNo ? ( - - ) : ( - - )} - - - -
- )} - {this.state.current == 1 && ( -
- - - - - - - - - - {this.state.sendOrNo ? ( - - ) : ( - - )} - - - -
- )} -
- -
-
- {this.state.current == 0 && ( - <> -
- -
-
- - )} - {this.state.current == 1 && ( - <> - {this.state.current > 0 && ( - - )} - - - )} -
-
- ) : ( -
-
{ - this.setState({ - buttondisabled: !( - allValues.target && allValues.code - ), - }) - }} - > - - + + + + + + + + + + + + {countDown ? ( + + ) : ( + + )} + + + + +
+ +
+
+ ) + } + + renderStepForm() { + const { types, currentStep, sendingCode, countDown } = this.state + + return ( +
+ + + + {steps.map(item => ( + + ))} + + + +
{ + this.setState({ + nextDisabled: !( + allValues.orgCode || + (allValues.target && allValues.code) + ), + }) + }} + > + {currentStep === 0 && ( + <> + + + + + + + + - - - - - - - {this.state.sendOrNo ? ( - - ) : ( - - )} - - - - -
- - - - - - - -
-
- )} -
-
-
-
+ ) : ( + + )} + + + + + )} + {currentStep === 1 && ( + <> + + + + + + + + + + + + {countDown ? ( + + ) : ( + + )} + + + + + )} + +
+ {currentStep === 0 && ( + <> + + + )} + {currentStep === 1 && ( + <> + + + + )} +
+ + ) + } + + render() { + const { visible, loading, types } = this.state + + return ( + this.close()} + visible={visible} + className="yo-modal-form" + title="绑定手机" + > + }> +
+ {types.length ? this.renderStepForm() : this.renderForm()} +
+
+
) } } diff --git a/web-react/src/pages/system/area/form.jsx b/web-react/src/pages/system/area/form.jsx index fde93a8..af531b0 100644 --- a/web-react/src/pages/system/area/form.jsx +++ b/web-react/src/pages/system/area/form.jsx @@ -5,7 +5,7 @@ import { cloneDeep } from 'lodash' import getDictData from 'util/dic' const initialValues = { - sort: 100 + sort: 100, } export default class form extends Component { state = { @@ -13,8 +13,8 @@ export default class form extends Component { loading: true, exist: false, codes: { - dicAreacodeType: [] - } + areacodeType: [], + }, } // 表单实例 form = React.createRef() @@ -33,29 +33,28 @@ export default class form extends Component { * 填充数据 * 可以在设置this.record之后对其作出数据结构调整 * [异步,必要] - * @param {*} params + * @param {*} params */ async fillData(params) { - this.record = cloneDeep(params.record) //#region 从后端转换成前段所需格式 - const codes = await getDictData('dic_areacode_type') - const exist = !!params.record; + const codes = await getDictData('areacode_type') + const exist = !!params.record this.setState({ codes, - exist + exist, }) this.record = { - ...this.record + ...this.record, } //#endregion this.form.current.setFieldsValue(this.record) this.setState({ - loading: false + loading: false, }) } @@ -63,7 +62,7 @@ export default class form extends Component { * 获取数据 * 可以对postData进行数据结构调整 * [异步,必要] - * @returns + * @returns */ async getData() { const form = this.form.current @@ -82,43 +81,55 @@ export default class form extends Component { render() { return ( -
+ }>
{/* 表单控件 */} - - } + > + {this.state.codes.areacodeType.map(item => { + return ( + + {item.value} + + ) + })} - + - - }> - + + } + > - - - + + - + @@ -129,4 +140,4 @@ export default class form extends Component { ) } -} \ No newline at end of file +} diff --git a/web-react/src/pages/system/org/index.jsx b/web-react/src/pages/system/org/index.jsx index 431e063..d671ce5 100644 --- a/web-react/src/pages/system/org/index.jsx +++ b/web-react/src/pages/system/org/index.jsx @@ -64,6 +64,7 @@ export default class index extends Component { { title: '机构类型', dataIndex: 'type', + width: 120, sorter: true, render: text => <>{this.bindCodeValue(text, 'org_type')}, }, diff --git a/web-react/src/views/login/index.jsx b/web-react/src/views/login/index.jsx index e04b7ea..a431711 100644 --- a/web-react/src/views/login/index.jsx +++ b/web-react/src/views/login/index.jsx @@ -13,6 +13,8 @@ export default class index extends Component { focusUser: false, focusPassword: false, + + btnDisabled: true, } backgroundImage = require(`assets/image/login-bg-0${Math.floor(Math.random() * 4)}.jpg`) @@ -36,6 +38,7 @@ export default class index extends Component { Message.success('登录成功') this.props.history.replace('/') } else { + this.setState({ loading: false }) Message.error(message) } }) @@ -48,15 +51,26 @@ export default class index extends Component { } render() { + const { loading, focusUser, focusPassword, btnDisabled } = this.state + return (
-
+ { + this.setState({ + btnDisabled: !values.account || !values.password, + }) + }} + > @@ -75,7 +89,7 @@ export default class index extends Component { @@ -95,8 +109,8 @@ export default class index extends Component {