From 359333e8ab5cb83b1aaaf47dca5e0688655bc3df Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 20 Jul 2019 14:49:59 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 2 + public/react/src/AppConfig.js | 4 +- .../src/common/components/Notcompleted.js | 1 - .../src/common/components/SetAppModel.js | 8 +- .../src/modules/login/Trialapplicationysl.js | 722 ++++++++++++++++++ public/react/src/modules/tpm/NewHeader.js | 4 +- .../react/src/modules/user/Notcompletedysl.js | 70 ++ 7 files changed, 799 insertions(+), 12 deletions(-) create mode 100644 public/react/src/modules/login/Trialapplicationysl.js create mode 100644 public/react/src/modules/user/Notcompletedysl.js diff --git a/public/react/src/App.js b/public/react/src/App.js index b7658450a..28a7e977e 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -14,6 +14,7 @@ import '@icedesign/base/dist/ICEDesignBase.css'; import '@icedesign/base/index.scss'; import LoginDialog from './modules/login/LoginDialog' +import Notcompletedysl from './modules/user/Notcompletedysl' import Trialapplication from './modules/login/Trialapplication' import NotFoundPage from './NotFoundPage' @@ -264,6 +265,7 @@ class App extends Component { + {/*{*/} {/* isRender === true?*/} {/* : ""*/} diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 159694da8..b3cfd7cf9 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -111,7 +111,6 @@ export function initAxiosInterceptors(props) { if(response===undefined){ return } - // locationurl(402); const config = response.config if (response.data.status === -1) { // console.error('error:', response.data.message) @@ -155,10 +154,9 @@ export function initAxiosInterceptors(props) { } if (response.data.status === 402) { - debugger console.log(response.data.status); console.log(response.data); - locationurl(402); + // locationurl(402); } diff --git a/public/react/src/common/components/Notcompleted.js b/public/react/src/common/components/Notcompleted.js index e974003de..d7998ca27 100644 --- a/public/react/src/common/components/Notcompleted.js +++ b/public/react/src/common/components/Notcompleted.js @@ -1,5 +1,4 @@ import React, { Component } from 'react'; -import {getImageUrl} from 'public/react/src/common/educoder'; import { Modal} from 'antd'; import axios from 'axios'; import '../../modules/user/common.css'; diff --git a/public/react/src/common/components/SetAppModel.js b/public/react/src/common/components/SetAppModel.js index a504beb69..b71a408c6 100644 --- a/public/react/src/common/components/SetAppModel.js +++ b/public/react/src/common/components/SetAppModel.js @@ -1,6 +1,6 @@ import React, { Component } from 'react'; import { Modal } from 'antd'; -export function SetAppModel(options) { +export function SetAppModel(options={}) { return function wrap(WrappedComponent) { return class Wrapper extends Component { constructor(props) { @@ -9,9 +9,6 @@ export function SetAppModel(options) { this.state = { } - console.log("SetAppModel"); - console.log("13"); - console.log(options); } modalCancel=()=>{ window.location.href = "/"; @@ -26,7 +23,6 @@ export function SetAppModel(options) { render() { const { titlemessage, Modallisttype, Modallist, singleButton } = this.state; - console.log(this.state.Notcompleteds); return (
diff --git a/public/react/src/modules/login/Trialapplicationysl.js b/public/react/src/modules/login/Trialapplicationysl.js new file mode 100644 index 000000000..ec7bebcda --- /dev/null +++ b/public/react/src/modules/login/Trialapplicationysl.js @@ -0,0 +1,722 @@ +import React, {Component} from 'react'; +import {Redirect} from 'react-router'; +import Dialog, { + DialogActions, + DialogContent, + DialogContentText, + DialogTitle, +} from 'material-ui/Dialog'; +import axios from 'axios'; + +import {broadcastChannelPostMessage} from 'educoder' +import {Tabs, Input, Checkbox, Button, notification, Menu} from 'antd'; + + +//试用申请 +class Trialapplicationysl extends Component { + // isRender控制弹出窗口显示 + constructor(props) { + super(props) + this.state = { + props: props, + login: "", + Phonenumberisnotcocodes: undefined, + codes: "", + reason: "", + Phonenumberisnotcoreason: undefined, + isRenders: false, + seconds: 60, + getverificationcodes: true, + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + readonlyInput: true, + user_phone_binded: props.user_phone_binded, + showTrial: false, + user: undefined, + borredss:"bor-reds", + borredssz:"bor-reds fl mr5", + } + //user_phone_binded 判断是否手机号验证 + // console.log("Trialapplication"); + // console.log(props); + } + + Cancel = () => { + this.props.Cancel() + } + + componentWillReceiveProps(nextProps) { + // console.log("46"); + // console.log(nextProps); + // console.log(this.props); + if (nextProps.user != this.props.user) { + // console.log("50"); + // console.log(nextProps.user); + if (nextProps.user !== undefined) { + // console.log("53"); + // console.log(nextProps.user); + this.setState({ + user_phone_binded: nextProps.user.user_phone_binded, + }) + } + + + } + + + } + + + //初始化数据 + componentDidMount() { + // console.log("53"); + // + // console.log(this.props.isRenders); + + if (this.props.isRenders != undefined) { + this.setState({ + isRenders: this.props.isRenders + }) + } + if (this.props.showTrial != undefined) { + // 判断是否返回主页的参数 + this.setState({ + showTrial: this.props.showTrial + }) + + } + axios.interceptors.response.use((response) => { + if (response != undefined) + if (response && response.data.status === 407) { + this.setState({ + isRenders: true + }) + } + return response; + }, (error) => { + //TODO 这里如果样式变了会出现css不加载的情况 + + }); + + } + + //获取登入 + loginInputonChange = (e) => { + // console.log(e.target.value); + this.setState({ + login: e.target.value, + }) + + + } + //获取申请理由 + loginInputonChanges = (e) => { + // console.log(e.target.value); + this.setState({ + reason: e.target.value, + Phonenumberisnotcoreason: undefined, + }) + + + } + //获取code + codesonChange = (e) => { + this.setState({ + codes: e.target.value, + Phonenumberisnotcocodes: undefined, + }) + } + + openNotification = (messge) => { + notification.open({ + message: "提示", + description: + messge, + onClick: () => { + console.log('Notification Clicked!'); + }, + }); + }; + //倒计时 + getverificationcode = () => { + if (this.state.Phonenumberisnotcobool === false) { + if (this.state.login.length === 0) { + this.setState({ + Phonenumberisnotco: "请输入正确的手机号或邮箱", + }) + return + } else { + this.setState({ + Phonenumberisnotco: "请输入正确的手机号或邮箱", + }) + } + return; + } + if (this.state.getverificationcodes === true) { + this.setState({ + getverificationcodes: undefined, + }) + let timer = setInterval(() => { + this.setState((preState) => ({ + seconds: preState.seconds - 1, + }), () => { + if (this.state.seconds == 0) { + clearInterval(timer); + this.setState({ + getverificationcodes: false, + seconds: 60, + }) + } + }); + }, 1000) + this.SMSverification(); + } else { + this.setState({ + getverificationcodes: undefined, + }) + let timer = setInterval(() => { + this.setState((preState) => ({ + seconds: preState.seconds - 1, + }), () => { + if (this.state.seconds == 0) { + clearInterval(timer); + this.setState({ + getverificationcodes: false, + seconds: 60, + + }) + } + }); + }, 1000) + this.SMSverification(); + } + } + + //短信验证 + SMSverification = () => { + var url = `/accounts/get_verification_code.json`; + axios.get((url), { + params: { + login: this.state.login, + type: 3, + } + }).then((result) => { + //验证有问题{"status":1,"message":"success"} + // console.log(result); + + + }).catch((error) => { + console.log(error); + + }) + } + + handleDialogClose() { + if (this.state.showTrial === false) { + this.setState({ + isRenders: false + }) + this.Cancel(); + window.location.href = "/"; + } else { + this.setState({ + isRenders: false + }) + this.Cancel(); + } + + } + + postregistered = () => { + //提交按钮 + if (this.state.user_phone_binded === false) { + + if (this.state.Phonenumberisnotcobool === false) { + var iphones = ""; + if (this.state.Phonenumberisnotco === undefined || this.state.Phonenumberisnotco === null || this.state.Phonenumberisnotco === "") { + iphones = "请输入手机号"; + } else { + iphones = this.state.Phonenumberisnotco; + } + + this.setState({ + Phonenumberisnotco: iphones, + }) + + return; + } + if (this.state.codes.length === 0) { + this.setState({ + Phonenumberisnotcocodes: "请输入验证码", + }) + return; + } + + } + + if (this.state.reason.length === 0) { + this.setState({ + Phonenumberisnotcoreason: "请输入推荐人信息或申请理由", + }) + return; + } + + var thiss = this; + var url = "/users/trial_apply.json"; + axios.post(url, { + phone: this.state.login, + code: this.state.codes, + reason: this.state.reason, + }).then((result) => { + // console.log(result); + // this.onTabChange("1"); + if(result !== undefined){ + this.props.showNotification(`试用申请已提交,我们将尽快完成审核`); + // if (this.state.showTrial === false) { + window.location.href = "/"; + this.setState({ + isRenders: false + }) + this.Cancel(); + // } else { + // this.setState({ + // isRenders: false + // }) + // this.Cancel(); + // + // } + } + }).catch((error) => { + + }) + + + } + inputOnBlur = (e) => { + this.isCorrectname(e.target.value); + // this.Emailphonenumberverification(e.target.value, id); + } + isCorrectname = (value) => { + console.log(value.length); + if (value.length === 0) { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: false, + }) + return; + } + // var telephone = $("#telephoneAdd.tianjia_phone").val(); + var regph = /^[1][3,4,5,6,7,8][0-9]{9}$/; + // var email = $("#add_email.tianjia_email").val(); + var regemail = /^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/; + + // [1]手机号开头必须是1 [3,4,5,6,7,8] 第二位是3-8中的一个 [0-9]{9} 后边9位可以是0-9的任意数字。 + var stringdata = undefined; + if (!regph.test(value)) { + stringdata = "手机号格式不正确"; + this.setState({ + Phonenumberisnotco: stringdata, + Phonenumberisnotcobool: false, + }) + } else { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: true, + }) + return + } + + if (!regemail.test(value)) { + if ((value.indexOf("@") != -1) === true) { + stringdata = "邮箱格式不正确"; + } else { + stringdata = "手机号格式不正确"; + + } + this.setState({ + Phonenumberisnotco: stringdata, + Phonenumberisnotcobool: false, + }) + + // this.Emailphonenumberverification(value) + return + } else { + this.setState({ + Phonenumberisnotco: undefined, + Phonenumberisnotcobool: true, + }) + return + } + } + //邮箱手机号验证 + Emailphonenumberverification = (value) => { + var url = `/accounts/valid_email_and_phone.json`; + axios.get((url), { + params: { + login: value, + type: 2, + } + }).then((result) => { + //验证有问题{"status":1,"message":"success"} + // console.log(result); + + + }).catch((error) => { + console.log(error); + // this.setState({ + // login:"", + // logins:"", + // }) + }) + } + + //执行view + render() { + let {login, codes, reason, isRenders, user_phone_binded,borredss,borredssz, Phonenumberisnotco, getverificationcodes, Phonenumberisnotcocodes, Phonenumberisnotcoreason, seconds} = this.state; + // console.log("Trialapplication22222222"); + // console.log(this.props); + + return ( +
+ { + isRenders === false ? "" : + +
+ + + + + +
{ + this.handleDialogClose() + }}> + +
+
+ +
+
    + 试用申请 +
+ +
+
+ 您尚未获得访问权限,请如实填写下述信息 +
+
+ 管理员审核批准后,即可继续访问网站 +
+ + { + user_phone_binded === true ? "" : +
+ this.inputOnBlur(e)} + style={{"height": "38px",}} + className={Phonenumberisnotco && Phonenumberisnotco !== ""?borredss:""} + name="myiphone" + > + { + Phonenumberisnotco && Phonenumberisnotco != "" ? +

+ {Phonenumberisnotco} +

+ :
+ } +
+ } + + + { + user_phone_binded === true ? "" : +
+ + + + + { + getverificationcodes === undefined ? + + : getverificationcodes === true ? + + : + + } +
+ } + + + { + Phonenumberisnotcocodes && Phonenumberisnotcocodes != "" ? +

+ {Phonenumberisnotcocodes} +

+ :
+ } +
+ + { + Phonenumberisnotcoreason && Phonenumberisnotcoreason !== "" ? +

+ {Phonenumberisnotcoreason} +

+ :
+ } +
+ + + + +
+ + +
+ +
+
+ + } +
+ + + ) + + + } + + +} + +export default Trialapplicationysl; diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index c672caa84..a4790ea6d 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -18,7 +18,7 @@ import Addcourses from '../courses/coursesPublic/Addcourses'; import LoginDialog from '../login/LoginDialog'; -import Trialapplication from '../login/Trialapplication' +import Trialapplicationysl from '../login/Trialapplicationysl' import 'antd/lib/modal/style/index.css'; @@ -629,7 +629,7 @@ submittojoinclass=(value)=>{ {/* />*/} {/* :""*/} {/*}*/} - this.cancelModulationModels()} > + this.cancelModulationModels()} >
{/*<%= link_to image_tag("/images/educoder/logo.png", alt:"高校智能化教学与实训平台", className:"logoimg"), home_path %>*/} diff --git a/public/react/src/modules/user/Notcompletedysl.js b/public/react/src/modules/user/Notcompletedysl.js new file mode 100644 index 000000000..cc7a78e13 --- /dev/null +++ b/public/react/src/modules/user/Notcompletedysl.js @@ -0,0 +1,70 @@ +import React, { Component } from 'react'; +import { Modal} from 'antd'; +import axios from 'axios'; +import '../../modules/user/common.css'; +//完善个人资料 +class Notcompletedysl extends Component { + + constructor(props) { + super(props) + this.state ={ + modalsType:false, + } + + } + componentDidMount() { + // console.log("Notcompletedysl"); + // console.log("开发了402了"); + + axios.interceptors.response.use((response) => { + // console.log(response); + if (response != undefined) + if (response && response.data.status === 402) { + this.setState({ + modalsType: true + }) + } + return response; + }, (error) => { + //TODO 这里如果样式变了会出现css不加载的情况 + + }); + + } + + modalCancel=()=>{ + window.location.href = "/"; + } + + setDownload=()=>{ + window.location.href ='/account/profile'; + } + + + render() { + console.log(this.props) + return( + +
+

您尚未完善个人资料

+

请在完成资料后,提交试用申请

+
+
+ + ) + } +} + +export default Notcompletedysl; \ No newline at end of file From 85ac1dfdf07d9a01c86bdb9464642c4ff35560bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 20 Jul 2019 14:54:38 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/LoginRegisterComponent.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index efd04db70..6a1ef1288 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -128,14 +128,17 @@ class LoginRegisterComponent extends Component { console.log("11111111111111111111111111"); this.state = { tab:["0"], - pciphone:pcipns, + } } else if (this.props.match.url === "/register") { this.state = { tab:["1"], - pciphone:pcipns, + } } + this.setState({ + pciphone:pcipns, + }) } From fc8614a33ad1d0a90cbfc2e4c1457eb645a93f68 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 20 Jul 2019 14:57:38 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/user/ReadPassword.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/user/ReadPassword.js b/public/react/src/modules/user/ReadPassword.js index 68072657a..6beab8e62 100644 --- a/public/react/src/modules/user/ReadPassword.js +++ b/public/react/src/modules/user/ReadPassword.js @@ -14,7 +14,7 @@ class ReadPassword extends Component { setDownload=()=>{ //立即联系 - this.props.StudyMakeMoney() + window.location.href = "/login" } From 724da87ba2dc1690ffc15e75539018d9d802c3ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 20 Jul 2019 15:10:12 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/AppConfig.js | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 078c3132c..63c318f19 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -10,26 +10,25 @@ broadcastChannelOnmessage('refreshPage', () => { }) function locationurl(list){ - if (window.location.port === "3007") { + if (window.location.port === "3007") { - } else { + } else { - if(list===402){ - SetAppModel(402) - }else if(list===407){ + if(list===402){ + SetAppModel(402) + }else if(list===407){ - }else{ - window.location.replace(list) - } + }else{ + window.location.replace(list) + } - } + } } // TODO 开发期多个身份切换 -const debugType ="" -// window.location.search.indexOf('debug=t') != -1 ? 'teacher' : -// window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' -// window._debugType = debugType; +const debugType =window.location.search.indexOf('debug=t') != -1 ? 'teacher' : + window.location.search.indexOf('debug=s') != -1 ? 'student' : 'admin' +window._debugType = debugType; export function initAxiosInterceptors(props) {