3 lines
35 KiB
JavaScript
3 lines
35 KiB
JavaScript
import{f as p}from"./org.c2b47d31.js";/* empty css */import{n as l}from"./vueComponentNormalizer.9ef17bb1.js";/* empty css */import{T as y}from"./TableLayout.05a39499.js";import{D as C}from"./DialogLayout.e3af3567.js";/* empty css */import{P as v}from"./Preview.1248e311.js";import{u as g}from"./my-course.a3711b76.js";import{C as w,a as _,s as S}from"./button-selft.87bbc4e0.js";import{d as b}from"./utils.068fedb0.js";import{y as I,g as F,u as k}from"./index.51e15757.js";import{i as x,j as $}from"./online-course.ea64e478.js";import{P as E}from"./PaperSelectQuestionTable.45cbe4d9.js";import{C as T}from"./course-disscuss.4aaeee1b.js";var D=function(){var e,t=this,i=t.$createElement,s=t._self._c||i;return s("div",{ref:"studybox",staticClass:"course-study"},[s("div",{staticClass:"course-study-header"},[s("span",[t._v("\u8BFE\u4EF6\u540D\u79F0\uFF1A"+t._s(t.nowStudyCourseware.name))]),s("span",[t._v("\u8BFE\u4EF6\u8981\u6C42\u5B66\u4E60\u65F6\u957F\uFF1A"+t._s(t.nowStudyCourseware.studyTime)+"\u5206\u949F")]),s("span",[t._v("\u8BFE\u4EF6\u5DF2\u7ECF\u5B66\u4E60\u65F6\u957F\uFF1A"),t.studyTIme_minute?s("i",[t._v(t._s(t.studyTIme_minute)+"\u5206\u949F")]):t._e(),s("i",[t._v(t._s(t.studyTIme_seconds)+"\u79D2")])]),s("el-progress",{staticStyle:{width:"50%",display:"flex","align-items":"center"},attrs:{percentage:t.studyProgress}}),s("div",{staticClass:"quanping"},[s("el-tooltip",{staticClass:"item",attrs:{effect:"dark",content:"\u5168\u5C4F",placement:"top"}},[this.isFullscreen?s("div",{staticClass:"unquanping-text",on:{click:function(o){return t.fullscreen(!1)}}},[t._v(" \u9000\u51FA\u5168\u5C4F ")]):s("div",{staticClass:"i-j-jxzb-quanping",on:{click:function(o){return t.fullscreen(!0)}}})])],1)],1),s("div",{staticClass:"course-study-perview"},[s("perview",{attrs:{timeline:(e=t.nowStudyCoursewar)===null||e===void 0?void 0:e.canSpeed,resource:t.nowStudyCourseware.info}})],1)])},W=[];const O={props:{nowStudyCourseware:{default:()=>{}},baseCourseForm:{default:()=>{}}},components:{perview:v},data(){return{needTime:0,studyTIme_all:0,studyTIme_seconds:0,timeFunction:null,submitTimeFunction:null,isSuspend:!1,studyTIme_minute:0,isFirstAlert:!0,isFullscreen:!1}},computed:{studyProgress(){const e=this.needTime?parseInt(this.studyTIme_all/this.needTime*100):100;return e>100?100:e}},watch:{},methods:{getInfoTIme(){this.studyTIme_minute=parseInt(this.studyTIme_all/60),this.studyTIme_seconds=Math.floor(this.studyTIme_all%60)||0},submitTime(){this.submitTimeFunction=setInterval(async()=>{const e=this.needTime?parseInt(this.studyTIme_all/this.needTime*100):100;this.nowStudyCourseware.studyProgress=e;let t=0,i=!0;this.baseCourseForm.courseSectionContent.forEach(r=>{r.courseware.forEach(n=>{n.studyProgress<100&&(i=!1)})}),t>=this.nowStudyCourseware.grade&&(t=this.nowStudyCourseware.grade,this.baseCourseForm.courseSectionContent.forEach(r=>{r.studyOver=!0}),this.isFirstAlert&&(this.alertUser("\u5F53\u524D\u8BFE\u7A0B\u5B66\u4E60\u5DF2\u7ED3\u675F\uFF0C\u53EF\u9009\u62E9\u5176\u4ED6\u8BFE\u7A0B\u5B66\u4E60\uFF01"),this.isFirstAlert=!1,this.$emit("courseWareStudyOver"))),e>=100&&this.isFirstAlert&&(this.alertUser("\u5F53\u524D\u8BFE\u4EF6\u5B66\u4E60\u5DF2\u7ED3\u675F\uFF0C\u53EF\u9009\u62E9\u5176\u4ED6\u8BFE\u4EF6\u7EE7\u7EED\u5B66\u4E60\uFF01"),this.isFirstAlert=!1,this.$emit("courseWareStudyOver"));const s={id:this.nowStudyCourseware.record_wareId,recordId:this.nowStudyCourseware.recordId,coursewareId:this.nowStudyCourseware.id,courseStudyOver:i?3:2,studyProgress:e>100?100:e,score:t,learningDuration:this.studyTIme_all};e>100&&(this.studyProgress=100);const o=await g(s);this.$set(this.nowStudyCourseware,"record_wareId",o.data.id)},2e3)},alertUser(e){this.$message.success(e)},fullscreen(e){const t=this.$refs.studybox;e?t.requestFullscreen():document.exitFullscreen(),t.onfullscreenchange=()=>{this.isFullscreen=!this.isFullscreen}}},created(){},mounted(){this.needTime=this.nowStudyCourseware.studyTime*60,this.studyTIme_all=this.nowStudyCourseware.learningDuration,this.getInfoTIme(),this.timeFunction=setInterval(()=>{this.isSuspend||(this.studyTIme_seconds>=59?(this.studyTIme_seconds=0,this.studyTIme_minute++):this.studyTIme_seconds++,this.studyTIme_all++)},1e3),this.submitTime()},beforeCreate(){},beforeMount(){},beforeUpdate(){},beforeDestroy(){clearInterval(this.submitTimeFunction),clearInterval(this.timeFunction)},updated(){},beforeUnmount(){},unmounted(){},activated(){}},u={};var P=l(O,D,W,!1,L,"658689eb",null,null);function L(e){for(let t in u)this[t]=u[t]}const A=function(){return P.exports}();var K=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"course-section-box"},[i("div",{staticClass:"section-left section-main"},[e.isStudy?i("div",{staticClass:"main-title"},[e._v(e._s(e.baseCourseForm.name))]):i("div",{staticClass:"main-title"},[e._v("\u65B0\u5EFA\u7AE0\u8282")]),i("div",{staticClass:"section-left-content"},[e.isStudy?e._e():i("el-button",{staticClass:"add-section-button",attrs:{round:"",type:"primary"},on:{click:e.addSection}},[i("i",{staticClass:"el-icon-plus"}),e._v("\u6DFB\u52A0\u7AE0\u8282")]),i("div",{staticClass:"section-list",on:{click:function(s){e.nowCheckSection={}}}},e._l(e.baseCourseForm.courseSectionContent,function(s,o){return i("div",{directives:[{name:"show",rawName:"v-show",value:!s.delFlag,expression:"!course.delFlag"}],key:o,staticClass:"every-section-label"},[i("div",{class:`section-label ${e.nowCheckSection.onlyKey==s.onlyKey&&"section-label-check"} ${s.studyOver?"section-study-over ":""}
|
|
${e.isStudy?"section-study ":""}`,on:{click:function(r){return r.stopPropagation(),e.checkSection(s,o)}}},[i("span",{staticClass:"label-title label-title-section"},[e._v(" "+e._s(s.name))]),e.isStudy?e._e():i("div",{staticClass:"label-toolbar label-toolbar-section"},[i("i",{staticClass:"el-icon-delete",on:{click:function(r){return r.stopPropagation(),e.deleteSection(s)}}}),i("div",{staticClass:"movelevel-button-box"},[i("li",{staticClass:"el-icon-arrow-up movelevel-button",on:{click:function(r){return r.stopPropagation(),e.move_Section(s,"up",o,"section")}}}),i("li",{staticClass:"el-icon-arrow-down movelevel-button",on:{click:function(r){return r.stopPropagation(),e.move_Section(s,"down",o,"section")}}})])])])])}),0)],1)]),i("div",{staticClass:"section-center section-main"},[i("div",{staticClass:"section-center-man"},[e.isStudy?i("div",{staticClass:"main-title"},[e._v("\u7AE0\u8282\u4FE1\u606F")]):i("div",{staticClass:"main-title"},[e._v("\u7AE0\u8282\u7F16\u8F91\u5668")]),i("div",{staticClass:"section-center-content"},[i("el-form",{ref:"numberValidateForm",staticClass:"demo-ruleForm",attrs:{model:e.nowCheckSection,"label-width":"100px",disabled:!e.nowCheckSection.onlyKey}},[i("el-form-item",{attrs:{label:"\u7AE0\u8282\u6807\u9898",prop:"name",rules:[{required:!0,message:"\u7AE0\u8282\u6807\u9898\u4E0D\u53EF\u4E3A\u7A7A"}]}},[e.isStudy?i("div",{staticClass:"input-replace"},[e._v(" "+e._s(e.nowCheckSection.name)+" ")]):i("el-input",{staticStyle:{width:"50%"},attrs:{autocomplete:"off"},model:{value:e.nowCheckSection.name,callback:function(s){e.$set(e.nowCheckSection,"name",s)},expression:"nowCheckSection.name"}})],1),i("el-form-item",{attrs:{label:"\u7AE0\u8282\u7B80\u4ECB"}},[e.isStudy?i("div",{staticClass:"input-replace"},[e._v(" "+e._s(e.nowCheckSection.explain)+" ")]):i("el-input",{staticClass:"scection-textarea-explain",attrs:{type:"textarea",autocomplete:"off"},model:{value:e.nowCheckSection.explain,callback:function(s){e.$set(e.nowCheckSection,"explain",s)},expression:"nowCheckSection.explain"}})],1),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:!e.nowStudyCourseware,expression:"!nowStudyCourseware"}],staticClass:"ware-table-item",attrs:{label:"\u8BFE\u4EF6\u8BBE\u7F6E"}},[i("TableLayout",{attrs:{column:e.column,height:"300",data:e.showCourewareList,pageInfo:e.pageInfo,size:"small",selection:""},on:{"current-change":e.pageChange,"size-change":e.pageSizeChange,"selection-change":e.selectionChange},scopedSlots:e._u([{key:"percentage",fn:function(s){return[e._v(" "+e._s(s.row.percentage)+"% ")]}},{key:"studyProgress",fn:function(s){return[e._v(" "+e._s(s.row.studyProgress)+"% ")]}},{key:"canSpeed",fn:function(s){return[e._v(" "+e._s(s.row.canSpeed?"\u5141\u8BB8":"\u4E0D\u5141\u8BB8")+" ")]}},e.isStudy?{key:"action",fn:function(s){return[s.row.studyProgress>=100?i("el-button",{staticStyle:{color:"#53da91"},attrs:{type:"text",icon:"el-icon-notebook-2"},on:{click:function(o){return o.stopPropagation(),e.startStudy(s.row)}}},[e._v("\u518D\u6B21\u5B66\u4E60")]):e._e(),s.row.studyProgress>0&&s.row.studyProgress<100?i("el-button",{staticStyle:{color:"#ef4243"},attrs:{type:"text",icon:"el-icon-timer"},on:{click:function(o){return o.stopPropagation(),e.startStudy(s.row)}}},[e._v("\u7EE7\u7EED\u5B66\u4E60")]):s.row.studyProgress==0?i("el-button",{staticStyle:{color:"#ff8f35"},attrs:{type:"text",icon:"el-icon-notebook-1"},on:{click:function(o){return o.stopPropagation(),e.startStudy(s.row)}}},[e._v("\u5F00\u59CB\u5B66\u4E60")]):e._e()]}}:{key:"action",fn:function(s){return[i("el-button",{attrs:{type:"text",icon:"el-icon-edit"},on:{click:function(o){return o.stopPropagation(),e.editorWare(s.row)}}},[e._v("\u7F16\u8F91")]),i("el-button",{staticStyle:{color:"red"},attrs:{type:"text",icon:"el-icon-delete"},on:{click:function(o){return e.deleteWare(e.nowCheckSection,s.row)}}},[e._v("\u5220\u9664")])]}}],null,!0)}),e.isStudy?e._e():i("el-button",{staticClass:"batches-delete-button",attrs:{type:"danger",size:"mini"},on:{click:e.deleteCorseware}},[e._v("\u5220\u9664\u9009\u4E2D")])],1),e.nowStudyCourseware?i("el-form-item",{staticClass:"ware-table-item",attrs:{label:"\u5B66\u4E60\u4FE1\u606F"}},[i("courseStudy",{attrs:{baseCourseForm:e.baseCourseForm,nowStudyCourseware:e.nowStudyCourseware},on:{courseWareStudyOver:e.courseWareStudyOver}})],1):e._e()],1)],1)])]),e.isStudy?e._e():i("div",{staticClass:"section-right section-main"},[i("div",{staticClass:"main-title"},[e._v("\u8D44\u6E90\u7BA1\u7406")]),i("ResourceManage",{ref:"ResourceManage",attrs:{nowCheckSection:e.nowCheckSection},on:{delForSection:e.delForSection,addToSection:e.addToSection}})],1),i("dialogSelf",{attrs:{title:"\u8BFE\u4EF6\u7F16\u8F91",visible:e.isShowEditorWare},on:{onConfirm:e.saveWareEditor,onCancel:function(s){e.isShowEditorWare=e.fasle}}},[i("el-form",{ref:"ruleForm",staticClass:"demo-ruleForm",staticStyle:{"padding-right":"10px"},attrs:{model:e.nowEditorWareInfo,rules:e.rules,"label-width":"90px"}},[i("el-form-item",{attrs:{label:"\u8D44\u6E90\u540D\u79F0"}},[i("el-input",{attrs:{disabled:""},model:{value:e.nowEditorWareInfo.resourceName,callback:function(s){e.$set(e.nowEditorWareInfo,"resourceName",s)},expression:"nowEditorWareInfo.resourceName"}})],1),i("el-form-item",{attrs:{label:"\u8BFE\u4EF6\u540D\u79F0",prop:"name"}},[i("el-input",{model:{value:e.nowEditorWareInfo.name,callback:function(s){e.$set(e.nowEditorWareInfo,"name",s)},expression:"nowEditorWareInfo.name"}})],1),i("el-form-item",{attrs:{label:"\u5B66\u4E60\u65F6\u957F"}},[i("el-input-number",{attrs:{"controls-position":"right",min:0,label:"\u63CF\u8FF0\u6587\u5B57"},model:{value:e.nowEditorWareInfo.studyTime,callback:function(s){e.$set(e.nowEditorWareInfo,"studyTime",s)},expression:"nowEditorWareInfo.studyTime"}}),e._v(" \u5206\u949F ")],1),i("el-form-item",{directives:[{name:"show",rawName:"v-show",value:["audio","video"].includes(e.nowEditorWareInfo.type),expression:"['audio', 'video'].includes(nowEditorWareInfo.type)"}],attrs:{label:"\u5FEB\u8FDB\u9650\u5236"}},[i("el-switch",{attrs:{"active-value":1,"inactive-value":0},model:{value:e.nowEditorWareInfo.canSpeed,callback:function(s){e.$set(e.nowEditorWareInfo,"canSpeed",s)},expression:"nowEditorWareInfo.canSpeed"}})],1)],1)],1)],1)},M=[];const q={props:{baseCourseForm:{typeof:Object,required:!0},isStudy:{typeof:Boolean,default:!1}},components:{TableLayout:y,courseStudy:A,ResourceManage:w,dialogSelf:C},data(){return{flodSection:{},nowCheckSection:{},nowWhiteIcon:"",showCourewareList:[],nowCheckWareList:[],nowEditorWareInfo:{studyTime:""},pageInfo:{page:1,pageSize:10,total:0},column:[{prop:"name",label:"\u8BFE\u4EF6\u540D\u79F0",width:"200",align:"center","show-overflow-tooltip":!0},{prop:"studyTime",label:"\u5B66\u4E60\u65F6\u957F(\u5206\u949F)",align:"center"},{prop:"percentage",label:"\u6743\u91CD\u5360\u6BD4",align:"center"},{prop:"canSpeed",label:"\u5FEB\u8FDB\u9650\u5236",align:"center"},{prop:"action",label:"\u64CD\u4F5C",align:"center"}],isShowEditorWare:!1,nowStudyCourseware:void 0,rules:{name:[{required:!0,message:"\u8BF7\u8F93\u5165\u8BFE\u4EF6\u540D\u79F0",trigger:"blur"}]}}},computed:{},watch:{nowCheckSection(){this.getShowWare()}},methods:{checkSection(e,t){const i=this.baseCourseForm.courseSectionContent,s=this.nowCheckSection.name;if(this.isStudy&&!this.baseCourseForm.sectionSortStudy){let o=!0;for(let r=0;r<i.length;r++)r<t&&!i[r].studyOver&&(o=!1);if(!o){this.$message.warning("\u5F53\u524D\u8BFE\u7A0B\u9700\u6309\u987A\u5E8F\u5B66\u4E60\uFF0C\u8BF7\u5148\u5B8C\u6210\u4E4B\u524D\u7AE0\u8282\u7684\u5B66\u4E60\uFF01");return}}else if(!this.isStudy&&s!==void 0&&s.trim().length<=0){this.$message.warning("\u8BF7\u8865\u5145\u5F53\u524D\u8BFE\u7A0B\u6807\u9898\u540D\u79F0");return}if(this.nowCheckSection.onlyKey===e.onlyKey){this.nowCheckSection={},this.nowStudyCourseware=void 0;return}this.nowStudyCourseware=void 0,this.$set(this,"nowCheckSection",e)},addSection(){const e=this.baseCourseForm.courseSectionContent,t=e.length?e[e.length-1].serialNumber+1:1;e.push({name:"\u65B0\u589E\u7AE0\u8282",explain:"\u7AE0\u8282\u8BF4\u660E",courseId:this.baseCourseForm.id?this.baseCourseForm.id:void 0,serialNumber:t,onlyKey:this.algorithm(),courseware:[]})},async deleteSection(e){if(await this.deleteConfirm()){const i=this.baseCourseForm.courseSectionContent||[];if(e.id)this.$set(e,"delFlag",1),delete e.onlyKey;else{const s=i.findIndex(o=>o.onlyKey===e.onlyKey);i.splice(s,1)}e.onlyKey===this.nowCheckSection.onlyKey&&(this.nowCheckSection={},this.showCourewareList=[]),this.sortAgain(i)}},async deleteWare(e,t){if(await this.deleteConfirm()){if(t.id)this.$set(t,"delFlag",1),t.delFlag=1;else{const s=e.courseware.findIndex(o=>o.onlyKey===t.onlyKey);e.courseware.splice(s,1)}this.sortAgain(e.courseware),this.$refs.ResourceManage.getSelected(),this.getShowWare()}},algorithm(){let e=["a","b","c","d","e","f","g","h","i","g","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"];const[t,i]=[Math.floor(Math.random()*4+1),Math.floor(Math.random()*8+17)];return e=e.sort(()=>.4-Math.random()).slice(t,i).slice(0,8).join(""),new Date().getTime()+e},move_Section(e,t,i,s,o){let r;if(s==="ware"?r=o.courseware:r=this.baseCourseForm.courseSectionContent,!e.delFlag){if(t==="up"){let n,a={};for(let c=i-1;c>=0;c--)if(!r[c].delFlag){a=r[c],n=c;break}if(n===void 0){this.$message.warning("\u5F53\u524D\u5DF2\u662F\u7B2C\u4E00\u4F4D");return}r.splice(n,1,e),r.splice(i,1,a),s==="ware"&&(this.nowWhiteIcon=a.onlyKey+"up")}if(t==="down"){let n,a={};for(let c=i+1;c<r.length;c++)if(!r[c].delFlag){a=r[c],n=c;break}if(n===void 0){this.$message.warning("\u5F53\u524D\u5DF2\u662F\u6700\u540E\u4E00\u4F4D");return}r.splice(n,1,e),r.splice(i,1,a),s==="ware"&&(this.nowWhiteIcon=a.onlyKey+"down")}this.$forceUpdate(),this.sortAgain(r)}},sortAgain(e){let t=1;e.forEach(i=>{i.delFlag||(i.serialNumber=t,t++)})},async editorWare(e){const{data:t}=await I(e.fileId);e.type=t.type,e.resourceName=t.name,this.nowEditorWareInfo=b(e),this.isShowEditorWare=!0},pageSizeChange(e){this.nowCheckSection.name&&(this.pageInfo.page=1,this.pageInfo.pageSize=e,this.showCourewareList=this.nowCheckSection.courseware.slice(0,1*e))},pageChange(e){typeof e=="number"&&this.nowCheckSection.name&&(this.pageInfo.page=e,this.showCourewareList=this.nowCheckSection.courseware.slice((e-1)*this.pageInfo.pageSize,e*this.pageInfo.pageSize))},selectionChange(e){this.nowCheckWareList=e},async deleteCorseware(e){if(this.nowCheckWareList.length<=0){this.$message.warning("\u8BF7\u9009\u62E9\u9700\u8981\u5220\u9664\u7684\u8BFE\u4EF6\uFF01");return}if(await this.deleteConfirm()){const i=[];this.nowCheckWareList.forEach(s=>{s.id?this.$set(s,"delFlag",1):i.push(s.onlyKey)}),i.forEach(s=>{const o=this.nowCheckSection.courseware.findIndex(r=>r.onlyKey===s.onlyKey);this.nowCheckSection.courseware.splice(o,1)})}this.$refs.ResourceManage.getSelected(),this.getShowWare()},deleteConfirm(){return this.$confirm("\u5220\u9664\u540E\u53EF\u4ECE\u53F3\u4FA7\u8D44\u6E90\u7BA1\u7406\u6DFB\u52A0\uFF0C\u662F\u5426\u7EE7\u7EED\u5220\u9664\uFF1F","\u63D0\u793A",{confirmButtonText:"\u786E\u5B9A",cancelButtonText:"\u53D6\u6D88",type:"warning"}).then(()=>!0).catch(e=>!1)},getShowWare(){if(!this.nowCheckSection.name){this.showCourewareList=[],this.pageInfo.total=0,this.pageInfo.page=1;return}const e=this.nowCheckSection.courseware.filter(s=>!s.delFlag);let t=this.pageInfo.page;const i=this.pageInfo.pageSize;e.length>0&&e.length<=(t-1)*i&&(this.pageInfo.page=t-1,t=t-1),this.pageInfo.total=e.length,this.showCourewareList=e.slice((t-1)*i,i*t)},setColumn(){this.column=[{prop:"name",label:"\u8BFE\u4EF6\u540D\u79F0",width:"200",align:"center","show-overflow-tooltip":!0},{prop:"studyTime",label:"\u8981\u6C42\u65F6\u957F(\u5206\u949F)",align:"center"},{prop:"studyProgress",label:"\u5DF2\u5B8C\u6210\u65F6\u957F",align:"center"},{prop:"percentage",label:"\u5360\u6BD4",align:"center"},{prop:"action",label:"\u64CD\u4F5C",align:"center"}]},startStudy(e){this.nowStudyCourseware=e},addToSection(e){e.isSelected=!0;const t=this.nowCheckSection.courseware,i=t.findIndex(r=>r.fileId===e.id);let s={};i===-1?(s={canSpeed:0,courseId:51,fileId:e.id,name:e.name,type:e.type,onlyKey:this.algorithm(),percentage:0,sectionId:this.nowCheckSection.id,serialNumber:t[t.length]?t[t.length].serialNumber+1:1,studyTime:0},t.push(s)):t[i].delFlag=0;const o=t.filter(r=>!r.delFlag).length;this.pageInfo.current=Math.ceil(o/this.pageInfo.pageSize),this.pageInfo.page=this.pageInfo.current,this.getShowWare()},delForSection(e){e.isSelected=!1;const t=this.nowCheckSection.courseware,i=t.findIndex(s=>s.fileId===e.id);i!==-1&&t[i].id?t[i].delFlag=1:i!==-1&&!t[i].id&&t.splice(i,1),this.$refs.ResourceManage.getSelected(),this.getShowWare()},saveWareEditor(){const e=this.nowCheckSection.courseware.findIndex(i=>i.onlyKey===this.nowEditorWareInfo.onlyKey);for(const i in this.nowEditorWareInfo)this.nowCheckSection.courseware[e][i]=this.nowEditorWareInfo[i];let t=0;this.baseCourseForm.courseSectionContent.forEach(i=>{i.courseware.forEach(s=>{t+=s.studyTime})}),this.baseCourseForm.courseSectionContent.forEach(i=>{i.courseware.forEach(s=>{s.percentage=Math.round(parseInt(s.studyTime/t||0)*100)})}),this.isShowEditorWare=!1,this.nowEditorWareInfo={}},courseWareStudyOver(){var t;((t=this.nowCheckSection.courseware)==null?void 0:t.filter(i=>i.studyProgress===100)).length===this.nowCheckSection.courseware.length&&(this.nowCheckSection.studyOver=!0)}},async created(){this.isStudy&&this.setColumn();const e=this.baseCourseForm.courseSectionContent;e.forEach(t=>{this.$set(t,"onlyKey",this.algorithm()),t.courseware.forEach(i=>{this.$set(i,"onlyKey",this.algorithm())}),t.courseware.sort((i,s)=>i.serialNumber-s.serialNumber)}),e.sort((t,i)=>t.serialNumber-i.serialNumber),this.nowCheckSection=e[0]||{},this.resourceLoading=!1},mounted(){},beforeCreate(){},beforeMount(){},beforeUpdate(){},updated(){},beforeUnmount(){},unmounted(){},activated(){}},d={};var N=l(q,K,M,!1,z,"1fe91934",null,null);function z(e){for(let t in d)this[t]=d[t]}const R=function(){return N.exports}();var U=function(){var e,t=this,i=t.$createElement,s=t._self._c||i;return s("div",[s("h2",{staticClass:"v-title"},[t._v("\u8BFE\u7A0B\u4FE1\u606F")]),s("div",{staticClass:"course-info-box course-item"},[s("div",{staticClass:"form-item"},[t._m(0),s("div",{staticClass:"form-input"},[t.isStudy?s("div",[t._v(" "+t._s(t.baseCourseForm.name)+" ")]):s("el-input",{class:t.error_input.name&&"error-input",staticStyle:{width:"250px"},attrs:{size:"mini",maxlength:20,placeholder:"\u8BF7\u8F93\u5165\u8BFE\u7A0B\u540D\u79F0"},model:{value:t.baseCourseForm.name,callback:function(o){t.$set(t.baseCourseForm,"name",o)},expression:"baseCourseForm.name"}})],1)]),s("div",{staticClass:"form-item"},[t._m(1),s("div",{staticClass:"form-input"},[t.isStudy?s("div",[t._v(" "+t._s((e=t.classify[0])===null||e===void 0?void 0:e.name)+" ")]):s("el-cascader",{class:t.error_input.classify&&"error-input",attrs:{options:t.classify,props:{checkStrictly:!0,value:"id",label:"name"},clearable:""},model:{value:t.baseCourseForm.classify,callback:function(o){t.$set(t.baseCourseForm,"classify",o)},expression:"baseCourseForm.classify"}})],1)]),t.isStudy?t._e():s("div",{staticClass:"form-item"},[s("span",{staticClass:"form-label"},[t._v("\u8BFE\u7A0B\u72B6\u6001\uFF1A")]),s("div",{staticClass:"form-input"},[s("el-switch",{attrs:{"active-value":1,"inactive-value":0},model:{value:t.baseCourseForm.status,callback:function(o){t.$set(t.baseCourseForm,"status",o)},expression:"baseCourseForm.status"}})],1)]),s("div",{staticClass:"form-item"},[s("span",{staticClass:"form-label"},[t._v("\u8BFE\u7A0B\u96BE\u5EA6\uFF1A")]),s("div",{staticClass:"form-input"},[t.isStudy?t._e():s("el-radio-group",{model:{value:t.baseCourseForm.difficulty,callback:function(o){t.$set(t.baseCourseForm,"difficulty",o)},expression:"baseCourseForm.difficulty"}},[s("el-radio",{attrs:{label:1}},[t._v("\u521D\u7EA7")]),s("el-radio",{attrs:{label:2}},[t._v("\u4E2D\u7EA7")]),s("el-radio",{attrs:{label:3}},[t._v("\u9AD8\u7EA7")])],1),t._v(" "+t._s(t.baseCourseForm.difficultyName)+" ")],1)]),t.isStudy?t._e():s("div",{staticClass:"form-item"},[s("span",{staticClass:"form-label"},[t._v("\u8BFE\u7A0B\u5C01\u9762\uFF1A ")]),s("div",{staticClass:"_photo",on:{click:t.toUploadPhoto}},[t.nowCheckCourse.cover?s("img",{attrs:{src:t.nowCheckCourse.cover.fileLinkTransfer()}}):s("i",{staticClass:"_icon el-icon-plus"})])]),s("div",{staticClass:"form-item",staticStyle:{width:"50%"}},[s("span",{staticClass:"form-label"},[t._v("\u8BFE\u7A0B\u7B80\u4ECB\uFF1A ")]),s("div",{staticClass:"form-input"},[t.isStudy?s("div",[t._v(" "+t._s(t.baseCourseForm.explain)+" ")]):s("el-input",{attrs:{type:"textarea",placeholder:"\u8BF7\u8F93\u5165\u5185\u5BB9"},model:{value:t.baseCourseForm.explain,callback:function(o){t.$set(t.baseCourseForm,"explain",o)},expression:"baseCourseForm.explain"}})],1)]),t.isStudy?t._e():s("div",{staticClass:"form-item",staticStyle:{width:"100%",display:"inline-block"}},[s("span",{staticClass:"form-label"},[t._v("\u8BFE\u7A0B\u5B66\u4E60\u8BBE\u7F6E\uFF1A ")]),s("div",{staticClass:"study-order-radio"},[t._v(" \u7AE0\u8282\u5B66\u4E60\uFF1A "),s("el-radio-group",{model:{value:t.baseCourseForm.sectionSortStudy,callback:function(o){t.$set(t.baseCourseForm,"sectionSortStudy",o)},expression:"baseCourseForm.sectionSortStudy"}},[s("el-radio",{attrs:{label:0}},[t._v("\u6309\u987A\u5E8F\u5B66\u4E60")]),s("el-radio",{attrs:{label:1}},[t._v("\u4E0D\u6309\u987A\u5E8F\u5B66\u4E60")])],1)],1)])])])},j=[function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("span",{staticClass:"form-label"},[e._v("\u8BFE\u7A0B\u540D\u79F0\uFF1A "),i("i",{staticClass:"must-write"},[e._v("*")])])},function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("span",{staticClass:"form-label"},[e._v("\u8BFE\u7A0B\u5206\u7C7B\uFF1A "),i("i",{staticClass:"must-write"},[e._v("*")])])}];const Q={props:{nowCheckCourse:{type:Object,default:()=>{}},error_input:{type:Object,default:()=>{}},classify:{type:Array,default:()=>[]},isStudy:{type:Boolean,default:!1}},components:{},data(){return{baseCourseForm:{},difficulty:[{label:1,title:"\u521D\u7EA7"},{label:2,title:"\u4E2D\u7EA7"},{label:3,title:"\u9AD8\u7EA7"}]}},computed:{},watch:{},methods:{async toUploadPhoto(){const[e]=await F({accepts:["image"]});this.baseCourseForm.cover=e}},created(){var e;if(this.isStudy){this.baseCourseForm=this.nowCheckCourse.courseInfo;const t=this.difficulty.findIndex(i=>i.label===this.baseCourseForm.classify);this.baseCourseForm.difficultyName=(e=this.difficulty[t])==null?void 0:e.title}else this.baseCourseForm=this.nowCheckCourse},mounted(){},beforeCreate(){},beforeMount(){},beforeUpdate(){},updated(){},beforeUnmount(){},unmounted(){},activated(){}},h={};var B=l(Q,U,j,!1,G,"29027639",null,null);function G(e){for(let t in h)this[t]=h[t]}const V=function(){return B.exports}();var H=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"course-statistics"},e._l(e.statisticsInfo,function(s,o){return i("div",{key:o,staticClass:"statistics-box"},[i("div",{staticClass:"statistics-title"},[e._v(" "+e._s(s.title)+" ")]),i("div",{staticClass:"statistics-content"},[e._v(e._s(s.gain)+"/"+e._s(s.total))])])}),0)},J=[];const X={props:{nowCheckCourse:{type:Object,default:()=>{}}},components:{},data(){return{statisticsInfo:[{title:"\u7AE0\u8282\u5B66\u4E60\u7EDF\u8BA1",total:0,gain:0},{title:"\u8BFE\u4EF6\u5B66\u4E60\u7EDF\u8BA1",total:0,gain:0},{title:"\u8BD5\u9898\u5B8C\u6210\u7EDF\u8BA1",total:0,gain:0},{title:"\u8BD5\u9898\u6210\u7EE9\u7EDF\u8BA1",total:0,gain:0}]}},computed:{},watch:{},methods:{disposalData(){this.getExercise(),this.getSection(),this.getExercises()},getExercise(){const e=this.nowCheckCourse.courseInfo.exercise,t=[];(this.nowCheckCourse.exercise&&this.nowCheckCourse.exercise.filter(s=>e.indexOf(s.exerciseId)!==-1)).forEach(s=>{e.forEach(o=>{o.id===s.exerciseId&&s.isRight?t.push(s):o.id===s.exerciseId&&s.isRight})}),this.statisticsInfo[2].total=e.length,this.statisticsInfo[2].gain=t.length},getSection(){const e=this.nowCheckCourse.courseInfo.courseSectionContent,t=this.nowCheckCourse.courseware,i=[],s=[];e.forEach(o=>{const r=[];o.courseware.forEach(n=>{i.push(n),n.recordId=this.nowCheckCourse.id,t.forEach(a=>{a.coursewareId===n.id&&(n.studyProgress=a.studyProgress,n.learningDuration=a.learningDuration||0,n.record_wareId=a.id,n.studyProgress>=100&&(r.push(n),s.push(n)))}),n.learningDuration||(n.learningDuration=0),n.studyProgress||(n.studyProgress=0)}),o.courseware.length===r.length?(o.studyOver=!0,this.statisticsInfo[0].gain++):(o.studyOver=!1,this.nowCheckCourse.studyProgress===3&&(o.studyOver=!0))}),this.statisticsInfo[0].total=e.length,this.statisticsInfo[1].total=i.length,this.statisticsInfo[1].gain=s.length},getExercises(){this.statisticsInfo[3].gain=this.nowCheckCourse.exerciseGrade,this.nowCheckCourse.exercise.forEach(e=>{e.questionScore===e.score&&this.statisticsInfo[2].gain++}),this.statisticsInfo[2].total=this.nowCheckCourse.courseInfo.exercise.length,this.statisticsInfo[3].total=this.nowCheckCourse.courseInfo.exercise.reduce((e,t)=>e+t.score,0)}},created(){this.disposalData()},mounted(){},beforeCreate(){},beforeMount(){},beforeUpdate(){},updated(){},beforeUnmount(){},unmounted(){},activated(){}},f={};var Y=l(X,H,J,!1,Z,"1310efd0",null,null);function Z(e){for(let t in f)this[t]=f[t]}const ee=function(){return Y.exports}();var te=function(){var e=this,t=e.$createElement,i=e._self._c||t;return i("div",{staticClass:"add-course"},[i("courseInfo",{attrs:{error_input:e.error_input,classify:e.classify,isStudy:e.isStudy,nowCheckCourse:e.nowCheckCourse}}),e.isStudy?i("h2",{staticClass:"v-title"},[e._v("\u8BFE\u7A0B\u7EDF\u8BA1")]):e._e(),e.isStudy?i("CourseStatistices",{attrs:{nowCheckCourse:e.nowCheckCourse}}):e._e(),i("h2",{staticClass:"v-title"},[e._v("\u8BFE\u7A0B\u7AE0\u8282")]),i("CourseSection",{ref:"CourseSection",attrs:{isStudy:e.isStudy,baseCourseForm:e.baseCourseForm},on:{startStudy:e.startStudy}}),e.isStudy&&e.baseCourseForm.exercise.length>0||!e.isStudy?i("h2",{staticClass:"v-title",staticStyle:{margin:"10px 0"}},[e._v(" \u8BFE\u540E\u4E60\u9898 ")]):e._e(),e.questionInfo?i("PaperSelectQuestionTable",{ref:"QuestionTable",staticStyle:{width:"60%",margin:"10px"},attrs:{isMounted:!0,questionData:e.questionInfo},on:{"current-change":e.changeQuestionsInfo}}):e.isStudy&&e.baseCourseForm.exercise.length>0?i("div",{staticStyle:{"padding-bottom":"10px",display:"flex"}},[i("el-tag",{staticStyle:{"margin-right":"10px"}},[e._v(e._s(e.baseCourseForm.exercise.length)+" \u9053\u8BD5\u9898")]),i("buttonSelftVue",{attrs:{width:"100px",icon:""},on:{click:function(){var s;if(!((s=e.baseCourseForm.exercise)!==null&&s!==void 0&&s.length)){e.$message.warin("\u5F53\u524D\u8BFE\u7A0B\u65E0\u8BD5\u9898\uFF01");return}e.$router.push({path:"/online-course/my-course/course-exercies",query:{recordId:e.nowCheckCourse.id,model:1}}),e.$refs.CourseSection.nowStudyCourseware=!1}}},[e._v("\u5F00\u59CB\u505A\u9898")]),i("buttonSelftVue",{attrs:{width:"100px",icon:""},on:{click:function(){var s;if(!((s=e.baseCourseForm.exercise)!==null&&s!==void 0&&s.length)){e.$message.warin("\u5F53\u524D\u8BFE\u7A0B\u65E0\u8BD5\u9898\uFF01");return}e.$router.push({path:"/online-course/my-course/course-exercies",query:{recordId:e.nowCheckCourse.id,model:1,viewer:!0}}),e.$refs.CourseSection.nowStudyCourseware=!1}}},[e._v("\u67E5\u770B\u7B54\u5377")])],1):e._e(),e.isStudy?e._e():i("h2",{staticClass:"v-title",staticStyle:{position:"relative"}},[e._v("\u9009\u53D6\u5B66\u5458")]),e.isStudy?e._e():i("div",{staticClass:"check-student-org"},[i("div",{staticClass:"form-item"},[i("div",{staticClass:"form-input"},[i("el-cascader",{class:e.error_input.studyOrgId&&"error-input",staticStyle:{width:"300px"},attrs:{size:"mini",options:e.orgList,placeholder:"\u8BF7\u9009\u62E9\u9700\u8981\u5B66\u4E60\u7684\u76F8\u5173\u73ED\u7EA7",props:{checkStrictly:!0,value:"id",label:"name"},clearable:""},model:{value:e.baseCourseForm.studyOrgId,callback:function(s){e.$set(e.baseCourseForm,"studyOrgId",s)},expression:"baseCourseForm.studyOrgId"}})],1)])]),e.isStudy?e._e():i("h2",{staticClass:"v-title",staticStyle:{margin:"10px 0"}},[e._v("\u4E92\u52A8\u8BBE\u7F6E")]),i("CourseEvealuate",{attrs:{nowCheckCourse:e.nowCheckCourse,isStudy:e.isStudy,courseDimensionality:e.courseDimensionality,studentDimensionality:e.studentDimensionality},on:{addDimensionality:e.addDimensionality,dleteInput:e.dleteInput}}),this.baseCourseForm.openDiscussion&&e.isStudy?i("h2",{staticClass:"v-title",staticStyle:{margin:"30px 0 0 0"}},[e._v(" \u8BC4\u8BBA "),i("span",{staticStyle:{"font-size":"12px"}},[e._v(e._s(this.nowCheckCourse.openDiscussion)+e._s(this.nowCheckCourse.discussion.length))])]):e._e(),this.baseCourseForm.openDiscussion&&e.isStudy?i("CourseDisscuss",{attrs:{nowCheckCourse:e.nowCheckCourse}}):e._e(),i("div",{staticClass:"add-course-buttom"},[e.isStudy?i("div",{staticClass:"add-course-buttom-fixed"},[i("el-button",{attrs:{type:"danger"},on:{click:function(s){return e.$emit("close_addCourse")}}},[e._v("\u9000\u51FA\u5B66\u4E60")])],1):i("div",{staticClass:"add-course-buttom-fixed"},[i("el-button",{attrs:{plain:""},on:{click:function(s){return e.$emit("close_addCourse")}}},[e._v("\u53D6\u6D88")]),i("el-button",{staticStyle:{"margin-left":"100px"},attrs:{type:"primary"},on:{click:e.saveCourse}},[e._v("\u4FDD\u5B58")])],1)])],1)},se=[];const ie={props:{classify:{type:Array,required:!0},nowCheckCourse:{type:Object,required:!0},isStudy:{type:Boolean,default:!1}},components:{CourseSection:R,courseInfo:V,CourseStatistices:ee,CourseEvealuate:_,PaperSelectQuestionTable:E,buttonSelftVue:S,CourseDisscuss:T},data(){return{rules:[],orgList:[],baseCourseForm:{},classifyOptions:{},studentDimensionality:[],courseDimensionality:[],saveEvealGradeList:[],error_input:{},nowCheckExercises:null,questionInfo:void 0}},created(){this.isStudy?(this.baseCourseForm=this.nowCheckCourse.courseInfo,this.baseCourseForm.recordInfo=this.nowCheckCourse):(this.baseCourseForm=this.nowCheckCourse,this.exerciseFormat()),this.getOrgList(),this.manageDimensionality(!0)},methods:{handleAvatarSuccess(e,t){this.imageUrl=URL.createObjectURL(t.raw)},addDimensionality(e){let t=[];const i=e?"studentDimensionality":"courseDimensionality";if(t=this[i].filter(s=>!s.id||!s.delFlag),t.length>=5){this.$message.warning("\u53EA\u652F\u63015\u4E2A\u8BC4\u4EF7\u7EF4\u5EA6\uFF01");return}this[i].push({courseId:this.baseCourseForm.id,dimensionality:"",type:e,delFlag:0})},dleteInput(e,t){e[t].id&&(this.saveEvealGradeList.push(e[t]),e[t].delFlag=1),e.splice(t,1)},async saveCourse(){try{if(this.checkInfoOk()){this.manageDimensionality();const e=this.baseCourseForm;if(e.id||(e.creator=this.$store.user.id),e.cover instanceof File){const{data:s}=await k(e.cover,{type:"course-cover"});e.cover=s.diskname}e.updater=this.$store.user.id,e.evalDimension.push(...this.saveEvealGradeList);const t=this.baseCourseForm.courseSectionContent.filter(s=>!s.delFlag);e.sectionCount=t.length,Array.isArray(e.classify)&&(e.classify=e.classify[e.classify.length-1]),Array.isArray(e.studyOrgId)&&(e.studyOrgId=e.studyOrgId[e.studyOrgId.length-1]);let i;if(e.id?i=await x(e.id,e):i=await $(e),i.code!==0)throw"\u4FDD\u5B58\u5931\u8D25,\u9519\u8BEF\u8BE6\u60C5\u8BF7\u67E5\u770B\u63A7\u5236\u53F0";this.$emit("close_addCourse")}}catch(e){this.$message.error(e)}},checkInfoOk(){const e=this.baseCourseForm;this.error_input={};const t=[];e.name||(this.error_input.name=!0,t.push("\u540D\u79F0")),!e.classify&&e.classify!==0&&(this.error_input.classify=!0,t.push("\u5206\u7C7B")),e.studyOrgId||(this.error_input.studyOrgId=!0,t.push("\u5B66\u4E60\u73ED\u7EA7"));let i=!1,s=!1,o=!1;return this.baseCourseForm.courseSectionContent.forEach(r=>{if(!r.delFlag&&r.name.trim().length<=0&&(i=!0),!r.delFlag&&r.courseware){const n=r.courseware.filter(a=>!a.delFlag);n&&n.length<1&&(s=!0)}}),this.baseCourseForm.txtOrGradeEvealute&&this.courseDimensionality.forEach(r=>{!r.delFlag&&r.dimensionality.trim().length<1&&r.type===0&&(o=!0)}),this.baseCourseForm.textOrGradeSelfEval&&this.studentDimensionality.forEach(r=>{!r.delFlag&&r.dimensionality.trim().length<1&&r.type===1&&(o=!0)}),i&&t.push("\u6240\u6709\u7AE0\u8282\u7684\u540D\u79F0"),o&&t.push("\u5404\u4E2A\u8BC4\u4EF7\u7EF4\u5EA6\u6807\u9898"),s&&t.push("\u6BCF\u4E2A\u7AE0\u8282\u7684\u8BFE\u4EF6\u4E0D\u53EF\u4E3A\u7A7A"),this.baseCourseForm.courseSectionContent.length<=0&&t.push("\u8BFE\u7A0B\u7AE0\u8282"),t.length>0?(this.$message.error(`\u8BFE\u7A0B\u3010${t.join("\u3001")},\u3011\u4E0D\u53EF\u4E3A\u7A7A`),!1):!0},manageDimensionality(e){e?this.baseCourseForm.evalDimension.forEach(t=>{t.type?this.studentDimensionality.push(t):this.courseDimensionality.push(t)}):(this.baseCourseForm.evalDimension=[],this.baseCourseForm.evalDimension.push(...this.studentDimensionality),this.baseCourseForm.evalDimension.push(...this.courseDimensionality))},getQuestionsInfo(){},changeQuestionsInfo(e){this.baseCourseForm.exercise=[];const t=e.fixdQuestions.map(s=>({courseId:this.baseCourseForm.id,questionId:s.id,score:s.itemScore,type:s.typeId,isFixed:1,creator:this.$store.user.id,updater:this.$store.user.id})),i=e.randQuestions.map(s=>({courseId:this.baseCourseForm.id,questionId:s.id,score:s.itemScore,type:s.typeId,isFixed:0}));this.baseCourseForm.exercise=[...t,...i]},async getOrgList(){const{data:e}=await p();this.$set(this,"orgList",e.toTree().tree)},exerciseFormat(){var t,i;const e={fixdQuestions:[],randQuestions:[]};(i=(t=this.baseCourseForm)==null?void 0:t.exercise)==null||i.forEach(s=>{if(s.isFixed){const o={...s.info,...s};o.id=s.info.id,o.typeId=o.type,o.itemScore=o.score,e.fixdQuestions.push(o)}else{const o={...s.info,...s};o.id=s.info.id,o.typeId=o.type,o.itemScore=o.score,e.randQuestions.push(o)}}),this.questionInfo=e}}},m={};var oe=l(ie,te,se,!1,re,"32614e1e",null,null);function re(e){for(let t in m)this[t]=m[t]}const _e=function(){return oe.exports}();export{_e as A};
|