|
@@ -13,7 +13,9 @@ import floderR from './TemplateItem/img/floderR.png';
|
|
|
import floderD from './TemplateItem/img/floderD.png';
|
|
|
import Empty from '@components/Empty';
|
|
|
import $ from 'jquery';
|
|
|
-import {windowEventHandler,getWindowInnerHeight} from '@utils/tools'
|
|
|
+import store from '@store';
|
|
|
+import { initCommonItemList,findTemplateNorms,getFloderListAll } from '@store/async-actions/tabTemplate';
|
|
|
+import { windowEventHandler,getWindowInnerHeight } from '@utils/tools'
|
|
|
|
|
|
class TemplateItems extends React.Component {
|
|
|
constructor(props) {
|
|
@@ -36,6 +38,7 @@ class TemplateItems extends React.Component {
|
|
|
this.clear = this.clear.bind(this);
|
|
|
this.showTipContent = this.showTipContent.bind(this);
|
|
|
this.getFloderLis = this.getFloderLis.bind(this);
|
|
|
+ this.whichTemp = this.whichTemp.bind(this);
|
|
|
}
|
|
|
componentDidMount(){
|
|
|
const height = getWindowInnerHeight()-195;
|
|
@@ -92,9 +95,6 @@ class TemplateItems extends React.Component {
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|
|
|
floderAction(e,id){
|
|
|
e&&e.stopPropagation()
|
|
@@ -147,8 +147,8 @@ class TemplateItems extends React.Component {
|
|
|
{admin&&<img src={showIndex== i?floderD:floderR} className={style.floderRD}/>}
|
|
|
{!admin&&<img src={tmpItm.slide == 1?floderD:floderR} className={style.floderRD}/>}
|
|
|
{tmpItm.name}({tmpItm.templateInfoCount})
|
|
|
- {admin&&<span className={`${style.floderPartAction}`} id="floderActionBtn" onClick={(e)=>{this.floderAction(e,tmpItm.id)}}>...</span>}
|
|
|
- {tmpItm.action == 1&&<div className={style.floderAction} id="floderAction">
|
|
|
+ {admin&&tmpItm.name!='未分类文件夹'&&<span className={`${style.floderPartAction}`} id="floderActionBtn" onClick={(e)=>{this.floderAction(e,tmpItm.id)}}>...</span>}
|
|
|
+ {tmpItm.action == 1&&tmpItm.name!='未分类文件夹'&&<div className={style.floderAction} id="floderAction">
|
|
|
<p onClick={(e)=>{this.floderRename(e,tmpItm.name,tmpItm.id)}}>重命名文件夹</p>
|
|
|
<p onClick={(e)=>{this.floderDelete(e,tmpItm.id)}}>删除文件夹</p>
|
|
|
</div>}
|
|
@@ -238,8 +238,22 @@ class TemplateItems extends React.Component {
|
|
|
}
|
|
|
|
|
|
handleChange(){
|
|
|
+ const {admin,selectTemp} = this.props;
|
|
|
const value = (this.$search.current.value).substring(0,30);
|
|
|
// this.$search.current.value = value
|
|
|
+ if(!admin&&selectTemp==1&&value == ''){
|
|
|
+ store.dispatch(initCommonItemList(1,""))
|
|
|
+ }else if(!admin&&selectTemp==2&&value == ''){
|
|
|
+ this.setState({
|
|
|
+ hasSearch:false
|
|
|
+ })
|
|
|
+ store.dispatch(findTemplateNorms(''))
|
|
|
+ }else if(admin){
|
|
|
+ this.setState({
|
|
|
+ hasSearch:false
|
|
|
+ })
|
|
|
+ store.dispatch(getFloderListAll(''))
|
|
|
+ }
|
|
|
setTimeout(() => {
|
|
|
this.setState({
|
|
|
val: value
|
|
@@ -248,7 +262,7 @@ class TemplateItems extends React.Component {
|
|
|
}
|
|
|
|
|
|
clear(){
|
|
|
- const {clearTemplateSearch} = this.props
|
|
|
+ const {clearTemplateSearch,selectTemp,admin} = this.props
|
|
|
this.$search.current.value = '';
|
|
|
this.setState({
|
|
|
val:''
|
|
@@ -259,6 +273,9 @@ class TemplateItems extends React.Component {
|
|
|
hasSearch: false
|
|
|
})
|
|
|
clearTemplateSearch&&clearTemplateSearch()
|
|
|
+ if(!admin){
|
|
|
+ store.dispatch(initCommonItemList(1,""))
|
|
|
+ }
|
|
|
}
|
|
|
clickTabChange(){
|
|
|
|
|
@@ -269,6 +286,14 @@ class TemplateItems extends React.Component {
|
|
|
this.clear();
|
|
|
}
|
|
|
}
|
|
|
+ whichTemp(num,val){
|
|
|
+ this.props.whichTemp(num,val)
|
|
|
+ if(val){
|
|
|
+ this.setState({
|
|
|
+ hasSearch:true
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
render() {
|
|
|
const {selectTemp,whichTemp, checkItemsAdmin,handleAllCheckboxAdmin,handleMangerTemplateAdmin,allCheckShowAdmin,admin,adminItems,allCheckShow, handleMangerTemplate,handleClickGetMore, handleDelList, handleAllCheckbox, items,checkItems,current,hasMore,templateNormsSearchList } = this.props;
|
|
|
|
|
@@ -342,7 +367,7 @@ class TemplateItems extends React.Component {
|
|
|
{
|
|
|
!admin?!allCheckShowAdmin&&<div
|
|
|
className={`${style.personalTmp} ${style.personalTmpStatand} ${selectTemp==2?style.personalTmpOwn:''}`}
|
|
|
- onClick={()=>{whichTemp(2);allCheckShow&&handleMangerTemplate()}}
|
|
|
+ onClick={()=>{this.whichTemp(2,(this.state.val).trim());allCheckShow&&handleMangerTemplate(2)}}
|
|
|
>标准模板 {selectTemp==2&&<img src={tempTip} className={style.tempTip} alt="" onMouseEnter={this.showTipContent} onMouseLeave={this.showTipContent}/>}
|
|
|
{
|
|
|
showTipContent&&<div className={style.tempTipContent}>
|