import{d as m,O as r,P as n,Q as u,U as p,j as i,z as _,B as g,n as v}from"./index.3bfa6a0e.js";import{C as I}from"./index.645e7ddc.js";import{C as y}from"./index.aac5e6b2.js";import"./index.79997a38.js";import{F as C}from"./index.983bfd1a.js";import{C as s}from"./index.b7202cd4.js";import{a as b,v as f,d as D}from"./api.190d2980.js";import"./use-id.7c44c16f.js";import"./index.0fd5538f.js";import"./index.e9acc943.js";import"./index.e55f880d.js";import"./oss-file-upload.782d2199.js";const V="_sectionVideo_c9e86_1",F="_videoBg_c9e86_7",R="_btnGroup_c9e86_13",N="_btnCropper_c9e86_37",h="_btnImg_c9e86_49",x="_section_c9e86_1",A="_sectionFile_c9e86_86",B="_muploader_c9e86_98",M="_uploadImg_c9e86_127",U="_tip_c9e86_132",k="_musicDetail_c9e86_158",G="_musicName_c9e86_163",O="_username_c9e86_169";var t={sectionVideo:V,videoBg:F,btnGroup:R,btnCropper:N,btnImg:h,section:x,sectionFile:A,muploader:B,uploadImg:M,tip:U,musicDetail:k,musicName:G,username:O},E=m({name:"creation-edit",setup(){const c=r(),a=n(),e=u({id:c.query.id,musicDetail:{},playType:"",desc:"",videoImg:"",img:""}),d=async()=>{console.log({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"});try{await D({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"}),a.back()}catch{}},l=()=>{v({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 b(e.id);e.musicDetail=o,e.desc=o.desc,e.videoImg=o.videoImg,e.img=o.img,(o==null?void 0:o.videoUrl.lastIndexOf("mp4"))!==-1?e.playType="Video":e.playType="Audio"}catch{}}),()=>i("div",null,[i(y,{position:"top"},{default:()=>[i(I,{border:!1},null)]}),e.playType==="Video"&&i("div",{class:[t.section,t.sectionVideo]},[i("img",{src:e.videoImg||f,class:t.videoBg},null),i("div",{class:t.btnGroup},[i(s,{class:t.btnImg,cropper:!0,tips:"",deletable:!1,onUploadChange:o=>{console.log(o,"img"),e.videoImg=o},options:{fixedNumber:[16,9]}},null),i("div",{class:t.btnCropper,onClick:l},[_("\u89C6\u9891\u622A\u53D6\u5C01\u9762")])])]),i("div",{class:t.section},[i(C,{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)]),i("div",{class:[t.section,t.sectionFile]},[i("div",{class:t.uploadImg},[i(s,{class:t.muploader,cropper:!0,tips:"",deletable:!1,modelValue:e.img,"onUpdate:modelValue":o=>e.img=o},null)]),i("div",{class:t.musicDetail},[i("p",{class:t.musicName},[e.musicDetail.musicSheetName]),i("p",{class:t.username},[e.musicDetail.username])])]),i("div",{class:t.btnGroup},[i(g,{type:"primary",round:!0,block:!0,color:"#2DC7AA",onClick:d},{default:()=>[e.musicDetail.type==="FORMAL"?"\u4FDD\u5B58":"\u53D1\u5E03"]})])])}});export{E as default};
