liucf 5 лет назад
Родитель
Сommit
c147e33592

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

@@ -98,7 +98,8 @@ class EditableSpan extends Component{
       clearTimeout(that.state.timer);
       temp = newText.replace(searchPre,'');
       isEnd = !(newText.indexOf(searchPre)>0);
-      search = temp.replace(/[(^\s*)|(\s*$)|(^\,*)|(\,*$)]/g,'');
+      // search = temp.replace(/[(^\s*)|(\s*$)|(^\,*)|(\,*$)]/g,'');
+      search = temp.replace(config.regPreAndAft,'');
       // if(!search&&searchPre){
       if(!temp&&searchPre&&newText){
         search = searchPre;

+ 1 - 0
src/config/index.js

@@ -35,4 +35,5 @@ export default {
     textReg:new RegExp("([\u4E00-\uFA29]|[\uE7C7-\uE7F3]|[a-zA-Z0-9])"), //包含中英文或数字
     slideTime:400,      //右侧指标推送展开/收起动画时间
     recoverTagNum:3,    //可回退标签的个数
+    regPreAndAft:/[^\u4e00-\u9fa5|0-9|a-z|A-Z|Ⅰ|Ⅱ|Ⅲ|Ⅳ|Ⅴ|Ⅵ|Ⅶ|Ⅷ|Ⅸ|Ⅹ]+$|^[^\u4e00-\u9fa5|0-9|a-z|A-Z|Ⅰ|Ⅱ|Ⅲ|Ⅳ|Ⅴ|Ⅵ|Ⅶ|Ⅷ|Ⅸ|Ⅹ]+/g  //搜索去掉前后的标点
 };

+ 8 - 4
src/containers/EditableSpan.js

@@ -19,7 +19,8 @@ function mapStateToProps(state){//console.log(state)
 
 function mainSuitSearch(obj){
   return (dispatch)=>{
-    const text = obj.text.replace(/\,/,'');
+    // const text = obj.text.replace(/\,/,'');
+    const text = obj.text;
     getSearch({boxMark:1,inpStr:text,mainIds:obj.mainIds,itemType:0}).then((res)=>{
       if(res.data.code=='0'){
         dispatch({
@@ -35,7 +36,8 @@ function mainSuitSearch(obj){
 
 function currentSearch(obj){
   return (dispatch)=>{
-    const text = obj.text.replace(/\,/,'');
+    // const text = obj.text.replace(/\,/,'');
+    const text = obj.text;
     getSearch({boxMark:1,inpStr:text,mainIds:obj.mainIds}).then((res)=>{
       if(res.data.code=='0'){
         dispatch({
@@ -51,7 +53,8 @@ function currentSearch(obj){
 
 function checkBodySearch(obj){
   return (dispatch)=>{
-    const text = obj.text.replace(/\,/,'');
+    // const text = obj.text.replace(/\,/,'');
+    const text = obj.text;
     getSearch({boxMark:4,inpStr:text}).then((res)=>{
       if(res.data.code=='0'){
         dispatch({
@@ -67,7 +70,8 @@ function checkBodySearch(obj){
 
 function otherHisSearch(obj) {
   return (dispatch)=>{
-    const text = obj.text.replace(/\,/,'');
+    // const text = obj.text.replace(/\,/,'');
+    const text = obj.text;
     getSearch({boxMark:3,inpStr:text}).then((res)=>{
       if(res.data.code=='0'){
         dispatch({