Merge remote-tracking branch 'origin/dev_aliyun' into dev_tj

merge from aliyun
dev_forge
tangjiang 5 years ago
commit 92954fb692

@ -39,7 +39,7 @@ module Searchable::Shixun
end end
def should_index? def should_index?
[0, 1, 2].include?(status) # published !hidden? && [0, 1, 2].include?(status) # published
end end
def to_searchable_json def to_searchable_json

@ -1,4 +1,4 @@
json.(@course, :id, :name, :course_members_count, :credit) json.(@course, :id, :name, :course_members_count, :credit, :invite_code_halt)
json.teachers_count @course.teachers.count json.teachers_count @course.teachers.count
json.students_count @course.students.count json.students_count @course.students.count
json.course_identity @current_user.course_identity(@course) json.course_identity @current_user.course_identity(@course)

@ -509,7 +509,7 @@ li.li-width7{width: 7%;text-align: left}
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.invite-tip{position: absolute;top: -5px;right: 140px;color: #fff; box-sizing: border-box;width: 170px;text-align: center;border-radius: 2px;background-color: rgba(5,16,26,0.6)} .invite-tip{position: absolute;top: -5px;right: 140px;color: #fff; box-sizing: border-box;width: 170px;text-align: center;border-radius: 2px;background-color: rgba(5,16,26,0.6);z-index: 5000;}
.inviteTipbtn a{font-size:14px;width: 100%;height: 30px;line-height: 30px;display: block;color: #747A7F;background-color: rgba(5,16,26,0.4)} .inviteTipbtn a{font-size:14px;width: 100%;height: 30px;line-height: 30px;display: block;color: #747A7F;background-color: rgba(5,16,26,0.4)}
.inviteTipbtn a:hover{color: #4cacff!important;} .inviteTipbtn a:hover{color: #4cacff!important;}
.top-black-trangle{display: block;border-width: 8px;position: absolute;top: -16px;right: 4px;border-style: dashed solid dashed dashed;border-color: transparent transparent rgba(5,16,26,0.6) transparent;font-size: 0;line-height: 0;} .top-black-trangle{display: block;border-width: 8px;position: absolute;top: -16px;right: 4px;border-style: dashed solid dashed dashed;border-color: transparent transparent rgba(5,16,26,0.6) transparent;font-size: 0;line-height: 0;}

@ -129,7 +129,8 @@ class TPIContextProvider extends Component {
tpm_cases_modified, tpm_cases_modified,
tpm_modified, tpm_modified,
tpm_script_modified, tpm_script_modified,
showUpdateDialog: false showUpdateDialog: false,
initTime: 0
}) })
} }
@ -145,7 +146,6 @@ class TPIContextProvider extends Component {
window.__fetchAllFlag = false; window.__fetchAllFlag = false;
this.fetchAll(stageId); this.fetchAll(stageId);
this.costTimeInterval = window.setInterval(()=> { this.costTimeInterval = window.setInterval(()=> {
const { game } = this.state; const { game } = this.state;
if (!game || game.status === 2) { // 已完成的任务不需要计时 if (!game || game.status === 2) { // 已完成的任务不需要计时
@ -167,7 +167,7 @@ class TPIContextProvider extends Component {
} }
// force 评测通过后异步执行该方法强制同步costTime到服务端 // force 评测通过后异步执行该方法强制同步costTime到服务端
_updateCostTime(async = false, force) { _updateCostTime(async = false, force) {
const { game, loading } = this.state; const { game, loading, initTime = 0 } = this.state;
// TODO 还有一种情况通关后cost_time计时停止没法通过这个判断 // TODO 还有一种情况通关后cost_time计时停止没法通过这个判断
if (!force && (loading || !game || game.status === 2)) { if (!force && (loading || !game || game.status === 2)) {
return; // 已完成的任务不需要处理 return; // 已完成的任务不需要处理
@ -178,12 +178,13 @@ class TPIContextProvider extends Component {
} }
// var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time` // var url = `${testPath}/api/v1/games/${ game.identifier }/cost_time`
var url = `${testPath}/api/tasks/${ game.identifier }/cost_time` var url = `${testPath}/api/tasks/${ game.identifier }/cost_time`
const disTime = Math.abs(game.cost_time - initTime);
window.$.ajax({ window.$.ajax({
type: 'get', type: 'get',
url: url, url: url,
async: async, //IMPORTANT, the call will be synchronous async: async, //IMPORTANT, the call will be synchronous
data: { data: {
time: game.cost_time time: disTime
} }
}).done((data) => { }).done((data) => {
console.log('complete'); console.log('complete');
@ -406,7 +407,6 @@ pop_box_new(htmlvalue, 480, 182);
} }
resData.game = game; resData.game = game;
const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData; const { tpm_cases_modified, tpm_modified, tpm_script_modified, myshixun } = resData;
if (myshixun.system_tip) { if (myshixun.system_tip) {
// system_tip为true的时候 不弹框提示用户更新 // system_tip为true的时候 不弹框提示用户更新
@ -440,7 +440,7 @@ pop_box_new(htmlvalue, 480, 182);
this.setState({ this.setState({
...resData, ...resData,
initTime: game.cost_time,
currentGamePassed: false, currentGamePassed: false,
loading: false, loading: false,
testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0), testSetsExpandedArray: testSetsExpandedArrayInitVal.slice(0),
@ -519,7 +519,6 @@ pop_box_new(htmlvalue, 480, 182);
// var url = `/api/v1/games/${stageId}` // var url = `/api/v1/games/${stageId}`
var url = `/tasks/${stageId}.json` var url = `/tasks/${stageId}.json`
// {"status":1,"message":"undefined method `authenticate!' for #<Grape::Endpoint:0xc8c91c0>"} // {"status":1,"message":"undefined method `authenticate!' for #<Grape::Endpoint:0xc8c91c0>"}
window.__fetchAllFlag = true; window.__fetchAllFlag = true;

@ -8,7 +8,7 @@ class NoneData extends Component{
render(){ render(){
const { style } = this.props; const { style } = this.props;
return( return(
<div className="edu-tab-con-box clearfix edu-txt-center" style={style}> <div className="edu-tab-con-box clearfix edu-txt-center" style={ style || { width:"100%" }}>
<style> <style>
{` {`
.edu-tab-con-box{ .edu-tab-con-box{

@ -122,11 +122,11 @@ class MessagSub extends Component {
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
if (item.auth_type === 1) { if (item.auth_type === 1) {
//系统管理页面 //系统管理页面
return window.open("/managements/identity_authentication"); return window.open("/admins/identity_authentications");
} }
if (item.auth_type === 2) { if (item.auth_type === 2) {
//系统管理页面 //系统管理页面
return window.open("/managements/professional_authentication") return window.open("/admins/professional_authentications")
} }
} }
if (item.tiding_type === "System") { if (item.tiding_type === "System") {
@ -143,7 +143,7 @@ class MessagSub extends Component {
case "ApplyAddDepartment" : case "ApplyAddDepartment" :
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
//部门审批 //部门审批
return window.open("/managements/depart") return window.open("/admins/department_applies")
} }
if (item.tiding_type === "System") { if (item.tiding_type === "System") {
// 账号管理页/account/profile // 账号管理页/account/profile
@ -153,7 +153,7 @@ class MessagSub extends Component {
case "ApplyAddSchools" : case "ApplyAddSchools" :
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
// 单位审批 // 单位审批
return window.open(" /managements/unit") return window.open("admins/unit_applies")
} }
if (item.tiding_type === "System") { if (item.tiding_type === "System") {
// 账号管理页 // 账号管理页
@ -164,7 +164,7 @@ class MessagSub extends Component {
switch (item.parent_container_type) { switch (item.parent_container_type) {
case "ApplyShixun" : case "ApplyShixun" :
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
return window.open("/managements/shixun_authorization") return window.open("/admins/shixun_authorizations")
} }
if (item.tiding_type === "System") { if (item.tiding_type === "System") {
// 实训详情页 :identifier = identifier // 实训详情页 :identifier = identifier
@ -173,10 +173,10 @@ class MessagSub extends Component {
case "ApplySubject" : case "ApplySubject" :
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
// 实训课程发布 // 实训课程发布
return window.open("/managements/subject_authorization") return window.open("/admins/subject_authorizations")
} }
if (item.tiding_type === "System") { if (item.tiding_type === "System") {
// 实践课程详情页 :parent_container_id = parent_container_id // 课程汇总详情页 :parent_container_id = parent_container_id
return window.open(`/paths/${item.parent_container_id}`) return window.open(`/paths/${item.parent_container_id}`)
} }
@ -222,7 +222,7 @@ class MessagSub extends Component {
case "Shixun" : case "Shixun" :
return window.open(`/shixuns/${item.identifier}/challenges`) return window.open(`/shixuns/${item.identifier}/challenges`)
case "Subject" : case "Subject" :
// 实践课程详情页 :id = container_id // 课程汇总详情页 :id = container_id
return window.open(`/paths/${item.container_id}`) return window.open(`/paths/${item.container_id}`)
case "JournalsForMessage" : case "JournalsForMessage" :
switch (item.parent_container_type) { switch (item.parent_container_type) {
@ -452,7 +452,7 @@ class MessagSub extends Component {
case "Library" : case "Library" :
if (item.tiding_type === 'Apply') { if (item.tiding_type === 'Apply') {
// /managements/library_applies // /managements/library_applies
return window.open(`/managements/library_applies`) return window.open(`/admins/library_applies`)
} }
if (item.tiding_type === 'System') { if (item.tiding_type === 'System') {
//教学案例详情 :id = container_id //教学案例详情 :id = container_id
@ -467,7 +467,7 @@ class MessagSub extends Component {
} else { } else {
if (item.tiding_type === 'Apply') { if (item.tiding_type === 'Apply') {
///managements/project_package_applies ///managements/project_package_applies
return window.open(`/managements/project_package_applies`) return window.open(`/admins/project_package_applies`)
} }
// if(item.tiding_type === 'System'){ // if(item.tiding_type === 'System'){
//众包详情 :id = container_id //众包详情 :id = container_id
@ -478,7 +478,7 @@ class MessagSub extends Component {
return window.open(`/shixuns/${item.identifier}/shixun_discuss`); return window.open(`/shixuns/${item.identifier}/shixun_discuss`);
case "Video": case "Video":
if (item.tiding_type === "Apply") { if (item.tiding_type === "Apply") {
return window.open(`/managements/video_applies`); return window.open(`/admins/video_applies`);
} else if (item.tiding_type === "System") { } else if (item.tiding_type === "System") {
return window.open(`/users/${this.props.current_user.login}/videos`); return window.open(`/users/${this.props.current_user.login}/videos`);
} }
@ -515,7 +515,7 @@ class MessagSub extends Component {
render() { render() {
let {page, limit, typeysl, count, isSpin, data} = this.state; let {page, limit, typeysl, count, isSpin, data} = this.state;
// console.log("6868686868"); // console.log("6868686868");
console.log(data); console.log(data);
return ( return (
<div className="clearfix ml20"> <div className="clearfix ml20">
{/*头部筛选数据*/} {/*头部筛选数据*/}
@ -529,7 +529,7 @@ class MessagSub extends Component {
onClick={(s, i) => this.getdata("project", 1)}>项目提醒</a></li> onClick={(s, i) => this.getdata("project", 1)}>项目提醒</a></li>
{/*<li className={typeysl && typeysl === "project_package" ? "active" : ""}><a*/} {/*<li className={typeysl && typeysl === "project_package" ? "active" : ""}><a*/}
{/*onClick={(s, i) => this.getdata("project_package", 1)}>众包提醒</a></li>*/} {/*onClick={(s, i) => this.getdata("project_package", 1)}>众包提醒</a></li>*/}
<li className={typeysl && typeysl === "interaction" ? "active" : ""}><a <li className={typeysl && typeysl === "interaction" ? "active" : ""}><a
onClick={(s, i) => this.getdata("interaction", 1)}>互动提醒</a></li> onClick={(s, i) => this.getdata("interaction", 1)}>互动提醒</a></li>
@ -545,120 +545,119 @@ class MessagSub extends Component {
{/*下面内容页面*/} {/*下面内容页面*/}
<div className="bor-top-greyE mycenter"> <div className="bor-top-greyE mycenter">
{/*这里可以进行数据处理*/} {/*这里可以进行数据处理*/}
<div className="myw100baifenbi edu-back-white"> <div className="myw100baifenbi">
<Spin size="large" className="myw100baifenbi mt10" spinning={isSpin}> <Spin size="large" className="myw100baifenbi mt10" spinning={isSpin}>
{ {
data === undefined ? data === undefined ?
<NoneData></NoneData> : <NoneData></NoneData> :
data.length === 0 ? data.length === 0 ?
<NoneData></NoneData> <NoneData></NoneData>
: data.map((item, key) => { : data.map((item, key) => {
// console.log(data) // console.log(data)
// ridinglist-subs // ridinglist-subs
var boolps = true; var boolps = true;
if (item.container_type === "PraiseTread" || item.container_type === "Grade" || item.container_type === "ChallengeWorkScore") { if (item.container_type === "PraiseTread" || item.container_type === "Grade" || item.container_type === "ChallengeWorkScore") {
boolps = false;
}
if (item.container_type === "JournalsForMessage") {
if (item.parent_container_type === "Principal") {
boolps = false; boolps = false;
} }
if (item.parent_container_type === "HomeworkCommon") { if (item.container_type === "JournalsForMessage") {
if (item.homework_type === null || item.homework_type === undefined) { if (item.parent_container_type === "Principal") {
boolps = false; boolps = false;
} }
if (item.parent_container_type === "HomeworkCommon") {
if (item.homework_type === null || item.homework_type === undefined) {
boolps = false;
}
}
} }
} // if(item.container_type==="HomeworkCommon"){
// if(item.container_type==="HomeworkCommon"){ // if(item.parent_container_type==="AnonymousAppeal"){
// if(item.parent_container_type==="AnonymousAppeal"){ // boolps=false;
// boolps=false; // }
// } // }
// } if (item.container_type === "ProjectPackage") {
if (item.container_type === "ProjectPackage") { if (item.tiding_type === "Destroyed_end") {
if (item.tiding_type === "Destroyed_end") { boolps = false;
boolps = false; }
} if (item.tiding_type === "Destroyed") {
if (item.tiding_type === "Destroyed") { boolps = false;
boolps = false; }
} }
} if (item.container_type === "Course") {
if (item.container_type === "Course") { if (item.tiding_type === "Delete") {
if (item.tiding_type === "Delete") { boolps = false;
boolps = false; }
} }
} if (item.container_type === "DeleteCourse") {
if (item.container_type === "DeleteCourse") { if (item.tiding_type === "System") {
if (item.tiding_type === "System") { boolps = false;
boolps = false; }
} }
} if (item.container_type === "DeleteCourseMember") {
if (item.container_type === "DeleteCourseMember") { if (item.tiding_type === "System") {
if (item.tiding_type === "System") { boolps = false;
boolps = false; }
} }
} return (
return ( <div className="pl25 ridinglist edu-back-white" key={key}>
<div className="pl25 ridinglist edu-back-white" key={key}> <div
<div className={boolps === true ? "ridinglist-sub clearfix df tiding_item" : "ridinglist-subs clearfix df tiding_item"}
className={boolps === true ? "ridinglist-sub clearfix df tiding_item" : "ridinglist-subs clearfix df tiding_item"} onClick={() => this.gettourl(item)}>
onClick={() => this.gettourl(item)}> <img onMouseDown={() => this.myCome(item)}
<img onMouseDown={() => this.myCome(item)} src={getImageUrl("images/" + item.trigger_user.image_url)}
src={getImageUrl("images/" + item.trigger_user.image_url)} className="radius mr10 fl myimgw48 myimgh48"/>
className="radius mr10 fl myimgw48 myimgh48"/> <div className="fl flex1">
<div className="fl flex1"> <p>
<p> <a className="mr20 private_message_a"
<a className="mr20 private_message_a" onMouseDown={() => this.myCome(item)}>{item.trigger_user.name}</a>
onMouseDown={() => this.myCome(item)}>{item.trigger_user.name}</a> <span className="color-grey-c">{item.time}</span>
<span className="color-grey-c">{item.time}</span> {item.tiding_type === "Apply" ? (
{item.tiding_type === "Apply" ? ( item.status === 0 ?
item.status === 0 ? <span className="edu-filter-btn ml20 edu-filter-btn-red">待处理</span> : ""
<span className="edu-filter-btn ml20 edu-filter-btn-red">待处理</span> : "" ) : ""}
) : ""} {item.tiding_type === "Apply" ? (
{item.tiding_type === "Apply" ? ( item.status === 1 ?
item.status === 1 ? <span className="edu-filter-btn ml20 edu-filter-btn-green">已处理</span> : ""
<span className="edu-filter-btn ml20 edu-filter-btn-green">已处理</span> : "" ) : ""}
) : ""}
</p> </p>
<style> <style>
{ {
`.yslspansk span{ `.yslspansk span{
color: #FF9966!important; color: #FF9966!important;
} }
` `
} }
</style> </style>
<p className="color-grey-6 yslspansk markdown-body mt10" style={{wordBreak: "break-word"}} <p className="color-grey-6 yslspansk markdown-body mt10" style={{wordBreak: "break-word"}}
dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}}></p> dangerouslySetInnerHTML={{__html: markdownToHTML(item.content).replace(/▁/g, "▁▁▁")}}></p>
</div>
<span className={item.new_tiding === true ? "new-point fr mr40 mt22" : ""}></span>
</div> </div>
<span className={item.new_tiding === true ? "new-point fr mr40 mt22" : ""}></span>
</div> </div>
)
</div> })}
)
})}
</Spin> </Spin>
{/*页数*/}
{data === undefined ? ""
:
(count > 10 ?
<div style={{textAlign: "center"}} className="new_expand mt10">
<div className="edu-txt-center mt30">
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit}
total={count}></Pagination>
</div>
</div> : ""
)
}
</div> </div>
</div> </div>
{/*页数*/}
{data === undefined ? ""
:
(count > 10 ?
<div style={{textAlign: "center"}} className="new_expand mt10">
<div className="edu-txt-center mt30">
<Pagination showQuickJumper current={page}
onChange={this.paginationonChanges} pageSize={limit}
total={count}></Pagination>
</div>
</div> : ""
)
}
</div> </div>
) )
} }

@ -112,29 +112,6 @@ class CodeRepositoryView extends Component {
.removeClass("codeRepoShow") .removeClass("codeRepoShow")
// .removeClass("fa-caret-down").addClass("fa-caret-right"); // .removeClass("fa-caret-down").addClass("fa-caret-right");
}) })
// $('#codetab_con_1').append(``)
// $('#codetab_con_1 .codemirrorBackground').hide()
window.addEventListener('beforeunload', this.beforeUnload);
}
componentWillUnmount () {
window.removeEventListener('beforeunload', this.beforeUnload);
}
beforeUnload = (e) => {
// console.log(this.props);
const { game } = this.props;
const url = `/api/tasks/${game.identifier}/cost_time.json`;
axios.get(url).then(res => {
// TODO
});
const msg = '确定要离开吗?';
e = e || window.event;
if (e) {
e.returnValue = msg;
}
return msg;
} }
onTreeSelect = (selectedKeys, info) => { onTreeSelect = (selectedKeys, info) => {

@ -313,10 +313,11 @@ class InfosCourse extends Component{
{/* 289 */} {/* 289 */}
{ {
page == 1 && is_current && !category && page == 1 && is_current && !category &&
this.props.current_user && this.props.current_user.user_identity != "学生" ? <Create href={"/courses/new"} name={"新建课堂"} index="1"></Create> : "" this.props.current_user && this.props.current_user.user_identity != "学生" ?
<Create href={"/courses/new"} name={"新建课堂"} index="1"></Create> : ""
} }
{ {
(!data || (data && data.courses.length==0)) && category && <NoneData></NoneData> (!data || (data && data.courses.length === 0)) && (category || (!category && this.props.current_user && this.props.current_user.user_identity == "学生")) && <NoneData></NoneData>
} }
{ {
data && data.courses && data.courses.map((item,key)=>{ data && data.courses && data.courses.map((item,key)=>{

@ -327,8 +327,7 @@ class InfosPath extends Component{
<div className="square-list clearfix"> <div className="square-list clearfix">
{/* 295 */} {/* 295 */}
{ {
page == 1 && is_current && !category && page == 1 && is_current && !category ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:""
this.props.current_user && this.props.current_user.user_identity != "学生" ? <Create href={"/paths/new"} name={"新建实践课程"} index="3"></Create>:""
} }
{ {
(!data || (data && data.subjects.length==0)) && category && <NoneData></NoneData> (!data || (data && data.subjects.length==0)) && category && <NoneData></NoneData>

@ -313,7 +313,7 @@ class InfosProject extends Component{
<div className="square-list clearfix"> <div className="square-list clearfix">
{/* 289 */} {/* 289 */}
{ {
page == 1 && is_current && this.props.current_user && !category && this.props.current_user.user_identity != "学生" ? page == 1 && is_current ?
<Create href={`${this.props.Headertop && this.props.Headertop.old_url}/projects/new`} name={"新建开发项目"} index="4" Createtype={"projects"} <Create href={`${this.props.Headertop && this.props.Headertop.old_url}/projects/new`} name={"新建开发项目"} index="4" Createtype={"projects"}
{...this.props} {...this.state} {...this.props} {...this.state}
></Create>:"" ></Create>:""

@ -335,7 +335,7 @@ class InfosShixun extends Component{
<div className="square-list clearfix"> <div className="square-list clearfix">
{/* 298 */} {/* 298 */}
{ {
page == 1 && is_current && !category && this.props.current_user && this.props.current_user.user_identity != "学生" ? page == 1 && is_current && !category ?
<Create href={"/shixuns/new"} name={"新建实训"} index="2"></Create>:"" <Create href={"/shixuns/new"} name={"新建实训"} index="2"></Create>:""
} }
{ {

@ -513,7 +513,7 @@ li.li-width7{width: 7%;text-align: left}
background-position: center; background-position: center;
background-repeat: no-repeat; background-repeat: no-repeat;
} }
.invite-tip{position: absolute;top: -5px;right: 140px;color: #fff; box-sizing: border-box;width: 170px;text-align: center;border-radius: 2px;background-color: rgba(5,16,26,0.6)} .invite-tip{position: absolute;top: -5px;right: 140px;color: #fff; box-sizing: border-box;width: 170px;text-align: center;border-radius: 2px;background-color: rgba(5,16,26,0.6);z-index: 5000;}
.inviteTipbtn a{font-size:14px;width: 100%;height: 30px;line-height: 30px;display: block;color: #747A7F;background-color: rgba(5,16,26,0.4)} .inviteTipbtn a{font-size:14px;width: 100%;height: 30px;line-height: 30px;display: block;color: #747A7F;background-color: rgba(5,16,26,0.4)}
.inviteTipbtn a:hover{color: #4cacff!important;} .inviteTipbtn a:hover{color: #4cacff!important;}
.top-black-trangle{display: block;border-width: 8px;position: absolute;top: -16px;right: 4px;border-style: dashed solid dashed dashed;border-color: transparent transparent rgba(5,16,26,0.6) transparent;font-size: 0;line-height: 0;} .top-black-trangle{display: block;border-width: 8px;position: absolute;top: -16px;right: 4px;border-style: dashed solid dashed dashed;border-color: transparent transparent rgba(5,16,26,0.6) transparent;font-size: 0;line-height: 0;}

Loading…
Cancel
Save