|
@@ -29,11 +29,10 @@ var yzToolbar = function(){
|
|
icon: 'fa-list-alt'
|
|
icon: 'fa-list-alt'
|
|
}];
|
|
}];
|
|
|
|
|
|
-
|
|
|
|
// 问题编号
|
|
// 问题编号
|
|
this.subjectNum = null;
|
|
this.subjectNum = null;
|
|
- // 需要插入组件的id
|
|
|
|
- this.sujectDomId = null;
|
|
|
|
|
|
+ // 获取当前需要插入的Dom
|
|
|
|
+ this.currentContent = null;
|
|
|
|
|
|
};
|
|
};
|
|
|
|
|
|
@@ -52,7 +51,7 @@ yzToolbar.prototype.toolbarContent = function () {
|
|
ulDom.appendChild(liDom);
|
|
ulDom.appendChild(liDom);
|
|
if( item.name == 'component' ){
|
|
if( item.name == 'component' ){
|
|
liDom.addEventListener('click', () => {
|
|
liDom.addEventListener('click', () => {
|
|
- this.addComponent();
|
|
|
|
|
|
+ this.addComponent(liDom);
|
|
},!0);
|
|
},!0);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
@@ -62,9 +61,9 @@ yzToolbar.prototype.toolbarContent = function () {
|
|
return toolDom;
|
|
return toolDom;
|
|
};
|
|
};
|
|
|
|
|
|
-yzToolbar.prototype.setSubjectTitle = function(pNum,id) {
|
|
|
|
|
|
+yzToolbar.prototype.setSubjectTitle = function(pNum,content) {
|
|
this.subjectNum = pNum;
|
|
this.subjectNum = pNum;
|
|
- this.sujectDomId = id;
|
|
|
|
|
|
+ this.currentContent = content;
|
|
this.menu.forEach( (item) => {
|
|
this.menu.forEach( (item) => {
|
|
if( item.name == 'subject' ){
|
|
if( item.name == 'subject' ){
|
|
item.title = '正在编辑' + pNum;
|
|
item.title = '正在编辑' + pNum;
|
|
@@ -75,13 +74,12 @@ yzToolbar.prototype.setSubjectTitle = function(pNum,id) {
|
|
});
|
|
});
|
|
};
|
|
};
|
|
|
|
|
|
-yzToolbar.prototype.addComponent = function() {
|
|
|
|
|
|
+yzToolbar.prototype.addComponent = function(dom) {
|
|
if(this.subjectNum == 'none' || !this.subjectNum){
|
|
if(this.subjectNum == 'none' || !this.subjectNum){
|
|
alert('请选择主观题');return;
|
|
alert('请选择主观题');return;
|
|
}
|
|
}
|
|
- let box = new boxContent();
|
|
|
|
- box.renderToDom();
|
|
|
|
- $('#' + this.sujectDomId + '_content').append(box.vdom);
|
|
|
|
|
|
+ console.log(this.currentContent);
|
|
|
|
+ this.currentContent.addComponent(1);
|
|
};
|
|
};
|
|
|
|
|
|
export default yzToolbar;
|
|
export default yzToolbar;
|