|
@@ -19,8 +19,10 @@ const route = useRoute();
|
|
|
const score = ref(0);
|
|
|
const data = ref(null);
|
|
|
const scoresList = ref(null);
|
|
|
+const defectsList = ref(null);
|
|
|
const taskId = computed(() => route.query.conversationId); // 会话ID "2c64eb8b69be432ca0bb9ae55bc78def"
|
|
|
const randarlist = ref([0, 0, 0, 0]);
|
|
|
+const loading = ref(false);
|
|
|
|
|
|
const nameMapping = {
|
|
|
introduction_profession: "自我介绍专业性",
|
|
@@ -28,17 +30,20 @@ const nameMapping = {
|
|
|
purchase_intent: "需求挖掘能力",
|
|
|
invitation_results: "沟通转化效果",
|
|
|
penalty_points: "扣分项",
|
|
|
+ defects: "评分详解"
|
|
|
};
|
|
|
|
|
|
const handleResult = async () => {
|
|
|
let res;
|
|
|
let shouldContinue = true; // 控制是否继续调用接口的标志
|
|
|
+ loading.value = true;
|
|
|
|
|
|
while (shouldContinue) {
|
|
|
res = await fetchTaskScore(taskId.value);
|
|
|
|
|
|
if (res.code !== 200) {
|
|
|
// 当返回错误时,停止调用接口
|
|
|
+ loading.value = false
|
|
|
shouldContinue = false;
|
|
|
} else if (res.body && Object.keys(res.body).length !== 0) {
|
|
|
// 当res.body有值时,停止调用接口
|
|
@@ -49,18 +54,20 @@ const handleResult = async () => {
|
|
|
}
|
|
|
}
|
|
|
if (res && res.code === 200 && res.body) {
|
|
|
+ loading.value = false;
|
|
|
const scores = extractScores(res.body);
|
|
|
score.value = scores.reduce((sum, score) => sum + score, 0);
|
|
|
scoresList.value = Object.keys(res.body).reduce((acc, key) => {
|
|
|
- // if (key !== "penalty_points") {
|
|
|
- acc[key] = {
|
|
|
- ...res.body[key],
|
|
|
- name: nameMapping[key], // 添加 name 字段
|
|
|
- };
|
|
|
- // }
|
|
|
+ if (key !== "defects") {
|
|
|
+ acc[key] = {
|
|
|
+ ...res.body[key],
|
|
|
+ name: nameMapping[key], // 添加 name 字段
|
|
|
+ };
|
|
|
+ }
|
|
|
return acc;
|
|
|
}, {});
|
|
|
- console.log(scoresList.value,'000000000');
|
|
|
+ defectsList.value = res.body.defects;
|
|
|
+ console.log(defectsList.value, '000000000');
|
|
|
const obj = extractScores(scoresList.value);
|
|
|
randarlist.value = Object.values(obj);
|
|
|
}
|
|
@@ -71,7 +78,7 @@ const extractScores = (data) => {
|
|
|
return Object.values(data).map((item) => {
|
|
|
// 确保 score 是一个字符串,并且去除可能的 "分" 字
|
|
|
let scoreStr = String(item.score).replace("分", "");
|
|
|
-
|
|
|
+
|
|
|
// 将 score 转换为整数,如果转换失败则返回 0
|
|
|
const score = parseInt(scoreStr, 10);
|
|
|
return isNaN(score) ? 0 : score;
|
|
@@ -100,8 +107,7 @@ onBeforeUnmount(() => {
|
|
|
<div class="score">
|
|
|
<span>最终得分</span>
|
|
|
<p class="score-num">
|
|
|
- <span style="margin-right: 0.2rem;">{{ score }}</span
|
|
|
- >分
|
|
|
+ <span style="margin-right: 0.2rem;">{{ score }}</span>分
|
|
|
</p>
|
|
|
</div>
|
|
|
<div style="height: 9.06rem; visibility: hidden"></div>
|
|
@@ -109,20 +115,17 @@ onBeforeUnmount(() => {
|
|
|
<div style="width: 100vw; height: 19.06rem">
|
|
|
<randarPage :randarList="randarlist" />
|
|
|
</div>
|
|
|
+ <div class="loading" v-show="loading">
|
|
|
+ <van-loading color="#0094ff" size="26px" vertical>加载中...</van-loading>
|
|
|
+ </div>
|
|
|
<div class="standard">
|
|
|
<div class="standard-title">
|
|
|
<img src="../assets/robot.jpg" alt="" />
|
|
|
<span>评分标准</span>
|
|
|
</div>
|
|
|
- <div
|
|
|
- class="standard-content"
|
|
|
- v-for="(item, key) in scoresList"
|
|
|
- :key="key"
|
|
|
- >
|
|
|
+ <div class="standard-content" v-for="(item, key) in scoresList" :key="key">
|
|
|
<div class="standard-subtitle">
|
|
|
- <span class="pro"
|
|
|
- >{{ item.name == "扣分项" ? item.name : `${item.name}(25分)`}}:</span
|
|
|
- >
|
|
|
+ <span class="pro">{{ item.name == "扣分项" ? item.name : `${item.name}(25分)` }}:</span>
|
|
|
<span>{{ item.score }}</span>
|
|
|
</div>
|
|
|
<p>
|
|
@@ -130,7 +133,31 @@ onBeforeUnmount(() => {
|
|
|
<span>{{ item.reason }}</span>
|
|
|
</p>
|
|
|
</div>
|
|
|
+ <div class="standard-content" style="margin-top: 1.5rem;">
|
|
|
+ <div class="standard-title">
|
|
|
+ <img src="../assets/robot.jpg" alt="" />
|
|
|
+ <span>评分详解</span>
|
|
|
+ </div>
|
|
|
+ <div class="standard-content" v-for="(item, index) in defectsList" :key="index">
|
|
|
+ <div class="standard-subtitle">
|
|
|
+ <span class="pro">轮次{{item.rounds}}:</span>
|
|
|
+ </div>
|
|
|
+ <p>
|
|
|
+ <span>原句:</span>
|
|
|
+ <span>{{ item.original_sentence }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <span>不足:</span>
|
|
|
+ <span>{{ item.defect }}</span>
|
|
|
+ </p>
|
|
|
+ <p>
|
|
|
+ <span>建议:</span>
|
|
|
+ <span>{{ item.example }}</span>
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
@@ -258,4 +285,17 @@ body {
|
|
|
.standard-content p span:nth-child(1) {
|
|
|
font-weight: 600;
|
|
|
}
|
|
|
+
|
|
|
+.loading {
|
|
|
+ position: fixed;
|
|
|
+ top: 0;
|
|
|
+ left: 0;
|
|
|
+ width: 100%;
|
|
|
+ height: 100%;
|
|
|
+ background-color: rgba(0, 0, 0, 0.5);
|
|
|
+ display: flex;
|
|
|
+ justify-content: center;
|
|
|
+ align-items: center;
|
|
|
+ z-index: 9999;
|
|
|
+}
|
|
|
</style>
|