zhangxc 5 лет назад
Родитель
Сommit
8a7432d045
2 измененных файлов с 9 добавлено и 11 удалено
  1. 2 3
      src/components/PushContainer/index.jsx
  2. 7 8
      src/components/TemplateItems/index.jsx

+ 2 - 3
src/components/PushContainer/index.jsx

@@ -452,10 +452,9 @@ class PushContainer extends Component {
       hasCalcIndex: false
       hasCalcIndex: false
     })
     })
   }
   }
-  whichTemp(tab,name){
-    console.log('tan',tab)
+  whichTemp(tab,name,hasSearch){
     if(tab!=2||!name){
     if(tab!=2||!name){
-      if(tab == 1 && name) {
+      if(tab == 1 && name&&hasSearch) {
         this.templateSearch(name,1)
         this.templateSearch(name,1)
       } else {
       } else {
         store.dispatch(initAdminItemList(1,true))
         store.dispatch(initAdminItemList(1,true))

+ 7 - 8
src/components/TemplateItems/index.jsx

@@ -228,7 +228,6 @@ class TemplateItems extends React.Component {
                 msg:'还没有保存模板'
                 msg:'还没有保存模板'
             })
             })
         }
         }
-        if(admin||selectTemp ===2)
         this.setState({
         this.setState({
             hasSearch: true
             hasSearch: true
         })
         })
@@ -295,11 +294,11 @@ class TemplateItems extends React.Component {
         },0)
         },0)
 
 
         this.props.whichTemp(num,val)
         this.props.whichTemp(num,val)
-        if(val){
-            this.setState({
-                hasSearch:true
-            })
-        }
+        // if(val){
+        //     this.setState({
+        //         hasSearch:true
+        //     })
+        // }
     }
     }
     render() {
     render() {
         const {selectTemp,whichTemp, checkItemsAdmin,handleAllCheckboxAdmin,handleMangerTemplateAdmin,allCheckShowAdmin,admin,adminItems,allCheckShow, handleMangerTemplate,handleClickGetMore, handleDelList, handleAllCheckbox, items,checkItems,current,hasMore,templateNormsSearchList } = this.props;
         const {selectTemp,whichTemp, checkItemsAdmin,handleAllCheckboxAdmin,handleMangerTemplateAdmin,allCheckShowAdmin,admin,adminItems,allCheckShow, handleMangerTemplate,handleClickGetMore, handleDelList, handleAllCheckbox, items,checkItems,current,hasMore,templateNormsSearchList } = this.props;
@@ -363,7 +362,7 @@ class TemplateItems extends React.Component {
                             {
                             {
                                 <div className={`${style.topBorder} clearfix`}>
                                 <div className={`${style.topBorder} clearfix`}>
                                     {
                                     {
-                                        !allCheckShow&&<div className={`${style.personalTmp} ${selectTemp==1?style.personalTmpOwn:''} clearfix`} onClick={()=>whichTemp(1,(this.state.val).trim())}>
+                                        !allCheckShow&&<div className={`${style.personalTmp} ${selectTemp==1?style.personalTmpOwn:''} clearfix`} onClick={()=>whichTemp(1,(this.state.val).trim(),hasSearch)}>
                                             <span className={style.tip}>个人模板</span>
                                             <span className={style.tip}>个人模板</span>
                                             <i></i>
                                             <i></i>
                                             {
                                             {
@@ -374,7 +373,7 @@ class TemplateItems extends React.Component {
                                     {
                                     {
                                         !admin?!allCheckShowAdmin&&<div 
                                         !admin?!allCheckShowAdmin&&<div 
                                             className={`${style.personalTmp} ${style.personalTmpStatand} ${selectTemp==2?style.personalTmpOwn:''}`} 
                                             className={`${style.personalTmp} ${style.personalTmpStatand} ${selectTemp==2?style.personalTmpOwn:''}`} 
-                                            onClick={()=>{this.whichTemp(2,(this.state.val).trim());allCheckShow&&handleMangerTemplate(2)}}
+                                            onClick={()=>{this.whichTemp(2,(this.state.val).trim(),hasSearch);allCheckShow&&handleMangerTemplate(2)}}
                                             >标准模板 {selectTemp==2&&<img src={tempTip} className={style.tempTip} alt="" onMouseEnter={this.showTipContent} onMouseLeave={this.showTipContent}/>}
                                             >标准模板 {selectTemp==2&&<img src={tempTip} className={style.tempTip} alt="" onMouseEnter={this.showTipContent} onMouseLeave={this.showTipContent}/>}
                                             {
                                             {
                                                 showTipContent&&<div className={style.tempTipContent}>
                                                 showTipContent&&<div className={style.tempTipContent}>