Commit aede6582 authored by Jeff nan's avatar Jeff nan

feat

parent e4661791
...@@ -220,11 +220,18 @@ function initVueApp(savedData) { ...@@ -220,11 +220,18 @@ function initVueApp(savedData) {
return this.getResultRows(this.vocalResult); return this.getResultRows(this.vocalResult);
}, },
getResultRows(result) { getResultRows(result) {
const cleaned = this.omitUsageFields(result) || {};
return Object.keys(cleaned).map((k) => ({ key: k, value: cleaned[k] }));
},
// 去掉前端不适配的用量字段
omitUsageFields(obj) {
if (obj == null || typeof obj !== 'object') return obj;
const hideKeys = { ai_amount: 1, ai_balance: 1, token_usage: 1 }; const hideKeys = { ai_amount: 1, ai_balance: 1, token_usage: 1 };
const data = result || {}; const out = {};
return Object.keys(data) Object.keys(obj).forEach((k) => {
.filter((k) => !hideKeys[k]) if (!hideKeys[k]) out[k] = obj[k];
.map((k) => ({ key: k, value: data[k] })); });
return out;
}, },
async getAuthKey() { async getAuthKey() {
// courseware 同名事件不能并发监听:并行调用会互相覆盖,只保留最后一次 // courseware 同名事件不能并发监听:并行调用会互相覆盖,只保留最后一次
...@@ -2649,13 +2656,13 @@ function initVueApp(savedData) { ...@@ -2649,13 +2656,13 @@ function initVueApp(savedData) {
data.task_uuid = this.task_uuid; data.task_uuid = this.task_uuid;
} }
if (this.subtitlesResult != null) { if (this.subtitlesResult != null) {
data.subtitlesResult = this.subtitlesResult; data.subtitlesResult = this.omitUsageFields(this.subtitlesResult);
} }
if (this.vocalTaskUuid) { if (this.vocalTaskUuid) {
data.vocalTaskUuid = this.vocalTaskUuid; data.vocalTaskUuid = this.vocalTaskUuid;
} }
if (this.vocalResult != null) { if (this.vocalResult != null) {
data.vocalResult = this.vocalResult; data.vocalResult = this.omitUsageFields(this.vocalResult);
} }
window.courseware.setData(data, function () { window.courseware.setData(data, function () {
}, key); }, key);
......
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