Merge branch 'dev_aliyun' of http://bdgit.educoder.net/Hjqreturn/educoder into dev_aliyun

issues25489
cxt 5 years ago
commit fdb75e1120

@ -75,7 +75,10 @@ const Otherloginstart=Loadable({
loader: () => import('./modules/login/Otherloginstart'),
loading: Loading,
})
const Otherloginsqq=Loadable({
loader: () => import('./modules/login/Otherloginqq'),
loading: Loading,
})
// const TestIndex = Loadable({
// loader: () => import('./modules/test'),
// loading: Loading,
@ -527,6 +530,9 @@ class App extends Component {
<Route
path="/otherloginstart" component={Otherloginstart}
/>
<Route
path={"/otherloginqq"} component={Otherloginsqq}
/>
<Route
path="/otherlogin" component={Otherlogin}
/>

@ -46,6 +46,7 @@ export function initAxiosInterceptors(props) {
//proxy="http://47.96.87.25:48080"
proxy="https://pre-newweb.educoder.net"
proxy="https://test-newweb.educoder.net"
//proxy="http://192.168.2.63:3001"
// 在这里使用requestMap控制避免用户通过双击等操作发出重复的请求
// 如果需要支持重复的请求考虑config里面自定义一个allowRepeat参考来控制
@ -73,15 +74,22 @@ export function initAxiosInterceptors(props) {
}
requestProxy(config)
var url = `/api${config.url}`;
let url = `/api${config.url}`;
//qq登录去掉api
if(config.params&&config.params.redirect_uri!=undefined){
if(config.params.redirect_uri.indexOf('otherloginqq')!=-1){
url = `${config.url}`;
}
}
if(`${config[0]}`!=`true`){
if (window.location.port === "3007") {
if (url.indexOf('.json') == -1) {
alert('开发提示:请给接口加.json:' + url)
}
// if (url.indexOf('.json') == -1) {
//
// alert('开发提示:请给接口加.json:' + url)
//
// }
config.url = `${proxy}${url}`;
if (config.url.indexOf('?') == -1) {
config.url = `${config.url}?debug=${debugType}`;

@ -43,7 +43,7 @@ class CompetitionCommon extends Component{
// })
// }
// }).catch((error) => {
// console.log(error)
// //console.log(error)
// })
}
}
@ -51,8 +51,8 @@ class CompetitionCommon extends Component{
componentDidUpdate = (prevProps) => {
if (prevProps.user != this.props.user) {
console.log("componentDidUpdatess");
console.log(this.props.user);
//console.log("componentDidUpdatess");
//console.log(this.props.user);
if (this.props.user && this.props.user.login != "") {
const zul = `/competitions/${this.props.match.params.identifier}/competition_staff.json`;
axios.get((zul)).then((result) => {
@ -64,7 +64,7 @@ class CompetitionCommon extends Component{
}
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
}
@ -103,7 +103,7 @@ class CompetitionCommon extends Component{
}
}
}).catch((error) => {
console.log(error)
//console.log(error)
})
//this.props.user 有可能为空
@ -119,7 +119,7 @@ class CompetitionCommon extends Component{
}
}
}).catch((error) => {
//console.log(error);
////console.log(error);
})
}
@ -161,7 +161,7 @@ class CompetitionCommon extends Component{
}
}).catch((error) => {
console.log(error)
//console.log(error)
})
}
}
@ -192,7 +192,7 @@ class CompetitionCommon extends Component{
}
}).catch((error) => {
console.log(error)
//console.log(error)
})
}else{
if (module_url.substring(0, 7) == 'http://' || module_url.substring(0, 8) == 'https://') {
@ -309,7 +309,7 @@ class CompetitionCommon extends Component{
})
}
}).catch((error) => {
console.log(error)
//console.log(error)
})
}

@ -16,8 +16,8 @@ const $ = window.$
const { Option } = Select;
const tagArray = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R',
'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z'
]
class SingleEditor extends Component{
@ -92,13 +92,13 @@ class SingleEditor extends Component{
}
const intScore = parseFloat(question_score)
if (intScore == 0) {
this.props.showNotification('分值必须大于0'); return;
} else if(!question_score || intScore == NaN) {
this.props.showNotification('分值:不能为空'); return;
}
}
if(!answerArray || answerArray.length == 0) {
this.props.showNotification('请先点击选择本选择题的正确选项'); return;
}
@ -119,9 +119,9 @@ class SingleEditor extends Component{
"question_type":1,
"question_score":5,
"question_choices":["a答案","b答案","c答案","d答案"],
"standard_answers":[1]
"standard_answers":[1]
}*/
const Id = this.props.match.params.Id
const Id = this.props.match.params.Id
if (question_id) {
const editUrl = this.props.getEditQuestionUrl(question_id);
axios.put(editUrl, {
@ -144,7 +144,7 @@ class SingleEditor extends Component{
});
} else {
const url = this.props.getAddQuestionUrl();
axios.post(url, {
exercise_bank_id: Id,
question_title,
@ -162,16 +162,16 @@ class SingleEditor extends Component{
.catch(function (error) {
console.log(error);
});
}
}
}
onCancel = () => {
this.props.onEditorCancel()
}
componentDidMount = () => {
}
onOptionClick = (index) => {
// if (this.props.exerciseIsPublish) {
@ -186,7 +186,7 @@ class SingleEditor extends Component{
// TODO 新建然后删除CD选项再输入题干会调用到这里且index是3
return;
}
let question_choices = this.state.question_choices.slice(0);
let question_choices = this.state.question_choices.slice(0);
question_choices[index] = value;
this.setState({ question_choices })
}
@ -200,19 +200,19 @@ class SingleEditor extends Component{
mdReactObject.toShowMode()
}
this.mdReactObject = that;
}
toShowMode = () => {
}
render() {
let { question_title, question_score, question_type, question_choices, standard_answers } = this.state;
let { question_id, index, exerciseIsPublish,
// question_title,
// question_type,
// question_title,
// question_type,
// question_score,
isNew } = this.props;
// const { getFieldDecorator } = this.props.form;
const isAdmin = this.props.isAdmin()
@ -221,9 +221,13 @@ class SingleEditor extends Component{
const qNumber = `question_${index}`;
// TODO show模式 isNew为false isEdit为false
// [true, false, true] -> [0, 2]
// [true, false, true] -> [0, 2]
const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1);
console.log("xuanzheshijuan");
console.log(answerTagArray);
console.log(!exerciseIsPublish);
return(
<div className="padding20-30 bor-bottom-greyE signleEditor" id={qNumber}>
<style>{`
@ -253,8 +257,8 @@ class SingleEditor extends Component{
ref="titleEditor"
></TPMMDEditor>
{question_choices.map( (item, index) => {
{question_choices.map( (item, index) => {
const bg = standard_answers[index] ? 'check-option-bg' : ''
return <div className="df optionRow " >
{/* 点击设置答案 */}
@ -268,7 +272,7 @@ class SingleEditor extends Component{
</span>
{/* </Tooltip> */}
<div style={{ flex: '0 0 1038px'}}>
<DMDEditor
<DMDEditor
ref={`optionEditor${index}`}
toMDMode={this.toMDMode} toShowMode={this.toShowMode}
height={166} className={'optionMdEditor'} noStorage={true}
@ -293,15 +297,22 @@ class SingleEditor extends Component{
<div className="mb20">
{/* {!exerciseIsPublish && <ActionBtn style="grey" className="middle mr20" onClick={this.addOption}>新增选项</ActionBtn>} */}
<span style={{color: '#FF6800'}}>{!exerciseIsPublish ? '温馨提示:点击选项标题,可以直接设置答案;选择多个答案即为多选题' : ' '}</span>
{answerTagArray && !!answerTagArray.length ? "" :
<span
style={{color: '#FF6800'}}>{'温馨提示:点击选项输入框可设置答案;选中的选项即为正确答案,选择多个答案即为多选题'}</span>
}
{ answerTagArray && !!answerTagArray.length ?
<React.Fragment>
<div style={{
display: "flex",
flexDirection: "row-reverse"
}}>
<React.Fragment>
<span className="fr color-orange">{answerTagArray.join(' ')}</span>
<span className="fr">标准答案</span>
</React.Fragment>
:
<span className="fr color-orange">请点击正确选项</span>
</div>
:
""
}
</div>
@ -310,18 +321,18 @@ class SingleEditor extends Component{
<InputNumber step={0.1} precision={1} min={0} max={100} style={{width: 100}} value={question_score} onChange={this.on_question_score_change}
disabled={exerciseIsPublish}
></InputNumber>&nbsp;
<span className="fr">
<ActionBtn style="greyBack" className="middle mr20" onClick={this.onCancel}
>取消</ActionBtn>
<ActionBtn style="blue" className="middle" onClick={this.onSave}>保存</ActionBtn>
</span>
</div>
</div>
)
}
}
// RouteHOC()
export default (SingleEditor);
export default (SingleEditor);

@ -117,12 +117,12 @@ class ShixunHomeworkPage extends Component {
/// 重做的确认
ModalSaves=()=>{
this.setState({
ModalsType:false,
Modalstopval:""
});
this.setState({
ModalsType:false,
Modalstopval:""
});
if(this.state.teacherdatapage){
this.resetshixunCombat(this.state.teacherdatapage.myshixun_identifier);
this.resetshixunCombat(this.state.teacherdatapage.myshixun_identifier);
}
try {
console.log("this.child");
@ -149,29 +149,29 @@ class ShixunHomeworkPage extends Component {
}
//重置按钮
resetshixunCombat=(id)=>{
this.setState({
mylistisSpin:true,
this.setState({
mylistisSpin:true,
})
let zrl=`/myshixuns/${id}/reset_my_game.json`;
axios.get(zrl).then((response) => {
// window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
this.setState({
mylistisSpin:false,
})
this.child.Isupdatass();
this.props.showNotification("已清空本实训的学习记录\n" +
"\n" +
"请点击“开启挑战”重做实训作业");
}).catch((error) => {
this.setState({
mylistisSpin:false,
})
let zrl=`/myshixuns/${id}/reset_my_game.json`;
axios.get(zrl).then((response) => {
// window.location.href = "/shixuns/" + response.data.shixun_identifier + "/challenges";
this.setState({
mylistisSpin:false,
})
this.child.Isupdatass();
this.props.showNotification("已清空本实训的学习记录\n" +
"\n" +
"请点击“开启挑战”重做实训作业");
}).catch((error) => {
this.setState({
mylistisSpin:false,
})
console.log(error)
});
console.log(error)
});
}
bindRef = ref => { this.child = ref }
///////////////教师截止
//编辑作业
//编辑作业
Showupdateinstructionsboolfalse (bool) {
this.setState({
Showupdateinstructions:bool
@ -183,7 +183,7 @@ class ShixunHomeworkPage extends Component {
Showupdateinstructions:true
})
}
gotohome=()=>{
gotohome=()=>{
// console.log(this.props)
let {jobsettingsdatapage}=this.state
@ -194,7 +194,7 @@ class ShixunHomeworkPage extends Component {
const isAdmin = this.props.isAdmin();
// console.log(119)
// console.log(jobsettingsdatapage);
// console.log(jobsettingsdatapage);
document.title=jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.course_name;
return (
<div className="newMain clearfix ">
@ -224,34 +224,34 @@ class ShixunHomeworkPage extends Component {
</div>
}
<div className="educontent mb20">
<p className=" fl color-black summaryname" style={{heigth: "33px"}}>
{teacherdatapage === undefined ? "" : teacherdatapage.homework_name}
</p>
<CoursesListType
typelist={teacherdatapage === undefined ? [""] : teacherdatapage.homework_status}
/>
<a className="color-grey-9 fr font-16 summaryname ml20 mr20" onClick={()=>this.gotohome()}>返回</a>
<a className="color-grey-9 fr font-16 mr20"
href={`/shixuns/${teacherdatapage === undefined ? "" : teacherdatapage.shixun_identifier}/challenges`}
target={"_blank"}>实训详情</a>
<div className="educontent mb20">
<p className=" fl color-black summaryname" style={{heigth: "33px"}}>
{teacherdatapage === undefined ? "" : teacherdatapage.homework_name}
</p>
<CoursesListType
typelist={teacherdatapage === undefined ? [""] : teacherdatapage.homework_status}
/>
<a className="color-grey-9 fr font-16 summaryname ml20 mr20" onClick={()=>this.gotohome()}>返回</a>
<a className="color-grey-9 fr font-16 mr20"
href={`/shixuns/${teacherdatapage === undefined ? "" : teacherdatapage.shixun_identifier}/challenges`}
target={"_blank"}>实训详情</a>
</div>
<div className="edu-back-white ">
<div className="stud-class-set bor-bottom-greyE ">
<div className=" clearfix edu-back-white poll_list">
<a className={parseInt(tab) === 0 ? "active" : ""} onClick={(e) => this.ChangeTab(0)}>作品列表</a>
<a className={parseInt(tab) === 1 ? "active" : ""} onClick={(e) => this.ChangeTab(1)}>作业描述</a>
{this.props.isAdmin() ?
this.state.code_review === true || jobsettingsdatapage === undefined ? [""] : jobsettingsdatapage.data.homework_status[0] === "未发布" ? "" :
<a
className={parseInt(tab) === 2 ? "active" : ""}
onClick={(e) => this.ChangeTab(2)}>
代码查重</a> : ""}
{parseInt(tab) === 3?
<style>{this.props.isAdmin()?
`
</div>
<div className="edu-back-white ">
<div className="stud-class-set bor-bottom-greyE ">
<div className=" clearfix edu-back-white poll_list">
<a className={parseInt(tab) === 0 ? "active" : ""} onClick={(e) => this.ChangeTab(0)}>作品列表</a>
<a className={parseInt(tab) === 1 ? "active" : ""} onClick={(e) => this.ChangeTab(1)}>作业描述</a>
{this.props.isAdmin() ?
this.state.code_review === true || jobsettingsdatapage === undefined ? [""] : jobsettingsdatapage.data.homework_status[0] === "未发布" ? "" :
<a
className={parseInt(tab) === 2 ? "active" : ""}
onClick={(e) => this.ChangeTab(2)}>
代码查重</a> : ""}
{parseInt(tab) === 3?
<style>{this.props.isAdmin()?
`
.poll_list a.active:after {
content: '';
width: 57px;
@ -262,17 +262,17 @@ class ShixunHomeworkPage extends Component {
position: absolute;
}
`:""
}</style>
:""}
}</style>
:""}
<a className={parseInt(tab) === 3 ? "active" : ""}
onClick={(e) => this.ChangeTab(3)}
>{this.props.isAdmin()?"设置":"得分规则"}</a>
{/*{this.props.isAdmin() ? <a*/}
{/* className="fr color-blue font-16"*/}
{/* href={`/api/homework_commons/${this.props.match.params.coursesId}/works_list.xlsx`}*/}
{/*>导出</a> : ""}*/}
<style>{`
<a className={parseInt(tab) === 3 ? "active" : ""}
onClick={(e) => this.ChangeTab(3)}
>{this.props.isAdmin()?"设置":"得分规则"}</a>
{/*{this.props.isAdmin() ? <a*/}
{/* className="fr color-blue font-16"*/}
{/* href={`/api/homework_commons/${this.props.match.params.coursesId}/works_list.xlsx`}*/}
{/*>导出</a> : ""}*/}
<style>{`
.drop_down_menu li a {
padding: 0px;
font-size: 14px;
@ -288,74 +288,74 @@ class ShixunHomeworkPage extends Component {
padding-top: 10px;
padding-bottom: 8px;
}
`}</style>
{this.props.isAdmin() ?
<li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
{/*<li><a*/}
{/* onClick={(child,i) => this.confirmysl(this.child,1)}>实训报告</a>*/}
{/*</li>*/}
<li><a
onClick={(child,i) => this.confirmysl(this.child,2)}>学生成绩</a>
</li>
{this.props.isAdmin() ?
<li className="li_line drop_down fr color-blue font-16 mr8 mt20" style={{"padding": "0 20px"}}>
导出<i className="iconfont icon-xiajiantou font-12 ml2"></i>
<ul className="drop_down_menu" style={{"right": "-0px", "left": "unset", "height": "auto"}}>
{/*<li><a*/}
{/* onClick={(child,i) => this.confirmysl(this.child,1)}>实训报告</a>*/}
{/*</li>*/}
<li><a
onClick={(child,i) => this.confirmysl(this.child,2)}>学生成绩</a>
</li>
</ul>
</li> : ""}
{this.props.isAdmin() ?
teacherdatapage && teacherdatapage.end_immediately === true ?
<a className="fr color-blue font-16" onClick={(child)=>this.homeworkendss(this.child)}>立即截止</a>
: ""
: ""}
{this.props.isAdmin() ?
teacherdatapage && teacherdatapage.publish_immediately === true ?
<a className="fr color-blue font-16" onClick={(child)=>this.homeworkstarts(this.child)}>立即发布</a>
: ""
: ""}
{this.props.isAdmin() ?
teacherdatapage && teacherdatapage.code_review === true ?
<a className="fr color-blue font-16" onClick={(child)=>this.workshowmodels(this.child)}>代码查重</a>
: "" : ""}
{
parseInt(tab)===1?
this.props.isAdmin() ?
<a className="fr color-blue font-16" onClick={()=>this.edenwork()}>编辑作业</a>
</ul>
</li> : ""}
{this.props.isAdmin() ?
teacherdatapage && teacherdatapage.end_immediately === true ?
<a className="fr color-blue font-16" onClick={(child)=>this.homeworkendss(this.child)}>立即截止</a>
: ""
: ""}
{this.props.isAdmin() ?
teacherdatapage && teacherdatapage.publish_immediately === true ?
<a className="fr color-blue font-16" onClick={(child)=>this.homeworkstarts(this.child)}>立即发布</a>
: ""
: ""}
{this.props.isAdmin() ?
teacherdatapage && teacherdatapage.code_review === true ?
<a className="fr color-blue font-16" onClick={(child)=>this.workshowmodels(this.child)}>代码查重</a>
: "" : ""}
{
parseInt(tab)===1?
this.props.isAdmin() ?
<a className="fr color-blue font-16" onClick={()=>this.edenwork()}>编辑作业</a>
:""
:""
:""
}
}
{this.state.view_report === true ? <Link className="fr color-blue font-16" target={"_blank"}
to={`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${teacherdatapage&&teacherdatapage.work_id}/shixun_work_report`}>
查看实训报告
</Link> : ""}
{
teacherdatapage === undefined ? ""
: teacherdatapage.commit_des === null || teacherdatapage.commit_des === undefined ? "" :
<a className="fr color-blue font-16"
href={`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${teacherdatapage === undefined ? "" : teacherdatapage.id}/commitsummary/${this.props.match.params.homeworkid}`}>{teacherdatapage.commit_des}</a>
}
{teacherdatapage === undefined ? "" : <Startshixuntask
{...this.props}
data={teacherdatapage}
/>}
{this.props.isStudent() ?
(
teacherdatapage&&teacherdatapage.redo_work===true?
<a className="fr color-blue font-16" onClick={()=>this.Modalcancelss()}>重做</a>
:""
)
: "" }
{this.state.view_report === true ? <Link className="fr color-blue font-16" target={"_blank"}
to={`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${teacherdatapage&&teacherdatapage.work_id}/shixun_work_report`}>
查看实训报告
</Link> : ""}
{
teacherdatapage === undefined ? ""
: teacherdatapage.commit_des === null || teacherdatapage.commit_des === undefined ? "" :
<a className="fr color-blue font-16"
href={`/courses/${this.props.match.params.coursesId}/${jobsettingsdatapage === undefined ? "" : jobsettingsdatapage.data.category.main === 1 ? "shixun_homeworks" :"shixun_homework"}/${teacherdatapage === undefined ? "" : teacherdatapage.id}/commitsummary/${this.props.match.params.homeworkid}`}>{teacherdatapage.commit_des}</a>
}
{teacherdatapage === undefined ? "" : <Startshixuntask
{...this.props}
data={teacherdatapage}
/>}
{this.props.isStudent() ?
(
teacherdatapage&&teacherdatapage.redo_work===true?
<a className="fr color-blue font-16" onClick={()=>this.Modalcancelss()}>重做</a>
:""
)
: "" }
</div>
</div>
</div>
</div>
{parseInt(tab) === 0 ?<Listofworksstudentone triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></Listofworksstudentone>:""}
{parseInt(tab) === 1 ?<Workquestionandanswer triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)} Showupdateinstructionsboolfalse={(i)=>this.Showupdateinstructionsboolfalse(i)}></Workquestionandanswer>:""}
{parseInt(tab) === 2 ?<ShixunStudentWork triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></ShixunStudentWork>:""}
{parseInt(tab) === 3 ?<Trainingjobsetting triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></Trainingjobsetting>:""}
</Spin>
{parseInt(tab) === 0 ?<Listofworksstudentone triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></Listofworksstudentone>:""}
{parseInt(tab) === 1 ?<Workquestionandanswer triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)} Showupdateinstructionsboolfalse={(i)=>this.Showupdateinstructionsboolfalse(i)}></Workquestionandanswer>:""}
{parseInt(tab) === 2 ?<ShixunStudentWork triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></ShixunStudentWork>:""}
{parseInt(tab) === 3 ?<Trainingjobsetting triggerRef={this.bindRef} {...this.props} {...this.state} Getdataback={(jobsettingsdata, teacherdata) => this.Getdataback(jobsettingsdata, teacherdata)}></Trainingjobsetting>:""}
</Spin>
</div>
</div>
)

@ -136,12 +136,18 @@
.startlogin{
color:#888;
}
.weixinheight390{
height: 390px;
}
.qqheight390{
width: 450px;
height: 390px;
}
#log_reg_content {
padding: 38px 30px 20px !important;
}
.textcenter{
text-align: center;
}
}

@ -7,7 +7,7 @@ import Dialog, {
DialogContentText,
DialogTitle,
} from 'material-ui/Dialog';
import {notification } from 'antd';
import {notification,Modal } from 'antd';
import axios from 'axios';
@ -104,8 +104,8 @@ class LoginDialog extends Component {
MyEduCoderModals:false,
Phonenumberisnotco:undefined,
Phonenumberisnotcobool:false,
weixinlogin:false
weixinlogin:false,
qqlogin:false
};
}
enter=(num) =>{
@ -529,14 +529,30 @@ class LoginDialog extends Component {
weixinlogin:true
})
}
openqqlogin=()=>{
this.setState({
qqlogin:true
})
//window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code`
window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginqq&response_type=code`
// window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code`
}
openphoneqqlogin=()=>{
window.open(
`https://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=716027609&pt_3rd_aid=101508858&daid=383&pt_skey_valid=0&style=35&s_url=http%3A%2F%2Fconnect.qq.com&refer_cgi=authorize&which=&client_id=101508858&response_type=code&scope=get_user_info&redirect_uri=https%3a%2f%2ftest-newweb.educoder.net%2fotherloginqq&response_type=code`
)
}
hideweixinlogin=()=>{
this.setState({
weixinlogin:false
weixinlogin:false,
qqlogin:false
})
}
render() {
let{open,login,speedy,loginValue,regular,isGoing,isGoingValue,disabled,bottonclass,Phonenumberisnotco,
dialogBox,shortcutnum,disabledType,gaincode,authCodeType,authCodeclass, isRender,weixinlogin}=this.state;
let{qqlogin,login,isGoing,isGoingValue,disabled,bottonclass,Phonenumberisnotco,
dialogBox, isRender,weixinlogin}=this.state;
if (isRender === undefined) {
isRender = false
@ -659,8 +675,22 @@ class LoginDialog extends Component {
<a onClick={()=>this.openweixinlogin()}>
<img src={require('./WeChat.png')} alt="微信登录"/>
</a>
<a onClick={()=>this.openqqlogin()} className={"ml10"}>
<img src={require('./qq.png')} alt="qq登录"/>
</a>
</div>
</p>:""}
</p>:<p className="clearfix mt20">
<span className={"startlogin"}> 快速登录 </span>
<div className={"mt10"}>
{/*<a onClick={()=>this.openweixinlogin()}>*/}
{/*<img src={require('./WeChat.png')} alt="微信登录"/>*/}
{/*</a>*/}
<a onClick={()=>this.openphoneqqlogin()} className={"ml10"}>
<img src={require('./qq.png')} alt="qq登录"/>
</a>
</div>
</p>}
</form>}
{weixinlogin===true?<iframe
@ -669,7 +699,9 @@ class LoginDialog extends Component {
sandbox="allow-scripts allow-same-origin allow-top-navigation"
scrolling="no"
src={`https://open.weixin.qq.com/connect/qrconnect?appid=wx6b119e2d829c13fa&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginstart&response_type=code&scope=snsapi_login#wechat_redirect`}></iframe>:""}
{weixinlogin===true?<p className="clearfix">
{weixinlogin===true?<p className="clearfix ">
<a className={"startlogin color-blue"} onClick={()=>this.hideweixinlogin()}>返回账号登录</a>
</p>:""}
</div>
@ -690,110 +722,3 @@ class LoginDialog extends Component {
export default LoginDialog ;
// onkeypress="user_login_keypress(event);"
// onkeypress="user_login_keypress(event);"
{/* <div className="pr drag_certi_block width100 mt5">
<div id="quick-drag" className="drag_slider" style={{color: 'rgb(255, 255, 255)'}}></div>
<div className="new-login-error" style={{height: '25px'}}>
<p id="passlogin_error_notice" className="color-orange edu-txt-left none" style={{display: 'block'}}></p>
</div>
</div>}
{/*第三方账号登录*/}
{/* <div className="mt10 edu-txt-center">
<p className="color-grey-9">第三方账号登录</p>
<div className="mt15">
<a href="javascript:void(0)" className="margin15"><img src="/images/educoder/weixin.png" className="radius"/></a>
<a href="javascript:void(0)" className="margin15"><img src="/images/educoder/QQ.png" className="radius"/></a>
<a href="javascript:void(0)" className="margin15"><img src="/images/educoder/weibo.png" className="radius"/></a>
</div>
</div>}
//
// {/*<div className="login-panel none" id="login-panel-2" style={{display:speedy==0?'block':'none'}}>*/}
// {/*<form acceptCharset="UTF-8" action="/login" id="code_login_form" method="post">*/}
// {/*<div style={{"display":"inline","padding":"0","margin":"0"}}>*/}
// {/*<input name="utf8" type="hidden" value="✓"></input>*/}
// {/*<input name="authenticity_token" type="hidden" value="NVLiIlHZfhVBQtO9djnWncJqqdikNQIIxEmOvzK9vNM="></input>*/}
// {/*</div>*/}
// {/*<input name="back_url" type="hidden" value={this.back_url}></input>*/}
// {/*<input*/}
// {/*type="text"*/}
// {/*id="pass_name_input"*/}
// {/*name="username"*/}
// {/*ref="shortcutText"*/}
// {/*onInput={this.shortcutIdChange}*/}
// {/*className="input-100-45 mt20"*/}
// {/*placeholder="手机号/邮箱号">*/}
// {/*</input>*/}
// {/*<div style={{height: '25px'}}>*/}
// {/*<p className="color-orange edu-txt-left none" id="pass_name_error_notice"*/}
// {/*style={{display: shortcutnum==0?'block':'none'}}>请输入有效的手机号/邮箱号*/}
// {/*</p>*/}
// {/*</div>*/}
//
// {/*<div id="wrapper">*/}
// {/*/!*drag*/ }*/}
// {/*<div id="quick-drag" className="drag_slider">*/}
// {/*<div className="drag_bg"></div>*/}
// {/*<div className="drag_text slidetounlock">*/}
// {/*请按住滑块,拖动到最右边*/}
// {/*</div>*/}
// {/*<div className="handler handler_bg"></div>*/}
// {/*</div>*/}
// {/*<div className="new-login-error" style={{height: '25px'}}>*/}
// {/*<p id="passlogin_error_notice" className="color-orange edu-txt-left none">请先拖动滑块完成验证</p>*/}
// {/*</div>*/}
// {/*</div>*/}
//
// {/*<p className="clearfix mt5">*/}
// {/*<input*/}
// {/*type="text"*/}
// {/*name="code"*/}
// {/*id="login_verification_code"*/}
// {/*className="input-48-45 edu-txt-center fl"*/}
// {/*ref="authCodeText"*/}
// {/*onInput={this.authCodeChange}*/}
// {/*placeholder="请输入验证码">*/}
// {/*</input>*/}
// {/*<button className={gaincode} disabled={disabledType}*/}
// {/*onClick={()=>{this.get_login_verification_code()}} id="get_verification_code">获取验证码</button>*/}
// {/*</p>*/}
//
// {/*<div style={{height: '25px'}}>*/}
// {/*<p className="color-orange edu-txt-left none" id="send_code_notice">*/}
// {/*请输入验证码*/}
// {/*</p>*/}
// {/*</div>*/}
//
// {/*<button className={authCodeclass} disabled={authCodeType} id="code_login_btn">登录</button>*/}
//
// {/*<p className="clearfix mt10">*/}
//
// {/*<span className="fl">*/}
// {/*<input type="checkbox"*/}
// {/*className="mr5 magic-checkbox"*/}
// {/*id="autolog"*/}
// {/*checked={isGoing}*/}
// {/*onChange={this.handleInputChange}*/}
// {/*value={isGoingValue}*/}
// {/*name="isGoing"*/}
// {/*></input>*/}
// {/*<label htmlFor="autolog" style={{"top":"0px"}}>下次自动登录</label>*/}
// {/*</span>*/}
//
// {/*<span className="fr">*/}
// {/*<a href="https://www.educoder.net/account/lost_password" className="mr3 color-grey-9">忘记密码</a><em className="vertical-line"></em>*/}
// {/*<a href="https://www.educoder.net/user_join" target="_blank" className="color-grey-9">注册</a>*/}
// {/*</span>*/}
//
// {/*</p>*/}
// {/*</form>*/}
// {/*</div>*/}

@ -132,6 +132,8 @@ class Otherlogin extends Component {
}
postwechatlogin=(type,username,password)=>{
let query=this.props.location.search;
const types = query.split('?type=');
if(type===false){
if(username===undefined||username===""||username===null){
this.setState({
@ -146,9 +148,11 @@ class Otherlogin extends Component {
return
}
}
let url = "/bind_user.json";
axios.post(url, {
type: 'wechat',
type: types[1]==="qq"?"qq":'wechat',
not_bind:type,
username:username,
password:password

@ -0,0 +1,58 @@
import React, { Component } from 'react';
import { BrowserRouter as Router, Route, Link } from "react-router-dom";
import { Spin } from 'antd';
import axios from 'axios';
class Otherloginqq extends Component {
componentDidMount() {
let query=this.props.location.search;
const type = query.split('?code=');
const types = type[1].split('&state=');
let codeurl = `/auth/qq/callback`;
axios.get(codeurl,{params:{
code:type[1],
redirect_uri:`https://${window.location.host}/otherloginqq`
}}).then((result)=> {
if(result){
if(result.data.status===0){
if(result.data.new_user===true){
window.location.href="/otherlogin?type=qq"
}else{
// this.getinfo()
if(types[1]==="account"){
window.location.href="/account/binding"
}else{
window.location.href="/"
}
}
}
}
}).catch((error)=>{
})
}
render() {
// Loading
return (
<div className="App" style={{minHeight: '800px',width:"100%"}}>
<style>
{
`
.margintop{
margin-top:20%;
}
`
}
</style>
<Spin size="large" className={"margintop"}/>
</div>
);
}
}
export default Otherloginqq;

@ -8,31 +8,34 @@ class Otherloginstart extends Component {
componentDidMount() {
let query=this.props.location.search;
const type = query.split('?code=');
const types = type[1].split('&state=');
console.log(types)
let codeurl = `/auth/wechat/callback.json`
axios.get(codeurl,{params:{
code:types[0]
}}).then((result)=> {
if(result){
if(result.data.status===0){
if(result.data.new_user===true){
window.location.href="/otherlogin"
}else{
// this.getinfo()
if(types[1]==="account"){
window.location.href="/account/binding"
debugger
if(query!= ""){
const type = query.split('?code=');
const types = type[1].split('&state=');
let codeurl = `/auth/wechat/callback.json`
axios.get(codeurl,{params:{
code:types[0]
}}).then((result)=> {
if(result){
if(result.data.status===0){
if(result.data.new_user===true){
window.location.href="/otherlogin?type=wechat"
}else{
window.location.href="/"
}
// this.getinfo()
if(types[1]==="account"){
window.location.href="/account/binding"
}else{
window.location.href="/"
}
}
}
}
}
}).catch((error)=>{
}).catch((error)=>{
})
}
})
}

@ -226,6 +226,7 @@ class TPIMonaco extends Component {
// https://github.com/Microsoft/monaco-editor/issues/539
window.monaco.editor.setModelLanguage(editor_monaco.getModel(), lang)
} else if (prevProps.isEditablePath != this.props.isEditablePath) {
// 当前文件是否可编辑
if (this.props.isEditablePath || this.props.shixun && this.props.shixun.code_edit_permission == true) {
editor_monaco.updateOptions({readOnly: false})
} else {
@ -250,6 +251,7 @@ class TPIMonaco extends Component {
}
}
componentWillUnmount() {
// 注意销毁不然会出现不能编辑的bug
this.editor_monaco && this.editor_monaco.dispose()
}

@ -68,6 +68,7 @@ class LoginRegisterComponent extends Component {
registered:undefined,
Phonenumberisnotcodmms:undefined,
weixinlogin:false,
qqlogin:false
}
}
if(props.loginstatus === false){
@ -106,7 +107,7 @@ class LoginRegisterComponent extends Component {
registered:undefined,
Phonenumberisnotcodmms:undefined,
weixinlogin:false,
qqlogin:false
}
}
}
@ -892,9 +893,25 @@ class LoginRegisterComponent extends Component {
hideweixinlogin=()=>{
this.setState({
weixinlogin:false,
qqlogin:false,
tab:["0"]
})
}
openqqlogin=()=>{
this.setState({
qqlogin:true
})
//window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2otherloginqq&response_type=code`
window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginqq&response_type=code`
// window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2fwww.educoder.net%2fotherloginstart&tp=qq&response_type=code`
}
openphoneqqlogin=()=>{
window.open(
`https://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=716027609&pt_3rd_aid=101508858&daid=383&pt_skey_valid=0&style=35&s_url=http%3A%2F%2Fconnect.qq.com&refer_cgi=authorize&which=&client_id=101508858&response_type=code&scope=get_user_info&redirect_uri=https%3a%2f%2ftest-newweb.educoder.net%2fotherloginqq&response_type=code`
)
}
render() {
const {
// 登录
@ -1040,12 +1057,31 @@ class LoginRegisterComponent extends Component {
<a onClick={()=>this.openweixinlogin()}>
<img src={require('./img/WeChat.png')} alt="微信登录"/>
</a>
<a onClick={()=>this.openqqlogin()} className={"ml10"}>
<img src={require('./img/qq.png')} alt="qq登录"/>
</a>
</div>
</p>:<p className="clearfix mb10 textcenter">
<span className={"startlogin"}> 快速登录 </span>
<div className={"mt10"}>
{/*<a onClick={()=>this.openweixinlogin()}>*/}
{/*<img src={require('./WeChat.png')} alt="微信登录"/>*/}
{/*</a>*/}
<a onClick={()=>this.openphoneqqlogin()}>
<img src={require('./img/qq.png')} alt="qq登录"/>
</a>
</div>
</p>:""}
</p>}
</div>
}
{
weixinlogin===false&&parseInt(tab[0])==1 &&
<div style={{width: '340px'}}>
@ -1201,8 +1237,22 @@ class LoginRegisterComponent extends Component {
<a onClick={()=>this.openweixinlogin()}>
<img src={require('./img/WeChat.png')} alt="微信登录"/>
</a>
<a onClick={()=>this.openqqlogin()} className={"ml10"}>
<img src={require('./img/qq.png')} alt="qq登录"/>
</a>
</div>
</p>:<p className="clearfix mb10 textcenter">
<span className={"startlogin"}> 快速登录 </span>
<div className={"mt10"}>
{/*<a onClick={()=>this.openweixinlogin()}>*/}
{/*<img src={require('./WeChat.png')} alt="微信登录"/>*/}
{/*</a>*/}
<a onClick={()=>this.openphoneqqlogin()}>
<img src={require('./img/qq.png')} alt="qq登录"/>
</a>
</div>
</p>:""}
</p>}
</div>
}
{weixinlogin===true?<iframe

@ -12,10 +12,54 @@ class AccountSecure extends Component {
super(props)
this.state = {
Modalstype:false,
list:[{
en_type: "wechat",
id: null,
nickname: "",
},{
en_type: "qq",
id: null,
nickname: "",
}
]
}
}
IsPC=()=>{
var userAgentInfo = navigator.userAgent;
var Agents = ["Android", "iPhone",
"SymbianOS", "Windows Phone",
"iPad", "iPod"];
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) {
flag = false;
break;
}
}
return flag;
}
componentDidMount() {
let {basicInfo}=this.props;
let {list}=this.state;
let newlist=list;
if(basicInfo===undefined||JSON.stringify(basicInfo) == "{}"||basicInfo&&basicInfo.open_users.length===0){
}else{
basicInfo&&basicInfo.open_users.map((item,key)=>{
newlist.map((items,keys)=>{
if(item.en_type===items.en_type){
items.id=item.id;
items.nickname=item.nickname;
}
})
})
}
this.setState({
list:newlist
})
}
showModal=()=>{
this.setState({
visible: true,
@ -64,10 +108,18 @@ class AccountSecure extends Component {
ModalSave:()=>this.Saveundologin(id),
})
}
openqqlogin=()=>{
window.location.href=`https://graph.qq.com/oauth2.0/show?which=Login&display=pc&client_id=101508858&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginqq&response_type=code`
}
openphoneqqlogin=()=>{
window.open(
`https://xui.ptlogin2.qq.com/cgi-bin/xlogin?appid=716027609&pt_3rd_aid=101508858&daid=383&pt_skey_valid=0&style=35&s_url=http%3A%2F%2Fconnect.qq.com&refer_cgi=authorize&which=&client_id=101508858&response_type=code&scope=get_user_info&redirect_uri=https%3a%2f%2ftest-newweb.educoder.net%2fotherloginqq&response_type=code`
)
}
render() {
let {basicInfo}=this.props;
let flag = this.IsPC(); //true为PC端false为手机端
let {list}=this.state;
return (
<div>
<div className="basicForm settingForm">
@ -137,6 +189,10 @@ class AccountSecure extends Component {
font-size: 40px !important;
color: #4eaf2b;
}
.qqlogo{
font-size: 40px !important;
color: #29a1e6;
}
.lineheight60{
line-height: 60px;
@ -146,64 +202,71 @@ class AccountSecure extends Component {
}
`}</style>
<div className="title">绑定登录账号</div>
<Form>
<div className="flexTable">
<div className="flexTable">
</div>
<div className="flexTable">
<div className="flexRow">
<div className="name">
<i className={"iconfont icon-weixin2 weixinlogo mr10"}></i>
<span className={"color-ooo"}>微信</span>
</div>
<div className="description lineheight60">
{basicInfo===undefined||JSON.stringify(basicInfo) == "{}"?"":basicInfo&&basicInfo.open_users.length===0?"":<span className={"color-grey-9 ml80"}>{basicInfo===undefined||JSON.stringify(basicInfo) == "{}"?"":basicInfo&&basicInfo.open_users[0].nickname}</span>}
</div>
<div className="status pt19">
<WordsBtn style={basicInfo===undefined||JSON.stringify(basicInfo) == "{}"?"":basicInfo&&basicInfo.open_users.length===0?"blue":"colorgrey9"} className={basicInfo===undefined||JSON.stringify(basicInfo) == "{}"?"":basicInfo&&basicInfo.open_users.length===0?"borderBottom":""}
onClick={
basicInfo===undefined||JSON.stringify(basicInfo) == "{}"?"":basicInfo&&basicInfo.open_users.length===0 ?() => this.showModal("wechat"):() => this.undologin("wechat",basicInfo===undefined||JSON.stringify(basicInfo) == "{}"?"":basicInfo&&basicInfo.open_users[0].id)
}
>{basicInfo===undefined||JSON.stringify(basicInfo) == "{}"?"":basicInfo&&basicInfo.open_users.length===0 ?"绑定":"解绑"}</WordsBtn>
</div>
</div>
</div>
<style>
{
`
{list.map((item,key)=>{
return(
<div className="flexTable" key={key}>
<div className="flexTable">
<div className="flexRow">
<div className="name">
{item.en_type!="qq"?<i className={"iconfont icon-weixin2 weixinlogo mr10"}></i>:<i className={"iconfont icon-qq qqlogo mr10"}></i>}
{item.en_type!="qq"?<span className={"color-ooo"}>微信</span>:<span className={"color-ooo"}>QQ</span>}
</div>
<div className="description lineheight60">
<span className={"color-grey-9 ml80"}>{item.nickname}</span>
</div>
<div className="status pt19">
{item.en_type!="qq"?<WordsBtn style={ item.id===null?"blue":"colorgrey9"} className={item.id===null?"borderBottom":""}
onClick={
item.id===null?() => this.showModal("wechat"):() => this.undologin("wechat",item.id)
}
>{item.id===null?"绑定":"解绑"}</WordsBtn>:<WordsBtn style={ item.id===null?"blue":"colorgrey9"} className={item.id===null?"borderBottom":""}
onClick={
item.id===null?flag===true?() => this.openphoneqqlogin():() => this.openqqlogin():() => this.undologin("qq",item.id)
}
>{item.id===null?"绑定":"解绑"}</WordsBtn>}
</div>
</div>
</div>
</div>
)
})
}
</Form>
<style>
{
`
.ml70{
margin-left: 70px;
}
`
}
</style>
<Modal
closable={false}
footer={null}
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
>
<div>
<iframe
className={"weixinheight390 ml70"}
frameBorder="0"
sandbox="allow-scripts allow-same-origin allow-top-navigation"
scrolling="no"
src={`https://open.weixin.qq.com/connect/qrconnect?appid=wx6b119e2d829c13fa&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginstart&response_type=code&scope=snsapi_login&state=account#wechat_redirect`}></iframe>
<p className="clearfix pagemancenter">
<a className={"startlogin color-blue"} onClick={()=>this.handleCancel()}>取消</a>
</p>
</div>
</Modal>
}
</style>
<Modal
closable={false}
footer={null}
visible={this.state.visible}
onOk={this.handleOk}
onCancel={this.handleCancel}
>
<div>
<iframe
className={"weixinheight390 ml70"}
frameBorder="0"
sandbox="allow-scripts allow-same-origin allow-top-navigation"
scrolling="no"
src={`https://open.weixin.qq.com/connect/qrconnect?appid=wx6b119e2d829c13fa&redirect_uri=https%3a%2f%2f${window.location.host}%2fotherloginstart&response_type=code&scope=snsapi_login&state=account#wechat_redirect`}></iframe>
<p className="clearfix pagemancenter">
<a className={"startlogin color-blue"} onClick={()=>this.handleCancel()}>取消</a>
</p>
</div>
</Form>
</Modal>
</div>
<div style={{color: '#989898', marginLeft: '20px'}}>* 我们确保你所提供的信息均处于严格保密状态不会泄露</div>
</div>

Loading…
Cancel
Save