liucf 6 年 前
コミット
2e48a3ca9f

+ 3 - 2
src/common/components/EditableSpan/index.jsx

@@ -123,7 +123,7 @@ class EditableSpan extends Component{
   }
   handleKeyup(e){
      const {boxMark,handleKeydown,i,value} = this.props;
-     const {preVal,index} = this.state;console.log(22,i,index);
+     const {preVal,index} = this.state;//console.log(22,i,index);
     let innerVal = e.target.innerText;
     if(e.keyCode==8){
       if(innerVal !==preVal){return}
@@ -134,7 +134,8 @@ class EditableSpan extends Component{
       if(index!==0 && pattern.test(data)){
         handleKeydown&&handleKeydown({boxMark,i:index});
         this.setState({
-          index:index-1
+          // index:index-1 //连续往前删除,体验不佳
+          index:null
         })
       }
     }

+ 1 - 0
src/containers/EditableSpan.js

@@ -210,6 +210,7 @@ function mapDispatchToProps(dispatch,state) {
       }
     },
     handleKeydown(obj){//backspace删除
+      if(obj.i==null){return}
       switch (+obj.boxMark){
         case 1:
           dispatch({type:DEL_MAIN,delIndex:obj.i});

+ 6 - 0
src/containers/MainSuit.js

@@ -126,6 +126,12 @@ function mapDispatchToProps(dispatch) {
           type: SAVE_FREE,
           data:item
         })
+        //右侧推送
+          setTimeout(function(){ 
+            if(didPushParamChange()){
+              dispatch(billing);
+            }
+          },500);
       },
       fetchPushInfos(){//文本模式下推送
         //调右侧推送

+ 9 - 3
src/store/actions/currentIll.js

@@ -254,10 +254,16 @@ export const confirm = (state,action) =>{
 export const setCheckBox = (state,action)=>{
   const res = Object.assign({},state);
   const {exists,labelInx,existsName} = action.data;
+  // 若每个选项都有符号,去掉最后一个,因与标签间的符号有冲突
+  let names=existsName;
+  let pattern = new RegExp(/\,+$|\,+$|\.+$|\。+$|\、+$/);//+ 一次或多次
+  if(pattern.test(existsName)){
+    names = existsName.substr(0,existsName.length-1);
+  }
   let arr = res.data;
-  arr[labelInx].value = existsName;
-  res.saveText[labelInx] = existsName;
-  res.selecteds[labelInx] = action.data;
+  arr[labelInx].value = names;
+  res.saveText[labelInx] = names;
+  res.selecteds[labelInx] = action.data;console.log(99,res,action);
   res.update=Math.random();
   return res;
 }

+ 8 - 2
src/store/actions/mainSuit.js

@@ -190,9 +190,15 @@ export const confirm = (state,action) =>{
 export const commConfirm=(state,action)=>{
   const res = Object.assign({},state);
   const {exists,ikey,existsName} = action.data;
+  // 若每个选项都有符号,去掉最后一个,因与标签间的符号有冲突
+  let names=existsName;
+  let pattern = new RegExp(/\,+$|\,+$|\.+$|\。+$|\、+$/);//+ 一次或多次
+  if(pattern.test(existsName)){
+    names = existsName.substr(0,existsName.length-1);
+  }
   let arr = res.data;
-  arr[ikey].value = existsName;
-  res.saveText[ikey] = existsName;
+  arr[ikey].value = names;
+  res.saveText[ikey] = names;
   res.selecteds[ikey] = action.data;
   res.update=Math.random();
   return res;