Ver código fonte

空数据处理

luolei 5 anos atrás
pai
commit
822c5a6dd0

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

@@ -138,7 +138,10 @@ class TemplateItems extends React.Component {
     genAdminItems(items,flg) {
         const Floder=[],Items = [];
         const {admin,checkItemsAdmin} = this.props;
-        const {showIndex}=this.state
+        let {showIndex}=this.state
+        if(items.length>0&&!items[0].templateInfo){
+            showIndex = -1
+        }
         for(let i = 0;i < items.length;i++){
             let tmpItm = items[i]
             Floder.push(

+ 3 - 1
src/store/reducers/tabTemplate.js

@@ -202,7 +202,9 @@ export default (state = initDataList, action) => {
   }
   if (action.type === INIT_ADMIN_ITEMS) {//标准模板数据
     const newState = Object.assign({}, state);
-    action.state[0].slide=1
+    if(action.state[0]&&action.state[0].templateInfo&&action.state[0].templateInfo.length>0){
+      action.state[0].slide=1
+    }
     newState.adminItems = action.state
     let tmpLis = [];
     for(let k = 0;k < action.state.length;k++){