Commit c3f5c09e by crushh

update: mergin

parents 6478c07a f506ea1e
......@@ -28,13 +28,24 @@
<div class="no-data-text">还未创建话术,请联系运营经理创建话术</div>
</div>
<el-dialog :visible.sync="tempDetail.show" @closed="onClosed" width="760px" title="查看话术">
<div class="temp-detail-item" v-for="el in 3" :key="el">
<div class="temp-detail-content">
<div class="temp-detail-title">普通节点</div>
<div class="temp-detail-desc">您好,我是江南布衣集团的首席福利官Rocky(停顿1秒),看到本月是您的生日月,祝您生日快乐呀!(空白2s)您的生日福利包已经准备好咯,本月有专属的生日折扣券和生日礼品福利可以领取呢~我稍后把领取路径发您手机上,记得点击领取一下哦~您的生日礼需要到所属的服务门店凭券直接领取,本月什么时候方便领取一下呢?</div>
<div v-if="!Array.isArray(tempDetail.tempData) || tempDetail.tempData.length == 0" class="no-temp-data">暂无话术节点</div>
<template v-else>
<div class="temp-detail-item" v-for="el in tempDetail.tempData" :key="el.decisionId">
<div class="temp-detail-content">
<div class="temp-detail-title">{{ el.decisionNodeType | formatNodeType }}</div>
<div v-if="!Array.isArray(el.list) || el.list.length == 0" class="no-temp-data">暂无录音</div>
<template v-else>
<div v-for="item in el.list" :key="item.id" class="sound-record">
<div class="temp-detail-desc">{{ item.knowledge }}</div>
<template v-if="item.realKnowledgeOssUrl">
<el-button type="text" @click="onPlay">播放</el-button>
<audio id="player" :src="item.realKnowledgeOssUrl"></audio>
</template>
</div>
</template>
</div>
</div>
<el-button type="text">播放</el-button>
</div>
</template>
</el-dialog>
</div>
</template>
......@@ -42,9 +53,6 @@
<script>
import { tempPageStatistics, tempDetail } from '@/service/api/aiApi.js';
import { formatDateTimeByType } from '@/utils/index.js';
// TODO 渲染话术详情、播放话术录音
// TODO 话术列表接口total字段异常
// TODO 需求文档中话术列表无-1的状态,所以接口是否要过滤掉-1的状态
export default {
name: 'Message',
data() {
......@@ -80,6 +88,10 @@ export default {
const list = [{ label: '三方删除', value: -1 }, ...statusList];
const state = list.find(el => el.value == status);
return state ? state.label : '--';
},
formatNodeType(type) {
const types = ['普通节点', '跳转节点', 'IVR节点', '数据采集节点', '条件判断节点'];
return types[type] || '--';
}
},
created() {
......@@ -96,7 +108,7 @@ export default {
},
getTempDetail() {
tempDetail({ aiTemplateId: this.tempDetail.aiTemplateId }).then(res => {
console.log(res);
this.tempDetail.tempData = res.result.list;
});
},
onSearch() {
......@@ -118,6 +130,9 @@ export default {
onClosed() {
this.tempDetail.aiTemplateId = '';
this.tempDetail.tempData = [];
},
onPlay() {
document.getElementById('player').play();
}
}
};
......@@ -213,11 +228,13 @@ export default {
}
}
}
.no-temp-data {
padding-bottom: 20px;
text-align: center;
color: #909399;
}
.temp-detail-item {
padding-bottom: 10px;
display: flex;
justify-content: space-between;
align-items: center;
+ .temp-detail-item {
padding-top: 10px;
border-top: 1px solid #e4e7ed;
......@@ -230,12 +247,24 @@ export default {
color: #303133;
line-height: 20px;
}
.temp-detail-desc {
width: 650px;
font-size: 14px;
font-weight: 400;
color: #303133;
line-height: 20px;
.sound-record {
display: flex;
justify-content: space-between;
align-items: center;
+ .sound-record {
margin-top: 10px;
.temp-detail-desc {
padding-top: 10px;
border-top: 1px solid #e4e7ed;
}
}
.temp-detail-desc {
width: 650px;
font-size: 14px;
font-weight: 400;
color: #303133;
line-height: 20px;
}
}
}
}
......
/**
* 解析property
* @param {Number | String} val property值,也可能是多个对应值之和
* @return {Object} map
* @return {Boolean} map.isCompute 是否是计算属性
* @return {Boolean} map.isField 是否是字段属性
* @return {Boolean} map.isValue 是否是值属性
* @return {Boolean} map.isCategray 是否是不是属性
* @return {Boolean} map.notProperty 是否是类别属性
*/
export default val => {
// 用二进制对应位上的1表示对应属性的开启状态
// {
// 1: '0001', // 计算属性
// 2: '0010', // 字段属性
// 4: '0100', // 值属性
// 8: '1000', // 不是属性
// 16: '00010000', // 类别属性
// }
// 将val转为二进制,来处理值之和的情况,例如:3 = 1 + 2 = 0001 + 0010 = 0011
// 然后再把二进制值的字符串转为数字,调转顺序,0 1转为bool
const status = Number(val)
.toString(2)
.split('')
.reverse()
.map(i => i == 1);
// 根据上面的键值对表,从二进制最末一位开始,对应在数组里
const keys = ['isCompute', 'isField', 'isValue', 'isCategray', 'notProperty'];
// 根据数组转换出状态结果
return keys.reduce((map, key, index) => ({ ...map, [key]: !!status[index] }), {});
};
......@@ -623,7 +623,7 @@ export default {
getAiTotalFee({ accountDepartId, searchParam, beginTime, endTime }).then(data => {
const { errorCode, result } = data;
if (errorCode == 0) {
this.sumFee = result != null ? result / 1000 : 0;
this.sumFee = result != null ? result : 0;
}
});
} catch (err) {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment