From bb453a0200bc591713b0e005e6b0122815a84e48 Mon Sep 17 00:00:00 2001
From: huweihang <916879598@qq.com>
Date: Mon, 22 Dec 2025 23:39:05 +0800
Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0AI=E6=92=AD=E6=94=BE?=
=?UTF-8?q?=E5=99=A8=E7=9B=B8=E5=85=B3=E5=8A=9F=E8=83=BD=E5=92=8C=E8=AE=BE?=
=?UTF-8?q?=E7=BD=AE=E7=95=8C=E9=9D=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 新增批量语种设置和开启AI处理按钮
- 实现AI翻译、AI处理和AI设置的弹框功能
- 增加AI权限检查和相关状态管理
- 更新表格选择功能以支持AI相关操作
---
src/views/course/ManageListRemote.vue | 486 +++++++++++++++++++++++++-
1 file changed, 483 insertions(+), 3 deletions(-)
diff --git a/src/views/course/ManageListRemote.vue b/src/views/course/ManageListRemote.vue
index 2a7ce99b..e6aaf068 100644
--- a/src/views/course/ManageListRemote.vue
+++ b/src/views/course/ManageListRemote.vue
@@ -162,6 +162,25 @@
-
+
+
+
选择
@@ -444,6 +465,234 @@
+
+
+
+
+
+ 注:仅支持对已开启AI处理的课程进行批量语种设置;所选的课程中有{{languageSetting.aiSetNoNum}}个未开启AI处理的课程,以上配置仅对{{languageSetting.aiSetNum}}个已开启AI处理的课程生效。
+
+
+ 取消
+ 确认
+
+
+
+
+
+
+
+
+
+
+
+
+ AI处理:
+
+
+ {{ aiProcessSetting.aiSet === 1 ? '开启' : '关闭' }}
+
+
+
+
+
+
+
+
+
+
+
+ AI摘要:
+
+
+ {{ aiProcessSetting.aiAbstract === 1 ? '开启' : '关闭' }}
+
+
+
+
+
+
+
+
+
+
+
+ AI文稿:
+
+
+ {{ aiProcessSetting.aiDraft === 1 ? '开启' : '关闭' }}
+
+
+
+
+
+
+
+
+
+
+
+ AI翻译语种:
+
+
+
+
+
+
+
+
+
+ 注:已跳过{{aiProcessSetting.aiSetNum}}个已开启AI处理的课程,仅更新剩余{{aiProcessSetting.aiSetNoNum}}个
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ AI功能状态:
+
+
+ {{ aiSetting.aiSet === 1 ? '已开放' : '未开放' }}
+
+
+
+
+
+
+
@@ -457,7 +706,7 @@ import adminPage from '@/components/Administration/adminPage.vue';
import TopCourseSorter from '@/components/Course/TopCourseSorter.vue';
import apiResowner from '../../api/modules/resowner.js';
import apiType from '../../api/modules/type.js'
-import { courseType } from '../../utils/tools.js';
+import { courseType, deepCopy } from '../../utils/tools.js';
import apiCourse from '@/api/modules/course.js';
// import {resOwnerIndexName,sysTypeIndexName} from '@/utils/type.js';
import { mapGetters, mapActions } from 'vuex';
@@ -467,7 +716,7 @@ export default {
name: 'manageCourse',
components: { courseForm, manager, auditCourse1, auditCourse2, adminPage, TopCourseSorter },
computed: {
- ...mapGetters(['resOwnerMap', 'sysTypeMap', 'userInfo', 'identity']),
+ ...mapGetters(['resOwnerMap', 'sysTypeMap', 'userInfo', 'identity', 'selectAllLang']),
resOwnerCascaderProps() {
// 搜索模式:关闭懒加载,直接使用全量 options
if (this.resOwnerSearchMode) {
@@ -611,12 +860,44 @@ export default {
extendRefId: '',
extendRefType: '',
scrollbarStyleApplied: false,
+ // AI 播放器相关
+ aiPermission: false,
+ selectedCourses: [],
+ languageSetting: {
+ dlgShow: false,
+ languageCode: ['zh-CN', 'en-US'],
+ aiSetNum: 0,
+ aiSetNoNum: 0
+ },
+ aiProcessSetting: {
+ dlgShow: false,
+ aiSet: 1,
+ aiAbstract: 1,
+ aiDraft: 1,
+ languageCode: ['zh-CN', 'en-US'],
+ aiSetNum: 0,
+ aiSetNoNum: 0
+ },
+ aiSetting: {
+ dlgShow: false,
+ courseId: '',
+ aiSet: 1,
+ aiAbstract: 1,
+ aiDraft: 1,
+ aiTranslate: 1,
+ languageCode: ['zh-CN', 'en-US', 'vi-VN']
+ },
+ aiSetTip: '是否将课程进行AI处理',
+ aiAbstractTip: '一键提炼课程视频核心要点,助力学员课前高效掌握重点,快速筛选学习资源',
+ aiDraftTip: '分段展示视频内容并精准同步时间轴,实现视频进度与文稿双向定位,学习内容触手可及',
+ aiTranslateTip: '智能转换视频字幕与语音为多语种,支持全球学员按需切换语言,打破学习边界',
};
},
created() {
this.pickerOptions = this.buildPickerOptions();
},
mounted() {
+ this.getAiPermission();
this.getAudiences()
let chooseFlag = this.$route.query.f;
this.extendRefId = this.$route.query.refId;
@@ -1769,6 +2050,8 @@ export default {
return this.isDisable(row);
case 'toggleTop':
return this.setTop(row);
+ case 'aiSetting':
+ return this.setAI(row);
default:
return;
}
@@ -1779,6 +2062,9 @@ export default {
if (row.isPermission && !this.forChoose && row.status == 2) {
actions.push({ key: 'withdraw', label: '撤回', className: 'action-link--primary' });
}
+ if (this.aiPermission) {
+ actions.push({ key: 'aiSetting', label: 'AI设置', className: 'action-link--primary' });
+ }
if (row.isPermission && row.status != 2) {
actions.push({ key: 'edit', label: '编辑', className: 'action-link--primary' });
}
@@ -1837,6 +2123,151 @@ export default {
if (inputInner) {
inputInner.style.width = `${target}px`;
}
+ },
+ // AI 播放器相关方法
+ getLanguageName(lang) {
+ const item = (this.selectAllLang || []).find(it => it.srclang === lang);
+ return (item && item.label) || '';
+ },
+ handleSelectionChange(val) {
+ this.selectedCourses = val || [];
+ },
+ getAIInfoByList(list = []) {
+ const total = list.length;
+ let aiSetNum = 0;
+ let aiSetNoNum = 0;
+ list.forEach(item => {
+ if (item.aiSet === 1) {
+ aiSetNum++;
+ } else {
+ aiSetNoNum++;
+ }
+ });
+ return {
+ selectNum: total,
+ aiSetNum,
+ aiSetNoNum
+ };
+ },
+ setAI(row) {
+ this.aiSetting = {
+ dlgShow: true,
+ ...row
+ };
+ },
+ changeAIKey(key) {
+ this.aiSetting[key] = this.aiSetting[key] === 1 ? 0 : 1;
+ },
+ confirmAISetting() {
+ const item = deepCopy(this.aiSetting);
+ item.languageStatus = item.aiSet;
+ item.languageCode = item.languageCode || [];
+ if (!item.languageCode.includes('zh-CN')) {
+ item.languageCode.unshift('zh-CN');
+ }
+ this._benchAiSet(
+ [item],
+ () => {
+ this.$showManageMessage('AI设置保存成功', 'success');
+ this.aiSetting.dlgShow = false;
+ this.searchData();
+ },
+ () => {
+ this.$showManageMessage('AI设置保存失败!', 'error');
+ }
+ );
+ },
+ setLanguage() {
+ if (!this.selectedCourses.length) return;
+ const info = this.getAIInfoByList(this.selectedCourses);
+ this.languageSetting = {
+ dlgShow: true,
+ languageCode: ['zh-CN', 'en-US'],
+ ...info
+ };
+ },
+ enableAI() {
+ if (!this.selectedCourses.length) return;
+ const info = this.getAIInfoByList(this.selectedCourses);
+ this.aiProcessSetting = {
+ dlgShow: true,
+ aiSet: 1,
+ aiAbstract: 1,
+ aiDraft: 1,
+ languageCode: ['zh-CN', 'en-US'],
+ ...info
+ };
+ },
+ confirmLanguageSetting() {
+ const courseList = deepCopy(this.selectedCourses || []);
+ let languageCode = deepCopy(this.languageSetting.languageCode || []);
+ if (!languageCode.includes('zh-CN')) {
+ languageCode.unshift('zh-CN');
+ }
+ courseList.forEach(item => {
+ item.languageCode = languageCode;
+ item.aiTranslate = item.aiSet;
+ item.languageStatus = item.aiSet;
+ });
+ this._benchAiSet(
+ courseList,
+ () => {
+ this.$showManageMessage('设置语种成功!', 'success');
+ this.languageSetting.dlgShow = false;
+ this.searchData();
+ },
+ () => {
+ this.$showManageMessage('设置语种失败!', 'error');
+ }
+ );
+ },
+ confirmAiProcess() {
+ const courseList = deepCopy(this.selectedCourses || []);
+ let { aiSet, aiAbstract, aiDraft, languageCode } = this.aiProcessSetting;
+ languageCode = languageCode || [];
+ if (!languageCode.includes('zh-CN')) {
+ languageCode.unshift('zh-CN');
+ }
+ courseList.forEach(item => {
+ item.aiSet = aiSet;
+ item.aiAbstract = aiAbstract;
+ item.aiDraft = aiDraft;
+ item.aiTranslate = aiSet;
+ item.languageStatus = aiSet;
+ item.languageCode = languageCode;
+ });
+ this._benchAiSet(
+ courseList,
+ () => {
+ this.$showManageMessage('开启AI处理成功!', 'success');
+ this.aiProcessSetting.dlgShow = false;
+ this.searchData();
+ },
+ () => {
+ this.$showManageMessage('开启AI处理失败!', 'error');
+ }
+ );
+ },
+ _benchAiSet(courseList, successCB, failCB) {
+ apiCourse.benchAiSet({ courseList }).then(res => {
+ if (res && res.status === 200) {
+ if (successCB) successCB(res);
+ } else if (failCB) {
+ failCB(res);
+ }
+ });
+ },
+ getAiPermission() {
+ apiCourse.listByUser({}).then(res => {
+ if (res && res.code === 200 && Array.isArray(res.data)) {
+ const index = res.data.findIndex(item => item.permissionCode === 'KjbAiSetCode');
+ this.aiPermission = index !== -1;
+ } else {
+ this.aiPermission = false;
+ }
+ }).catch(() => {
+ this.aiPermission = false;
+ });
}
}
};
@@ -2219,6 +2650,55 @@ export default {
overflow: hidden;
}
+// AI 播放器相关样式
+.form-item {
+ margin-bottom: 20px;
+ display: flex;
+ align-items: center;
+ gap: 10px;
+}
+
+.form-label {
+ white-space: nowrap;
+ font-size: 14px;
+ color: #000000;
+}
+
+.status-text {
+ font-size: 14px;
+ color: #000000;
+}
+
+.action-buttons {
+ display: flex;
+ gap: 10px;
+ margin-left: auto;
+}
+
+.tips {
+ color: #f56c6c;
+ font-size: 12px;
+ margin: 10px 0;
+ line-height: 1.5;
+}
+
+.languages-list {
+ display: flex;
+ flex-wrap: wrap;
+ gap: 20px;
+}
+
+.language-tag {
+ display: inline-block;
+ padding: 4px 12px;
+ border-radius: 4px;
+ background-color: #f5f5f5;
+ font-size: 12px;
+}
+
+// 注意:custom-putaway 和 custom-takeout 已在全局样式 src/assets/styles/btn.scss 中定义
+// 无需在此重复定义
+
::v-deep .el-table .el-table__body-wrapper::-webkit-scrollbar-thumb {
border-radius: 4px;
background-color: #4284F7;