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