diff --git a/public/react/src/App.js b/public/react/src/App.js index f0c0fac5d..1205113df 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -324,7 +324,7 @@ class App extends Component { title: 'EduCoder', desc: '创新源于实践', link: currentUrl, - imgUrl: currentUrl + '/images/educoder/index/subject/subject15.jpg' + imgUrl: (currentUrl.endsWith('/') ? currentUrl : currentUrl + '/') + 'images/educoder/index/subject/subject15.jpg' }; wx.onMenuShareAppMessage(shareData);//分享给好友 diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 2fbee86da..939d2cdaa 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -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) { diff --git a/public/react/src/modules/user/usersInfo/banks/GtaskBanksEdit.js b/public/react/src/modules/user/usersInfo/banks/GtaskBanksEdit.js index 16ecea151..d7e433de3 100644 --- a/public/react/src/modules/user/usersInfo/banks/GtaskBanksEdit.js +++ b/public/react/src/modules/user/usersInfo/banks/GtaskBanksEdit.js @@ -59,7 +59,7 @@ class GtaskBanksEdit extends Component { }); } toWorkDetail = () => { - this.props.history.push(`/banks/gtask/${this.props.match.params.workId}/${this.props.match.params.type}?tab=0`); + window.location.href=`/banks/gtask/${this.props.match.params.workId}/${this.props.match.params.type}?tab=0`; this.props.initPublic(undefined); } onCancel = () => { diff --git a/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js b/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js index cfd85b260..16f77ad46 100644 --- a/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js +++ b/public/react/src/modules/user/usersInfo/banks/NewGtaskForm.js @@ -19,6 +19,7 @@ class NewGtaskForms extends Component{ initValue = (data) => { + if (data.isEdit===true) { const contentFileList = data.attachments.map(item => { return { id: item.id, @@ -31,10 +32,10 @@ class NewGtaskForms extends Component{ }) this.setState({ ...data, - base_on_project: data.group_info.base_on_project, + base_on_project: data.task_type===2?data.group_info.base_on_project:undefined, title_num: parseInt(data.name.length), - min_num: data.group_info.min_number, - max_num: data.group_info.max_number, + min_num: data.task_type===2?data.group_info.min_number:undefined, + max_num: data.task_type===2?data.group_info.max_number:undefined, contentFileList, }, () => { setTimeout(() => { @@ -47,6 +48,8 @@ class NewGtaskForms extends Component{ }); }) + } + } @@ -120,27 +123,28 @@ class NewGtaskForms extends Component{ values.description = mdContnet; if (!err) { + if (this.props.data.isEdit===true) { let url="/task_banks/"+topicId+".json"; axios.put(url, { - gtask_bank: { - name: values.title, - description: values.description, - min_num:task_type===1?undefined:min_num, - max_num:task_type===1?undefined:max_num, - base_on_project: task_type===1?undefined:base_on_project===true?1:0 - }, - attachment_ids:contentFileList + gtask_bank: { + name: values.title, + description: values.description, + min_num:task_type===1?undefined:min_num, + max_num:task_type===1?undefined:max_num, + base_on_project: task_type===1?undefined:base_on_project===true?1:0 + }, + attachment_ids:contentFileList } ).then((response) => { - if(response.data.status===0){ - this.props.showNotification(response.data.message) - }else{ - this.props.showNotification(response.data.message) - } + if(response.data.status===0){ + this.props.showNotification(response.data.message) + }else{ + this.props.showNotification(response.data.message) + } }).catch((error) => { console.log(error) }) - + } } else { $("html").animate({ scrollTop: $('html').scrollTop() - 100 }) }