Commit c3b779d2 by zhangxw

套餐用例评审修改,AI对练冗余词逻辑修改

1 parent 7ca1b4f5
......@@ -142,7 +142,8 @@
:ref="'selectRefs_' + item.name" :placeholder="'请选择' + item.label" @change="selectAddAttr($event, item)"
:style="{ 'width': item.width || formItemWidth }" filterable>
<el-option v-for="subItem in item.optionList" :key="subItem[item.optionId]"
:label="subItem[item.optionLabel]" :value="subItem[item.optionId]" />
:label="subItem[item.optionLabel]" :value="subItem[item.optionId]"
:disabled="item.name == 'sceneType' && subItem[item.optionId] != 0 && subItem[item.optionId] != 1" />
</el-select>
</template>
</el-form-item>
......
......@@ -27,6 +27,7 @@ export default {
return {
extendedPosiType: baseConfig.extendedPosiType || [], // 延保类
equitySceneType: baseConfig.equitySceneType || [], // 会员权益/升级类目
membraneTypeList: baseConfig.membraneTypeList, // 膜类
show: false,
addOrEdit: 'add',
proFormRef: 'pro',
......@@ -194,11 +195,6 @@ export default {
remoteMethod(query) {
this.goodsNameKeyword = query
this.currentPage = 1
if (Array.isArray(goodsData)) {
for (let index = 0; index < goodsData.length; index++) {
this.$set(this.editForm[1].formBlock[index][0], 'optionList', [])
}
}
this.goodsSelectList = []
this.getSelectingList() // 请求接口
},
......@@ -422,8 +418,8 @@ export default {
if (merchantGoodsInfoList?.length < 2) return this.$message.error('套餐至少需包含两个商品')
// 套餐总售价需大于零
if (formObj?.sellPrice <= 0) return this.$message.error('套餐总售价需大于零,请检查套餐包含商品售价')
if (merchantGoodsInfoList?.findIndex(v => v.goodsType == 1) > -1 && data?.sceneType != 1) return this.$message.error('太阳膜类商品套餐仅支持上架至精品升级场景')
if (merchantGoodsInfoList?.findIndex(v => this.extendedPosiType.includes(v.goodsType)) > -1 && data?.sceneType != 0) return this.$message.error('延保类商品套餐仅支持上架至会员/权益升级场景')
if (merchantGoodsInfoList?.findIndex(v => this.membraneTypeList.includes(v.goodsType)) > -1 && data?.sceneType != 1) return this.$message.error('膜类商品仅支持上架精品升级场景')
if (merchantGoodsInfoList?.findIndex(v => this.extendedPosiType?.concat(this.equitySceneType)?.includes(v.goodsType)) > -1 && data?.sceneType != 0) return this.$message.error('延保、权益类商品仅支持上架会员权益场景')
this.editData = data
if ((num == 1)) {
this.$confirm('<p>上架信息保存后,自动进入上架审核流程</p>是否确定保存?', '提示', {
......
......@@ -73,32 +73,27 @@ export default {
filterWordsData() {
const toneWords = contantData.toneWords
const toneList = contantData.toneList
// 构建一个正则表达式,匹配数组h中每个元素的叠词
const regex = new RegExp(`(${toneWords.map(str => str.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')).join('|')})\\1+`, 'g');
const {redundantWords} = this.itemData.fluency
let words = ''
try {
words = JSON.parse(redundantWords).content
} catch (error) {
}
const matches = words.match(regex)||[];
let redundantWordsList = new Map()
matches.forEach((i) => {
const l = i.slice(0, 1);
const v = redundantWordsList.get(l);
if (v) {
redundantWordsList.set(l, v + (i.length - 1));
} else {
redundantWordsList.set(l, i.length - 1);
const wordCountMap = new Map();
toneWords.forEach(word => {
const count = (words.match(new RegExp(word, 'g')) || []).length;
if(count>0) {
wordCountMap.set(word, count);
}
});
const positionX = [...redundantWordsList.keys()]
const positionY = [...redundantWordsList.values()];
const wordNum = positionY.reduce((cur,prev)=>{
return cur+prev
},0)
let star = 5 - Math.ceil(wordNum/2)
if(star < 1) {
const positionX = [...wordCountMap.keys()]
const positionY = [...wordCountMap.values()];
const wordNum = positionY.reduce((cur, prev) => {
return cur + prev
}, 0)
let star = 5 - Math.ceil(wordNum / 2)
if (star < 1) {
star = 1
}
this.wordsData = {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!