调整对应评阅跳转

dev_ec
杨树明 5 years ago
parent c9c66f2f7f
commit bae0380eb2

@ -1,24 +1,24 @@
import React, { Component } from 'react';
import {Link} from 'react-router-dom'
const map={"blue":"colorblue","white":"colorwhite","grey":"colorgrey", 'orange': "color-orange"}
class WordsBtn extends Component {
constructor(props) {
super(props);
}
render() {
let{to, href}=this.props
return(
<React.Fragment>
{
to==undefined ?
<a href={href || "javascript:void(0)"} onClick={this.props.onClick} className={"btn "+`${map[this.props.style]} ${this.props.className}`}>{this.props.children}</a>
:
<Link to={to} className={"btn "+`${map[this.props.style]} ${this.props.className}`}>{this.props.children}</Link>
}
</React.Fragment>
)
}
}
import React, { Component } from 'react';
import {Link} from 'react-router-dom'
const map={"blue":"colorblue","white":"colorwhite","grey":"colorgrey", 'orange': "color-orange"}
class WordsBtn extends Component {
constructor(props) {
super(props);
}
render() {
let{to, href,target}=this.props
return(
<React.Fragment>
{
to==undefined ?
<a href={href || "javascript:void(0)"} target={target} onClick={this.props.onClick} className={"btn "+`${map[this.props.style]} ${this.props.className}`}>{this.props.children}</a>
:
<Link to={to} className={"btn "+`${map[this.props.style]} ${this.props.className}`}>{this.props.children}</Link>
}
</React.Fragment>
)
}
}
export default WordsBtn;

@ -1,184 +1,184 @@
import React, { Component } from 'react';
export const STATUS_UN_PUBLISH = "未发布"
// homework_status: ["提交中", "未开启补交"]
export const STATUS_SUBMIT = "提交中"
// export const STATUS_UN_PUBLISH = "未发布"
// homework_status: ["提交中"] 未发布 未开启补交
export function RouteHOC(options = {}) {
return function wrap(WrappedComponent) {
return class Wrapper extends Component {
constructor(props) {
super(props);
this.state = {
}
}
toCreateProject = () => {
let url = '/projects/new'
if (window.location.port == 3007) {
// window.location.href
url = '/testbdweb.educoder.net/projects/new'
}
window.open(
url,
'_blank' // <- This is what makes it open in a new window.
);
}
// common_homework group_homework
// 是否是分组作业
isGroup = () => {
return window.location.pathname.indexOf('group_homeworks') != -1
}
getModuleName = (isChinese) => {
const isGroup = this.isGroup()
if (isChinese) {
let chName = isGroup ? '分组作业' : '普通作业'
return chName;
}
const secondName = isGroup ? 'group_homeworks' : 'common_homeworks'
return secondName;
}
getModuleType = () => {
const isGroup = this.isGroup()
return isGroup ? 3 : 1
}
toDetailPage = (_courseId, workId, topicId) => {
if (typeof _courseId == "object") {
const topicId = _courseId.topicId
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/boards/${workId}/messages/${topicId}`)
} else {
this.props.history.push(`/courses/${_courseId}/boards/${workId}/messages/${topicId}`)
}
}
toEditPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/edit`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/edit`)
}
}
toWorkDetailPage = (_courseId, _workId, _studentWorkId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
const studentWorkId = _courseId.studentWorkId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/${_studentWorkId || studentWorkId}/appraise`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/${_studentWorkId}/appraise`)
}
}
toNewPage = (courseId) => {
const secondName = this.getModuleName()
this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.category_id}/new`)
}
toListPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}${_workId ? '/' + _workId : ''}`)
}
}
toWorkPostPage = (_courseId, _workId, isEdit, _studentWorkId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
const studentWorkId = _courseId.studentWorkId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/${isEdit? `${_studentWorkId || studentWorkId}/post_edit` : 'post'}`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/${isEdit? `${_studentWorkId}/post_edit` : 'post'}`)
}
}
toWorkListPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/list`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/list`)
}
}
toWorkAnswerPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${workId}/answer`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/answer`)
}
}
toWorkQuestionPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _workId || _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${workId}/question`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/question`)
}
}
toWorkSettingPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/setting`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/setting`)
}
}
render() {
const { snackbarOpen} = this.state;
return (
<React.Fragment>
<WrappedComponent {...this.props}
toDetailPage={this.toDetailPage}
toEditPage={this.toEditPage}
toNewPage={this.toNewPage}
toListPage={this.toListPage}
toWorkDetailPage={this.toWorkDetailPage}
toWorkPostPage={this.toWorkPostPage}
toWorkListPage={this.toWorkListPage}
toWorkAnswerPage={this.toWorkAnswerPage}
toWorkQuestionPage={this.toWorkQuestionPage}
toWorkSettingPage={this.toWorkSettingPage}
toCreateProject={this.toCreateProject}
isGroup={this.isGroup}
getModuleName={this.getModuleName}
getModuleType={this.getModuleType}
>
</WrappedComponent>
</React.Fragment>
)
}
}
}
import React, { Component } from 'react';
export const STATUS_UN_PUBLISH = "未发布"
// homework_status: ["提交中", "未开启补交"]
export const STATUS_SUBMIT = "提交中"
// export const STATUS_UN_PUBLISH = "未发布"
// homework_status: ["提交中"] 未发布 未开启补交
export function RouteHOC(options = {}) {
return function wrap(WrappedComponent) {
return class Wrapper extends Component {
constructor(props) {
super(props);
this.state = {
}
}
toCreateProject = () => {
let url = '/projects/new'
if (window.location.port == 3007) {
// window.location.href
url = '/testbdweb.educoder.net/projects/new'
}
window.open(
url,
'_blank' // <- This is what makes it open in a new window.
);
}
// common_homework group_homework
// 是否是分组作业
isGroup = () => {
return window.location.pathname.indexOf('group_homeworks') != -1
}
getModuleName = (isChinese) => {
const isGroup = this.isGroup()
if (isChinese) {
let chName = isGroup ? '分组作业' : '普通作业'
return chName;
}
const secondName = isGroup ? 'group_homeworks' : 'common_homeworks'
return secondName;
}
getModuleType = () => {
const isGroup = this.isGroup()
return isGroup ? 3 : 1
}
toDetailPage = (_courseId, workId, topicId) => {
if (typeof _courseId == "object") {
const topicId = _courseId.topicId
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/boards/${workId}/messages/${topicId}`)
} else {
this.props.history.push(`/courses/${_courseId}/boards/${workId}/messages/${topicId}`)
}
}
toEditPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/edit`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/edit`)
}
}
toWorkDetailPage = (_courseId, _workId, _studentWorkId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
const studentWorkId = _courseId.studentWorkId
window.open(`/courses/${courseId}/${secondName}/${_workId || workId}/${_studentWorkId || studentWorkId}/appraise`);
} else {
window.open(`/courses/${_courseId}/${secondName}/${_workId}/${_studentWorkId}/appraise`);
}
}
toNewPage = (courseId) => {
const secondName = this.getModuleName()
this.props.history.push(`/courses/${courseId.coursesId}/${secondName}/${courseId.category_id}/new`)
}
toListPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}${_workId ? '/' + _workId : ''}`)
}
}
toWorkPostPage = (_courseId, _workId, isEdit, _studentWorkId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
const studentWorkId = _courseId.studentWorkId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/${isEdit? `${_studentWorkId || studentWorkId}/post_edit` : 'post'}`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/${isEdit? `${_studentWorkId}/post_edit` : 'post'}`)
}
}
toWorkListPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/list`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/list`)
}
}
toWorkAnswerPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${workId}/answer`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/answer`)
}
}
toWorkQuestionPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _workId || _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${workId}/question`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/question`)
}
}
toWorkSettingPage = (_courseId, _workId) => {
const secondName = this.getModuleName()
if (typeof _courseId == "object") {
const workId = _courseId.workId
const courseId = _courseId.coursesId
this.props.history.push(`/courses/${courseId}/${secondName}/${_workId || workId}/setting`)
} else {
this.props.history.push(`/courses/${_courseId}/${secondName}/${_workId}/setting`)
}
}
render() {
const { snackbarOpen} = this.state;
return (
<React.Fragment>
<WrappedComponent {...this.props}
toDetailPage={this.toDetailPage}
toEditPage={this.toEditPage}
toNewPage={this.toNewPage}
toListPage={this.toListPage}
toWorkDetailPage={this.toWorkDetailPage}
toWorkPostPage={this.toWorkPostPage}
toWorkListPage={this.toWorkListPage}
toWorkAnswerPage={this.toWorkAnswerPage}
toWorkQuestionPage={this.toWorkQuestionPage}
toWorkSettingPage={this.toWorkSettingPage}
toCreateProject={this.toCreateProject}
isGroup={this.isGroup}
getModuleName={this.getModuleName}
getModuleType={this.getModuleType}
>
</WrappedComponent>
</React.Fragment>
)
}
}
}
}

@ -823,6 +823,7 @@ class Studentshavecompletedthelist extends Component {
<span style={{textAlign: "center",color: '#999999',}}>--</span>
:
<a style={{textAlign: "center"}} className="color-blue"
target="_blank"
href={`/courses/${this.props.match.params.coursesId}/exercises/${this.props.match.params.Id}/users/${record.myid}`}>{record.operating}</a>
}

@ -864,7 +864,7 @@ class GraduationTaskssettinglist extends Component{
{
tag.name &&
<Tooltip key={key} placement="bottom" title={tag.name==="分配"?taskslistdata&&taskslistdata.cross_comment===true?"":"指定该作品的交叉评阅人":tag.name==="调分"?<pre>调整学生最终成绩<br/>其它历史评分将全部失效</pre>:""}>
{tag.name==="评阅"?<a style={{color:'#4CACFF',padding:"0px 5px"}} href={"/courses/"+courseId+"/graduation_tasks/"+tag.id+"/appraise"} >
{tag.name==="评阅"?<a target="_blank" style={{color:'#4CACFF',padding:"0px 5px"}} href={"/courses/"+courseId+"/graduation_tasks/"+tag.id+"/appraise"} >
{tag.name}
</a>
:

@ -228,7 +228,7 @@ class PollDetailTabFirst extends Component{
width:120,
render:(operation,item,index)=>{
return(
item.status == 1 ? <WordsBtn style="blue" to={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollId}/users/${item.login}`}>查看</WordsBtn>:<span className="color-grey-9">--</span>
item.status == 1 ? <WordsBtn style="blue" target={"_blank"} to={`/courses/${this.props.match.params.coursesId}/polls/${this.props.match.params.pollId}/users/${item.login}`}>查看</WordsBtn>:<span className="color-grey-9">--</span>
)
}
}];

Loading…
Cancel
Save