Merge remote-tracking branch 'origin/master'

dev_forum
杨树明 6 years ago
commit d45d955ebf

@ -75,12 +75,16 @@ class WorkDetailPageHeader extends Component{
return( return(
<React.Fragment> <React.Fragment>
<div> <div>
<div className="newMain clearfix worklist1"> <div className="newMain clearfix worklist1 workDetailPageHeader">
<div className={"educontent mt20"}> <div className={"educontent mt20"}>
<style>{` <style>{`
.memoContent { .memoContent {
background: #fff; background: #fff;
} }
.workDetailPageHeader .summaryname {
line-height: 20px;
margin-top: 13px;
}
`}</style> `}</style>
<CBreadcrumb items={[ <CBreadcrumb items={[
{ to: `/courses/${courseId}`, name: course_name}, { to: `/courses/${courseId}`, name: course_name},
@ -93,7 +97,7 @@ class WorkDetailPageHeader extends Component{
]}></CBreadcrumb> ]}></CBreadcrumb>
<div style={{ width:'100%',height:'52px'}} > <div style={{ width:'100%',height:'52px'}} >
<span className=" fl color-black summaryname"> <span className=" fl color-black summaryname" style={{}}>
{homework_name} {homework_name}
{/* <Link to={"/courses/"+courseId+"/graduation"+"/graduation_tasks/"}>{homework_name}</Link> */} {/* <Link to={"/courses/"+courseId+"/graduation"+"/graduation_tasks/"}>{homework_name}</Link> */}
</span> </span>

@ -212,7 +212,7 @@ class Index extends Component {
<MainContentContainer <MainContentContainer
onDrawerButtonClick={this.onDrawerButtonClick} onDrawerButtonClick={this.onDrawerButtonClick}
grade={context.grade} grade={context.grade}
allowed_unlock={context.allowed_unlock}
user={context.user} user={context.user}
power={context.power} power={context.power}
myshixun_manager={context.myshixun_manager} myshixun_manager={context.myshixun_manager}

@ -91,7 +91,7 @@ class UpdateDrawer extends Component {
// const url = `/myshixuns/${myshixun.identifier}/stages/${game.identifier}/system_update` // const url = `/myshixuns/${myshixun.identifier}/stages/${game.identifier}/system_update`
// const url = `/api/v1/games/${game.identifier}/system_update?myshixun_id=${myshixun.id}` // const url = `/api/v1/games/${game.identifier}/system_update?myshixun_id=${myshixun.id}`
const url = `/tasks/${game.identifier}/system_update?myshixun_id=${myshixun.id}` const url = `/tasks/${game.identifier}/system_update.json?myshixun_id=${myshixun.id}`
this.setState({ loading: true }) this.setState({ loading: true })
axios.get(url, { axios.get(url, {
// withCredentials: true, // withCredentials: true,

@ -234,8 +234,8 @@ class CodeEvaluateView extends Component {
</React.Fragment> </React.Fragment>
) : ) :
<p className="color-orange -task-testline pl20"> <p className="color-orange -task-testline pl20">
{ allowed_unlock === true ? '隐藏测试集,暂不支持解锁和查看。' : '此为隐藏测试项。'} { !allowed_unlock ? '隐藏测试集,暂不支持解锁和查看。' : '此为隐藏测试项。'}
{ power === 0 ? <a href="javascript:void(0)" className="color_white test_set_data" { (power === 0 && allowed_unlock == true) ? <a href="javascript:void(0)" className="color_white test_set_data"
onClick={()=>showDialog({ contentText, callback: testSetUnlock , moreButtonsRender})} onClick={()=>showDialog({ contentText, callback: testSetUnlock , moreButtonsRender})}
style={{"textDecoration": "underline"}}>解锁</a> : '' } style={{"textDecoration": "underline"}}>解锁</a> : '' }
</p> </p>

@ -81,10 +81,10 @@ class LeftViewContainer extends Component {
if ( tabIndex === 2 && this.state.gameAnswer === '') { // 参考答案 if ( tabIndex === 2 && this.state.gameAnswer === '') { // 参考答案
// 多级答案后换了接口 // 多级答案后换了接口
// 选择题(st === 1)还是走以前的接口 // 选择题(st === 1)还是走以前的接口
if (true || (this.props.st === 0)) { if ((this.props.st === 0)) {
this.fetchIfCouldGetAnswerWithoutGoldForMultiLevelAnswer() this.fetchIfCouldGetAnswerWithoutGoldForMultiLevelAnswer()
} else if (this.props.st === 1) { } else if (this.props.st === 1) {
this.fetchIfCouldGetAnswerWithoutGold(); this.fetchIfCouldGetAnswerWithoutGoldForChoose();
} }
return; return;
} }
@ -337,7 +337,41 @@ class LeftViewContainer extends Component {
console.log(error); console.log(error);
}); });
} }
fetchIfCouldGetAnswerWithoutGold() { // 选择题查看答案
fetchIfCouldGetAnswerWithoutGoldForChoose() {
const url = `/tasks/${this.props.game.identifier}/get_choose_answer.json`
axios.get(url, {
// withCredentials: true,
})
.then((response) => {
if (response.data.status == 0) {
this.props.showSnackbar(response.data.message)
return;
}
/*
将扣除XXX点金币是否确认查看答案     
已经过职业认证的教师可以免金币查看答案哟
继续查看 立即认证新开页
*/
// 答案测试 TODO
// if (false && response.data.view_answer === true) {
if (response.data.choose_answers) {
this.showAnswer(response.data.choose_answers)
} else if (response.data.status == 1) {
// 三个角色 普通用户、未认证教师、已认证教师,这里要区分普通用户和未认证教师用户
this.setState({
dialogOpen: true,
})
}
})
.catch(function (error) {
console.log(error);
});
return;
// 查看是否有权限直接查看true可以直接查看false需要扣金币查看 // 查看是否有权限直接查看true可以直接查看false需要扣金币查看
// var getAnswerUrl = `/api/v1/games/${this.props.game.identifier}/answer`; // var getAnswerUrl = `/api/v1/games/${this.props.game.identifier}/answer`;
var getAnswerUrl = `/tasks/${this.props.game.identifier}/answer.json` var getAnswerUrl = `/tasks/${this.props.game.identifier}/answer.json`
@ -445,12 +479,16 @@ class LeftViewContainer extends Component {
const challenge_score = this.props.challenge.score const challenge_score = this.props.challenge.score
// 前端计算扣除金币数 // 前端计算扣除金币数
let goldToMinuse = 0 let goldToMinuse = 0
for (let i = 0; i < lockedAnswers.length; i++) { if (this.state.isMultiLevelAnswer) {
let answer = lockedAnswers[i]; for (let i = 0; i < lockedAnswers.length; i++) {
goldToMinuse = goldToMinuse + answer.score * challenge_score / 100; let answer = lockedAnswers[i];
if (answer.id == paramSelectID) { goldToMinuse = goldToMinuse + answer.score * challenge_score / 100;
break; if (answer.id == paramSelectID) {
break;
}
} }
} else {
goldToMinuse = challenge_score
} }
this.props.readGameAnswer({ this.props.readGameAnswer({
@ -474,39 +512,26 @@ class LeftViewContainer extends Component {
console.log(error); console.log(error);
}); });
} }
handleDialogReadAnswer(selectID) { getChooseAnswer = () => {
const url = `/tasks/${this.props.game.identifier}/unlock_choose_answer.json`
this.handleMultiLevelAnswer(selectID || this.state.singleAnswerId) axios.get(url, {
return ;
if (this.state.isMultiLevelAnswer) {
}
if (selectID) {
}
// var getAnswerUrl = `/api/v1/games/${this.props.game.identifier}/answer_grade`
var getAnswerUrl = `/tasks/${this.props.game.identifier}/answer_grade.json`
axios.get(getAnswerUrl, {
// withCredentials: true, // withCredentials: true,
}) })
.then((response) => { .then((response) => {
// {message: "您没有足够的金币", status: -1} // {message: "您没有足够的金币", status: -1}
if (response.data.status == 0) { if (response.data.status == 0) {
this.props.showSnackbar(response.data.message) this.props.showSnackbar(response.data.message)
return; return;
} }
const gameAnswer = response.data.choose_answers;
const gameAnswer = response.data.answer; // const final_score = response.data.final_score;
const final_score = response.data.final_score;
const grade = response.data.grade; const grade = response.data.grade;
this.props.readGameAnswer({ this.props.readGameAnswer({
final_score, // final_score,
grade, grade: this.props.grade - this.props.challenge.score
}) })
this.showAnswer(gameAnswer) this.showAnswer(gameAnswer)
@ -516,6 +541,14 @@ class LeftViewContainer extends Component {
console.log(error); console.log(error);
}); });
} }
handleDialogReadAnswer(selectID) {
if (this.props.st === 1) {
// 选择题
this.getChooseAnswer()
} else {
this.handleMultiLevelAnswer(selectID || this.state.singleAnswerId)
}
}
createNewComment = (page) => { createNewComment = (page) => {
const flag = this.props.createNewComment(page) const flag = this.props.createNewComment(page)
if (flag === true) { if (flag === true) {

Loading…
Cancel
Save