diff --git a/.umirc.ts b/.umirc.ts index 3c053081..2bb54dcc 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -11,7 +11,7 @@ export default defineConfig({ routes: [ { path: '/', - redirect: '/home', + redirect: '/login', }, { name: '首页', @@ -20,7 +20,7 @@ export default defineConfig({ icon: 'HomeOutlined', }, { - name: ' 基础图层', + name: '基础图层', path: '/baseMap', component: './BaseMap', icon: 'BlockOutlined', @@ -31,12 +31,12 @@ export default defineConfig({ // component: './Access', // }, { - name: ' CRUD 示例', + name: 'CRUD 示例', path: '/table', component: './Table', }, { - name: ' 登录', + name: '登录', path: '/login', component: './Login', // 不展示菜单 @@ -45,7 +45,16 @@ export default defineConfig({ hideInMenu: true, }, { - name: ' 关于我们', + name: '注册', + path: '/register', + component: './Register', + // 不展示菜单 + menuRender: false, + // 不展示在菜单栏里 + hideInMenu: true, + }, + { + name: '关于我们', path: '/about', component: './About', }, @@ -66,7 +75,7 @@ export default defineConfig({ ], proxy: { '/api': { - 'target': 'http://101.42.40.202:8081',//8.142.119.212:8083 + 'target': 'http://localhost:8081',//101.42.40.202:8081 'changeOrigin': true, // 'pathRewrite': { '^/api' : '' }, }, diff --git a/README.md b/README.md index 09d8c91e..0f995982 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ Gitee 是 OSCHINA 推出的基于 Git 的代码托管平台(同时支持 SVN #### 使用说明 -1. xxxx -2. xxxx +1. yarn install +2. yarn add 3. xxxx #### 参与贡献 diff --git a/src/api/index.js b/src/api/index.js index 88d6e58d..385441fb 100644 --- a/src/api/index.js +++ b/src/api/index.js @@ -1,10 +1,18 @@ import { request } from '@umijs/max'; // 密码登录 -export function passwordLogin( params ) { +export function passwordLogin( data ) { return request('/api/user/login', { + method: 'POST', + data: data + }); +} + +// 发送注册验证短信 +export function registerSms( params ) { + return request('/api/user/registerSms', { method: 'GET', - params: params, + params: params }); } @@ -20,6 +28,6 @@ export function queryUserMenu() { export function getLayerPoints( params ) { return request('/api/basicMap/getLayerPoints', { method: 'GET', - params: params, + params: params }); } diff --git a/src/index.less b/src/index.less index 34fa9312..6bde4188 100644 --- a/src/index.less +++ b/src/index.less @@ -20,7 +20,7 @@ body { #login_page .ant-tabs { transform: translateY(-50%); position: fixed; - top: 50%; + top: 45%; right: 0px; width: 38%; } @@ -56,13 +56,12 @@ body { height: 42px; } #login_page input { - font-size: 22px; + font-size: 18px !important; box-shadow: none; } -#login_page .ant-form-item-required, #login_page input{ - color: #A7B0BC; - -} +// #login_page .ant-form-item-required, #login_page input{ +// color: #A7B0BC; +// } #login_page .ant-form-item-required, #login_page input, #login_page .ant-btn{ font-size: 22px; font-family: Source Han Sans CN-Regular, Source Han Sans CN; @@ -70,7 +69,7 @@ body { line-height: 32px; } #login_page .ant-form-item-required { - margin-bottom: 8px; + margin-bottom: 20px; } #login_page .ant-form-item-required::before { display: none; @@ -81,6 +80,9 @@ body { margin-top: 18px; font-size: 18px; } +#login_page .form-item { + margin-bottom: 45px; +} // 左侧导航栏 :where(.css-dev-only-do-not-override-9ntgx0).ant-layout .ant-layout-sider-light { background-image: url(./assets/images/nav-bg.png) !important; diff --git a/src/pages/BaseMap/index.js b/src/pages/BaseMap/index.js index 971f26a0..dbd7ed69 100644 --- a/src/pages/BaseMap/index.js +++ b/src/pages/BaseMap/index.js @@ -89,7 +89,7 @@ class BaseMap extends React.Component{ } // 获取图层明细点位数据/热力图数据 - getLayerPoints = (layerId, selected, nodeType) => {debugger + getLayerPoints = (layerId, selected, nodeType) => { if (selected) { return axios.get('/api/basicMap/getLayerPoints', { params: { @@ -138,7 +138,8 @@ class BaseMap extends React.Component{ let self = this; let map = this.state.map; let LabelsData = data || []; - + let logoImage = data.length > 0 && data[0].logoImage; + map.addImage = (layerId, logoImage); const pointLayer = new PointLayer({name: layerId}) .source(LabelsData, { parser: { @@ -147,8 +148,8 @@ class BaseMap extends React.Component{ y: 'lat', } }) - .shape('simple') - .size(15) + .shape(layerId) + .size(30) .color('mag', mag => { return mag > 4.5 ? '#5B8FF9' : '#5CCEA1'; }) @@ -555,7 +556,7 @@ class BaseMap extends React.Component{ {/* 地图 */}
-
+
) diff --git a/src/pages/Login/index.js b/src/pages/Login/index.js index 6cf30ed0..daf94b19 100644 --- a/src/pages/Login/index.js +++ b/src/pages/Login/index.js @@ -1,3 +1,4 @@ +import { useState } from 'react'; import { Tabs } from 'antd'; import PasswordLogin from './passwordLogin'; import VerificationCodeLogin from './verificationCodeLogin'; @@ -11,9 +12,6 @@ function Login (e) { - - -
diff --git a/src/pages/Login/passwordLogin.js b/src/pages/Login/passwordLogin.js index 92e40b4d..1b63c18b 100644 --- a/src/pages/Login/passwordLogin.js +++ b/src/pages/Login/passwordLogin.js @@ -18,9 +18,9 @@ function Login (e) { // } passwordLogin({username: values.username, password: values.password}).then((e) => { if (!e.success) { - message.error('登录失败'); + message.error(e.message); } else { - navigate('/Home'); + navigate('/home'); // cookie.save('username', 'wyd'); } }) @@ -60,6 +60,7 @@ function Login (e) { message: '账户名称不能为空!', }, ]} + style={{marginBottom: '45px'}} > @@ -78,17 +79,18 @@ function Login (e) { - 同意服务条款 忘记密码? - + */} - - - 新用户注册 + + + 新用户注册 ); diff --git a/src/pages/Login/verificationCodeLogin.js b/src/pages/Login/verificationCodeLogin.js index 1099a95b..79116070 100644 --- a/src/pages/Login/verificationCodeLogin.js +++ b/src/pages/Login/verificationCodeLogin.js @@ -29,7 +29,7 @@ function VerificationCodeLogin (e) { } let onFinish = (values) => { - passwordLogin({username: values.username, password: values.password}).then((e) => { + passwordLogin({values}).then((e) => { if (!e.success) { message.error('登录失败'); } else { @@ -74,6 +74,7 @@ function VerificationCodeLogin (e) { message: '账户名称不能为空!', }, ]} + style={{marginBottom: '45px'}} > @@ -102,6 +103,7 @@ function VerificationCodeLogin (e) { offset: 4, span: 16, }} + style={{marginTop: '38px'}} > 同意服务条款 @@ -112,8 +114,9 @@ function VerificationCodeLogin (e) { offset: 4, span: 16, }} + style={{marginTop: '68px'}} > - 新用户注册 diff --git a/src/pages/Register/index.js b/src/pages/Register/index.js new file mode 100644 index 00000000..e81139c6 --- /dev/null +++ b/src/pages/Register/index.js @@ -0,0 +1,162 @@ +import { useState } from 'react'; +import { Form, Input, Button, Checkbox, message, Col, Row, Tag, Tabs } from 'antd'; +import '../../index.less'; +import { useNavigate } from 'react-router-dom'; +import { registerSms } from '../../api'; + +function Register(e) { + + let navigate = useNavigate(); + let [code, setCode] = useState('获取验证码'); + let [coding, setCoding] = useState(false); + let [mobile, setMobile] = useState(''); + const [form] = Form.useForm(); + let onMobileChange = (e) => { + let val = e.target.value; + setMobile(val) + } + // 点击获取验证码 + let getCheckCode = (values) => {debugger + // e.preventDefault(); + // 请求发送验证码接口,请求成功开始倒计时 + registerSms({'phone': mobile}).then((e) => { + if (!e.success) { + message.error(e.message); + } else { + countDown(60); + } + }) + } + // 倒计时 + let countDown = (code) => { + let count = parseFloat(code); + if (code === 1) { + setCode('获取验证码'); + setCoding(false); + } else { + count = count - 1; + setCoding(true); + setCode(`${count}s后重新发送`) + setTimeout(countDown, 1000, count); + } + } + let onFinish = async (values) => { + register({ + username: values.username, + password: values.password + }).then((e) => { + if (!e.success) { + message.error(e.message); + } else { + message.success("注册成功"); + navigate('/login'); + } + }) + }; + let onFinishFailed = (errorInfo) => { + console.log('Failed:', errorInfo); + }; + + return ( +
+
+ + +
+ + + + + + + + + + + + + + + + + + 同意服务条款 + + + + + 前往登录 + +
+
+
+
+
+ ); +} + + +export default Register; \ No newline at end of file