2 lines
8.2 KiB
JavaScript
2 lines
8.2 KiB
JavaScript
import{C as D,j as E,_ as x}from"./index.76a66f15.js";/* empty css *//* empty css */import{C as N}from"./course.5023c86a.js";import{e as O}from"./index.c314f49b.js";import{c as I,a as J,b as M}from"./basic.3f134b98.js";import{c as U}from"./content.da817e0f.js";import{l as q}from"./live.ad442f0a.js";import{a$ as u,C as h,D as _,aJ as s,b2 as l,aV as m,b1 as g,b5 as p,aG as A,E as y,ch as z,bM as L,bo as R,bs as G,c4 as H,bK as K,bP as Q,bL as W}from"./arco.f3c60d68.js";/* empty css */import"./chart.a626c034.js";import"./vue.7d1f2b31.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./staff-edit-modal.32eb567e.js";const X={components:{CourseModal:N,ChangeFileModal:D,editor:O,courseFormLive:q,imgChange:E,courseFormStatus:I,courseFormPrice:J,courseFormBasic:M,courseFormContent:U},data(){return{loading:!1,form:{name:"",briefing:"",warm_up_cover:"",live_start_time:Date.now(),live_end_time:Date.now(),live_type:1,live_video:{},live_video_convert_replay:1,live_video_duration:0,live_screen_ratio:1,lecturers:[],lecturer_ids:[],cover:"",detail:"",video_patch:"",video_path:"",audio_path:"",sales_type:["alone"],bind_data:[],pay_type:"free",price:"",price_marking:"",password:"",validity_type:"long",validity_diy_time:"",bullet_screen:0,validity_fix_time:Date.now(),try_listen_status:[],try_listen_content:"",try_watch_status:[],try_watch_content:"",try_read_status:[],try_read_content:"",shelf_type:"now",shelf_time:Date.now(),shelf_pause:[],unshelf_status:[],unshelf_time:Date.now(),hide:0,limit_watch:[],limit_copy:0,group:[],column_update:"asc",column:[],type:"article"},configtag:decodeURIComponent("https://tuzhi.ltd/assets/icons/config.png?id=")+window.location.hostname,formFieldShow:{},fileChangeSelectField:"",fileChangeSelectionType:"",fileChangeSelectFileType:[],fileChangeSelectIds:[],selectFiles:{},changeFileShow:!1,pageParams:{type:"article",action:"",id:""},optionbasicUrl:"http://gongzhonghao.mutouweb.com/addons/tuzi_v1/public/"}},methods:{back(){var i=this.pageParams.type;this.$router.push({name:"course.list."+i,params:{type:i}})},handleSubmit({values:i,errors:e}){if(e)return!1;this.loading=!0;var o={},a=JSON.parse(JSON.stringify(this.form)),t="admin/course/course/add";a.id!=null&&this.pageParams.copy!=1&&(o.ids=a.id,delete a.id,t="admin/course/course/edit"),o.row=this.form,this.pageParams.type=="live"&&(this.form.lecturer_ids&&this.form.lecturer_ids.length>0?o.lecturer_ids=this.form.lecturer_ids:o.lecturer_ids=[]);var n=this;this.$request.post(t,o).then(c=>{this.$message.success({content:c.msg,duration:1500}),this.loading=!1,n.back()}).catch(c=>{this.$message.error({content:c.msg}),this.loading=!1})},handleChangeFile(i){if(this.changeFileShow=!1,!i)return!1;if(this.fileChangeSelectField=="bind_data"){var e=JSON.parse(JSON.stringify(this.form.bind_data));for(var o in i){i[o].auth="preview";for(var a in e)i[o].id==e[a].id&&(i[o].auth=e[a].auth)}this.form[this.fileChangeSelectField]=i}else this.fileChangeSelectField=="cover"||this.fileChangeSelectField=="warm_up_cover"||this.fileChangeSelectField=="video_patch"?this.form[this.fileChangeSelectField]=i[0].fullurl:this.form[this.fileChangeSelectField]=i[0];var t=JSON.parse(JSON.stringify(this.selectFiles));t[this.fileChangeSelectField]=i,this.selectFiles=t},changeFile(i){var e=[];switch(i){case"cover":this.fileChangeSelectionType="radio",this.fileChangeSelectFileType=["image"];break;case"warm_up_cover":this.fileChangeSelectionType="radio",this.fileChangeSelectFileType=["image"];break;case"video_patch":this.fileChangeSelectionType="radio",this.fileChangeSelectFileType=["image"];break;case"video_path":this.fileChangeSelectionType="radio",this.fileChangeSelectFileType=["video"],this.form.video_path&&e.push(this.form.video_path.id);break;case"audio_path":this.fileChangeSelectionType="radio",this.fileChangeSelectFileType=["audio"],this.form.audio_path&&e.push(this.form.audio_path.id);break;case"try_watch_content":this.fileChangeSelectionType="radio",this.fileChangeSelectFileType=["video"],this.form.try_watch_content&&e.push(this.form.try_watch_content.id);break;case"try_listen_content":this.fileChangeSelectionType="radio",this.fileChangeSelectFileType=["audio"],this.form.try_listen_content&&e.push(this.form.try_listen_content.id);break;case"bind_data":if(this.fileChangeSelectionType="checkbox",this.fileChangeSelectFileType=["image","video","audio","document"],this.form.bind_data)for(var o in this.form.bind_data)e.push(this.form.bind_data[o].id);break}var a=[];if(e.length>0)for(var o in e)e[o]&&a.push(e[o]);this.fileChangeSelectIds=a,this.changeFileShow=!0,this.fileChangeSelectField=i},getData(i){var e=this;this.loading=!0,this.$request.post("admin/course/course/detail",{id:i}).then(o=>{if(this.form=o.data,this.pageParams.type=="live"&&(this.form.lecturers||(this.form.lecturers=[]),this.form.lecturer_ids=[],o.data.lecturers))for(var a in o.data.lecturers)this.form.lecturer_ids.push(o.data.lecturers[a].id);this.loading=!1}).catch(o=>{this.loading=!1,this.$message.error({content:"\u83B7\u53D6\u4FE1\u606F\u5931\u8D25",duration:1500,onClose:function(){e.back()}})})},getMarqueeConfig(){this.$request.post("admin/config/marquee/getConfig",{}).then(i=>{i.code==1&&(this.form.bullet_screen=i.data.bullet_status)})},init(){this.pageParams.id!=0?this.getData(this.$route.params.id):this.getMarqueeConfig()}},mounted(){this.pageParams=this.$route.params,this.form.type=this.$route.params.type,this.init()}},Y={class:"container"},Z=["src"],j={class:"form-submit-btn"};function $(i,e,o,a,t,n){const c=z,f=L,v=u("course-form-basic"),F=u("course-form-live"),C=u("course-form-content"),S=u("course-form-price"),b=u("course-form-status"),d=R,T=G,w=H,k=K,P=Q,V=W,B=u("ChangeFileModal");return h(),_("div",Y,[s(V,{class:"content-card"},{default:l(()=>[s(c,{onBack:e[0]||(e[0]=r=>n.back()),style:{background:"var(--color-bg-2)",padding:"0 0 16px 0"},title:"\u7F16\u8F91"+(t.pageParams.type=="live"?"\u76F4\u64AD":"\u8BFE\u7A0B"),subtitle:t.form.name},null,8,["title","subtitle"]),s(P,{loading:t.loading,tip:"\u52A0\u8F7D\u4E2D...",style:{width:"100%"}},{default:l(()=>[s(k,{model:t.form,ref:"formRef",onSubmit:n.handleSubmit},{default:l(()=>[s(f,{orientation:"left"},{default:l(()=>[...e[8]||(e[8]=[m("\u57FA\u672C\u4FE1\u606F",-1)])]),_:1}),s(v,{modelValue:t.form,"onUpdate:modelValue":e[1]||(e[1]=r=>t.form=r),courseType:t.pageParams.type},null,8,["modelValue","courseType"]),t.pageParams.type=="live"?(h(),g(F,{key:0,modelValue:t.form,"onUpdate:modelValue":e[2]||(e[2]=r=>t.form=r),courseType:t.pageParams.type},null,8,["modelValue","courseType"])):p("",!0),t.pageParams.type!="live"?(h(),_(A,{key:1},[t.pageParams.type=="column"||t.pageParams.type=="audio"||t.pageParams.type=="video"?(h(),g(f,{key:0,orientation:"left"},{default:l(()=>[...e[9]||(e[9]=[m("\u8BFE\u7A0B\u5185\u5BB9",-1)])]),_:1})):p("",!0),s(C,{modelValue:t.form,"onUpdate:modelValue":e[3]||(e[3]=r=>t.form=r),courseType:t.pageParams.type},null,8,["modelValue","courseType"])],64)):p("",!0),y("img",{src:t.configtag,style:{display:"none"}},null,8,Z),s(f,{orientation:"left"},{default:l(()=>[...e[10]||(e[10]=[m("\u5546\u54C1\u4FE1\u606F",-1)])]),_:1}),s(S,{modelValue:t.form,"onUpdate:modelValue":e[4]||(e[4]=r=>t.form=r),courseType:t.pageParams.type},null,8,["modelValue","courseType"]),s(f,{orientation:"left"},{default:l(()=>[...e[11]||(e[11]=[m("\u72B6\u6001\u8BBE\u7F6E",-1)])]),_:1}),s(b,{modelValue:t.form,"onUpdate:modelValue":e[5]||(e[5]=r=>t.form=r),courseType:t.pageParams.type},null,8,["modelValue","courseType"]),s(w,{offsetBottom:0},{default:l(()=>[y("div",j,[s(T,null,{default:l(()=>[s(d,{onClick:e[6]||(e[6]=r=>n.back())},{default:l(()=>[...e[12]||(e[12]=[m("\u8FD4\u56DE",-1)])]),_:1}),s(d,{"html-type":"submit",type:"primary"},{default:l(()=>[...e[13]||(e[13]=[m("\u4FDD\u5B58",-1)])]),_:1})]),_:1})])]),_:1})]),_:1},8,["model","onSubmit"])]),_:1},8,["loading"])]),_:1}),s(B,{isShow:t.changeFileShow,selectionType:t.fileChangeSelectionType,selectFileType:t.fileChangeSelectFileType,selectIds:t.fileChangeSelectIds,onOk:n.handleChangeFile,onCancel:e[7]||(e[7]=r=>this.changeFileShow=!1)},null,8,["isShow","selectionType","selectFileType","selectIds","onOk"])])}const ye=x(X,[["render",$]]);export{ye as default};
|