import{d as n,ah as r,ag as d,r as u,$ as p,c as s,aj as _,q as g,B as v,e as h}from"./index.28bb778f.js";import{O as b}from"./index.82695db9.js";import{O as t}from"./index.18ed6044.js";import{a as y,m as I,v as f,d as C}from"./video-bg.861b439d.js";import{F as D}from"./index.5332ff88.js";import"./oss-file-upload.a6733202.js";import"./index.e91c4bbc.js";import"./ImagePreview.45ee17fc.js";import"./index.0534ba7c.js";import"./index.7e0a75cb.js";import"./function-call.c1d8444f.js";import"./index.49de14a4.js";const V="_sectionVideo_1shm1_1",F="_videoBg_1shm1_7",B="_btnGroup_1shm1_13",N="_btnCropper_1shm1_37",O="_btnImg_1shm1_49",x="_section_1shm1_1",M="_sectionFile_1shm1_86",R="_muploader_1shm1_98",U="_uploadImg_1shm1_108",k="_tip_1shm1_116",G="_musicDetail_1shm1_142",T="_musicName_1shm1_147",w="_username_1shm1_153";var i={sectionVideo:V,videoBg:F,btnGroup:B,btnCropper:N,btnImg:O,section:x,sectionFile:M,muploader:R,uploadImg:U,tip:k,musicDetail:G,musicName:T,username:w},K=n({name:"creation-edit",setup(){const a=r(),c=d(),e=u({id:a.query.id,playType:"",musicDetail:{},desc:"",videoImg:"",img:null}),m=async()=>{try{await C({id:e.id,img:e.img,videoImg:e.videoImg,desc:e.desc||"\u6211\u53D1\u5E03\u4E86\u4E00\u9996\u6F14\u594F\u4F5C\u54C1\uFF0C\u5FEB\u6765\u542C\u542C\u5427\uFF5E",musicPracticeRecordId:e.musicDetail.musicPracticeRecordId,type:"FORMAL"}),c.back()}catch(o){console.log(o)}},l=()=>{h({api:"videoCrop",content:{url:e.musicDetail.videoUrl}},o=>{o!=null&&o.content.videoCover&&(e.videoImg=o.content.videoCover)})};return p(async()=>{try{const{data:o}=await y(e.id);e.musicDetail=o,e.desc=o.desc,e.videoImg=o.videoImg,e.img=o.img||I,(o==null?void 0:o.videoUrl.lastIndexOf("mp4"))!==-1?e.playType="Video":e.playType="Audio"}catch{}}),()=>s("div",null,[s(b,{position:"top"},{default:()=>[s(_,{border:!1},null)]}),e.playType==="Video"&&s("div",{class:[i.section,i.sectionVideo]},[s("img",{src:e.videoImg||f,class:i.videoBg},null),s("div",{class:i.btnGroup},[s(t,{class:i.btnImg,cropper:!0,deletable:!1,onUploadChange:o=>{e.videoImg=o},tips:"",options:{fixedNumber:[16,9]}},null),s("div",{class:i.btnCropper,onClick:l},[g("\u89C6\u9891\u622A\u53D6\u5C01\u9762")])])]),s("div",{class:i.section},[s(D,{rows:4,autosize:!0,type:"textarea",maxlength:150,placeholder:"\u6211\u53D1\u5E03\u4E86\u4E00\u9996\u6F14\u594F\u4F5C\u54C1\uFF0C\u5FEB\u6765\u542C\u542C\u5427\uFF5E",showWordLimit:!0,modelValue:e.desc,"onUpdate:modelValue":o=>e.desc=o},null)]),s("div",{class:[i.section,i.sectionFile]},[s("div",{class:i.uploadImg},[s(t,{class:i.muploader,cropper:!0,deletable:!1,modelValue:e.img,"onUpdate:modelValue":o=>e.img=o},null)]),s("div",{class:i.musicDetail},[s("p",{class:i.musicName},[e.musicDetail.musicSheetName]),s("p",{class:i.username},[e.musicDetail.username])])]),s("div",{class:i.btnGroup},[s(v,{type:"primary",round:!0,block:!0,color:"#FF8057",onClick:m},{default:()=>[e.musicDetail.type==="FORMAL"?"\u4FDD\u5B58":"\u53D1\u5E03"]})])])}});export{K as default};
