Authored by 陈峰

Merge branch 'feature/sensitiveWord' into 'release/3.0'

word dev



See merge request !51
... ... @@ -497,6 +497,50 @@ export default {
return newProduct;
},
checkSensitive() {
let contentModel = {
phrase: this.product.phrase,
productIntro: this.product.productIntro
};
return new Promise((resolve, reject) => {
this.productCreateService.sensitiveWord(contentModel).then((resData) => {
if (resData.code === 200) {
const phraseBoolean = resData.data && _.get(resData.data, 'phrase') && resData.data.phrase.length > 0;
const introBoolean = resData.data && _.get(resData.data, 'productIntro') && resData.data.productIntro.length > 0;
if (introBoolean || phraseBoolean) {
if (phraseBoolean) {
this.$Notice.error({
title: '商品卖点存在违禁词',
desc: resData.data.phrase
});
reject();
}
if (introBoolean) {
this.$Notice.error({
title: '商品简介存在违禁词',
desc: resData.data.productIntro
});
reject();
}
} else {
resolve();
}
} else {
this.$Notice.error({
title: '文字校验错误',
desc: resData.message
});
reject();
}
});
});
},
phraseCheckSensitive() {
let contentModel = {
phrase: this.product.phrase
... ... @@ -590,8 +634,7 @@ export default {
return Promise.reject();
}
})
.then(this.phraseCheckSensitive)
.then(this.introCheckSensitive)
.then(this.checkSensitive)
.then(this.save)
.catch(() => this.$Loading.error());
},
... ...