Authored by 陈峰

merge

... ... @@ -151,9 +151,38 @@ export default {
this.refreshTable();
this.product.sellerGoodsInfoStr = JSON.stringify(this.table.data.map(handleColor));
},
phraseCheckSensitive() {
let contentModel = {
phrase: this.product.phrase
};
return new Promise((resolve, reject) => {
this.productCreateService.sensitiveWord(contentModel).then((resData) => {
if (resData.code === 200) {
if (resData.data && _.get(resData.data, 'phrase') && resData.data.phrase.length > 0) {
this.$Notice.error({
title: '商品卖点存在违禁词',
desc: resData.data.phrase
});
reject();
} else {
resolve();
}
} else {
this.$Notice.error({
title: '商品卖点文字校验错误',
desc: resData.message
});
reject();
}
});
});
},
submit: function() {
return this.validate().then(() => {
this.beforeSubmit();
this.phraseCheckSensitive();
return this.productCreateService.saveBaseProductInfo(this.product);
}, () => {
this.$Message.error('请填写必填项!');
... ...
... ... @@ -175,10 +175,40 @@ export default {
this.model.productMaterial = result[3];
});
},
introCheckSensitive() {
let contentModel = {
desc: this.desc
};
return new Promise((resolve, reject) => {
this.productCreateService.sensitiveWord(contentModel).then((resData) => {
if (resData.code === 200) {
if (resData.data && resData.data.desc && resData.data.desc.length > 0) {
this.$Notice.error({
title: '商品简介存在违禁词',
desc: resData.data.desc
});
reject();
} else {
resolve();
}
} else {
this.$Notice.error({
title: '商品简介文字校验错误',
desc: resData.message
});
reject();
}
});
});
},
submit: function() {
let submitData = this.beforeSubmit();
return this.introCheckSensitive().then(() => {
let submitData = this.beforeSubmit();
return this.productCreateService.updateNetInfo(submitData);
return this.productCreateService.updateNetInfo(submitData);
}, () => {});
},
beforeSubmit: function() {
let result = {
... ...
... ... @@ -503,6 +503,62 @@ export default {
return newProduct;
},
phraseCheckSensitive() {
let contentModel = {
phrase: this.product.phrase
};
return new Promise((resolve, reject) => {
this.productCreateService.sensitiveWord(contentModel).then((resData) => {
if (resData.code === 200) {
if (resData.data && _.get(resData.data, 'phrase') && resData.data.phrase.length > 0) {
this.$Notice.error({
title: '商品卖点存在违禁词',
desc: resData.data.phrase
});
reject();
} else {
resolve();
}
} else {
this.$Notice.error({
title: '商品卖点文字校验错误',
desc: resData.message
});
reject();
}
});
});
},
introCheckSensitive() {
let contentModel = {
productIntro: this.product.productIntro
};
return new Promise((resolve, reject) => {
this.productCreateService.sensitiveWord(contentModel).then((resData) => {
if (resData.code === 200) {
if (resData.data && _.get(resData.data, 'productIntro') && resData.data.productIntro.length > 0) {
this.$Notice.error({
title: '商品简介存在违禁词',
desc: resData.data.productIntro
});
reject();
} else {
resolve();
}
} else {
this.$Notice.error({
title: '商品简介文字校验错误',
desc: resData.message
});
reject();
}
});
});
},
save() {
let newProduct = this.beforeSave();
... ... @@ -540,6 +596,8 @@ export default {
return Promise.reject();
}
})
.then(this.phraseCheckSensitive)
.then(this.introCheckSensitive)
.then(this.save)
.catch(() => this.$Loading.error());
},
... ...
... ... @@ -39,6 +39,7 @@
<script>
import xss from 'xss';
import _ from 'lodash';
import ShopService from 'services/shop/shop-service';
const SHOPNATURE = {
... ... @@ -90,7 +91,6 @@
uploadImageRemove: function() {
this.shopData.shopLogo = '';
},
beforeSubmit: function() {
let result = {
shopDomain: this.shopData.shopDomain,
... ... @@ -105,11 +105,40 @@
return result;
},
submit: function() {
let newShop = this.beforeSubmit();
checkSensitiveWord: function() {
let contentModel = {
shopIntro: this.shopData.shopIntro
};
return new Promise((resolve, reject) => {
this.shopService.sensitiveWord(contentModel).then((resData) => {
if (resData.code === 200) {
if (resData.data && _.get(resData.data, 'shopIntro') && resData.data.shopIntro.length > 0) {
this.$Notice.error({
title: '店铺简介存在违禁词',
desc: resData.data.shopIntro
});
reject();
} else {
resolve();
}
} else {
this.$Notice.error({
title: '店铺简介文字校验错误',
desc: resData.message
});
reject();
}
});
});
},
save: function() {
this.$Loading.start();
this.shopService.saveBaseShopInfo(newShop).then((result) => {
let newShop = this.beforeSubmit();
return this.shopService.saveBaseShopInfo(newShop).then((result) => {
this.$Loading.finish();
if (result.code === 200) {
... ... @@ -125,6 +154,11 @@
});
}
});
},
submit: function() {
this.checkSensitiveWord().then(() => {
this.save();
}, () => {});
}
}
};
... ...
... ... @@ -7,7 +7,8 @@ let apiUrl = {
attr: '/platform/selectAttributes',
material: '/platform/querySellerProductMaterial',
updateNetInfo: '/platform/updateSellerProductNetSaleInfo',
updateProduct: '/platform/updateProduct'
updateProduct: '/platform/updateProduct',
sensitiveWordValidate: '/platform/sensitiveWordValidate'
};
class ProductCreateService extends Service {
... ... @@ -101,6 +102,12 @@ class ProductCreateService extends Service {
return this.post(apiUrl.updateNetInfo, info);
}
sensitiveWord(contentModel) {
return this.post(apiUrl.sensitiveWordValidate, {
validateContent: JSON.stringify(contentModel)
});
}
/**
* 保存商品基本信息
* @param product
... ...
... ... @@ -20,5 +20,11 @@ class ShopService extends Service {
findShopsDecorator() {
return this.post('/platform/findBusinessShopsDecorator');
}
sensitiveWord(contentModel) {
return this.post('/platform/sensitiveWordValidate', {
validateContent: JSON.stringify(contentModel)
});
}
}
export default ShopService;
... ...
... ... @@ -96,6 +96,7 @@ let domainApis = {
getConsultList: '/seller/consult/getConsultList',
consultReply: '/seller/consult/reply',
getShareOrderList: '/seller/shareOrder/shareOrderList',
sensitiveWordValidate: '/sensitiveWord/validate'
},
shop: {
login: '/loginInter',
... ...