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

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

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

Loading…
Cancel
Save