dev_aliyun_beta
杨树明 6 years ago
parent 845967802b
commit 1a60ce165e

@ -21,16 +21,16 @@ let hashTimeout
// TODO 开发期多个身份切换
let debugType =""
if (isDev) {
const _search = window.location.search;
let parsed = {};
if (_search) {
parsed = queryString.parse(_search);
}
debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
window.location.search.indexOf('debug=s') != -1 ? 'student' :
window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin'
}
// if (isDev) {
// const _search = window.location.search;
// let parsed = {};
// if (_search) {
// parsed = queryString.parse(_search);
// }
// debugType = window.location.search.indexOf('debug=t') != -1 ? 'teacher' :
// window.location.search.indexOf('debug=s') != -1 ? 'student' :
// window.location.search.indexOf('debug=a') != -1 ? 'admin' : parsed.debug || 'admin'
// }
window._debugType = debugType;
export function initAxiosInterceptors(props) {

@ -17,7 +17,7 @@ class InfosTopics extends Component{
super(props);
this.state={
isSpin:false,
category:"common",
category:"normal",
course_list_id:undefined,
sort_by:"updated_at",
sort_direction:"desc",
@ -29,11 +29,13 @@ class InfosTopics extends Component{
}
componentDidMount(){
this.updataslist()
}
updataslist=()=>{
let types=this.props.match.params.topicstype;
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,page)
}
searchAlldata=(type,category,course_list_id,sort_by,sort_direction,page)=>{
let user_id=this.props.current_user&&this.props.current_user.user_id;
if(user_id!=undefined){
@ -122,11 +124,16 @@ class InfosTopics extends Component{
let { category,course_list_id,sort_by,sort_direction,page}=this.state;
this.searchAlldata(types,category,course_list_id,sort_by,sort_direction,pageNumber)
this.setState({
page:pageNumber
page:pageNumber,
checkBoxValues:[]
})
}
deletecheckBoxValues=()=>{
let {checkBoxValues}=this.state;
if(checkBoxValues.length===0){
this.props.showNotification("请选择题库")
}
this.setState({
Modalstype:true,
Modalstopval:"是否确认删除?",
@ -136,13 +143,19 @@ class InfosTopics extends Component{
}
topicssavedelete=()=>{
let {checkBoxValues}=this.state;
const url = `/homework_commons/${workId}/student_works/delete_work.json`;
let {checkBoxValues,category}=this.state;
const url = `/question_banks/multi_delete.json`;
axios.delete(url, { data: {
user_id: id
object_id: checkBoxValues,
object_type:category
}})
.then((response) => {
if(response.data.status===0){
this.updataslist()
this.props.showNotification(response.data.message)
}else{
this.props.showNotification(response.data.message)
}
})
.catch(function (error) {
console.log(error);
@ -165,27 +178,31 @@ class InfosTopics extends Component{
})
}
openTopics=()=>{
openTopics=(id)=>{
this.setState({
Modalstype:true,
Modalstopval:"公开后不能重设为私有",
ModalsBottomval:"是否确认设为公开?",
ModalCancel:this.topicscancelmodel,
ModalSave:this.topicssaveonOpen,
ModalSave:()=>this.topicssaveonOpen(id),
})
}
topicssaveonOpen=()=>{
let {checkBoxValues}=this.state;
const url = `/homework_commons/${workId}/student_works/delete_work.json`;
axios.delete(url, { data: {
user_id: id
}})
.then((response) => {
})
.catch(function (error) {
topicssaveonOpen=(id)=>{
let {category}=this.state;
const url = `/question_banks/multi_public.json`;
axios.post(url,{
object_id:[id],
object_type:category
}).then((response) => {
if(response.data.status===0){
this.updataslist()
this.props.showNotification(response.data.message)
}else{
this.props.showNotification(response.data.message)
}
}).catch(function (error) {
console.log(error);
});
@ -213,7 +230,7 @@ class InfosTopics extends Component{
} = this.state;
let categorylist=[
{val:"普通作业",type:"common"},
{val:"普通作业",type:"normal"},
{val:"分组作业",type:"group"},
{val:"毕设选题",type:"gtopic"},
{val:"毕设任务",type:"gtask"},
@ -227,7 +244,9 @@ class InfosTopics extends Component{
//types===publicly 公共
//types===personal 私有
let user_id=this.props.current_user&&this.props.current_user.user_id;
let user_type=this.props.current_user&&this.props.current_user.user_identity;
let targetuserid=this.props.data&&this.props.data.id;
const menu = (
<Menu>
<Menu.Item onClick={()=>this.updatedlist("updated_at")}>
@ -349,8 +368,8 @@ class InfosTopics extends Component{
</sapn>
</span>
</Dropdown>
<span className="fr mr30 topcsactive pointer" onClick={()=>this.sendTopics()}>发送</span>
{types==="personal"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.deletecheckBoxValues()}>删除</span>:""}
{user_type!="学生"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.sendTopics()}>发送</span>:""}
{types==="personal"?user_id===targetuserid&&user_type!="学生"?<span className="fr mr30 topcsactive pointer" onClick={()=>this.deletecheckBoxValues()}>删除</span>:"":""}
</p>
</div>
@ -364,14 +383,14 @@ class InfosTopics extends Component{
<div className="item-body">
<div className="clearfix ds pr pt5 contentSection" >
<Checkbox value={item.id} className={"fl mt5"}></Checkbox>
{user_type!="学生"?<Checkbox value={item.id} key={item.id} className={"fl mt5"}></Checkbox>:""}
<a title={item.name} className="ml10 fl mt3 font-16 color-dark maxwidth900">
{item.name}
</a>
{item.is_public===false?<span className="edu-filter-btn ml15 fl typestyle mt3 topiscfilterbtn">公开</span>:""}
{item.is_public===true?<span className="edu-filter-btn ml15 fl typestyle mt3 topiscfilterbtn">公开</span>:""}
{types==="personal"&&item.is_public===false?<a className="btn colorblue mr25 fr font-16" onClick={()=>this.openTopics()}>设为公开</a>:""}
{types==="personal"&&item.is_public===false?user_id===targetuserid&&user_type!="学生"?<a className="btn colorblue mr25 fr font-16" onClick={()=>this.openTopics(item.id)}>设为公开</a>:"":""}
<div className="cl"></div>
@ -386,7 +405,7 @@ class InfosTopics extends Component{
</p>
<div className="homepagePostSetting homepagePostSettingname topscisright">
{types==="personal"?<a className="btn colorblue mr25 font-16 fr">编辑</a>:""}
{types==="personal"?user_id===targetuserid&&user_type!="学生"?<a className="btn colorblue mr25 font-16 fr">编辑</a>:"":""}
</div>
</div>
</div>

Loading…
Cancel
Save