|
@@ -21,7 +21,6 @@ class TemplateItem extends React.Component {
|
|
|
this.content = null;
|
|
|
this.isAnimate = false;
|
|
|
this.state = {
|
|
|
- isOpen: false,
|
|
|
delHover: false,
|
|
|
editHover: false,
|
|
|
checkBox:false,
|
|
@@ -39,13 +38,6 @@ class TemplateItem extends React.Component {
|
|
|
for(var a in previewJson){
|
|
|
DesItems.push(<DesItem preview={preview} des={a} />);
|
|
|
}
|
|
|
- // if(previewJson){
|
|
|
- // console.log(previewJson,1000)
|
|
|
- // previewJson.forEach((v, i) => {
|
|
|
- // DesItems.push(<DesItem des={v} key={i} />);
|
|
|
- // this.title += `${v}\n`;
|
|
|
- // });
|
|
|
- // }
|
|
|
return DesItems;
|
|
|
}
|
|
|
|
|
@@ -53,39 +45,11 @@ class TemplateItem extends React.Component {
|
|
|
return this.state.isOpen ? arrow_down_icon : arrow_icon;
|
|
|
}
|
|
|
|
|
|
- getContentStyle() {
|
|
|
- return {
|
|
|
- display: this.state.isOpen ? 'block' : 'none'
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
handleContentClick(e,sex) {
|
|
|
e.stopPropagation();
|
|
|
this.props.handleContentClick(this.props.id,sex);
|
|
|
}
|
|
|
|
|
|
- // handleTitleClick() {
|
|
|
- // if (this.isAnimate) {
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // this.isAnimate = true;
|
|
|
- // if (this.state.isOpen) {
|
|
|
- // $(this.content).slideUp(() => {
|
|
|
- // this.isAnimate = false;
|
|
|
- // this.setState({
|
|
|
- // isOpen: false
|
|
|
- // });
|
|
|
- // });
|
|
|
- // // console.log($(this.content).parent().siblings().find('.content'))
|
|
|
- // return;
|
|
|
- // }
|
|
|
- // $(this.content).slideDown(() => {
|
|
|
- // this.isAnimate = false;
|
|
|
- // this.setState({
|
|
|
- // isOpen: true
|
|
|
- // });
|
|
|
- // });
|
|
|
- // }
|
|
|
handleCheckboxClick(e,id){ //点击复选框
|
|
|
e.stopPropagation();
|
|
|
let tempCheck = this.state.checkBox;
|
|
@@ -159,11 +123,32 @@ class TemplateItem extends React.Component {
|
|
|
}
|
|
|
|
|
|
handleTitleClick(e) {
|
|
|
- $(e.target).next().slideToggle()
|
|
|
- let tmpDomLis = $(e.target).parent().siblings()
|
|
|
- for(let i = 0;i < tmpDomLis.length;i++){
|
|
|
- let tmpDiv = tmpDomLis[i]
|
|
|
- $(tmpDiv).children().eq(1).slideUp()
|
|
|
+ if($(e.target).attr('src')){
|
|
|
+ let tmpDomLis = $(e.target).parent().parent().siblings()
|
|
|
+ $(e.target).parent().next().slideToggle()
|
|
|
+ if($(e.target).parent().next().height() == 0){
|
|
|
+ $(e.target).attr('src',arrow_down_icon)
|
|
|
+ }else{
|
|
|
+ $(e.target).attr('src',arrow_icon)
|
|
|
+ }
|
|
|
+ for(let i = 0;i < tmpDomLis.length;i++){
|
|
|
+ let tmpDiv = tmpDomLis[i]
|
|
|
+ $(tmpDiv).children().eq(1).slideUp()
|
|
|
+ $(tmpDiv).children().eq(0).children('img').eq(0).attr('src',arrow_icon)
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ let tmpDomLis = $(e.target).parent().siblings()
|
|
|
+ $(e.target).next().slideToggle()
|
|
|
+ if($(e.target).next().height() == 0){
|
|
|
+ $(e.target).children('img').eq(0).attr('src',arrow_down_icon)
|
|
|
+ }else{
|
|
|
+ $(e.target).children('img').eq(0).attr('src',arrow_icon)
|
|
|
+ }
|
|
|
+ for(let i = 0;i < tmpDomLis.length;i++){
|
|
|
+ let tmpDiv = tmpDomLis[i]
|
|
|
+ $(tmpDiv).children().eq(1).slideUp()
|
|
|
+ $(tmpDiv).children().eq(0).children('img').eq(0).attr('src',arrow_icon)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -192,7 +177,7 @@ class TemplateItem extends React.Component {
|
|
|
>
|
|
|
{name+sexStr}
|
|
|
</span>
|
|
|
- <img className={style.arrow} src={this.getArrow()} />
|
|
|
+ <img className={style.arrow} src={arrow_icon} />
|
|
|
<img title={'删除模板'}
|
|
|
className={style.del}
|
|
|
style={{display:allCheckShow?'none':'block'}}
|