Authored by OF1706

word dev

@@ -151,9 +151,38 @@ export default { @@ -151,9 +151,38 @@ export default {
151 this.refreshTable(); 151 this.refreshTable();
152 this.product.sellerGoodsInfoStr = JSON.stringify(this.table.data.map(handleColor)); 152 this.product.sellerGoodsInfoStr = JSON.stringify(this.table.data.map(handleColor));
153 }, 153 },
  154 + phraseCheckSensitive() {
  155 + let contentModel = {
  156 + phrase: this.product.phrase
  157 + };
  158 +
  159 + return new Promise((resolve, reject) => {
  160 + this.productCreateService.sensitiveWord(contentModel).then((resData) => {
  161 + if (resData.code === 200) {
  162 + if (resData.data && _.get(resData.data, 'phrase') && resData.data.phrase.length > 0) {
  163 + this.$Notice.error({
  164 + title: '商品卖点存在违禁词',
  165 + desc: resData.data.phrase
  166 + });
  167 + reject();
  168 + } else {
  169 + resolve();
  170 + }
  171 +
  172 + } else {
  173 + this.$Notice.error({
  174 + title: '商品卖点文字校验错误',
  175 + desc: resData.message
  176 + });
  177 + reject();
  178 + }
  179 + });
  180 + });
  181 + },
154 submit: function() { 182 submit: function() {
155 return this.validate().then(() => { 183 return this.validate().then(() => {
156 this.beforeSubmit(); 184 this.beforeSubmit();
  185 + this.phraseCheckSensitive();
157 return this.productCreateService.saveBaseProductInfo(this.product); 186 return this.productCreateService.saveBaseProductInfo(this.product);
158 }, () => { 187 }, () => {
159 this.$Message.error('请填写必填项!'); 188 this.$Message.error('请填写必填项!');
@@ -174,10 +174,40 @@ export default { @@ -174,10 +174,40 @@ export default {
174 this.model.productMaterial = result[3]; 174 this.model.productMaterial = result[3];
175 }); 175 });
176 }, 176 },
  177 + introCheckSensitive() {
  178 + let contentModel = {
  179 + desc: this.desc
  180 + };
  181 +
  182 + return new Promise((resolve, reject) => {
  183 + this.productCreateService.sensitiveWord(contentModel).then((resData) => {
  184 + if (resData.code === 200) {
  185 + if (resData.data && resData.data.desc && resData.data.desc.length > 0) {
  186 + this.$Notice.error({
  187 + title: '商品简介存在违禁词',
  188 + desc: resData.data.desc
  189 + });
  190 + reject();
  191 + } else {
  192 + resolve();
  193 + }
  194 +
  195 + } else {
  196 + this.$Notice.error({
  197 + title: '商品简介文字校验错误',
  198 + desc: resData.message
  199 + });
  200 + reject();
  201 + }
  202 + });
  203 + });
  204 + },
177 submit: function() { 205 submit: function() {
178 - let submitData = this.beforeSubmit(); 206 + return this.introCheckSensitive().then(() => {
  207 + let submitData = this.beforeSubmit();
179 208
180 - return this.productCreateService.updateNetInfo(submitData); 209 + return this.productCreateService.updateNetInfo(submitData);
  210 + }, () => {});
181 }, 211 },
182 beforeSubmit: function() { 212 beforeSubmit: function() {
183 let result = { 213 let result = {
@@ -503,6 +503,62 @@ export default { @@ -503,6 +503,62 @@ export default {
503 503
504 return newProduct; 504 return newProduct;
505 }, 505 },
  506 + phraseCheckSensitive() {
  507 + let contentModel = {
  508 + phrase: this.product.phrase
  509 + };
  510 +
  511 + return new Promise((resolve, reject) => {
  512 + this.productCreateService.sensitiveWord(contentModel).then((resData) => {
  513 + if (resData.code === 200) {
  514 + if (resData.data && _.get(resData.data, 'phrase') && resData.data.phrase.length > 0) {
  515 + this.$Notice.error({
  516 + title: '商品卖点存在违禁词',
  517 + desc: resData.data.phrase
  518 + });
  519 + reject();
  520 + } else {
  521 + resolve();
  522 + }
  523 +
  524 + } else {
  525 + this.$Notice.error({
  526 + title: '商品卖点文字校验错误',
  527 + desc: resData.message
  528 + });
  529 + reject();
  530 + }
  531 + });
  532 + });
  533 + },
  534 + introCheckSensitive() {
  535 + let contentModel = {
  536 + productIntro: this.product.productIntro
  537 + };
  538 +
  539 + return new Promise((resolve, reject) => {
  540 + this.productCreateService.sensitiveWord(contentModel).then((resData) => {
  541 + if (resData.code === 200) {
  542 + if (resData.data && _.get(resData.data, 'productIntro') && resData.data.productIntro.length > 0) {
  543 + this.$Notice.error({
  544 + title: '商品简介存在违禁词',
  545 + desc: resData.data.productIntro
  546 + });
  547 + reject();
  548 + } else {
  549 + resolve();
  550 + }
  551 +
  552 + } else {
  553 + this.$Notice.error({
  554 + title: '商品简介文字校验错误',
  555 + desc: resData.message
  556 + });
  557 + reject();
  558 + }
  559 + });
  560 + });
  561 + },
506 save() { 562 save() {
507 let newProduct = this.beforeSave(); 563 let newProduct = this.beforeSave();
508 564
@@ -540,6 +596,8 @@ export default { @@ -540,6 +596,8 @@ export default {
540 return Promise.reject(); 596 return Promise.reject();
541 } 597 }
542 }) 598 })
  599 + .then(this.phraseCheckSensitive)
  600 + .then(this.introCheckSensitive)
543 .then(this.save) 601 .then(this.save)
544 .catch(() => this.$Loading.error()); 602 .catch(() => this.$Loading.error());
545 }, 603 },
@@ -38,7 +38,7 @@ @@ -38,7 +38,7 @@
38 </template> 38 </template>
39 39
40 <script> 40 <script>
41 - 41 + import _ from 'lodash';
42 import ShopService from 'services/shop/shop-service'; 42 import ShopService from 'services/shop/shop-service';
43 43
44 const SHOPNATURE = { 44 const SHOPNATURE = {
@@ -90,7 +90,6 @@ @@ -90,7 +90,6 @@
90 uploadImageRemove: function() { 90 uploadImageRemove: function() {
91 this.shopData.shopLogo = ''; 91 this.shopData.shopLogo = '';
92 }, 92 },
93 -  
94 beforeSubmit: function() { 93 beforeSubmit: function() {
95 let result = { 94 let result = {
96 shopDomain: this.shopData.shopDomain, 95 shopDomain: this.shopData.shopDomain,
@@ -105,11 +104,40 @@ @@ -105,11 +104,40 @@
105 104
106 return result; 105 return result;
107 }, 106 },
108 - submit: function() {  
109 - let newShop = this.beforeSubmit(); 107 + checkSensitiveWord: function() {
  108 + let contentModel = {
  109 + shopIntro: this.shopData.shopIntro
  110 + };
  111 +
  112 + return new Promise((resolve, reject) => {
  113 + this.shopService.sensitiveWord(contentModel).then((resData) => {
  114 + if (resData.code === 200) {
  115 + if (resData.data && _.get(resData.data, 'shopIntro') && resData.data.shopIntro.length > 0) {
  116 + this.$Notice.error({
  117 + title: '店铺简介存在违禁词',
  118 + desc: resData.data.shopIntro
  119 + });
  120 + reject();
  121 + } else {
  122 + resolve();
  123 + }
110 124
  125 + } else {
  126 + this.$Notice.error({
  127 + title: '店铺简介文字校验错误',
  128 + desc: resData.message
  129 + });
  130 + reject();
  131 + }
  132 + });
  133 + });
  134 + },
  135 + save: function() {
111 this.$Loading.start(); 136 this.$Loading.start();
112 - this.shopService.saveBaseShopInfo(newShop).then((result) => { 137 +
  138 + let newShop = this.beforeSubmit();
  139 +
  140 + return this.shopService.saveBaseShopInfo(newShop).then((result) => {
113 this.$Loading.finish(); 141 this.$Loading.finish();
114 142
115 if (result.code === 200) { 143 if (result.code === 200) {
@@ -125,6 +153,11 @@ @@ -125,6 +153,11 @@
125 }); 153 });
126 } 154 }
127 }); 155 });
  156 + },
  157 + submit: function() {
  158 + this.checkSensitiveWord().then(() => {
  159 + this.save();
  160 + }, () => {});
128 } 161 }
129 } 162 }
130 }; 163 };
@@ -7,7 +7,8 @@ let apiUrl = { @@ -7,7 +7,8 @@ let apiUrl = {
7 attr: '/platform/selectAttributes', 7 attr: '/platform/selectAttributes',
8 material: '/platform/querySellerProductMaterial', 8 material: '/platform/querySellerProductMaterial',
9 updateNetInfo: '/platform/updateSellerProductNetSaleInfo', 9 updateNetInfo: '/platform/updateSellerProductNetSaleInfo',
10 - updateProduct: '/platform/updateProduct' 10 + updateProduct: '/platform/updateProduct',
  11 + sensitiveWordValidate: '/platform/sensitiveWordValidate'
11 }; 12 };
12 13
13 class ProductCreateService extends Service { 14 class ProductCreateService extends Service {
@@ -101,6 +102,12 @@ class ProductCreateService extends Service { @@ -101,6 +102,12 @@ class ProductCreateService extends Service {
101 return this.post(apiUrl.updateNetInfo, info); 102 return this.post(apiUrl.updateNetInfo, info);
102 } 103 }
103 104
  105 + sensitiveWord(contentModel) {
  106 + return this.post(apiUrl.sensitiveWordValidate, {
  107 + validateContent: JSON.stringify(contentModel)
  108 + });
  109 + }
  110 +
104 /** 111 /**
105 * 保存商品基本信息 112 * 保存商品基本信息
106 * @param product 113 * @param product
@@ -20,5 +20,11 @@ class ShopService extends Service { @@ -20,5 +20,11 @@ class ShopService extends Service {
20 findShopsDecorator() { 20 findShopsDecorator() {
21 return this.post('/platform/findBusinessShopsDecorator'); 21 return this.post('/platform/findBusinessShopsDecorator');
22 } 22 }
  23 +
  24 + sensitiveWord(contentModel) {
  25 + return this.post('/platform/sensitiveWordValidate', {
  26 + validateContent: JSON.stringify(contentModel)
  27 + });
  28 + }
23 } 29 }
24 export default ShopService; 30 export default ShopService;
@@ -96,6 +96,7 @@ let domainApis = { @@ -96,6 +96,7 @@ let domainApis = {
96 getConsultList: '/seller/consult/getConsultList', 96 getConsultList: '/seller/consult/getConsultList',
97 consultReply: '/seller/consult/reply', 97 consultReply: '/seller/consult/reply',
98 getShareOrderList: '/seller/shareOrder/shareOrderList', 98 getShareOrderList: '/seller/shareOrder/shareOrderList',
  99 + sensitiveWordValidate: '/sensitiveWord/validate'
99 }, 100 },
100 shop: { 101 shop: {
101 login: '/loginInter', 102 login: '/loginInter',