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

issues25489
杨树林 5 years ago
commit cbb06fdece

@ -20,6 +20,7 @@ class Oauth::BaseController < ActionController::Base
end
def auth_hash
Rails.logger.info("[OAuth2] omniauth.auth -> #{request.env['omniauth.auth'].inspect}")
request.env['omniauth.auth']
end
end

@ -48,8 +48,8 @@ module OmniAuth
def user_info
access_token.options[:mode] = :query
params = { oauth_consumer_key: options.client_id, openid: uid, format: 'json', parse: :json }
@user_info ||= access_token.get('/user/get_user_info', params: params).parsed
param = { oauth_consumer_key: options[:client_id], openid: uid, format: 'json' }
@user_info ||= access_token.get('/user/get_user_info', params: param, parse: :json).parsed
end
end
end

@ -28,7 +28,7 @@ class Oauth::CreateOrFindQqAccountService < ApplicationService
user.create_user_extension!(gender: gender)
# 下载头像
avatar_path = Util::FileManage.source_disk_filename(user)
Util.download_file(params.dig('info', 'figureurl_qq_1'), avatar_path)
Util.download_file(params.dig('info', 'image'), avatar_path)
end
new_open_user = OpenUsers::QQ.create!(user: user, uid: params['uid'], extra: params.dig('extra', 'raw_info'))

@ -1,3 +1,8 @@
其他的文档位置:
/educoder/public/react/public/js/readme.txt 关于js_min_all
/educoder/educoder/public/react/scripts/readme-cdn.txt 关于CDN
/educoder/public/react/src/modules/page/readme.txt 关于TPI
1、 安装node v6.9.x此安装包含了node和npm。
2、 安装cnpm命令行 npm install -g cnpm --registry=https://registry.npm.taobao.org

@ -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}`;

@ -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,28 @@ 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.location.href=`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%2f${window.location.host}%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 +673,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 +697,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 +720,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,60 @@
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;
if(query!= ""){
}
const type = query.split('?code=');
let codeurl = `/auth/qq/callback`;
axios.get(codeurl,{params:{
code:type[1],
redirect_uri:`https://test-newweb.educoder.net/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)=>{
})
}
})
}

@ -1,3 +1,131 @@
state说明
tasks详情接口
allowed_unlock 为true时才允许非管理员用户解锁隐藏测试集
discusses_count 总评论数
challenge 实训关卡信息
exec_time --
modify_time --
path 关卡文件路径
position 第几关
praises_count 点赞数
score 分数
shixun_id
st 0-编程题 1-选择题
subject 关卡名称
task_pass 过关任务
web_route --
game 为每一个用户独立创建的实训关卡对应的信息
accuracy --
answer_deduction--
answer_open --
challenge_id
cost_time 通关耗时
created_at
end_time
evaluate_count
final_score
id
identifier
modify_time
myshixun_id
open_time
picture_path
resubmit_identifier
retry_status
star
status 2-已通关
test_sets_view true-测试集已解锁
updated_at
user_id
game_count 关卡数
git_url 仓库地址vnc会用到
has_answer
is_teacher 是否是老师 初始化被赋值到 user.is_teacher
last_compile_output
mirror_name 镜像名称 TPIMonaco会用到这个属性来判断当前关卡使用的什么语言 见 mirror2LanguageMap
myshixun
commit_id: "80cb6fc55a14bdd64a9c99913f416966238ed3de"
created_at: "2019-07-26T09:00:31.000+08:00"
git_url: null
gpid: null
id: 542543
identifier: "ns53g8vfeo" 有些接口会用到
is_public: true
modify_time: "2017-11-02T18:12:23.000+08:00"
onclick_time: "2019-07-26T09:00:31.000+08:00"
repo_name: "p15478209/ns53g8vfeo20190726090031"
reset_time: "2017-10-25T09:33:03.000+08:00"
shixun_id: 61
status: 0
system_tip: true (如果修改了测试集 || 修改了代码) && system_tip为true 也就是下面代码为true时才显示更新通知弹框
const showUpdateButton = (tpm_cases_modified || needUpdateScript) && myshixun.system_tip === true;
updated_at: "2019-11-05T10:58:35.000+08:00"
user_id: 24731
myshixun_manager: true
next_game: "so7ijzqe63a9" 下一关identifier
praise_count: 120 点赞数
prev_game: "bxg5w9uonhts" 上一关identifier
record_onsume_time: 0.296 上一次评测耗时 初始化被赋值到newResData.record = newResData.record_onsume_time
sets_error_count: 0 失败测试集数量
shixun
authentication: false
averge_star: 4.9
can_copy: false
challenges_count: 4 关卡数
closer_id: null
code_edit_permission: false 是否允许修改代码
code_hidden: false 是否隐藏文件目录按钮
created_at: "2017-06-09T11:32:16.000+08:00"
end_time: null
excute_time: null
exec_time: 25
forbid_copy: false forbid_copy ? "不允许学员复制和粘贴代码" : "允许学员复制和粘贴代码"
fork_from: null
git_url: "educoder/uznmbg54"
gpid: 2448
hidden: false
hide_code: false 是否隐藏代码tab
homepage_show: true
id: 61
identifier: "uznmbg54"
image_text: null
language: "Python3.6" !!
major_id: 635
mirror_script_id: null
modify_time: "2017-11-02T18:12:23.000+08:00"
multi_webssh: false 多命令行tab
myshixuns_count: 9655 学员数
name: "Python表达式问题求解※"
opening_time: null
pod_life: 0
publish_time: "2017-09-01T10:37:49.000+08:00"
repo_name: "educoder/uznmbg54"
reset_time: "2017-10-25T09:33:03.000+08:00"
sigle_training: false
status: 2 shixun.status >= 2 实训已发布 shixun.status <= 1 模拟实战
task_pass: task_pass ? "允许学员跳关挑战" : "不允许学员跳关挑战"
test_set_permission: true test_set_permission ? "允许学员通过金币解锁查看测试集内容" : "不允许学员通过金币解锁查看测试集内容"
trainee: 1
updated_at: "2019-10-11T08:50:59.000+08:00"
use_scope: 0
user_id: 3039
users_count: 4
visits: 69699
webssh: 1 是否显示命令行tab
st 0-编程题 1-选择题
test_sets 测试集
test_sets_count: 1
time_limit: 25 game_status.json轮训次数
tomcat_url: "http://47.96.157.89" web类型实训可以打开展现一个测试服务用来查看评测结果 const webDisplayUrl = `${tomcat_url}:${data.port}/${path}`
tpm_cases_modified: false 参考system_tip属性
tpm_modified: true 参考system_tip属性
user 当前关卡所属用户的信息
user_praise 当前用户是否点赞
-------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- --------------
TPIContextProvider
tpi主要的state容器主要接口`/tasks/${stageId}.json`一次性获取所有tpi首屏展示所需要的信息除了代码内容。
接口返回的内容包括
@ -54,4 +182,21 @@ TPIContextProvider
没用的文件
LeftNav.js
AnswerListContainer.js left 他人解答
AnswerListContainer.js left 他人解答
TPI SSH
命令行的js资源都位于这个目录/react/public/js/jsFromMiddleLayer/base64.js
/page/main/CodeRepositoryView.js文件中open_webssh.json接口返回后会根据代码区试图大小计算ssh视图的大小同样的逻辑在js_min_all中也有
var h = $("#games_repository_contents").height() - $("#top_repository").height() - repositoryTabHeight;
这里有个对应的issue https://www.trustie.net/issues/25279
这里是要判断特殊的屏幕(公司dell笔记本可重现),针对这些情况处理,加高命令行的高度
ps js_min_all中搜`$("#games_repository_contents").height()`可以找到相关代码
VNCDisplay
使用的github上的代码 https://github.com/novnc/noVNC/

@ -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,23 @@ 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.location.href=`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%2f${window.location.host}%2fotherloginqq&response_type=code`
}
render() {
const {
// 登录
@ -1040,12 +1055,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 +1235,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

@ -137,6 +137,10 @@ class AccountSecure extends Component {
font-size: 40px !important;
color: #4eaf2b;
}
.qqlogo{
font-size: 40px !important;
color: #29a1e6;
}
.lineheight60{
line-height: 60px;
@ -146,6 +150,7 @@ class AccountSecure extends Component {
}
`}</style>
<div className="title">绑定登录账号</div>
<Form>
<div className="flexTable">
<div className="flexTable">
@ -202,6 +207,63 @@ class AccountSecure extends Component {
</Modal>
</div>
<div className="flexTable">
<div className="flexTable">
</div>
<div className="flexTable">
<div className="flexRow">
<div className="name">
<i className={"iconfont icon-qq qqlogo mr10"}></i>
<span className={"color-ooo"}>QQ</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>
{
`
.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>
</div>
</Form>
</div>

Loading…
Cancel
Save