diff --git a/src/api/modules/course.js b/src/api/modules/course.js index 00db854c..f0312fd6 100644 --- a/src/api/modules/course.js +++ b/src/api/modules/course.js @@ -440,6 +440,11 @@ const queryCrowd=function(query){ const ids=function (data){ return ajax.postJson('/xboe/m/course/manage/ids',data); } + +// ai播放器相关 - 批量AI设置 +const benchAiSet=function(data){ + return ajax.postJson('/xboe/m/course/manage/benchAiSet',data); +} export default { saveBase, submitCourse, @@ -482,6 +487,7 @@ export default { exportCourseAudit, exportCourse, queryCrowd, - ids + ids, + benchAiSet } diff --git a/src/assets/images/course/generationFailed.png b/src/assets/images/course/generationFailed.png new file mode 100644 index 00000000..5ca255d5 Binary files /dev/null and b/src/assets/images/course/generationFailed.png differ diff --git a/src/assets/images/course/languageIcon.png b/src/assets/images/course/languageIcon.png new file mode 100644 index 00000000..454e67cb Binary files /dev/null and b/src/assets/images/course/languageIcon.png differ diff --git a/src/assets/images/course/selectLanguage.png b/src/assets/images/course/selectLanguage.png new file mode 100644 index 00000000..f13efb3a Binary files /dev/null and b/src/assets/images/course/selectLanguage.png differ diff --git a/src/assets/styles/btn.scss b/src/assets/styles/btn.scss index e6ba1a8e..0cb69515 100644 --- a/src/assets/styles/btn.scss +++ b/src/assets/styles/btn.scss @@ -97,3 +97,29 @@ font-size: 14px; border-radius: 4px; } +// 已下架 +.custom-takeout{ + display: inline-block; + padding: 3px 13px; + border-radius: 20px; + font-size: 12px; + background: rgba(254, 249, 195, 1); + color: rgba(133, 77, 14, 1); + font-size: 12px; + font-weight: 500; + line-height: 17px; + letter-spacing: 0px; +} +// 已上架 +.custom-putaway{ + display: inline-block; + padding: 3px 13px; + border-radius: 20px; + font-size: 12px; + background: rgba(220, 252, 231, 1); + color: rgba(22, 101, 52, 1); + font-size: 12px; + font-weight: 500; + line-height: 17px; + letter-spacing: 0px; +} \ No newline at end of file diff --git a/src/components/Course/courseForm.vue b/src/components/Course/courseForm.vue index 71c1fb77..fed1ddcb 100644 --- a/src/components/Course/courseForm.vue +++ b/src/components/Course/courseForm.vue @@ -904,7 +904,7 @@ export default { } }); } - + this.initAiData(); } else { //console.log(editData,'editData'); this.weikeReset = editData.id; @@ -1005,6 +1005,23 @@ export default { console.error("获取字典信息失败:", error); } }, + // ai播放器相关 + // 初始化ai数据 + initAiData() { + // 如果ai设置为空则给默认值 - 会看成新增状态 + if(this.courseInfo.aiSet === null || this.courseInfo.aiSet === '' || this.courseInfo.aiSet === undefined){ + this.courseInfo.isAddAI = 1; //暂时是否是新增 + this.courseInfo.aiSet = 1; + this.courseInfo.aiAbstract = 1; + this.courseInfo.aiDraft = 1; + this.courseInfo.aiTranslate = 1; + this.courseInfo.languageStatus = 1; + this.courseInfo.languageCode = ['zh-CN', 'en-US']; + } else { + // 获取ai设置信息 + this.courseInfo.isAddAI = 0; + } + }, //获取课程信息 async getDetail(id) { this.curCourseId = id; @@ -1032,18 +1049,7 @@ export default { console.log("--- 编辑查看 this.isPermission = ",this.isPermission) console.log("--- 编辑查看 this.dicts = ",this.dicts) // ai播放器相关 - // 如果ai设置为空则给默认值 - 会看成新增状态 - if(this.courseInfo.aiSet === null || this.courseInfo.aiSet === '' || this.courseInfo.aiSet === undefined){ - this.courseInfo.isAddAI = 1; //暂时是否是新增 - this.courseInfo.aiSet = 1; - this.courseInfo.aiAbstract = 1; - this.courseInfo.aiDraft = 1; - this.courseInfo.aiTranslate = 1; - this.courseInfo.languageCode = ['zh-CN', 'en-US']; - } else { - // 获取ai设置信息 - this.courseInfo.isAddAI = 0; - } + this.initAiData() if(!this.courseInfo.orgId){ //根据课程创建者获取机构id apiUser.getOrgSimpleByUserId(result.course.sysCreateAid).then(ors=>{ diff --git a/src/components/VideoPlayer/index.vue b/src/components/VideoPlayer/index.vue index 33216033..f998c4a6 100644 --- a/src/components/VideoPlayer/index.vue +++ b/src/components/VideoPlayer/index.vue @@ -121,7 +121,7 @@
-
+
{{!currentLang ? 'AI翻译' : currentLangLabel}}
@@ -337,13 +337,17 @@ export default { }, // ai播放器相关 computed: { - ...mapGetters(['selectableLang','currentLang']) + ...mapGetters(['selectableLang','currentLang','courseInfo']), + isAiTranslate () { + return this.courseInfo?.aiSet == 1 && this.courseInfo?.aiTranslate == 1; + } }, created() { // ai播放器相关 this.SET_currentLang(''); }, mounted() { + console.log('---',this.isAiTranslate,this.courseInfo,'courseInfo'); this.videoDom = this.$refs.video; this.videoDom.focus({preventScroll: true}); let speedValue=localStorage.getItem('boe_video_speed'); diff --git a/src/data/pages.js b/src/data/pages.js index fa49ae36..d5d42d59 100644 --- a/src/data/pages.js +++ b/src/data/pages.js @@ -117,6 +117,8 @@ export const iframes=[ {title:'嵌入测试', path:'/iframe/index',hidden:false,component:'portal/iframe'}, {title:'课件管理', path:'/iframe/course/coursewares',hidden:false,component:'course/Courseware'}, {title:'课程管理', path:'/iframe/course/manages',hidden:false,component:'course/ManageList'}, + {title:'ai摘要', path:'/iframe/course/aiAbstract',hidden:false,component:'course/aiSet/aiAbstract'}, + {title:'ai翻译', path:'/iframe/course/aiTranslate',hidden:false,component:'course/aiSet/aiTranslate'}, {title:'考试试题管理', path:'/iframe/exam/questions',hidden:false,component:'exam/Question'}, {title:'查看答卷', path:'/iframe/exam/viewanswer',hidden:false,component:'exam/viewAnswer'}, {title:'考试试卷管理', path:'/iframe/exam/papers',hidden:false,component:'exam/TestPaper'}, diff --git a/src/security.js b/src/security.js index 9788cc03..a0fccc63 100644 --- a/src/security.js +++ b/src/security.js @@ -29,6 +29,19 @@ router.beforeEach((to, from, next) => { // 在免登录白名单,直接进入 next() }else{ + // if (!store.getters.init) { + // store.commit('app/SET_INITDATA',true); + // let myRouters=routers(); + // store.dispatch('GenerateRoutes',{routers:myRouters}).then(accessRoutes=>{ + // console.log('accessRoutes::',accessRoutes) + // router.addRoutes(accessRoutes) // 动态添加可访问路由表 + // next({ ...to, replace: true }) // hack方法 确保addRoutes已完成 + // }); + // } else { + // to.meta.keepAlive = true + // next(); + // } + // return; if(getToken()){ if(to.path === '/login'){ // 如果是外部用户,把配置的路由跳转到个人中心 diff --git a/src/store/getters.js b/src/store/getters.js index 38aac938..dd30759d 100644 --- a/src/store/getters.js +++ b/src/store/getters.js @@ -33,5 +33,6 @@ const getters = { selectableLang:state => state.video.selectableLang, currentLang:state => state.video.currentLang, currentTime:state => state.video.currentTime, + courseInfo:state => state.video.courseInfo, } export default getters diff --git a/src/store/modules/video.js b/src/store/modules/video.js index e91c2388..b1a82b3a 100644 --- a/src/store/modules/video.js +++ b/src/store/modules/video.js @@ -95,6 +95,7 @@ const state = { selectableLang: [], // 可选语言列表+字幕信息 currentLang: '', // 当前选中语言 currentTime: -1, // 当前视频时间 + courseInfo: {}, } const mutations = { @@ -117,15 +118,13 @@ const mutations = { SET_currentTime: (state, time) => { state.currentTime = time }, + SET_courseInfo: (state, info) => { + state.courseInfo = info + }, } const actions = { - unicomPraises({ commit }, data) { - commit('SET_praisesUnicom', data) - }, - unicomFavorites({ commit }, data) { - commit('SET_favoritesUnicom', data) - } + } export default { diff --git a/src/views/course/ManageList.vue b/src/views/course/ManageList.vue index f0454659..b5c771e5 100644 --- a/src/views/course/ManageList.vue +++ b/src/views/course/ManageList.vue @@ -456,11 +456,11 @@
AI摘要状态: - + {{ aiSetting.aiAbstract === 1 ? '已上架' : '已下架' }}
- + {{ aiSetting.aiAbstract === 0 ? '上架' : '下架' }} 编辑 @@ -470,11 +470,11 @@
AI文稿状态: - + {{ aiSetting.aiDraft === 1 ? '已上架' : '已下架' }}
- + {{ aiSetting.aiDraft === 0 ? '上架' : '下架' }}
@@ -483,11 +483,11 @@
AI翻译状态: - + {{ aiSetting.aiTranslate === 1 ? '已上架' : '已下架' }}
- + {{ aiSetting.aiTranslate === 0 ? '上架' : '下架' }} 编辑 @@ -495,22 +495,27 @@
-
- 支持语种: -
-
- 中文 - 已下架 -
-
- 英语 - 生成中 -
-
- 越南语 - 已上架 +
+ 支持语种: +
+
+ {{ getLanguageName(lang) }} + 已下架
+ + +
@@ -531,7 +536,7 @@ import auditCourse2 from '@/components/Course/auditCourse2.vue'; import adminPage from '@/components/Administration/adminPage.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'; @@ -632,7 +637,7 @@ export default { languageCode: ['zh-CN', 'en-US'] // 默认选中的语种 }, aiProcessSetting: { // 开启AI处理弹框 - dlgShow: true, + dlgShow: false, aiSet: 1, aiAbstract: 1, aiDraft: 1, @@ -685,6 +690,7 @@ export default { }, methods: { + getAudiences(){ apiUserbasic.getInAudienceIds().then(res=>{ if (res.status == 200) { @@ -1148,6 +1154,9 @@ export default { // ai播放器相关 + getLanguageName(lang){ + return this.selectAllLang.find(item => item.srclang === lang).label || ''; + }, handleSelectionChange(val){ this.selectedCourses = val; console.log(val); @@ -1172,115 +1181,109 @@ export default { }, // AI设置 setAI(row) { - this.aiSetting.courseId = row.id; - // 这里可以添加获取当前课程AI设置的逻辑 - this.aiSetting.dlgShow = true; + console.log('row', row); + this.aiSetting = { + dlgShow: true, + ...row + }; + }, + changeAIKey(key) { + this.aiSetting[key] = this.aiSetting[key] === 1 ? 0 : 1; }, - // 确认AI设置 confirmAISetting() { - const { courseId, aiSet, aiAbstract, aiDraft, aiTranslate } = this.aiSetting; - - // 这里可以添加保存AI设置的API调用 - console.log('保存AI设置', { - courseId, - aiSet, - aiAbstract, - aiDraft, - aiTranslate - }); - - // 模拟成功保存 - this.$message.success('AI设置保存成功'); - this.aiSetting.dlgShow = false; - // 可以选择是否刷新列表数据 + 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], (res) => { + this.$message.success('AI设置保存成功'); + this.aiSetting.dlgShow = false; + // 可以选择是否刷新列表数据 + this.searchData(); + }, (res) => { + this.$message.error('AI设置保存失败!'); + }) }, setLanguage() { if (this.selectedCourses.length > 0) { - this.languageSetting = {...this.languageSetting, ...this.getAIInfoByList(this.selectedCourses)} - this.languageSetting.dlgShow = true; + this.languageSetting = {...{ + dlgShow: true, + languageCode: ['zh-CN', 'en-US'] // 默认选中的语种 + }, ...this.getAIInfoByList(this.selectedCourses)} } }, enableAI() { // 开启AI处理按钮点击事件 if (this.selectedCourses.length > 0) { - this.aiProcessSetting = {...this.aiProcessSetting, ...this.getAIInfoByList(this.selectedCourses)} - this.aiProcessSetting.dlgShow = true; + this.aiProcessSetting = {...{ + dlgShow: true, + aiSet: 1, + aiAbstract: 1, + aiDraft: 1, + languageCode: ['zh-CN', 'en-US'] // 默认选中的语种 + }, ...this.getAIInfoByList(this.selectedCourses)} } }, - - async confirmLanguageSetting() { - try { - // 收集选中的课程ID - const courseIds = this.selectedCourses.map(course => course.id).join(','); - // 获取选择的语种 - const languages = this.languageSetting.selectedLanguages.join(','); - - // 这里可以根据实际需求调用API进行语种设置 - console.log('批量设置课程语种', { courseIds, languages }); - - // 显示成功提示 - this.$message({ - type: 'success', - message: `已成功为${this.selectedCourses.length}个课程设置语种`, - offset: 50 - }); - - // 关闭弹框 + // 批量设置语种 - 确认 + 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, (res) => { + this.$message.success('设置语种成功!'); this.languageSetting.dlgShow = false; - - // 刷新数据(如果需要) - // this.searchData(); - } catch (error) { - console.error('设置语种失败', error); - this.$message({ - type: 'error', - message: '设置语种失败,请稍后重试', - offset: 50 - }); - } - }, - async confirmAiProcess() { - try { - // 收集选中的课程ID - const courseIds = this.selectedCourses.map(course => course.id).join(','); - // 获取AI处理配置 - const { aiSet, aiAbstract, aiDraft, selectedLanguages } = this.aiProcessSetting; - - // 这里可以根据实际需求调用API进行AI处理设置 - console.log('批量开启AI处理', { - courseIds, - aiSet, - aiAbstract, - aiDraft, - languages: selectedLanguages.join(',') - }); - - // 模拟计算跳过和更新的课程数量 - const totalCourses = this.selectedCourses.length; - const skippedCount = Math.floor(totalCourses * 0.2); // 假设20%的课程已开启AI处理 - const updatedCount = totalCourses - skippedCount; - - // 显示成功提示 - this.$message({ - type: 'success', - message: `已跳过${skippedCount}个已开启AI处理的课程,成功为${updatedCount}个课程更新AI处理设置`, - offset: 50 - }); - - // 关闭弹框 - this.aiProcessSetting.dlgShow = false; - - // 刷新数据 + // 可以选择是否刷新列表数据 this.searchData(); - } catch (error) { - console.error('开启AI处理失败', error); - this.$message({ - type: 'error', - message: '开启AI处理失败,请稍后重试', - offset: 50 - }); + }, (res) => { + this.$message.error('设置语种失败!'); + }) + }, + + // 批量开启AI处理 - 确认 + confirmAiProcess() { + // 获取AI处理配置 + let { aiSet, aiAbstract, aiDraft, languageCode } = this.aiProcessSetting; + const courseList = deepCopy(this.selectedCourses); + 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, (res) => { + this.$message.success('开启AI处理成功!'); + this.aiProcessSetting.dlgShow = false; + // 可以选择是否刷新列表数据 + this.searchData(); + }, (res) => { + this.$message.error('开启AI处理失败!'); + }) + }, + + _benchAiSet(courseList, successCB, failCB) { + apiCourse.benchAiSet({courseList}).then(res => { + if(res.status === 200){ + successCB && successCB(res); + }else{ + failCB && failCB(res); + } + }) }, } }; @@ -1363,22 +1366,6 @@ export default { margin: 10px 0; line-height: 1.5; } -.status-badge{ - display: inline-block; - padding: 3px 13px; - border-radius: 20px; - font-size: 12px; - background: rgba(254, 249, 195, 1); - color: rgba(133, 77, 14, 1); - font-size: 12px; - font-weight: 500; - line-height: 17px; - letter-spacing: 0px; -} -.status-badge--active{ - background: rgba(220, 252, 231, 1); - color: rgba(22, 101, 52, 1); -} .languages-list{ display: flex; flex-wrap: wrap; diff --git a/src/views/course/aiSet/aiAbstract.vue b/src/views/course/aiSet/aiAbstract.vue new file mode 100644 index 00000000..2efd2c32 --- /dev/null +++ b/src/views/course/aiSet/aiAbstract.vue @@ -0,0 +1,245 @@ + + + + + diff --git a/src/views/course/aiSet/aiTranslate.vue b/src/views/course/aiSet/aiTranslate.vue new file mode 100644 index 00000000..28f146b6 --- /dev/null +++ b/src/views/course/aiSet/aiTranslate.vue @@ -0,0 +1,388 @@ + + + + + diff --git a/src/views/portal/course/Index.vue b/src/views/portal/course/Index.vue index 552f513e..ebe06897 100644 --- a/src/views/portal/course/Index.vue +++ b/src/views/portal/course/Index.vue @@ -393,7 +393,7 @@
- 摘要 + 摘要
diff --git a/src/views/study/coursenew.vue b/src/views/study/coursenew.vue index c77365dd..1c952d3d 100644 --- a/src/views/study/coursenew.vue +++ b/src/views/study/coursenew.vue @@ -376,6 +376,7 @@
@@ -650,7 +651,7 @@
-
+
@@ -1054,6 +1055,7 @@ export default { }, ...mapMutations({ SET_selectableLang: 'video/SET_selectableLang', + SET_courseInfo: 'video/SET_courseInfo', }), handleOpen(key, path) { if (this.isFalse) { @@ -1387,6 +1389,10 @@ export default { // ai播放器相关 - 视频处理 handleAIVideo(list = [], r) { this.SET_selectableLang(list); + this.SET_courseInfo(this.courseInfo); + if (this.courseInfo.aiSet && this.courseInfo.aiAbstract == 1 && this.courseInfo.summaryContent) { + this.coutab(4); + } console.log("ai处理", this.selectableLang); }, isShowTime() {