Browse Source

品牌允许输入中文

yangc 8 years ago
parent
commit
f161b159cf
1 changed files with 4 additions and 2 deletions
  1. 4 2
      components/applyPurchase/PublishApply.vue

+ 4 - 2
components/applyPurchase/PublishApply.vue

@@ -348,12 +348,14 @@
         if ((/[^\x00-\xff]/g).test(this.applyObj.brand)) {
           let chineseIndex = -1
           for (let i = 0; i < this.applyObj.brand.length; i++) {
-            if ((/[^\x00-\xff]/g).test(this.applyObj.brand.charAt(i))) {
+            if ((/[^\x00-\xff]/g).test(this.applyObj.brand.charAt(i)) && !(/[\u4e00-\u9fa5]/).test(this.applyObj.brand.charAt(i))) {
               chineseIndex = i
               break
             }
           }
-          this.applyObj.brand = cutOutString(this.applyObj.brand, chineseIndex)
+          if (chineseIndex > -1) {
+            this.applyObj.brand = this.applyObj.brand.substring(0, chineseIndex)
+          }
         } else if (this.applyObj.brand && getRealLen(this.applyObj.brand) > 50) {
           this.applyObj.brand = cutOutString(this.applyObj.brand, 50)
         } else {