diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index 80973be75..11cfc1962 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -29,7 +29,7 @@ const env = getClientEnvironment(publicUrl); module.exports = { // You may want 'eval' instead if you prefer to see the compiled output in DevTools. // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s - devtool: "source-map", // 开启调试 + // devtool: "source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/src/modules/comment/Comments.js b/public/react/src/modules/comment/Comments.js index ec7d6a5a8..c07bd5de2 100644 --- a/public/react/src/modules/comment/Comments.js +++ b/public/react/src/modules/comment/Comments.js @@ -1,579 +1,586 @@ -import React, { Component } from 'react'; - -import Dialog, { - DialogActions, - DialogContent, - DialogContentText, - DialogTitle, -} from 'material-ui/Dialog'; -import Button from 'material-ui/Button'; -import Tooltip from 'material-ui/Tooltip'; - -import Pagination from 'rc-pagination'; -import 'rc-pagination/assets/index.css'; - -import { getImageUrl, toPath } from 'educoder'; - -import Input, { InputLabel } from 'material-ui/Input'; - -import { FormControl, FormHelperText } from 'material-ui/Form'; - -import CommentItemKEEditor from './CommentItemKEEditor'; -import CommentItemMDEditor from './CommentItemMDEditor'; - -import './Comment.css' -import Modals from '../modals/Modals' - -/* - -------------------------- 样式相关 - class 改成 className - style 需要传入json对象 style="margin:0px"> -> style={{ margin:"0px" }}> - margin-top -> marginTop - onclick -> onClick 驼峰 - - -------------------------- 模板语法相关 - 页面都在前端组装、渲染 - rails模板的 if等逻辑改成js实现 - 客户端需要能判断 User.current.manager_of_shixun?(comment.dis_id) - - -------------------------- 现有ui控件的使用方式 - 方案1: 换成对应的react组件,然后再调用(控件简单时推荐) - 方案2: 在react环境中使用若干jquery插件(控件复杂,又无react环境下的替代方案时考虑使用) - - -------------------------- - 需要服务端提供对应的rest api - - -*/ - -const _origin = window.location.origin; - - -/* - 用到的props: - user user_url image_url - - loadingComments-- - comment_count_without_reply - currentPage - comments - - 接口 - deleteComment 删除 - onPaginationChange 翻页变化 - commentPraise 点赞 - hiddenComment 隐藏 - rewardCode 奖励 - -*/ -class Comments extends Component { - constructor(props) { - super(props) - - this.handleDialogClose = this.handleDialogClose.bind(this) - this.handleGoldRewardDialogClose = this.handleGoldRewardDialogClose.bind(this) - - this.state = { - dialogOpen: false, - goldRewardDialogOpen: false, - goldRewardInput: '', - - showReplyEditorFlag: false, // false->true or true->false时切换editor显示或隐藏 - currentReplyComment: null - } - } - componentWillUnmount() { - const $ = window.$; - $(document).off("onReply"); - } - componentDidMount() { - setTimeout(()=>{ - const $ = window.$; - // 绑定后会自动off? 加timeout试试 - $(document).on("onReply", (e, args)=>{ - const { commentContent, id, editor } = args; - - this.props.replyComment(commentContent, id, editor) - }); - }, 1000) - - } - initReply(comment) { - this.props.initReply && this.props.initReply(comment) - // 如果配置的使用kindEditor - if (window.__useKindEditor === true) { - const { user } = this.props; - console.log('initReply ', comment) - - const $ = window.$; - var id = comment.id - var reply_message_el = `#reply_message_${id}` - var reply_iconup_el = `#reply_iconup_${id}` - if($(reply_message_el).html() == "") { - $(".reply_to_message").html(""); - $(reply_message_el).html(`
\n
\"0?1442652658\"<\/a><\/div>\n
\n
\n
<\/div>\n \n
<\/div>\n -
-
-
-
-
- {noStorage == true ? ' ' :

 

} - {/* {noStorage == true ? ' ' :

 

} */} -
- - ) - } -} - - +import React, {Component} from 'react'; + +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; + +import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; + +// import "antd/dist/antd.css"; + +import { getImageUrl, toPath, getUrl } from 'educoder'; +import '../../courses/css/Courses.css' + +import axios from 'axios'; + +import './css/TPMchallengesnew.css'; +require('codemirror/lib/codemirror.css'); + +let origin = getUrl(); + +let path = getUrl("/editormd/lib/") + +const $ = window.$; + +let timeout; + +let currentValue; + +const Option = Select.Option; + +const RadioGroup = Radio.Group; + + + +// 保存数据 +function md_add_data(k,mdu,d){ + window.sessionStorage.setItem(k+mdu,d); +} + +// 清空保存的数据 +function md_clear_data(k,mdu,id){ + window.sessionStorage.removeItem(k+mdu); + var id1 = "#e_tip_"+id; + var id2 = "#e_tips_"+id; + if(k == 'content'){ + $(id2).html(" "); + }else{ + $(id1).html(" "); + } +} +window.md_clear_data = md_clear_data +// editor 存在了jquery对象上,应用不需要自己写md_rec_data方法了 +function md_rec_data(k, mdu, id) { + if (window.sessionStorage.getItem(k + mdu) !== null) { + var editor = $("#e_tips_" + id).data('editor'); + editor.setValue(window.sessionStorage.getItem(k + mdu)); + // debugger; + // /shixuns/b5hjq9zm/challenges/3977/tab=3 setValue可能导致editor样式问题 + md_clear_data(k, mdu, id); + } +} +window.md_rec_data = md_rec_data; + +function md_elocalStorage(editor,mdu,id){ + if (window.sessionStorage){ + var oc = window.sessionStorage.getItem('content'+mdu); + if(oc !== null ){ + console.log("#e_tips_"+id) + $("#e_tips_"+id).data('editor', editor); + var h = '您上次有已保存的数据,是否
恢复 ? / 不恢复'; + $("#e_tips_"+id).html(h); + } + setInterval(function() { + var d = new Date(); + var h = d.getHours(); + var m = d.getMinutes(); + var s = d.getSeconds(); + h = h < 10 ? '0' + h : h; + m = m < 10 ? '0' + m : m; + s = s < 10 ? '0' + s : s; + if(editor.getValue().trim() != ""){ + md_add_data("content",mdu,editor.getValue()); + var id1 = "#e_tip_"+id; + var id2 = "#e_tips_"+id; + + var textStart = " 数据已于 " + var text = textStart + h + ':' + m + ':' + s +" 保存 "; + // 占位符 + var oldHtml = $(id2).html(); + if (oldHtml && oldHtml != ' ' && oldHtml.startsWith(textStart) == false) { + $(id2).html( oldHtml.split(' (')[0] + ` (${text})`); + } else { + $(id2).html(text); + } + // $(id2).html(""); + } + },10000); + + }else{ + $("#e_tip_"+id).after('您的浏览器不支持localStorage.无法开启自动保存草稿服务,请升级浏览器!'); + } +} + + +function create_editorMD(id, width, high, placeholder, imageUrl, callback, initValue, + onchange, watch, { noStorage, showNullButton }, that) { + // 还是出现了setting只有一份,被共用的问题 + + var editorName = window.editormd(id, { + width: width, + height: high===undefined?400:high, + path: path, // "/editormd/lib/" + markdown : initValue, + + dialogLockScreen: false, + watch:watch===undefined?true:watch, + syncScrolling: "single", + tex: true, + tocm: true, + emoji: true, + taskList: true, + codeFold: true, + searchReplace: true, + htmlDecode: "style,script,iframe", + sequenceDiagram: true, + autoFocus: false, + + // mine + + toolbarIcons: function (mdEditor) { + let react_id = `react_${mdEditor.id}`; + const __that = window[react_id] + + // Or return editormd.toolbarModes[name]; // full, simple, mini + // Using "||" set icons align right. + const icons = ["bold", "italic", "|", "list-ul", "list-ol", "|", "code", "code-block", "|", "testIcon", "testIcon1", '|', "image", "table", '|', "watch", "clear"]; + if (__that.props.showNullButton) { + icons.push('nullBtton') + } + return icons + }, + toolbarCustomIcons: { + testIcon: "
", + testIcon1: "
", + nullBtton: "
点击插入填空项
", + }, + //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 + saveHTMLToTextarea: true, + // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 + dialogMaskOpacity: 0.6, + placeholder: placeholder, + imageUpload: true, + imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], + imageUploadURL: imageUrl,//url + onchange: onchange, + onload: function() { + let _id = this.id // 如果要使用this,这里不能使用箭头函数 + let _editorName = this; + let react_id = `react_${_editorName.id}`; + const __that = window[react_id] + + // this.previewing(); + // let _id = id; + $("#" + _id + " [type=\"latex\"]").bind("click", function () { + _editorName.cm.replaceSelection("```latex"); + _editorName.cm.replaceSelection("\n"); + _editorName.cm.replaceSelection("\n"); + _editorName.cm.replaceSelection("```"); + var __Cursor = _editorName.cm.getDoc().getCursor(); + _editorName.cm.setCursor(__Cursor.line - 1, 0); + }); + + $("#" + _id + " [type=\"inline\"]").bind("click", function () { + _editorName.cm.replaceSelection("$$$$"); + var __Cursor = _editorName.cm.getDoc().getCursor(); + _editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 2); + _editorName.cm.focus(); + }); + $("[type=\"inline\"]").attr("title", "行内公式"); + $("[type=\"latex\"]").attr("title", "多行公式"); + + if (__that.props.showNullButton) { + const NULL_CH = '▁' + // const NULL_CH = '〇' + // const NULL_CH = '🈳' + + $("#" + _id + " [type=\"nullBtton\"]").bind("click", function () { + _editorName.cm.replaceSelection(NULL_CH); + // var __Cursor = _editorName.cm.getDoc().getCursor(); + // _editorName.cm.setCursor(__Cursor.line - 1, 0); + }); + } + + if (noStorage == true) { + + } else { + md_elocalStorage(_editorName, `MDEditor__${_id}`, _id); + } + + callback && callback(_editorName) + } + }); + return editorName; +} + + +export default class TPMMDEditor extends Component { + constructor(props) { + super(props) + this.state = { + initValue: '' + } + } + componentDidUpdate(prevProps, prevState) { + // 不能加,影响了试卷填空题 + // if (this.props.initValue != prevProps.initValue) { + // this.answers_editormd.setValue(this.props.initValue) + // } + } + + // react_mdEditor_ + componentDidMount = () => { + const { mdID, initValue, placeholder, showNullButton} = this.props; + + let _id = `mdEditor_${mdID}` + this.contentChanged = false; + const _placeholder = placeholder || ""; + // amp; + // 编辑时要传memoId + const imageUrl = `/api/attachments.json`; + // 创建editorMd + let react_id = `react_${_id}`; + window[react_id] = this + const answers_editormd = create_editorMD(_id, '100%', this.props.height, _placeholder, imageUrl, (__editorName) => { + react_id = `react_${__editorName.id}`; + const that = window[react_id] + + setTimeout(() => { + console.log('timeout', __editorName.id) + __editorName.resize() + __editorName.cm && __editorName.cm.refresh() + }, that.props.refreshTimeout || 500) + if (that.props.initValue != undefined && that.props.initValue != '') { + __editorName.setValue(that.props.initValue) + } + if (that.state.initValue) { + __editorName.setValue(that.state.initValue) + } + __editorName.cm.on("change", (_cm, changeObj) => { + that.contentChanged = true; + if (that.state.showError) { + that.setState({showError: false}) + } + that.onEditorChange() + }) + that.props.onCMBlur && __editorName.cm.on('blur', () => { + that.props.onCMBlur() + }) + that.props.onCMBeforeChange && __editorName.cm.on('beforeChange', (cm,change) => { + that.props.onCMBeforeChange(cm,change) + }) + that.answers_editormd = __editorName; + window[_id] = __editorName; + }, initValue, this.onEditorChange,this.props.watch, { + noStorage: this.props.noStorage, + showNullButton: this.props.showNullButton + }, this); + + } + showError = () => { + this.setState({showError: true}) + } + onEditorChange = () => { + if (!this.answers_editormd) return; + const val = this.answers_editormd.getValue(); + try { + this.props.onChange && this.props.onChange(val) + } catch(e) { + // http://localhost:3007/courses/1309/common_homeworks/6566/setting + // 从这个页面,跳转到编辑页面,再在编辑页面点击返回的时候,这里会报错 + console.error('出错') + console.error(e) + } + } + resize = () => { + if (!this.answers_editormd) { // 还未初始化 + return; + } + this.answers_editormd.resize() + this.answers_editormd.cm && this.answers_editormd.cm.refresh() + this.answers_editormd.cm.focus() + } + + getValue = () => { + try { + return this.answers_editormd.getValue() + } catch (e) { + return '' + } + } + setValue = (val) => { + try { + this.answers_editormd.setValue(val) + } catch (e) { + // TODO 这里多实例的时候,前一个实例的state会被后面这个覆盖 参考NewWork.js http://localhost:3007/courses/1309/homework/9300/edit/1 + // 未初始化 + this.setState({ initValue: val }) + } + } + + render() { + + let { + showError + } = this.state; + let { mdID, className, noStorage } = this.props; + let _style = {} + if (showError) { + _style.border = '1px solid red' + } + return ( + +
+ {/* padding10-20 */} +
+ +
+
+
+
+
+ {noStorage == true ? ' ' :

 

} + {/* {noStorage == true ? ' ' :

 

} */} +
+
+ ) + } +} + + diff --git a/public/react/src/modules/tpm/challengesnew/TPManswer2.js b/public/react/src/modules/tpm/challengesnew/TPManswer2.js index ef850994d..6218cc468 100644 --- a/public/react/src/modules/tpm/challengesnew/TPManswer2.js +++ b/public/react/src/modules/tpm/challengesnew/TPManswer2.js @@ -1,6 +1,6 @@ import React, {Component} from 'react'; -import {Input, InputNumber, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; +import {Input, InputNumber, Select, Radio, Checkbox, Popconfirm, message, Modal, Tooltip} from 'antd'; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; @@ -320,9 +320,11 @@ export default class TPManswer extends Component { return
*

级别{index + 1}

+ this.delanswers(index)}> +
名称: diff --git a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js index 43194acb1..a50f00dd4 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js +++ b/public/react/src/modules/tpm/challengesnew/TPMchallengesnew.js @@ -572,6 +572,7 @@ export default class TPMchallengesnew extends Component {

服务配置

+ *
diff --git a/public/react/src/modules/tpm/challengesnew/TPMquestion.js b/public/react/src/modules/tpm/challengesnew/TPMquestion.js index 60840b81f..86451e3ec 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMquestion.js +++ b/public/react/src/modules/tpm/challengesnew/TPMquestion.js @@ -1,6 +1,6 @@ import React, {Component} from 'react'; -import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Tooltip} from 'antd'; +import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal,Tooltip,notification} from 'antd'; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; @@ -184,7 +184,7 @@ export default class TPMquestion extends Component { practice_url: newpractice_url, go_back_url: newgo_back_url, power:response.data.power, - questioMD:response.data.task_pass, + // questioMD:response.data.task_pass, answer:response.data.answer }) @@ -192,7 +192,7 @@ export default class TPMquestion extends Component { this.setState({ contentMdRefval:response.data.task_pass }) - this.contentMdRef.current.setValue(response.data.task_pass || '') + // this.contentMdRef.current.setValue(response.data.task_pass || '') if(response.data.chooses.length===0){ this.questionadd() } @@ -248,14 +248,14 @@ export default class TPMquestion extends Component { practice_url: newpractice_url, go_back_url: newgo_back_url, power:response.data.power, - questioMD:response.data.task_pass, + // questioMD:response.data.task_pass, }) this.setState({ contentMdRefval:response.data.task_pass }) - this.contentMdRef.current.setValue(response.data.task_pass || '') + // this.contentMdRef.current.setValue(response.data.task_pass || '') if(response.data.chooses.length===0){ this.questionadd() } @@ -400,12 +400,14 @@ export default class TPMquestion extends Component { } questionall=()=>{ - this.setState({ - activetype:"first", - newquestionaddtype:false, - editquestionaddtype:false, - questionaddtype:false - }) + // this.setState({ + // activetype:"first", + // newquestionaddtype:false, + // editquestionaddtype:false, + // questionaddtype:false + // }) + + window.location.href = '/shixuns/'+this.props.match.params.shixunId+'/challenges/'+this.props.match.params.checkpointId+'/editquestion'; } questionadd=()=>{ $('html').animate({ @@ -707,14 +709,22 @@ export default class TPMquestion extends Component { // $('html').animate({ // scrollTop: 10 // }, 200); - message.success("修改成功"); + $('html').animate({ + scrollTop: 10 + }, 200); + + notification.open({ + message: '提示', + description: + '修改成功,请点击右侧加号继续添加', + }); this.setState({ questionaddtype:false, newquestioMDvaluetype:false, newquestioMDvaluetypes:false, }) - setTimeout(window.location.href="/shixuns/"+this.props.match.params.shixunId+"/challenges/"+this.props.match.params.checkpointId+"/editquestion"+"/"+response.data.challenge_choose_id,1000) + // setTimeout(window.location.href="/shixuns/"+this.props.match.params.shixunId+"/challenges/"+this.props.match.params.checkpointId+"/editquestion"+"/"+response.data.challenge_choose_id,1000) // this.gochooseid() }).catch((error) => { console.log(error) @@ -761,12 +771,17 @@ export default class TPMquestion extends Component { newquestioMDvaluetypes:false, questionaddarray:questionaddarrays }) - // $('html').animate({ - // scrollTop: 10 - // }, 200); - message.success("新建成功"); + $('html').animate({ + scrollTop: 10 + }, 200); + + notification.open({ + message: '提示', + description: + '新建成功,请点击右侧加号继续添加', + }); // this.getanswer_subitlist() - this.gochooseid("/shixuns/"+this.props.match.params.shixunId+"/challenges/"+this.props.match.params.checkpointId+"/editquestion"+"/"+response.data.challenge_choose_id) + // this.gochooseid("/shixuns/"+this.props.match.params.shixunId+"/challenges/"+this.props.match.params.checkpointId+"/editquestion"+"/"+response.data.challenge_choose_id) }).catch((error) => { console.log(error) }); @@ -869,7 +884,8 @@ export default class TPMquestion extends Component { } gochooseid=(url)=>{ - window.location.href =url + window.location.href =url + // window.location.Reload(url) // this.props.history.replace( url ); // this.props.history.push( url ); // 返回 diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js index 7de8529d7..a037e62dc 100644 --- a/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js +++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionEdit.js @@ -24,7 +24,10 @@ export default class TpmQuestionEdit extends Component { render() { - console.log( this.props.questionlists) + console.log( this.props.neweditanswerRef) + console.log( this.props.neweditanswerRefval) + console.log( this.props.editanswersRef) + console.log( this.props.editanswersRefval) return (
@@ -34,7 +37,7 @@ export default class TpmQuestionEdit extends Component {
*
-
diff --git a/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js b/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js index 76a540e0c..58632b96b 100644 --- a/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js +++ b/public/react/src/modules/tpm/challengesnew/TpmQuestionNew.js @@ -24,7 +24,7 @@ export default class TpmQuestionNew extends Component { render() { - console.log( this.props.questionlists) + // console.log( this.props.questionlists) return (
diff --git a/public/react/src/modules/tpm/component/TPMRightSection.js b/public/react/src/modules/tpm/component/TPMRightSection.js index 28c49333a..8479acd76 100644 --- a/public/react/src/modules/tpm/component/TPMRightSection.js +++ b/public/react/src/modules/tpm/component/TPMRightSection.js @@ -130,7 +130,7 @@ class TPMRightSection extends Component { return(
- 69?1526971094 + 69?1526971094
@@ -161,7 +161,7 @@ class TPMRightSection extends Component {
- 实训 + 实训
diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js index b98e9a8ab..1935f2053 100644 --- a/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js +++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challenges.js @@ -314,7 +314,7 @@ class Challenges extends Component { */}
-

+

全部任务 {this.props.identity < 5 && ChallengesDataList&&ChallengesDataList.shixun_status=== 0 ? { + let {collaboratorList,user_name,school_name} = this.state; this.setState({ Searchadmin: [], + spinnings:true, }) // if (value === "") { // this.setState({ @@ -174,7 +177,9 @@ class Collaborators extends Component { school_name:school_name, }}).then((response) => { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { - + this.setState({ + spinnings:false + }) }else{ let newlist = response.data.users; for (var i = 0; i < newlist.length; i++) { @@ -182,7 +187,8 @@ class Collaborators extends Component { } this.setState({ Searchadmin: newlist, - collaboratorList: collaboratorList + collaboratorList: collaboratorList, + spinnings:false }) } @@ -404,7 +410,10 @@ class Collaborators extends Component { lineHeight: '30px', }; // console.log(collaboratorList) - return ( + + const antIcon = ; + + return (

this.showCollaboratorsvisible("cooperation")} className="edu-default-btn edu-greenback-btn fr mr20 height40" data-remote="true"> - + 添加合作者 + + 添加合作者 this.showCollaboratorsvisible("admin")} style={{display:this.props.identity===1?"block":"none"}} @@ -467,6 +476,7 @@ class Collaborators extends Component { visible={Collaboratorsvisibleadmin} closable={false} footer={null} + width={800} > {/**/} - 姓名: + 姓名或手机号: - {this.setState({user_name: e.target.value})}} - style={{ width: '130px'}} + {this.setState({user_name: e.target.value})}} + style={{ width: '215px'}} > 单位: - {this.setState({school_name: e.target.value})}} - style={{ width: '135px'}}> + {this.setState({school_name: e.target.value})}} + style={{ width: '215px'}} + > - this.onSearchadmin()} - style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}} + this.onSearchadmin()} + style={{ height: '30px', lineHeight: '30px', width: '70px'}} >搜索

- 姓名 - 职业 - 单位 + 姓名 + 职业 + 单位

- -
-
    - {Searchadmin.length === 0 ?
  • - 请试试搜索一下 -
  • : Searchadmin.map((item, key) => { - return ( -
  • - this.selectChangenickname(e, key)} - id={item.user_id}> - {item.nickname} - {item.identify} - {item.school_name} -
  • - ) - }) - - } -
-
+ +
+
    + {Searchadmin.length === 0 ?
  • + 请试试搜索一下 +
  • : Searchadmin.map((item, key) => { + return ( +
  • + this.selectChangenickname(e, key)} + id={item.user_id}> + {item.nickname} + {item.identify} + {item.school_name} +
  • + ) + }) + + } +
+
+
-
- 全选
diff --git a/public/react/src/modules/user/Interestpage.js b/public/react/src/modules/user/Interestpage.js index 77397fbc6..9c31abd1b 100644 --- a/public/react/src/modules/user/Interestpage.js +++ b/public/react/src/modules/user/Interestpage.js @@ -1,7 +1,5 @@ import React, {Component} from 'react'; - - -import {Button} from 'antd'; +import {Button,notification} from 'antd'; import {broadcastChannelPostMessage} from 'educoder'; import axios from 'axios'; import './common.css' @@ -26,12 +24,65 @@ class InterestpageComponent extends Component { this.state = { gouxuans: "", gouxuans2:0, - gouxuans3:[{id:1,name:"前端开发",bool:false,url:qdkf},{id:2,name:"后端开发",bool:false,url:hdkf},{id:3,name:"移动开发",bool:false,url:ydkf},{id:4,name:"数据库",bool:false,url:sjk},{id:5,name:"云计算和大数据",bool:false,url:ysj},{id:6,name:"运维与测试",bool:false,url:yunwei},{id:7,name:"人工智能",bool:false,url:rgzn},{id:8,name:"其他",bool:false,url:qita}], + gouxuans4:[], namezh:this.props.namezh, passmm:this.props.passmm, + homedatalist:undefined, + hometypepvisible: undefined, + } } + openNotification = (messge) => { + // type 1 成功提示绿色 2提醒颜色黄色 3错误提示红色 + notification.open({ + message: "提示", + description: messge, + onClick: () => { + console.log('Notification Clicked!'); + }, + }); + } + componentDidMount(){ + let{gouxuans4} =this.state; + let url=`/repertoires.json`; + axios.get(url).then((response)=> { + if(response){ + console.log("53"); + console.log(response.data); + for(var i=0;i{ + console.log(error) + }); + } componentWillReceiveProps(nextProps) { // console.log("46"); // console.log(nextProps); @@ -85,21 +136,21 @@ class InterestpageComponent extends Component { } Clickteacher2=(e)=>{ console.log(e); - let {gouxuans3} =this.state; - for (var i=0;i{ - console.log(this.state.login); - console.log(this.state.password); - var url = "/accounts/login.json"; - axios.post(url, { - login: this.props.login, - password: this.props.password, - }).then((response) => { - if (response === undefined) { - return - } - if (response.status === 200) { - // if (response.data.status === 402) { - // window.location.href = response.data.url; - // } else { - // broadcastChannelPostMessage('refreshPage') - // this.setState({ - // isRender: false - // }) - window.location.href = "/" - // } - } - - - }).catch((error) => { - console.log(error); - }) - } + // //跳转然后登入 + // Jumptotheinterestpage=()=>{ + // console.log(this.state.login); + // console.log(this.state.password); + // var url = "/accounts/login.json"; + // axios.post(url, { + // login: this.props.login, + // password: this.props.password, + // }).then((response) => { + // if (response === undefined) { + // return + // } + // if (response.status === 200) { + // // if (response.data.status === 402) { + // // window.location.href = response.data.url; + // // } else { + // // broadcastChannelPostMessage('refreshPage') + // // this.setState({ + // // isRender: false + // // }) + // window.location.href = "/" + // // } + // } + // + // + // }).catch((error) => { + // console.log(error); + // }) + // } render() { const { gouxuans, - gouxuans3 + gouxuans4, } = this.state // height: 346px; return ( -
+
请选择你的职业
@@ -188,12 +244,12 @@ class InterestpageComponent extends Component {
-
选择你可能感兴趣的内容
+
选择你可能感兴趣的内容
基于你关注的内容推荐
- {gouxuans3&&gouxuans3.map((item,key)=>{ + {gouxuans4&&gouxuans4.map((item,key)=>{ return(
this.Clickteacher2(item.id)}> {item.bool===true?:
} @@ -203,9 +259,8 @@ class InterestpageComponent extends Component { ) })}
- - -
+ +
); diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 18759f022..35fb819b0 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -730,12 +730,23 @@ class LoginRegisterComponent extends Component { {/* style={{height: '0', width: '0', border: 'none', display: "none"}}/>*/} {/**/} + this.Showandhide(key)}> }> diff --git a/public/react/src/modules/user/account/AccountBasicEdit.js b/public/react/src/modules/user/account/AccountBasicEdit.js index 7463fa632..f7e58b8de 100644 --- a/public/react/src/modules/user/account/AccountBasicEdit.js +++ b/public/react/src/modules/user/account/AccountBasicEdit.js @@ -101,7 +101,11 @@ class AccountBasic extends Component { this.props.form.validateFieldsAndScroll((err, values) => { console.log(values); let {basicInfo}=this.props; - if(!err){ + // TODO 为什么modal里的form影响到这里的了 + if (err) { + delete err.depart + } + if(!err || Object.keys(err).length == 0){ let url=`/users/accounts/${basicInfo.id}.json` axios.put((url),{ nickname:values.nickname, @@ -117,7 +121,9 @@ class AccountBasic extends Component { department_id:this.state.department_id }).then((result)=>{ if(result){ + this.props.showNotification('保存成功') this.props.getBasicInfo(); + this.props.history.push('/account/profile') } }).catch((error)=>{ console.log(error); diff --git a/public/react/src/modules/user/common.css b/public/react/src/modules/user/common.css index 949fd8def..669b78fab 100644 --- a/public/react/src/modules/user/common.css +++ b/public/react/src/modules/user/common.css @@ -58,7 +58,6 @@ display: flex; flex-flow: row wrap; align-content:stretch; - margin-top: 10px; } .ysldivhomediv{ width: 101px; @@ -90,14 +89,14 @@ .ysldivhomedivtxt{ width:101px; height:27px; - margin-bottom: 10px; + margin-bottom: 5px; font-size: 14px; text-align: center; } .ysldivhomedivimg{ - width: 101px; - height: 101px; + width: 90px; + height: 90px; } .ysllogin_register_contents{ display: flex; @@ -108,7 +107,7 @@ } .ysllogin_section { width:800px; - height: 620px; + height: 600px; display: flex; align-items: center; flex-direction: column; @@ -131,8 +130,8 @@ .yslbutton{ width:255px; height: 36px; - margin-top:30px; - margin-bottom: 19px; + margin-top: 20px; + } .mt22{ margin-top: 22px;