hjm 5 years ago
commit 2e2eb52161

@ -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.

@ -553,19 +553,28 @@ class Coursesleftnav extends Component{
// notification.open({
// message: "删除成功",
// });
window.location.href = url;
// this.props.history.replace(url);
window.location.href = url;
}
deletenavchilds=(url)=>{
deletenavchilds=(url,mainurl)=>{
axios.delete(url).then((result)=>{
if(result.data.status===0){
this.updatadeleteSecondary(result.data.right_url)
if(mainurl===undefined){
this.updatadeleteSecondary(result.data.right_url)
}else{
this.updatadeleteSecondary(mainurl)
}
}
}).catch((error)=>{
console.log(error)
})
}
deleteSecondary=(e,type,id)=>{
deleteSecondary=(e,type,id,mainurl)=>{
e.stopPropagation();//阻止冒泡
if(type===1){
let url="/course_second_categories/"+id+".json"
@ -593,7 +602,7 @@ class Coursesleftnav extends Component{
ModalsType:true,
Modalstopval:"该目录下的内容将被移动到父目录,",
ModalsBottomval:"是否确认删除?",
ModalSave:()=>this.deletenavchilds(url),
ModalSave:()=>this.deletenavchilds(url,mainurl),
})
}
@ -726,7 +735,7 @@ class Coursesleftnav extends Component{
{item.type==="course_group"?<div onClick={e=>this.deleteSecondary(e,2,iem.category_id)}>删除</div>:""}
{/*讨论区*/}
{item.type==="board"?<div onClick={e=>this.Navmodalnames(e,7,"editSecondname",iem.category_id,iem.category_name)}>重命名</div>:""}
{item.type==="board"?<div onClick={e=>this.deleteSecondary(e,3,iem.category_id)}>删除</div>:""}
{item.type==="board"?<div onClick={e=>this.deleteSecondary(e,3,iem.category_id,item.category_url)}>删除</div>:""}
</div>)
}

@ -40,7 +40,8 @@ class coursesHomeCard extends Component{
className="mt80 mb25"/>
<p className="font-14 color-white">非成员不能访问</p>
</div>
<a href={item.first_category_url} className="square-img" >
{/*<a href={item.first_category_url} className="square-img" >*/}
<a href={`/courses/${item.id}/students`} className="square-img" >
{/*target="_blank"*/}
{
item.is_public===1&&item.id===1309?

@ -211,15 +211,15 @@ class ShixunModal extends Component{
<a onClick={()=>this.changeTag("all")} className={ type==="all" ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>全部</a>
</li>
{
shixunmodallist && shixunmodallist.tags.map((item,key)=>{
return(
<li className="fl mr5 mt5" key={key}>
<a onClick={()=>this.changeTag(item.tag_id)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>
</li>
)
})
}
{/*{*/}
{/*shixunmodallist && shixunmodallist.tags.map((item,key)=>{*/}
{/*return(*/}
{/*<li className="fl mr5 mt5" key={key}>*/}
{/*<a onClick={()=>this.changeTag(item.tag_id)} className={ parseInt(type) === parseInt(item.tag_id) ? "active edu-filter-cir-grey font-12":"edu-filter-cir-grey font-12"}>{item.tag_name}</a>*/}
{/*</li>*/}
{/*)*/}
{/*})*/}
{/*}*/}
</div>
<div className="clearfix mb10" id="shixun_search_form_div" style={{height:"30px"}}>
@ -251,9 +251,9 @@ class ShixunModal extends Component{
}
<ul className="clearfix greybackHead edu-txt-center">
<li className="fl with40 paddingleft22" >实训名称</li>
<li className="fl with30 edu-txt-left">使用院校</li>
<li className="fl with10">使用人数</li>
<li className="fl with10">评价等级</li>
<li className="fl with30 edu-txt-left">院校</li>
<li className="fl with10">学习人数</li>
<li className="fl with10">难度</li>
<li className="fl with10"></li>
</ul>
@ -292,9 +292,9 @@ class ShixunModal extends Component{
<span style={{"textAlign":"left","color":"#05101A"}} className="task-hide color-grey-name">{item.shixun_name}</span>
</Checkbox>
</li>
<li className="fl with30 edu-txt-left task-hide paddingl5">{item.school_users}</li>
<li className="fl with30 edu-txt-left task-hide paddingl5">{item.school}</li>
<li className="fl with10 paddingl10">{item.myshixuns_count}</li>
<li className="fl with10 color-orange-tip paddingl10">{item.preference}</li>
<li className="fl with10 color-orange-tip paddingl10">{item.level}</li>
<Tooltip title="新窗口查看详情">
<li className="fl with10"><a className="color-blue" href={"/shixuns/"+item.identifier+"/challenges"} target="_blank">详情</a></li>
</Tooltip>

@ -1,134 +1,138 @@
.taskResultLayer {
color: #666666;
z-index: 99999999999999;
width: 100%;
height: 100%;
position: fixed;
background:rgba(0,0,0,0.8);
top: 0px;
overflow: hidden;
}
.taskResultLayer .closeIcon{
position: absolute;
right: 100px;
top: 46px;
font-size: 28px;
z-index: 999999;
color: rgb(255,255,255,0.7);
cursor: pointer;
}
.taskResultLayer .closeIcon:hover {
color: #4CACFF;
}
.taskResultLayer .expGold {
color: #b27919 ;
}
.taskResultLayer .rateLabel {
color: #fff ;
font-size: 14px;
}
.taskResultLayer .rc-rate-star {
font-size: 24px;
color: rgb(192, 192, 192);
}
.taskResultLayer .rc-rate-star:nth-child(5) {
margin-right: 0px;
}
/* ImageLayer ----------------- Start */
.passContent{
justify-content: center;
align-items: center;
display: -webkit-flex;
height: 100%;
text-align: center;
}
.passImg{
max-width: 86%;
max-height: 100%;
}
/* ImageLayer ----------------- End */
.passTaskContent{
width: 652px;
height:100%;
margin:0px auto;
margin-top: 4%;
}
.passTaskImg{
position: absolute;
z-index: 2;
user-select: none;
}
.winpPerson{
position: absolute;
width: 100%;
z-index: 3;
color: #D1A448;
text-align: center;
margin-top:304px;
font-size: 18px;
}
.winPanel{
position: absolute;
width: 308px;
z-index: 5;
height: 356px;
border-radius: 10px;
margin:0px auto;
top:435px;
left: 50%;
margin-left: -154px;
text-align: center;
}
.inline{
display: inline-block;
width: auto;
line-height: 26px;
font-size: 16px;
}
.inline.exp {
margin-left: 18px;
}
.inline img{
margin-right: 8px;
}
.goldring{
margin-right: 8px;
width: 17px;
height: 17px;
border-radius: 50%;
background-color: #FFD633;
display: block;
float: left;
margin-top: 5px;
}
.passNext{
width:120px;
height:30px;
line-height:30px;
border-radius: 2px;
display: block;
background-color:#CCC;
color:#fff!important;
margin: 0px auto;
}
.passed{
width:120px;
height:30px;
line-height:30px;
border-radius: 2px;
display: block;
color:#fff!important;
margin: 0px auto;
margin-top: 12px;
background-color: #CCCCCC;
}
.passed.stared {
background-color:#4CACFF;
opacity: 0.8;
}
.passed.stared:hover {
opacity: 1;
.taskResultLayer {
color: #666666;
z-index: 99999999999999;
width: 100%;
height: 100%;
position: fixed;
background:rgba(0,0,0,0.8);
top: 0px;
overflow: hidden;
}
.taskResultLayer .closeIcon{
position: absolute;
right: 100px;
top: 46px;
font-size: 28px;
z-index: 999999;
color: rgb(255,255,255,0.7);
cursor: pointer;
}
.taskResultLayer .closeIcon:hover {
color: #4CACFF;
}
.taskResultLayer .expGold {
color: #b27919 ;
}
.taskResultLayer .rateLabel {
color: #fff ;
font-size: 14px;
}
.taskResultLayer .rc-rate-star {
font-size: 24px;
color: rgb(192, 192, 192);
}
.taskResultLayer .rc-rate-star:nth-child(5) {
margin-right: 0px;
}
/* ImageLayer ----------------- Start */
.passContent{
justify-content: center;
align-items: center;
display: -webkit-flex;
height: 100%;
text-align: center;
}
.passImg{
max-width: 86%;
max-height: 100%;
}
/* ImageLayer ----------------- End */
.passTaskContent{
width: 652px;
height:100%;
margin:0px auto;
margin-top: 4%;
}
.passTaskImg{
position: absolute;
z-index: 2;
user-select: none;
}
.winpPerson{
position: absolute;
width: 100%;
z-index: 3;
color: #D1A448;
text-align: center;
margin-top:304px;
font-size: 18px;
}
.winPanel{
position: absolute;
width: 308px;
z-index: 5;
height: 356px;
border-radius: 10px;
margin:0px auto;
top:435px;
left: 50%;
margin-left: -154px;
text-align: center;
}
.inline{
display: inline-block;
width: auto;
line-height: 26px;
font-size: 16px;
}
.inline.exp {
margin-left: 18px;
}
/*.inline img{*/
/*margin-right: 8px;*/
/*}*/
.goldring{
margin-right: 8px;
width: 17px;
height: 17px;
border-radius: 50%;
background-color: #FFD633;
display: block;
float: left;
margin-top: 5px;
}
.passNext{
width:120px;
height:30px;
line-height:30px;
border-radius: 2px;
display: block;
background-color:#CCC;
color:#fff!important;
margin: 0px auto;
}
.passed{
width:120px;
height:30px;
line-height:30px;
border-radius: 2px;
display: block;
color:#fff!important;
margin: 0px auto;
margin-top: 12px;
background-color: #CCCCCC;
}
.passed.stared {
background-color:#4CACFF;
opacity: 0.8;
}
.passed.stared:hover {
opacity: 1;
}
.vertical4{
vertical-align: -4px;
}

@ -476,7 +476,7 @@ class DetailCardsEditAndEdit extends Component{
footer={null}
width="840px"
destroyOnClose={true}
>Z
>
<Spin spinning={hometypepvisible} size="large" style={{marginTop:'15%'}}>
<div className="newupload_conbox">
<div className="clearfix mb20 shixun_work_div newshixun_tab_div cdefault" style={{"marginRight":"4px"}} id="shixun_tab_div">

@ -37,7 +37,16 @@ class NewFooter extends Component {
</ul>
</div>
<div>
<p className="footer_con-p inline lineh-30 font-14"><span className="font-18 fl">©</span>&nbsp;2019&nbsp;EduCoder<span className="ml15 mr15">ICP17009477</span><a href="https://team.trustie.net" style={{"color":"#888"}} target="_blank">Trustie</a>&nbsp;&nbsp;&nbsp;&amp;&nbsp;&nbsp;&nbsp;IntelliDE inside.</p>
<p className="footer_con-p inline lineh-30 font-14">
<span className="font-18 fl">©</span>&nbsp;2019&nbsp;EduCoder
<a style={{"color":"#888"}} target="_blank" href="http://beian.miit.gov.cn/" className="ml15 mr15">湘ICP备17009477号</a>
<a style={{"color":"#888"}} target="_blank" href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode=43019002000962" className="mr15">
<img className="vertical4" src={require('./beian.png')}/>湘公网安备43019002000962号
</a>
<a href="https://team.trustie.net" style={{"color":"#888"}}
target="_blank">Trustie</a>&nbsp;&nbsp;&nbsp;&amp;&nbsp;&nbsp;&nbsp;IntelliDE inside. <span
className="mr15">版权所有 湖南智擎科技有限公司</span>
</p>
</div>
<div className="cl"></div>
</div>

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

@ -1,338 +1,338 @@
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 = '您上次有已保存的数据,是否<a style="cursor: pointer;" class="link-color-blue" onclick="md_rec_data(\'content\',\''+ mdu + '\',\'' + id + '\')">恢复</a> ? / <a style="cursor: pointer;" class="link-color-blue" onclick="md_clear_data(\'content\',\''+ mdu + '\',\'' + id + '\')">不恢复</a>';
$("#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: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>",
nullBtton: "<a type=\"nullBtton\" class='pr' title='增加填空'><div class='border-left'><span></span></div><span class='fillTip'>点击插入填空项</span><i class=\"iconfont icon-edit font-16\"></i></a>",
},
//这个配置在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 (
<React.Fragment>
<div className={`df ${className}`} >
{/* padding10-20 */}
<div className="edu-back-greyf5 radius4" id={`mdEditor_${mdID}`} style={{..._style}}>
<textarea style={{display: 'none'}} id="evaluate_script_show" name="content"></textarea>
<div className="CodeMirror cm-s-defualt">
</div>
</div>
</div>
<div className={"fr rememberTip"}>
{noStorage == true ? ' ' : <p id={`e_tips_mdEditor_${mdID}`} className="edu-txt-right color-grey-cd font-12"> </p>}
{/* {noStorage == true ? ' ' : <p id={`e_tips_mdEditor_${mdID}`} className="edu-txt-right color-grey-cd font-12"> </p>} */}
</div>
</React.Fragment>
)
}
}
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 = '您上次有已保存的数据,是否<a style="cursor: pointer;" class="link-color-blue" onclick="md_rec_data(\'content\',\''+ mdu + '\',\'' + id + '\')">恢复</a> ? / <a style="cursor: pointer;" class="link-color-blue" onclick="md_clear_data(\'content\',\''+ mdu + '\',\'' + id + '\')">不恢复</a>';
$("#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: "<a type=\"inline\" class=\"latex\" ><div class='zbg'></div></a>",
testIcon1: "<a type=\"latex\" class=\"latex\" ><div class='zbg_latex'></div></a>",
nullBtton: "<a type=\"nullBtton\" class='pr' title='增加填空'><div class='border-left'><span></span></div><span class='fillTip'>点击插入填空项</span><i class=\"iconfont icon-edit font-16\"></i></a>",
},
//这个配置在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 (
<React.Fragment>
<div className={`df ${className}`} >
{/* padding10-20 */}
<div className="edu-back-greyf5 radius4" id={`mdEditor_${mdID}`} style={{..._style}}>
<textarea style={{display: 'none'}} id={`mdEditors_${mdID}`} name="content"></textarea>
<div className="CodeMirror cm-s-defualt">
</div>
</div>
</div>
<div className={"fr rememberTip"}>
{noStorage == true ? ' ' : <p id={`e_tips_mdEditor_${mdID}`} className="edu-txt-right color-grey-cd font-12"> </p>}
{/* {noStorage == true ? ' ' : <p id={`e_tips_mdEditor_${mdID}`} className="edu-txt-right color-grey-cd font-12"> </p>} */}
</div>
</React.Fragment>
)
}
}

@ -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 );
// 返回

@ -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 (
<div>
@ -34,7 +37,7 @@ export default class TpmQuestionEdit extends Component {
<div className="df">
<span className="mr30 color-orange pt10">*</span>
<div className="flex1 mr20">
<TPMMDEditor ref={this.props.neweditanswerRef} placeholder="请输入选择题的题干内容" mdID={'newquestioMDid'} refreshTimeout={1500}
<TPMMDEditor ref={this.props.neweditanswerRef} placeholder="请输入选择题的题干内容" mdID={'editquestioMDid'} refreshTimeout={1500}
watch={true} className="courseMessageMD" initValue={this.props.neweditanswerRefval}></TPMMDEditor>
</div>

@ -24,7 +24,7 @@ export default class TpmQuestionNew extends Component {
render() {
console.log( this.props.questionlists)
// console.log( this.props.questionlists)
return (
<div>

@ -1,4 +1,9 @@
.height40 {
height: 30px;
line-height: 30px;
.height40 {
height: 30px;
line-height: 30px;
}
.line27{
line-height: 27px;
vertical-align: 1px;
}

@ -2,7 +2,7 @@ import React, { Component } from 'react';
import { Redirect } from 'react-router';
import {Modal, Button, Radio, Input, Checkbox,message} from 'antd';
import {Modal, Button, Radio, Input, Checkbox,message,Spin, Icon} from 'antd';
import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom";
@ -44,7 +44,8 @@ class Collaborators extends Component {
collaboratorListsum:10,
collaboratorListsumtype:true,
user_name:undefined,
school_name:undefined
school_name:undefined,
spinnings:false
}
}
componentDidMount() {
@ -155,9 +156,11 @@ class Collaborators extends Component {
})
}
onSearchadmin = (value) => {
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 = <Icon type="loading" style={{ fontSize: 24 }} spin />;
return (
<React.Fragment>
<p className="clearfix mt30"
style={{display:this.props.identity<5?"block":"none"}}
@ -412,7 +421,7 @@ class Collaborators extends Component {
<a onClick={() => this.showCollaboratorsvisible("cooperation")}
className="edu-default-btn edu-greenback-btn fr mr20 height40"
data-remote="true">
+ 添加合作
<span className={"line27"}>+ </span>
</a>
<a onClick={() => 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}
>
{/*<Search*/}
{/*placeholder="输入用户的姓名、昵称、邮箱进行搜索"*/}
@ -475,53 +485,53 @@ class Collaborators extends Component {
{/*onInput={this.onSearchadmins}*/}
{/*style={{width: '100%'}}*/}
{/*/>*/}
<span className="mr10">姓名:</span>
<span className="mr10">姓名或手机号:</span>
<Input allowClear placeholder="请输入真实姓名" value={user_name} onInput={(e) => {this.setState({user_name: e.target.value})}}
style={{ width: '130px'}}
<Input placeholder="请输入姓名或手机号码搜索" value={user_name} onInput={(e) => {this.setState({user_name: e.target.value})}}
style={{ width: '215px'}}
></Input>
<span className="label ml10 " style={{ minWidth: '36px' }}>单位:</span>
<Input allowClear placeholder="请输入单位名称" className="ml10" value={school_name} onInput={(e) => {this.setState({school_name: e.target.value})}}
style={{ width: '135px'}}>
<Input placeholder="请输入单位名称" className="ml10" value={school_name} onInput={(e) => {this.setState({school_name: e.target.value})}}
style={{ width: '215px'}}
>
</Input>
<a className="task-btn task-btn-orange" onClick={() => this.onSearchadmin()}
style={{ height: '30px', lineHeight: '30px', marginLeft: '10px', width: '70px'}}
<a className="task-btn task-btn-orange ml20" onClick={() => this.onSearchadmin()}
style={{ height: '30px', lineHeight: '30px', width: '70px'}}
>搜索</a>
<p className="clearfix pl35 mt20">
<span className="fl edu-txt-w80 task-hide font-bd ml10 edu-txt-left">姓名</span>
<span className="fl edu-txt-w80 task-hide font-bd">职业</span>
<span className="fl edu-txt-w180 task-hide font-bd ml50">单位</span>
<span className="fl edu-txt-w100 task-hide font-bd ml10 edu-txt-left">姓名</span>
<span className="fl edu-txt-w100 task-hide font-bd">职业</span>
<span className="fl edu-txt-w180 task-hide font-bd ml80">单位</span>
</p>
<div className="mt5" style={{background: '#f7f9fd'}}>
<div className="clearfix">
<ul className="upload_select_box fl" id="search_not_teachers_list" onScroll={this.contentViewScrolledit}>
{Searchadmin.length === 0 ? <li style={{textAlign: 'center'}}>
<span>请试试搜索一下</span>
</li> : Searchadmin.map((item, key) => {
return (
<li key={key} style={{display: item.identify === "专业人士" ? "none" : "block"}}>
<Checkbox className="fl mr20" checked={item.checked}
onChange={(e) => this.selectChangenickname(e, key)}
id={item.user_id}></Checkbox>
<a className="task-hide color-grey3 fl span1 edu-txt-w80 edu-txt-left">{item.nickname}</a>
<span className="task-hide fl color-grey edu-txt-w80 span2">{item.identify}</span>
<span
title={item.school_name}
style={{width: '150px'}}
className="span3 color-grey fl edu-txt-w260 task-hide ml50 task-hide" >{item.school_name}</span>
</li>
)
})
}
</ul>
</div>
<Spin indicator={antIcon} spinning={this.state.spinnings}>
<div className="clearfix">
<ul className="upload_select_box fl" id="search_not_teachers_list" onScroll={this.contentViewScrolledit}>
{Searchadmin.length === 0 ? <li style={{textAlign: 'center'}}>
<span>请试试搜索一下</span>
</li> : Searchadmin.map((item, key) => {
return (
<li key={key} style={{display: item.identify === "专业人士" ? "none" : "block"}}>
<Checkbox className="fl mr20" checked={item.checked}
onChange={(e) => this.selectChangenickname(e, key)}
id={item.user_id}></Checkbox>
<a className="task-hide color-grey3 fl span1 edu-txt-w80 edu-txt-left">{item.nickname}</a>
<span className="task-hide fl color-grey edu-txt-w80 span2">{item.identify}</span>
<span
title={item.school_name}
style={{width: '150px'}}
className="span3 color-grey fl edu-txt-w260 task-hide ml50 task-hide" >{item.school_name}</span>
</li>
)
})
}
</ul>
</div>
</Spin>
</div>
<div className="mt10 clearfix">
<span className="fl mr15">
<Checkbox className="fl" checked={allChangechecked} onChange={this.allChange}>全选</Checkbox>
<div className="fl" style={{height: '27px'}}>

@ -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<response.data.repertoires.length;i++){
var qdkfys="";
if(response.data.repertoires[i].id===1){
qdkfys=qdkf;
}if(response.data.repertoires[i].id===2){
qdkfys=hdkf;
}if(response.data.repertoires[i].id===3){
qdkfys=ydkf;
}if(response.data.repertoires[i].id===4){
qdkfys=sjk;
}if(response.data.repertoires[i].id===5){
qdkfys=ysj;
}if(response.data.repertoires[i].id===6){
qdkfys=yunwei;
}if(response.data.repertoires[i].id===8){
qdkfys=qita;
}if(response.data.repertoires[i].id===9){
qdkfys=rgzn;
}
var datas={id:response.data.repertoires[i].id,name:response.data.repertoires[i].name,bool:false,url:qdkfys};
gouxuans4.push(datas);
this.setState({
gouxuans4:gouxuans4,
})
}
console.log("75");
console.log(gouxuans4);
}
}).catch((error)=>{
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<gouxuans3.length;i++){
if(gouxuans3[i].id === e){
let {gouxuans4} =this.state;
for (var i=0;i<gouxuans4.length;i++){
if(gouxuans4[i].id === e){
console.log("51");
console.log(e);
if(gouxuans3[i].bool === true){
gouxuans3[i].bool=false;
if(gouxuans4[i].bool === true){
gouxuans4[i].bool=false;
}else{
gouxuans3[i].bool=true;
gouxuans4[i].bool=true;
}
}
}
console.log(gouxuans3);
console.log(gouxuans4);
this.setState({
gouxuans3:gouxuans3,
gouxuans4:gouxuans4,
})
}
@ -107,15 +158,20 @@ class InterestpageComponent extends Component {
//兴趣页面点击
Interestcompletionpage(){
if(this.state.gouxuans.length === 0){
this.props.showNotification("请选择您的职业");
this.openNotification("请选择您的职业");
return
}
var ints=[];
for (var i =0;i<this.state.gouxuans.length;i++) {
if(this.state.gouxuans[i].bool === true){
ints.push(this.state.gouxuans[i].id);
for (var i =0;i<this.state.gouxuans4.length;i++) {
if(this.state.gouxuans4[i].bool === true){
ints.push(this.state.gouxuans4[i].id);
}
}
if(ints.length<1){
this.openNotification("内容是最少得选一个");
return
}
var url = "/users/interest.json";
axios.post(url, {
identity:this.state.gouxuans,
@ -133,39 +189,39 @@ class InterestpageComponent extends Component {
})
}
//跳转然后登入
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);
})
}
// //跳转然后登入
// 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 (
@ -193,7 +249,7 @@ class InterestpageComponent extends Component {
<div ><span className="yslspans3">基于你关注的内容推荐</span></div>
<div className="ysldivhome2">
{gouxuans3&&gouxuans3.map((item,key)=>{
{gouxuans4&&gouxuans4.map((item,key)=>{
return(
<div className={item.id<5?"ysldivhomediv1":"ysldivhomediv2"} onClick={()=>this.Clickteacher2(item.id)}>
{item.bool===true?<img src={gouxuan} className="yslgouxuanimg"/>:<div className="yslgouxuanimg2"></div>}

Loading…
Cancel
Save