;(function(){var _excluded=["auditStatus","lessonCoverUrl","lessonPrice","lessonDesc","lessonSubject","lessonName","id"];function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i=0)continue;target[key]=source[key];}return target;}function ownKeys(object,enumerableOnly){var keys=Object.keys(object);if(Object.getOwnPropertySymbols){var symbols=Object.getOwnPropertySymbols(object);enumerableOnly&&(symbols=symbols.filter(function(sym){return Object.getOwnPropertyDescriptor(object,sym).enumerable;})),keys.push.apply(keys,symbols);}return keys;}function _objectSpread(target){for(var i=1;i1&&createVNode(ElTooltip,{"class":"box-item","effect":"dark","content":"删除","placement":"top"},{default:function _default(){return[createVNode("div",{"onClick":function onClick(){ElMessageBox.confirm('确定删除该条数据吗?','提示',{type:'warning'}).then(function(){createState.lessonList.splice(index,1);});}},[createVNode(ElIcon,{"size":29,"class":"ml-3"},{default:function _default(){return[createVNode("img",{"src":iconDelete},null)];}})])];}})]),createVNode("h2",{"class":"text-xl font-semibold pb-5"},["\u7B2C ".concat(index+1," \u8BFE")]),createVNode(ElFormItem,{"label":"课程标题","prop":"lessonList.".concat(index,".videoTitle"),"rules":[{required:true,message:'请输入课程标题'}]},{default:function _default(){return[createVNode(ElInput,{"placeholder":"请输入课程标题","maxlength":50,"modelValue":item.videoTitle,"onUpdate:modelValue":function onUpdateModelValue($event){return item.videoTitle=$event;}},null)];}}),createVNode(ElFormItem,{"label":"课程介绍","prop":"lessonList.".concat(index,".videoContent"),"rules":[{required:true,message:'请输入课程介绍'}]},{default:function _default(){return[createVNode(ElInput,{"placeholder":"请输入课程介绍","modelValue":item.videoContent,"onUpdate:modelValue":function onUpdateModelValue($event){return item.videoContent=$event;},"type":"textarea","maxlength":200,"rows":4,"showWordLimit":true},null)];}}),createVNode(ElRow,null,{default:function _default(){return[createVNode(ElCol,{"span":12},{default:function _default(){return[createVNode(ElFormItem,{"label":"课程视频","required":true},{default:function _default(){return[createVNode(ColVideo,{"styleValue":{with:'150px',height:'85px'},"controls":false,"src":item.videoUrl,"volume":false},null),createVNode("p",null,null)];}})];}}),createVNode(ElCol,{"span":10},{default:function _default(){return[createVNode(ElFormItem,{"label":"视频封面","prop":"lessonList.".concat(index,".coverUrl"),"rules":[{required:true,message:'请上传视频封面'}]},{default:function _default(){return[createVNode(ColUpload,{"modelValue":item.coverUrl,"onUpdate:modelValue":function onUpdateModelValue($event){return item.coverUrl=$event;},"bucket":"video-course"},null)];}})];}})];}})]);})];}}),createVNode("div",{"class":"text-center pt-6 pb-7"},[createVNode(ElButton,{"round":true,"class":"!w-44 !h-[48px] !text-base","onClick":function onClick(){createState.active=0;var currentY=document.documentElement.scrollTop||document.body.scrollTop;scrollAnimation(currentY,0);}},{default:function _default(){return[createTextVNode("\u4E0A\u4E00\u6B65")];}}),createVNode(ElButton,{"round":true,"type":"primary","class":"!w-44 !h-[48px] !text-base","onClick":this.handleSubmit},{default:function _default(){return[createTextVNode("\u4E0B\u4E00\u6B65")];}})]),createVNode(ElDialog,{"modelValue":this.show,"onUpdate:modelValue":function onUpdateModelValue($event){return _this3.show=$event;},"title":"预览"},{default:function _default(){return[createVNode(CoursePreview,null,null)];},footer:function footer(){return createVNode("span",{"class":"dialog-footer !text-center block "},[createVNode(ElButton,{"size":"large","round":true,"onClick":function onClick(){_this3.show=false;}},{default:function _default(){return[createTextVNode("\u8FD4\u56DE\u7F16\u8F91")];}}),createVNode(ElButton,{"size":"large","round":true,"type":"primary","onClick":_this3.createSubmit},{default:function _default(){return[createState.groupId?'确认修改':'创建完成'];}})]);}})]);}});var tabs="_tabs_1g4lj_1";var imgCover="_imgCover_1g4lj_4";var courseInfo="_courseInfo_1g4lj_7";var styles={tabs:tabs,imgCover:imgCover,courseInfo:courseInfo};function _isSlot(s){return typeof s==='function'||Object.prototype.toString.call(s)==='[object Object]'&&!isVNode(s);}var CourseInfo=defineComponent({name:'course-info',data:function data(){return{url:''// calcRatePrice: 0 as any };},computed:{choiceSubjectIds:function choiceSubjectIds(){// 选择的科目编号 var ids=createState.lessonGroup.lessonSubject?Number(createState.lessonGroup.lessonSubject):null;return ids?[ids]:[];},subjectList:function subjectList(){// 学科列表 return createState.subjectList||[];},lessonSubjectName:function lessonSubjectName(){var _this4=this;// 选择的科目 var tempStr='';this.subjectList.forEach(function(item){if(_this4.choiceSubjectIds.includes(item.id)){tempStr=item.name;}});return tempStr;},calcRatePrice:function calcRatePrice(){// 计算手续费 var rate=createState.rate||0;var price=createState.lessonGroup.lessonPrice||0;return(price-rate/100*price).toFixed(2);}},mounted:function mounted(){return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee3(){var res,rate,price;return regeneratorRuntime.wrap(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.prev=0;if(!(createState.subjectList.length<=0)){_context3.next=6;break;}_context3.next=4;return request.post('/api-website/teacher/querySubject');case 4:res=_context3.sent;createState.subjectList=res.data||[];case 6:rate=createState.rate||0;price=createState.lessonGroup.lessonPrice||0;// this.calcRatePrice = (price - (rate / 100) * price).toFixed(2) // setInterval(() => { // console.log( // createState.lessonGroup.lessonCoverTemplateUrl, // 'createState.lessonGroup.lessonCoverTemplateUrl' // ) // }, 1000) _context3.next=12;break;case 10:_context3.prev=10;_context3.t0=_context3["catch"](0);case 12:case"end":return _context3.stop();}}},_callee3,null,[[0,10]]);}))();},methods:{// onChoice(id: number) { // createState.lessonGroup.lessonSubject = id // this.subjectStatus = false // }, onFormatter:function onFormatter(e){e.target.value=verifyNumberIntegerAndFloat(e.target.value);// 计算手续费 createState.rate||0;e.target.value||0;// this.calcRatePrice = (price - (rate / 100) * price).toFixed(2) },tabChange:function tabChange(name){this.$refs.form.clearValidate('lessonCoverTemplateUrl');this.$refs.form.clearValidate('lessonCoverUrl');createState.tabIndex=name;},selectImg:function selectImg(val){createState.lessonGroup.lessonCoverUrl='';createState.lessonGroup.lessonCoverTemplateUrl=val;}},render:function render(){var _this5=this;var _slot;return createVNode("div",{"class":styles.courseInfo},[createVNode(ElForm,{"class":"px-6 pb-10 pt-7","size":"large","ref":"form","labelWidth":'120px',"labelPosition":"left","model":createState.lessonGroup},{default:function _default(){return[createVNode(ElFormItem,{"label":"课程名称","prop":"lessonName","rules":[{required:true,message:'请输入课程名称'}]},{default:function _default(){return[createVNode(ElInput,{"modelValue":createState.lessonGroup.lessonName,"onUpdate:modelValue":function onUpdateModelValue($event){return createState.lessonGroup.lessonName=$event;},"maxlength":20,"placeholder":"请输入课程名称"},null)];}}),createVNode(ElFormItem,{"label":"课程声部","prop":"lessonSubject","rules":[{required:true,message:'请选择课程声部'}]},{default:function _default(){return[createVNode(ElSelect,{"class":"w-full","modelValue":createState.lessonGroup.lessonSubject,"onUpdate:modelValue":function onUpdateModelValue($event){return createState.lessonGroup.lessonSubject=$event;},"placeholder":"请选择课程声部"},_isSlot(_slot=createState.subjectList.map(function(item){return createVNode(ElOption,{"key":item.id,"value":item.id,"label":item.name},null);}))?_slot:{default:function _default(){return[_slot];}})];}}),createVNode(ElFormItem,{"label":"课程介绍","prop":"lessonDesc","rules":[{required:true,message:'请输入课程介绍'}]},{default:function _default(){return[createVNode(ElInput,{"placeholder":"请输入课程介绍","modelValue":createState.lessonGroup.lessonDesc,"onUpdate:modelValue":function onUpdateModelValue($event){return createState.lessonGroup.lessonDesc=$event;},"type":"textarea","maxlength":200,"rows":4,"showWordLimit":true},null)];}}),createVNode(ElFormItem,{"label":"课程组售价","prop":"lessonPrice","rules":[{required:true,message:'请输入课程组售价'}]},{default:function _default(){return[createVNode(ElInput,{"placeholder":"请输入课程组售价","modelValue":createState.lessonGroup.lessonPrice,"onUpdate:modelValue":function onUpdateModelValue($event){return createState.lessonGroup.lessonPrice=$event;},"onKeyup":_this5.onFormatter,"maxlength":9},{suffix:function suffix(){return createVNode("span",{"class":"text-base text-[#999]"},[createTextVNode("\u5143")]);}})];}}),createVNode("div",{"class":"text-sm text-[#999] pl-[120px] leading-relaxed pb-2"},[createVNode("p",null,[createTextVNode("\u6263\u9664\u624B\u7EED\u8D39\u540E\u60A8\u7684\u8BFE\u7A0B\u9884\u8BA1\u6536\u5165\u4E3A\uFF1A ")]),createVNode("p",null,[createTextVNode("\u8BFE\u7A0B\u7EC4\u603B\u6536\u5165"),createVNode("span",{"class":"px-1 text-[#FF4E19]"},[_this5.calcRatePrice]),createTextVNode("\u5143/\u4EBA")]),createVNode("p",null,[createTextVNode("\u60A8\u7684\u8BFE\u7A0B\u6536\u5165\u5C06\u5728\u8BFE\u7A0B\u7ED3\u675F\u540E\u7ED3\u7B97\u5230\u60A8\u7684\u8D26\u6237\u4E2D ")])]),createVNode(ElFormItem,{"label":"课程封面","class":"!mb-0","prop":"lessonCoverUrl","rules":[{required:true,message:'请上传课程封面',trigger:'change'}]},{default:function _default(){return[createVNode(ColCropper,{"modelValue":createState.lessonGroup.lessonCoverUrl,"bucket":"video-course","cropUploadSuccess":function cropUploadSuccess(data){createState.lessonGroup.lessonCoverUrl=data;createState.lessonGroup.lessonCoverTemplateUrl='';},"options":{title:'课程封面',fixedNumber:[3.34,2],autoCropWidth:375,autoCropHeight:212// fixedNumber: [3, 2], // autoCropWidth: 300, // autoCropHeight: 200 }},null)];}})];}}),createVNode("div",{"class":" text-center pt-6 pb-7"},[createVNode(ElButton,{"type":"primary","round":true,"class":"!w-44 !h-[48px] !text-base","onClick":function onClick(){_this5.$refs.form.validate(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee4(valid){var currentY;return regeneratorRuntime.wrap(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:if(!valid){_context4.next=6;break;}createState.active=1;currentY=document.documentElement.scrollTop||document.body.scrollTop;scrollAnimation(currentY,0);_context4.next=8;break;case 6:_this5.$nextTick(function(){var isError=document.getElementsByClassName('is-error');isError[0].scrollIntoView({block:'center',behavior:'smooth'});});return _context4.abrupt("return",false);case 8:case"end":return _context4.stop();}}},_callee4);}));return function(_x2){return _ref2.apply(this,arguments);};}());}},{default:function _default(){return[createTextVNode("\u4E0B\u4E00\u6B65")];}})])]);}});var index=exports('default',defineComponent({name:'video-operation',data:function data(){var query=this.$route.query;return{type:query.type||'create'};},created:function created(){var _this6=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee5(){var query,res,result,_result$lessonGroup,auditStatus,lessonCoverUrl,lessonPrice,lessonDesc,lessonSubject,lessonName,id,group;return regeneratorRuntime.wrap(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:// 重置数据 resestState();query=_this6.$route.query;createState.groupId=Number(query.groupId)||0;// 判断是否是编辑 if(createState.groupId){_context5.next=5;break;}return _context5.abrupt("return",false);case 5:_context5.prev=5;createState.loadingStatus=true;_context5.next=9;return request.get('/api-website/videoLessonGroup/selectVideoLesson',{params:{groupId:createState.groupId}});case 9:res=_context5.sent;result=res.data;_result$lessonGroup=result.lessonGroup,auditStatus=_result$lessonGroup.auditStatus,lessonCoverUrl=_result$lessonGroup.lessonCoverUrl,lessonPrice=_result$lessonGroup.lessonPrice,lessonDesc=_result$lessonGroup.lessonDesc,lessonSubject=_result$lessonGroup.lessonSubject,lessonName=_result$lessonGroup.lessonName,id=_result$lessonGroup.id,group=_objectWithoutProperties(_result$lessonGroup,_excluded);// 判断模板图片是否在模板列表中,如果不在则是用户自己上传的图片 // const statusUrl = createState.templateList.includes(lessonCoverUrl) // ? true // : false createState.lessonGroup={id:id,lessonName:lessonName,lessonSubject:Number(lessonSubject),lessonDesc:lessonDesc,lessonPrice:lessonPrice,// lessonCoverTemplateUrl: statusUrl ? lessonCoverUrl : '', lessonCoverUrl:lessonCoverUrl};createState.lessonList=[];result.detailList&&result.detailList.forEach(function(item){createState.lessonList.push({videoTitle:item.videoTitle,videoContent:item.videoContent,videoUrl:item.videoUrl,coverUrl:item.coverUrl,posterUrl:item.posterUrl// 视频封面图 });});createState.loadingStatus=false;_context5.next=20;break;case 18:_context5.prev=18;_context5.t0=_context5["catch"](5);case 20:if(createState.lessonGroup.lessonCoverUrl&&!createState.templateList.includes(createState.lessonGroup.lessonCoverUrl)){createState.tabIndex=2;}else{createState.tabIndex=1;}case 21:case"end":return _context5.stop();}}},_callee5,null,[[5,18]]);}))();},mounted:function mounted(){var _this7=this;return _asyncToGenerator(/*#__PURE__*/regeneratorRuntime.mark(function _callee6(){var sysConfig;return regeneratorRuntime.wrap(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:document.title=_this7.type==='create'?'新建视频课':'编辑视频课';_context6.prev=1;_context6.next=4;return request.get('/api-website/sysConfig/queryByParamName',{params:{paramName:'video_lesson_service_fee'}});case 4:sysConfig=_context6.sent;createState.rate=sysConfig.data.paramValue;_context6.next=10;break;case 8:_context6.prev=8;_context6.t0=_context6["catch"](1);case 10:case"end":return _context6.stop();}}},_callee6,null,[[1,8]]);}))();},render:function render(){return createVNode(Fragment,null,[createVNode("div",{"class":"text-2xl font-semibold text-black leading-none px-6 py-5 "},[this.type==='create'?'新建视频课':'编辑视频课']),createVNode("div",{"class":"pt-12"},[createVNode(ColSteps,{"class":"pl-[60px] pr-7","type":"large","active":createState.active},null),createState.active===0&&createVNode(CourseInfo,null,null),createState.active===1&&createVNode(CourseContent,null,null)])]);}}));}};});})();