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`);
} }
@ -545,7 +545,7 @@ 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}>
{ {
@ -641,10 +641,6 @@ class MessagSub extends Component {
})} })}
</Spin> </Spin>
</div>
</div>
{/*页数*/} {/*页数*/}
{data === undefined ? "" {data === undefined ? ""
: :
@ -660,6 +656,9 @@ class MessagSub extends Component {
} }
</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