Commit c3b779d2 by zhangxw

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

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