Merge branch 'release/3.0' of http://git.yoho.cn/fe/yoho-shop-manage into release/3.0
Showing
1 changed file
with
45 additions
and
2 deletions
@@ -497,6 +497,50 @@ export default { | @@ -497,6 +497,50 @@ export default { | ||
497 | 497 | ||
498 | return newProduct; | 498 | return newProduct; |
499 | }, | 499 | }, |
500 | + checkSensitive() { | ||
501 | + let contentModel = { | ||
502 | + phrase: this.product.phrase, | ||
503 | + productIntro: this.product.productIntro | ||
504 | + }; | ||
505 | + | ||
506 | + return new Promise((resolve, reject) => { | ||
507 | + this.productCreateService.sensitiveWord(contentModel).then((resData) => { | ||
508 | + if (resData.code === 200) { | ||
509 | + | ||
510 | + const phraseBoolean = resData.data && _.get(resData.data, 'phrase') && resData.data.phrase.length > 0; | ||
511 | + const introBoolean = resData.data && _.get(resData.data, 'productIntro') && resData.data.productIntro.length > 0; | ||
512 | + | ||
513 | + if (introBoolean || phraseBoolean) { | ||
514 | + | ||
515 | + if (phraseBoolean) { | ||
516 | + this.$Notice.error({ | ||
517 | + title: '商品卖点存在违禁词', | ||
518 | + desc: resData.data.phrase | ||
519 | + }); | ||
520 | + reject(); | ||
521 | + } | ||
522 | + | ||
523 | + if (introBoolean) { | ||
524 | + this.$Notice.error({ | ||
525 | + title: '商品简介存在违禁词', | ||
526 | + desc: resData.data.productIntro | ||
527 | + }); | ||
528 | + reject(); | ||
529 | + } | ||
530 | + | ||
531 | + } else { | ||
532 | + resolve(); | ||
533 | + } | ||
534 | + } else { | ||
535 | + this.$Notice.error({ | ||
536 | + title: '文字校验错误', | ||
537 | + desc: resData.message | ||
538 | + }); | ||
539 | + reject(); | ||
540 | + } | ||
541 | + }); | ||
542 | + }); | ||
543 | + }, | ||
500 | phraseCheckSensitive() { | 544 | phraseCheckSensitive() { |
501 | let contentModel = { | 545 | let contentModel = { |
502 | phrase: this.product.phrase | 546 | phrase: this.product.phrase |
@@ -589,8 +633,7 @@ export default { | @@ -589,8 +633,7 @@ export default { | ||
589 | return Promise.reject(); | 633 | return Promise.reject(); |
590 | } | 634 | } |
591 | }) | 635 | }) |
592 | - .then(this.phraseCheckSensitive) | ||
593 | - .then(this.introCheckSensitive) | 636 | + .then(this.checkSensitive) |
594 | .then(this.save) | 637 | .then(this.save) |
595 | .catch(() => this.$Loading.error()); | 638 | .catch(() => this.$Loading.error()); |
596 | }, | 639 | }, |
-
Please register or login to post a comment