Ver código fonte

模板文件切换 tab

zhangxc 5 anos atrás
pai
commit
fcb09515c8

+ 0 - 1
src/components/Advice/Textarea/index.jsx

@@ -44,7 +44,6 @@ class Textarea extends Component {
   }
   componentDidMount(){
     const {value} = this.props;
-    console.log("aaaavalue",value)
     if(value && value.trim()){
       this.$dom.current.innerHTML = value
       // this.$dom.current.focus()

+ 19 - 4
src/components/TemplateItems/index.jsx

@@ -23,7 +23,8 @@ class TemplateItems extends React.Component {
             val:'',
             height:'',
             showTipContent:false,
-            hasSearch: false
+            hasSearch: false,
+            showIndex: -1
         }
         this.$cont = React.createRef();
         this.$conts = React.createRef();
@@ -66,9 +67,10 @@ class TemplateItems extends React.Component {
             showTipContent:!show
         })
     }
-    floderSlide(e,item){
+    floderSlide(e,item,i){
         e.stopPropagation()
         const {floderSlide} = this.props
+        const {showIndex} = this.state
         if(!item.templateInfo){
             return;
         }
@@ -79,6 +81,17 @@ class TemplateItems extends React.Component {
             $(tmpD).children().eq(1).slideUp()
         }
         floderSlide(item.id)
+        if(showIndex === i) {
+            this.setState({
+                showIndex: -1
+            })
+        } else {
+            this.setState({
+                showIndex: i
+            })
+        }
+        
+
     }
     floderAction(e,id){
         e&&e.stopPropagation()
@@ -122,12 +135,14 @@ class TemplateItems extends React.Component {
     genAdminItems(items,flg) {
         const Floder=[],Items = [];
         const {admin,checkItemsAdmin} = this.props;
+        const {showIndex}=this.state
         for(let i = 0;i < items.length;i++){
             let tmpItm = items[i]
             Floder.push(
                 <div className={style.floderPart}>
-                    <div className={style.floderPartFl} onClick={(e)=>this.floderSlide(e,tmpItm)}>
-                        <img src={tmpItm.slide == 1?floderD:floderR} className={style.floderRD}/>
+                    <div className={style.floderPartFl} onClick={(e)=>this.floderSlide(e,tmpItm,i)}>
+                        <img src={showIndex== i?floderD:floderR} className={style.floderRD}/>
+                        {/* <img src={tmpItm.slide == 1?floderD:floderR} className={style.floderRD}/> */}
                         {tmpItm.name}({tmpItm.templateInfoCount})
                         <span className={`${style.floderPartAction}`} id="floderActionBtn" onClick={(e)=>{this.floderAction(e,tmpItm.id)}}>...</span>
                         {tmpItm.action == 1&&<div className={style.floderAction} id="floderAction">