diff --git a/src/forge/Main/Detail.js b/src/forge/Main/Detail.js index deca680c..e2177f65 100644 --- a/src/forge/Main/Detail.js +++ b/src/forge/Main/Detail.js @@ -527,6 +527,17 @@ class Detail extends Component { : "" } + hideModal = () => { + this.setState({ + visible: false + }); + this.props.history.push('/projects'); + } + + sureModal = () => { + const { getListData } = this.props; + getListData && getListData(1); + } render() { const { projectDetail, watchers_count, praises_count, @@ -550,7 +561,7 @@ class Detail extends Component { } return (
- +
diff --git a/src/forge/Main/SpecialModal.jsx b/src/forge/Main/SpecialModal.jsx index dd1fab9e..66b79ed3 100644 --- a/src/forge/Main/SpecialModal.jsx +++ b/src/forge/Main/SpecialModal.jsx @@ -37,7 +37,7 @@ function SpecialModal({ visible , hideModal , sureModal , showNotification , use } } return( - + { !user_apply_signatures || (user_apply_signatures && user_apply_signatures.status !== "waiting") ?
diff --git a/src/home/FifthSection/index.scss b/src/home/FifthSection/index.scss index 53ea59b9..f68ff481 100644 --- a/src/home/FifthSection/index.scss +++ b/src/home/FifthSection/index.scss @@ -4,7 +4,7 @@ $deg2: -36deg; $bgcolorlist:#254dea #e33230 #0766fb #f02c66 #6038ff #f85e55 #c13cff #2cb840 #5744f6 #e9862e; .home-fifth-section { - min-height: 50vh; + // min-height: 50vh; background: linear-gradient(#fff 0%, #cbdcff 100%); .fifth-main { diff --git a/src/home/FirstSection/index.scss b/src/home/FirstSection/index.scss index f52d53b9..10a0e929 100644 --- a/src/home/FirstSection/index.scss +++ b/src/home/FirstSection/index.scss @@ -1,5 +1,5 @@ .home-first-section { - height: 90vh; + height: 93vh; min-height: 650px; // background: linear-gradient( // #1a2358 0%, @@ -32,6 +32,7 @@ align-items: center; height: 80vh; min-height: 600px; + margin-top: 6vh; } .website { diff --git a/src/military/task/taskDetail/index.jsx b/src/military/task/taskDetail/index.jsx index 37786008..d21dbf21 100644 --- a/src/military/task/taskDetail/index.jsx +++ b/src/military/task/taskDetail/index.jsx @@ -478,15 +478,15 @@ export default Form.create()( }
- {!current_user.enterpriseCertification && current_user.login &&
- 请先完善主体信息 + {(!current_user.enterpriseCertification&&!current_user.authentication) && current_user.login &&} {/* {!current_user.login &&
创客任务仅限登录用户查看,请先注册登录红山开源账号!
} */} - {current_user.enterpriseCertification && detailData.status === 3 && (!detailData.exceptClosedBoolean) && signContent()} + {(current_user.enterpriseCertification||current_user.authentication) && detailData.status === 3 && (!detailData.exceptClosedBoolean) && signContent()}
交稿 diff --git a/src/military/task/taskList/index.jsx b/src/military/task/taskList/index.jsx index 2929fb08..ee72488d 100644 --- a/src/military/task/taskList/index.jsx +++ b/src/military/task/taskList/index.jsx @@ -153,7 +153,7 @@ export default ({ history, current_user, showLoginDialog, location, mygetHelmeta content:

完成条件后,重新点击查看您的最新参与资格

- 主体信息未认证 + 未进行实名未认证
, onOk: () => { diff --git a/src/modules/login/EducoderLogin.js b/src/modules/login/EducoderLogin.js index 6cf97a6e..e45dca16 100644 --- a/src/modules/login/EducoderLogin.js +++ b/src/modules/login/EducoderLogin.js @@ -126,21 +126,21 @@ class EducoderLogin extends Component { justifyContent: "center", width: "100%", }}> -
© {moment().year()} GitLink | 确实开源京ICP备13000930号GitLink   &   IntelliDE inside.
+
© {moment().year()} 红山开源 | 确实开源京ICP备13000930号红山开源   &   IntelliDE inside.
: this.props.mygetHelmetapi===undefined||this.props.mygetHelmetapi.main_site===null|| this.props.mygetHelmetapi.main_site===undefined?
-
© {moment().year()} GitLink | 确实开源京ICP备13000930号GitLink   &   IntelliDE inside.
+
© {moment().year()} 红山开源 | 确实开源京ICP备13000930号红山开源   &   IntelliDE inside.
:this.props.mygetHelmetapi.main_site===true?
-
© {moment().year()} GitLink | 确实开源京ICP备13000930号GitLink   &   IntelliDE inside.
+
© {moment().year()} 红山开源 | 确实开源京ICP备13000930号红山开源   &   IntelliDE inside.
:"" } diff --git a/src/modules/login/LoginDialog.js b/src/modules/login/LoginDialog.js index c2e27772..50a76ab8 100644 --- a/src/modules/login/LoginDialog.js +++ b/src/modules/login/LoginDialog.js @@ -466,6 +466,7 @@ class LoginDialog extends Component { } const main_web_site_url =localStorage.chromesetting && JSON.parse(localStorage.chromesetting).main_web_site_url; + const current_main_site_url =localStorage.chromesetting && JSON.parse(localStorage.chromesetting).current_main_site_url; return ( 下次自动登录 - this.getloginurl(`${main_web_site_url}/account/lost_password`)} + this.getloginurl(`/resetPassword`)} className="mr3 color-grey-9">找回密码 - this.getloginurl(`${main_web_site_url}/user_join`)} className="color-grey-9">注册 + this.getloginurl(`/register`)} className="color-grey-9">注册

{ diff --git a/src/modules/loginRegister/Login.jsx b/src/modules/loginRegister/Login.jsx index 3f835038..8335caf5 100644 --- a/src/modules/loginRegister/Login.jsx +++ b/src/modules/loginRegister/Login.jsx @@ -4,82 +4,88 @@ import { Link } from "react-router-dom"; import axios from 'axios'; import educoderLogo from '../login/educoder.png'; import cookie from 'react-cookies'; +import { getImageUrl} from 'educoder'; import './LoginRegisterPage.scss'; -function Login(props){ - const [message,setMessage] = useState(); +function Login(props) { + const [message, setMessage] = useState(); const [setting, setSetting] = useState(undefined); - const {form, location} = props; - const {getFieldDecorator } = form; - const {search} = location; + const { form, location } = props; + const { getFieldDecorator } = form; + const { search } = location; - useEffect(()=>{ + useEffect(() => { //控制密码输入框在DOM不可见value clear; //获取第三方登录平台信息 setSetting(JSON.parse(localStorage.getItem("chromesetting"))); - },[]) - + }, []) + // 登录表单提交 - function handleSubmit(){ + function handleSubmit() { form.validateFields((err, values) => { if (!err) { axios.post(`/accounts/login.json`, { login: values.username, password: values.password, - autologin: values.remember?1:0, + autologin: values.remember ? 1 : 0, }).then((response) => { if (!response.data.login) { response.data.status === -2 ? setMessage(response.data.message) : setMessage("错误的账号或密码"); } else { //判断用户是否选择【下次自动登录】 - cookie.save('autologin',values.remember); + cookie.save('autologin', values.remember); const searchParams = new URLSearchParams(search.substring(1)); const goPage = searchParams.get("go_page"); //意见反馈 window.location.href = goPage ? goPage : `/${response.data.login}` } }).catch((error) => { - console.log('error',error); + console.log('error', error); }) } }); } //校验用户名 - function comfirmWrite(rule, value, callback, index){ + function comfirmWrite(rule, value, callback, index) { setMessage(undefined); - value ? callback():index === 1? callback("请输入邮箱地址或用户名登录"):callback("请输入登录密码"); + value ? callback() : index === 1 ? callback("请输入邮箱地址或用户名登录") : callback("请输入登录密码"); } //清除密码框的value属性->DOM看不见密码值 - function clear(){ + function clear() { const password = document.getElementById("login_password"); - if(password && password.type==="password"){ - setTimeout(()=>{ + if (password && password.type === "password") { + setTimeout(() => { password.removeAttribute('value'); - },0) + }, 0) } } - return( + const settings = JSON.parse(localStorage.getItem('chromesetting')); + + return (
+
+ {settings && 红山开源} +
- 欢迎登录 GitLink + 欢迎登录 红山开源 没有账号?去注册
-

{message}

+

{message}

- {getFieldDecorator('username',{ - rules:[ + {getFieldDecorator('username', { + rules: [ { validator: (rule, value, callback) => { comfirmWrite(rule, value, callback, 1) } } ], - validateTrigger:"onBlur", - })()} + validateTrigger: "onBlur", + })()} @@ -89,9 +95,9 @@ function Login(props){ validator: (rule, value, callback) => { comfirmWrite(rule, value, callback, 2) } } ], - validateTrigger:"onBlur", + validateTrigger: "onBlur", })( - , + , )} @@ -109,19 +115,19 @@ function Login(props){ { setting && setting.third_party && setting.third_party.length > 0 ? -

-

-  快速登录  - {setting.third_party.map((item,key)=>{ - return( - - {`${item.name}登录`} - - ) - }) - } -

- :"" +

+

+  快速登录  + {setting.third_party.map((item, key) => { + return ( + + {`${item.name}登录`} + + ) + }) + } +

+ : "" }
diff --git a/src/modules/loginRegister/LoginRegisterPage.jsx b/src/modules/loginRegister/LoginRegisterPage.jsx index 788bbf40..1f6ca4c3 100644 --- a/src/modules/loginRegister/LoginRegisterPage.jsx +++ b/src/modules/loginRegister/LoginRegisterPage.jsx @@ -1,26 +1,42 @@ -import React from "react"; +import React, { useEffect } from "react"; import Login from "./Login"; import Register from "./Register"; import ResetPassword from "./ResetPassword"; -import logo from './img/logo.svg'; -import banner from './img/banner.png'; -import ball from './img/ball.png'; -import img1 from './img/img1.png'; -import img2 from './img/img2.png'; +import { getImageUrl} from 'educoder'; + +// import logo from './img/logo.svg'; +// import banner from './img/banner.png'; +// import ball from './img/ball.png'; +// import img1 from './img/img1.png'; +// import img2 from './img/img2.png'; import '../loginRegister/LoginRegisterPage.scss'; -function LoginRegisterPage(props){ - return( +function LoginRegisterPage(props) { + useEffect(() => { + // 手动添加mate标签 + const addMeta = (name, content) => { + const meta = document.createElement('meta'); + meta.content = content; + meta.name = name; + document.getElementsByTagName('head')[0].appendChild(meta); + }; + + addMeta( + 'viewport', + 'width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no,viewport-fit=cover', + ); + }) + return (
-
+ {/*
{window.location.href='/'}}> -
+
*/}
- {props.location.pathname === "/login" ? : props.location.pathname === "/register" ? : } - - + {props.location.pathname === "/login" ? : props.location.pathname === "/register" ? : } + {/* + */}
diff --git a/src/modules/loginRegister/LoginRegisterPage.scss b/src/modules/loginRegister/LoginRegisterPage.scss index 53b0844b..d5d7bf3b 100644 --- a/src/modules/loginRegister/LoginRegisterPage.scss +++ b/src/modules/loginRegister/LoginRegisterPage.scss @@ -33,6 +33,8 @@ .Register_content{top: 8em; } .ResetPassword_content{top: 16vh; } } + + .login_register_left{ height: 100%; background-image: url(./img/bg.png); @@ -60,6 +62,7 @@ } .login_register_right{ height: 100%; + padding-top:10vh; background-image: url(./img/rightBg.png); .img1{ width: 15vw; @@ -72,16 +75,18 @@ margin-left: 22vw; } .right_cont{ - position: absolute; + // position: absolute; + margin:0 auto; z-index: 2; - left: 45vw; + // left: 45vw; padding: 2.5em 5em; border-radius: 7px; font-size: 15px; - & .login_register_head{ + .login_register_head{ display: flex; justify-content: space-between; align-items: center; + margin-bottom: 1vh; &>span:first-child{ font-size: 1.5em; font-weight: 600; @@ -89,17 +94,17 @@ line-height: 1.5; } //注册页面的获取验证码输入框 - & .ant-input{width: 18rem; } + // .ant-input{width: 18rem; } } //第一个输入框 - & .account{margin-top: 4vh; } + .account{margin-top: 4vh; } //所有的链接 - & a{ + a{ color: #466AFF; &:hover{opacity:0.8; } } //登录 注册 重置密码并登录按钮 - & .login_register_cofBut{ + .login_register_cofBut{ font-size: 1em; width: 100%; height: 3.1em; @@ -128,31 +133,35 @@ border-color: #d9d9d9; } //输入密码提示框 - & .password_tips{ + .password_tips{ margin-top: -10px; padding-bottom: 8px; color: #808080; font-size: 0.9em; } - & .message, .ant-form-explain{ + .message, .ant-form-explain{ color: #D40000; font-size: 13px; } - & .message.active{ + .message.active{ margin-bottom: -30px !important; } //antd 输入框样式 - & .ant-input{ + .ant-input,.ant-select-selection{ height: 3.1em; background-color: #F7F7F7 !important; font-size: 1em; color: #333333; &:hover{border-color:#466AFF; } } - & .ant-form-explain{ + .ant-select-selection__rendered{ + line-height: 3em; + } + .ant-form-explain{ margin-top: 0.5vh; margin-bottom: -10px; } + //输入框 .ant-form-item{ margin-bottom: 15px; @@ -167,7 +176,13 @@ background-color: #466AFF; border: #466AFF; } - + .inline_input { + display: flex; + .ant-form-item-control-wrapper{ + flex: 1; + } + } + .ant-checkbox-checked::after{ border: 1px solid #466AFF; } @@ -230,4 +245,72 @@ } & .login_register_cofBut{margin-top: 1.5vh; } } -} \ No newline at end of file +} +.logoimgbox{ + text-align: center; + .logoimg{ + width: 150px; + max-width: 30vw; + margin-bottom: 2vh; + } +} +/*当页面宽度小于786px*/ +@media screen and (max-width:786px) { + .login_register_right{ + padding-top:0; + } + .login_register_right .right_cont{ + padding:8vh 15px + } + .ant-form-item-label, .ant-form-item-control-wrapper{ + width: auto !important; + } + .login_register_right .right_cont .inline_input{ + display: block; + } + .logoimgbox{ + .logoimg{ + width: 150px; + } + } +} +@media screen and (max-width:375px) { + .login_register_right .right_cont{ + font-size: 13px; + padding:5vh 15px + } + .logoimgbox{ + .logoimg{ + margin-bottom: 0; + } + } +} +@media screen and (max-width:360px) { + .login_register_right .right_cont{ + font-size: 12px; + padding:5vh 10px + } + .logoimgbox{ + display: none; + } +} + +.login_agreement{ + width: 90vw !important; + max-width: 1000px; + .ant-modal-header{ + display: none; + } + .ant-modal-body{ + max-height: 55vh; + overflow-y:scroll; + + h3{ + margin:.75em auto; + } + p{ + margin:.45em auto; + } + } +} + diff --git a/src/modules/loginRegister/Register.jsx b/src/modules/loginRegister/Register.jsx index 1ff6d9e1..c121cb31 100644 --- a/src/modules/loginRegister/Register.jsx +++ b/src/modules/loginRegister/Register.jsx @@ -1,16 +1,15 @@ import React, { useEffect, useRef, useState } from "react"; -import { Form, Input, Button, Checkbox, message } from "antd"; +import { Form, Input, Button, Checkbox, message, Select, Modal } from "antd"; import { Link } from "react-router-dom"; import axios from 'axios'; -import { setmiyah } from 'educoder'; +import { setmiyah ,getImageUrl ,isMobile} from 'educoder'; import './LoginRegisterPage.scss'; +const Option = Select.Option; -function Register(props){ - const {form} = props; - const {getFieldDecorator } = form; - //用户输入的符合规则的邮箱(用于获取验证码) - const [emailStr, setEmailStr] = useState(undefined); - //用户输入的符合规则的用户名,用于当用户输入符合规则的用户名之后再更改又去触发check.json接口 +function Register(props) { + const { form } = props; + const { getFieldDecorator,setFieldsValue,validateFields,getFieldValue } = form; + //用户输入的符合规则的手机号(用于获取验证码) const [loginStr, setLoginStr] = useState(undefined); const [secondsStr, setSecondsStr] = useState(60); const [countDown, setCountDown] = useState(false); @@ -19,120 +18,102 @@ function Register(props){ const [tipVisable, setTipVisable] = useState(false); //用于表单提交时会再次校验数据 const [userNameGo, setUserNameGo] = useState(true); - const [emailGo, setEmailGo] = useState(true); + const [phoneGo, setPhoneGo] = useState(true); + const [visible, setVisible] = useState(false); const seconds = useRef(); let interval = undefined; //页面加载完自动聚焦到第一个输入框 const inputEl = useRef(null); //注册表单提交 - function handleSubmit(){ - form.validateFields((err, values) => { + function handleSubmit() { + validateFields((err, values) => { if (!err) { values.agreement && axios.post(`/accounts/register.json`, { - login: values.email, - namespace: values.register_username, + login: values.login, password: values.register_psd, - password_confirmation: values.psdComfirm, + company_name: values.company_name, + user_type: values.user_type, code: values.captcha - }).then((response)=>{ - if(response.data && response.data.status === -6){ + }).then((response) => { + if (response.data && response.data.status === -6) { //验证码不正确 - form.setFields({captcha: {value:values.captcha,errors:[new Error('验证码错误,请重新输入')]}}); - //设置邮箱内容-》不设置会被恢复成undefined,从而点击验证码失败 - setEmailStr(values.email); - }else if(response.data && response.data.status === 0){ - //注册成功,页面跳转即可,注册后登录流程forge处理了 - window.location.href = "/"+values.register_username; + form.setFields({ captcha: { value: values.captcha, errors: [new Error('验证码错误,请重新输入')] } }); + //设置手机内容-》不设置会被恢复成undefined,从而点击验证码失败 + setLoginStr(values.login); + } else if (response.data && response.data.status === 0) { + window.location.href = "/" } else { - setEmailStr(values.email); + setLoginStr(values.login); setMess(response.data.message); } }) } }); } - - //判断用户名(username)是否注册 - function usernameConfirm(rule, value, callback){ - setUserNameGo(true); - value && (userNameGo || value !== loginStr) ? axios.post(`/accounts/check.json`, { - value: value, - type: 1 + + + //判断手机是否注册 + function phoneConfirm(rule, value, callback) { + setPhoneGo(true); + value && (phoneGo || value !== loginStr) ? axios.get(`/accounts/valid_email_and_phone.json`, { + params: { + login: value, + type: 1 + } }).then(response => { - if (response.data.status === -1) { - callback('该名称已经被使用'); + if (response.data.status === -2) { + setGetCaptchaBut(false); + setMess(response.data.message); + callback('该手机已被注册'); } else { setLoginStr(value); - setUserNameGo(false); - callback(); - } - }):callback();setLoginStr(undefined); - } - - //判断邮箱是否注册 - function emailConfirm(rule, value, callback) { - setEmailGo(true); - value && (emailGo || value !== emailStr) ? axios.post(`/accounts/check.json`, { - value: value, - type: 2 - }).then(response => { - if (response.data.status === -1) { - setGetCaptchaBut(false); - callback('该邮箱已被注册'); - } else { - setEmailStr(value); setGetCaptchaBut(true); - setEmailGo(false); + setPhoneGo(false); callback(); } - }):callback();setEmailStr(undefined); + }) : callback(); setLoginStr(undefined); } - //确认密码 - function comfirmPassWord(rule, value, callback, index) { - if ((index === 2 && value && form.getFieldValue('register_psd') && value !== form.getFieldValue('register_psd')) || (index === 1 && value && form.getFieldValue('psdComfirm') && value !== form.getFieldValue('psdComfirm'))) { - if(index===1){ - form.setFields({psdComfirm: {value:form.getFieldValue('psdComfirm'),errors:[new Error('密码不一致,请重新输入')]}}); - callback(); - }else{ - callback('密码不一致,请重新输入'); - } - } else { - callback(); - } - } //检查密码是否符合格式 - function checkPassWord(rule, value, callback){ - if(!value){ + function checkPassWord(rule, value, callback) { + if (!value) { setTipVisable(true); callback('请输入登录密码'); - }else if(/(?!.*\s)(?!^[\u4e00-\u9fa5]+$)^.{8,16}$/.test(value)){ + } else if (/(?!.*\s)(?!^[\u4e00-\u9fa5]+$)^.{8,16}$/.test(value)) { callback() - }else{ + } else { setTipVisable(true); - if(value.length<8 || value.length>16){ + if (value.length < 8 || value.length > 16) { callback('密码长度为8-16个字符'); - }else{ + } else { callback('密码不能使用空格'); } } } //确认勾选服务 - function comfirmRead(rule, value, callback){ - if(value){ + function comfirmRead(rule, value, callback) { + if (value) { callback(); - }else{ + } else { callback("请阅读并接受我们的服务条款"); } } //获取验证码 function getCaptcha() { + if(isMobile){ + let phone=getFieldValue('login'); + const pattern = /^1(3|4|5|6|7|8|9)\d{9}$/; + if (!pattern.test(phone)) { + message.error('您输入的手机号不正确'); + return; + } + } setMess(undefined); - if (emailStr) { + if (loginStr) { // 倒计时开始 setCountDown(true); setGetCaptchaBut(false); @@ -155,15 +136,14 @@ function Register(props){ //请求获取验证码接口 axios.get(`/accounts/get_verification_code.json`, { params: { - login: emailStr, + login: loginStr, type: 1, - smscode: setmiyah(emailStr), + smscode: setmiyah(loginStr), } }).then(response => { if (response.data && response.data.status === 0) { //验证码发送成功 - let email = emailStr.substring(emailStr.indexOf("@")+1); - message.success({content:验证码已发送,请注意查收。前往邮箱}); + message.success({ content: 验证码已发送,请注意查收。 }); } else { //验证码发送失败,获取验证码按钮变灰并且文案变回【获取验证码】 setGetCaptchaBut(false); @@ -176,146 +156,214 @@ function Register(props){ } //清除密码框的value属性->DOM看不见密码值 - function clear(){ + function clear() { const password = document.getElementById("register_register_psd"); const passwordComfirm = document.getElementById("register_psdComfirm"); - if(password && password.type==="password"){ - setTimeout(()=>{ + if (password && password.type === "password") { + setTimeout(() => { password.removeAttribute('value'); - },0) + }, 0) } - if(passwordComfirm && passwordComfirm.type==="password"){ - setTimeout(()=>{ + if (passwordComfirm && passwordComfirm.type === "password") { + setTimeout(() => { passwordComfirm.removeAttribute('value'); - },0) + }, 0) } } useEffect(() => { - inputEl.current.focus(); - clear; + // inputEl.current.focus(); + clear(); }, []) - return( -
-
-
- 欢迎注册 GitLink - 已有账号,立即登录 -
-

{mess}

- - - {getFieldDecorator('register_username',{ - rules:[ - { - required:true, - message:"请输入用户名" - }, - { - pattern: /^[a-zA-Z]/, - message: "用户名必须以字母开头" - }, - { - pattern: /[a-zA-Z0-9]$/, - message: "用户名只能使用英文字母和数字" - }, - { - min: 4, - max: 15, - message: "用户名长度为4到15个字符" - }, - { - validator: (rule, value, callback) => { usernameConfirm(rule, value, callback) } - } - ], - validateTrigger:"onBlur", - validateFirst: true, - })({document.getElementById("register_register_username").removeAttribute("readOnly")}}/>)} - - - {getFieldDecorator('email',{ - rules:[ - { - type: 'email', - message: '请输入正确的邮箱格式', - }, - { - required:true, - message:"请输入邮箱地址" - }, - { - validator: (rule, value, callback) => { emailConfirm(rule, value, callback) } - } - ], - validateTrigger:"onBlur", - validateFirst: true, - })({document.getElementById("register_email").removeAttribute("readOnly")}} />)} - + const settings=JSON.parse(localStorage.getItem('chromesetting')); - - -
- {getFieldDecorator('captcha', { - rules: [{ - required: true, - message: "请输入验证码" - }], - validateTrigger: "onBlur", - })( - {document.getElementById("register_captcha").removeAttribute("readOnly")}} /> - )} - -
-
- - - {getFieldDecorator('register_psd',{ - rules:[ - { - validator: (rule, value, callback) => { comfirmPassWord(rule, value, callback, 1) } - }, - { - validator: (rule, value, callback) => { checkPassWord(rule, value, callback) } - } - ], - validateTrigger:"onBlur", - validateFirst: true, - })({document.getElementById("register_register_psd").removeAttribute("readOnly")}}/>)} - - 请输入8-16位密码,区分大小写、不能使用空格 - - - {getFieldDecorator('psdComfirm', { - rules: [ - { - required: true, - message: "请确认登录密码" - }, - { - validator: (rule, value, callback) => { comfirmPassWord(rule, value, callback, 2) } - } - ], - validateTrigger: "onBlur", - validateFirst: true, - })({document.getElementById("register_psdComfirm").removeAttribute("readOnly")}}/>)} - - - - - {getFieldDecorator('agreement', { - valuePropName: 'checked', - initialValue: false, - rules: [ - { - validator: (rule, value, callback) => { comfirmRead(rule, value, callback) } - } - ], - })(我已阅读并接受《GitLink服务协议条款》)} - - - + return ( +
+
+ {settings&&红山开源}
+
+ 欢迎注册 红山开源 + 已有账号,立即登录 +
+

{mess}

+
+ + + {getFieldDecorator('login', { + rules: [ + { + required: true, + message: "请输入手机号" + }, + { + validator: (rule, val, callback) => { + const pattern = /^1(3|4|5|6|7|8|9)\d{9}$/; + if (pattern.test(val)) { + setGetCaptchaBut(true); + callback(); + } else { + setGetCaptchaBut(false); + callback('请输入正确的手机号码!'); + } + } + }, + { + validator: (rule, value, callback) => { phoneConfirm(rule, value, callback) } + } + ], + validateTrigger: "onBlur", + validateFirst: true, + })()} + + + + +
+ {getFieldDecorator('captcha', { + rules: [{ + required: true, + message: "请输入验证码" + }], + validateTrigger: "onBlur", + })( + + )} + +
+
+ + + {getFieldDecorator('register_psd', { + rules: [ + { + validator: (rule, value, callback) => { checkPassWord(rule, value, callback) } + } + ], + validateTrigger: "onBlur", + validateFirst: true, + })()} + + 请输入8-16位密码,区分大小写、不能使用空格 + + + {getFieldDecorator('company_name', { + rules: [ + { + required: true, + message: "请输入单位" + }, + ], + validateTrigger: "onBlur", + validateFirst: true, + })()} + + + + {getFieldDecorator('user_type', { + rules: [ + { + required: true, + message: "请选择用户类型" + }, + ], + validateTrigger: "onBlur", + validateFirst: true, + })()} + + + + + {getFieldDecorator('agreement', { + valuePropName: 'checked', + initialValue: false, + rules: [ + { + validator: (rule, value, callback) => { comfirmRead(rule, value, callback) } + } + ], + })(我已阅读并接受 { setVisible(true) }}>《红山开源服务协议条款》)} + + +
+ + { setVisible(false) ;setFieldsValue({agreement:true})}} + onCancel={() => { setVisible(false);setFieldsValue({agreement:false}) }} + className="login_agreement" + > +

尊敬的用户,您好!

+ +

欢迎使用红山开源平台,在您使用红山开源平台前,请认真阅读并遵守《红山开源服务协议》(以下简称”本协议”),请您务必审慎阅读、充分理解协议的各条款内容。 当您在注册过程中点击查看并同意本服务协议,按照注册流程成功注册为红山开源平台的用户即表示您已充分阅读、理解并完全接受本协议中的全部条款。本条款旨在保障您权益,维护平台正常秩序,实现平台规范化运营,给您提供一个良好的开发环境。如您违反条款中的规定事项,一经发现,平台有权变更、暂停或终止您对平台服务的使用而无须事先声明,包括但不限于限制您使用平台服务的次数与资源、账号永久封闭等。

+ +

请您在进行注册前承诺接受并遵守本协议的约定,届时您不应以未阅读本协议的内容等理由,主张本协议无效或本协议中的某些条款无效,或要求撤销本协议。

+ +

一、红山开源平台权利和义务

+ +

1、尊重用户隐私:尊重用户隐私,保障用户隐私安全是红山开源平台的一项基本政策;

+ +

2、管理平台用户:红山开源平台依据国家法律、地方法律和国际法律等的标准以及本行业的规则来管理平台注册用户;

+ +

3、处理用户反馈:红山开源平台的相关人员会及时处理用户反馈的问题并给予及时回复。

+ +

二、用户权利和义务

+ + 用户在使用红山开源平台的过程中,必须遵守如下原则: + +

1、遵守所有中华人民共和国的法律、法规、规章制度、规范、政策、行政命令、强制标准及行业标准等(统称为“法律法规”);

+ +

2、不干扰和混乱网络服务,包括但不限于使用插件、外挂或非经红山平台授权的第三方工具或服务接入平台服务和相关系统;

+ +

3、遵守所有使用网络服务的网络协议、规定、程序和惯例,如在此方面造成任何后果及损失,由用户自行承担全部责任;

+ +

4、不传输任何骚扰性的、中伤他人的、辱骂性的、恐吓性的、伤害性的、庸俗的,淫秽的、以及含有中国法律、法规、规章、条例以及任何具有法律效力之规范所限制或禁止的其他内容等信息资料,一经发现,红山平台将按照国家有关规定,及时删除网站中含有上述内容的地址、目录,并保留原始记录,在二十四小时之内向公安机关报告;

+ +

5、不传输任何教唆他人构成犯罪行为或疑似包含犯罪行为煽动性的资料;

+ +

6、用户不得故意或者过失损害红山开源平台合法权利和利益,包括但不限于恶意获取、删除或修改平台的原始数据和其他数据及其他任何有损本平台一切相关知识产权的行为。

+ +

三、关于责任

+ + 鉴于网络服务的特殊性,用户同意红山开源团队有权在事先通知的情况下,变更、中断、升级部分网络服务。红山开源团队不担保网络服务不会中断,但承诺在用户可承受的时间内快速恢复服务,同时确保用户数据的安全性和可靠性。 + +

四、保障网络信息安全

+ + 用户不得利用平台服务从事以下危害计算机网络信息安全的活动: + +

(1) 未经允许,进入计算机信息网络或者使用计算机信息网络资源的;

+ +

(2) 未经允许,对计算机信息网络功能进行删除、修改或者增加的;

+ +

(3) 未经允许,对进入计算机信息网络中存储、处理或者传输的数据和应用程序进行删除、修改或者增加的;

+ +

(4) 故意制作、传播计算机病毒等破坏性程序的;

+ +

(5) 其他危害计算机信息网络安全的行为。

+ +

五、服务条款的修改

+ + 红山开源团队保留在必要时对本协议修改的权利,一旦发生变动,这些条款可由红山开源团队及时更新,且毋须另行通知,修改后的条款一旦在网页上公布即有效代替原来的服务条款。用户可随时查阅最新版服务条款。 + +

六、用户须知

+ + 用户充分理解并同意,用户对自己使用平台服务的一切行为及由此产生的一切结果负责,包括但不限于用户所发表的任何内容、提供的任何服务以及由此产生的任何后果。用户应对平台服务的内容应自行判断并决定是否使用,并承担因使用平台服务及其相关内容而引起的所有风险,包括因对平台服务及其内容的真实性、完整性、准确性、及时性及实用性的依赖而产生的风险。平台不对此提供任何担保和保证,不对因前述风险而导致的任何后果或损失对用户承担责任。 + +

如果用户违反了法律法规或本协议,红山开源平台有权依据合理判断对违反法律法规或本协议的行为作出处理,并对违反法律法规及本协议的任何用户调查并采取适当的法律行动,包括但不限于民事诉讼等。用户应当自行承担由此产生的任何法律责任。

+ + +

注:本协议最终解释权归红山开源团队所有。

+
) } diff --git a/src/modules/loginRegister/ResetPassword.jsx b/src/modules/loginRegister/ResetPassword.jsx index fa7ec72a..a9746e2c 100644 --- a/src/modules/loginRegister/ResetPassword.jsx +++ b/src/modules/loginRegister/ResetPassword.jsx @@ -2,12 +2,12 @@ import React, { useEffect, useRef, useState } from "react"; import { Form, Input, Button, message } from "antd"; import { Link } from "react-router-dom"; import axios from 'axios'; -import { setmiyah } from 'educoder'; +import { setmiyah ,getImageUrl,isMobile} from 'educoder'; import './LoginRegisterPage.scss'; function ResetPassword(props) { const {form } = props; - const {getFieldDecorator } = form; + const {getFieldDecorator,getFieldValue } = form; const [emailStr, setEmailStr] = useState(undefined); const [secondsStr, setSecondsStr] = useState(60); const [countDown, setCountDown] = useState(false); @@ -26,15 +26,14 @@ function ResetPassword(props) { form.validateFieldsAndScroll((err, values) => { if (!err) { axios.post(`/accounts/reset_password.json`, { - login: values.email, - password: values.psd, - password_confirmation: values.psdComfirm, + login: values.login, + new_password: values.psd, code: values.captcha, }).then((response) => { - if (response.data.status === 0) { + if (response.data.status === 1) { //重置密码成功,调用登录接口 axios.post(`/accounts/login.json`, { - login: values.email, + login: values.login, password: values.psd }).then((login_response) => { if (!login_response.data.login) { @@ -46,8 +45,8 @@ function ResetPassword(props) { console.log('error',error); }) } else { - //设置邮箱内容-》不设置会被恢复成undefined,从而点击验证码失败 - setEmailStr(values.email); + //设置手机号内容-》不设置会被恢复成undefined,从而点击验证码失败 + setEmailStr(values.login); const message = response.data.message; message === "验证码不正确" ? form.setFields({captcha: {value:values.captcha,errors:[new Error('验证码错误,请重新输入')]}}) : setMess(message); } @@ -56,38 +55,25 @@ function ResetPassword(props) { }); } - //判断邮箱是否注册 + //判断手机号是否注册 function emailConfirm(rule, value, callback) { setEmailGo(true); - value && (emailGo || value !== emailStr) ? axios.post(`/accounts/check.json`, { - value: value, - type: 2 - }).then(response => { - if (response.data && response.data.status === -1) { + value && (emailGo || value !== emailStr) ? axios.get(`/accounts/valid_email_and_phone.json`,{params: { + login: value, + type: 1 + }}).then(response => { + if (response.data && response.data.status === -2) { setEmailStr(value); setGetCaptchaBut(true); setEmailGo(false); callback(); } else { setGetCaptchaBut(false); - callback('此邮箱未注册'); + callback('此手机号未注册'); } }):callback();setEmailStr(undefined); } - //确认密码 - function comfirmPassWord(rule, value, callback, index) { - if ((index === 2 && value && form.getFieldValue('psd') && value !== form.getFieldValue('psd')) || (index === 1 && value && form.getFieldValue('psdComfirm') && value !== form.getFieldValue('psdComfirm'))) { - if(index===1){ - form.setFields({psdComfirm: {value:form.getFieldValue('psdComfirm'),errors:[new Error('密码不一致,请重新输入')]}}); - callback(); - }else{ - callback('密码不一致,请重新输入'); - } - } else { - callback(); - } - } //检查密码是否符合格式 function checkPassWord(rule, value, callback){ @@ -108,6 +94,14 @@ function ResetPassword(props) { //获取验证码 function getCaptcha() { + if(isMobile){ + let phone=getFieldValue('login'); + const pattern = /^1(3|4|5|6|7|8|9)\d{9}$/; + if (!pattern.test(phone)) { + message.error('您输入的手机号不正确'); + return; + } + } setMess(undefined); if (emailStr) { // 倒计时开始 @@ -139,8 +133,7 @@ function ResetPassword(props) { }).then(response => { if (response.data && response.data.status === 0) { //验证码发送成功 - let email = emailStr.substring(emailStr.indexOf("@")+1); - message.success({content:验证码已发送,请注意查收。前往邮箱}); + message.success({content:验证码已发送,请注意查收}); } else { //验证码发送失败,获取验证码按钮变灰并且文案变回【获取验证码】 setGetCaptchaBut(false); @@ -173,9 +166,14 @@ function ResetPassword(props) { clear; }, []) + const settings=JSON.parse(localStorage.getItem('chromesetting')); + return (
+
+ {settings&&红山开源} +
找回密码 已有账号,立即登录 @@ -183,15 +181,21 @@ function ResetPassword(props) {

{mess}

- {getFieldDecorator('email', { + {getFieldDecorator('login', { rules: [ { - type: 'email', - message: '请输入正确的邮箱格式', + validator: (rule, val, callback) => { + const pattern = /^1(3|4|5|6|7|8|9)\d{9}$/; + if (pattern.test(val)) { + callback(); + } else { + callback('请输入正确的手机号码!'); + } + } }, { required: true, - message: "请输入已注册的邮箱" + message: "请输入已注册的手机号" }, { validator: (rule, value, callback) => { emailConfirm(rule, value, callback) } @@ -199,7 +203,7 @@ function ResetPassword(props) { ], validateTrigger: "onBlur", validateFirst: true, - })({document.getElementById("resetPassword_email").removeAttribute("readOnly")}} />)} + })()} @@ -212,43 +216,26 @@ function ResetPassword(props) { }], validateTrigger: "onBlur", })( - {document.getElementById("resetPassword_captcha").removeAttribute("readOnly")}} /> + )} - + {/* */} +
{getFieldDecorator('psd', { rules: [ - { - validator: (rule, value, callback) => { comfirmPassWord(rule, value, callback,1) } - }, { validator: (rule, value, callback) => { checkPassWord(rule, value, callback) } } ], validateTrigger: "onBlur", validateFirst: true, - })({document.getElementById("resetPassword_psd").removeAttribute("readOnly")}} />)} + })()} 请输入8-16位密码,区分大小写、不能使用空格 - - {getFieldDecorator('psdComfirm', { - rules: [ - { - required: true, - message: "请确认新密码" - }, - { - validator: (rule, value, callback) => { comfirmPassWord(rule, value, callback,2) } - } - ], - validateTrigger: "onBlur", - validateFirst: true, - })({document.getElementById("resetPassword_psdComfirm").removeAttribute("readOnly")}} />)} - diff --git a/src/modules/tpm/NewHeader.js b/src/modules/tpm/NewHeader.js index 4e545b06..eb1c5211 100644 --- a/src/modules/tpm/NewHeader.js +++ b/src/modules/tpm/NewHeader.js @@ -829,11 +829,11 @@ class NewHeader extends Component { this.educoderlogin()} className={`mr5 ${activeIndex ? 'color-home' : 'color-grey-6'}`}>登录 { - settings && settings.new_course && settings.new_course.register_url && ( + // settings && settings.new_course && settings.new_course.register_url && ( activeIndex ? - : - 注册 - ) + : + 注册 + // ) } : diff --git a/src/modules/user/LoginRegisterComponent.js b/src/modules/user/LoginRegisterComponent.js index f4a6d97f..670e42b0 100644 --- a/src/modules/user/LoginRegisterComponent.js +++ b/src/modules/user/LoginRegisterComponent.js @@ -385,7 +385,7 @@ class LoginRegisterComponent extends Component { 登录密码出错已达上限,账号已被锁定;

- 请10分钟后重新登录或找回密码 @@ -1243,7 +1243,7 @@ class LoginRegisterComponent extends Component { color: '#676767', }}>我已阅读并同意 - 《服务协议条款》 + 《服务协议条款》 :""}