import{d,f as n,P as m,Q as p,S as _,V as g,j as o,A as v,B as b,n as I}from"./ResizeObserver.es.45df6c0f.js";import{C as h}from"./index.1a59558b.js";import{C as y}from"./index.6c7f2a68.js";import"./index.5034ef43.js";import{F as C}from"./index.0acff0f0.js";import{C as s}from"./index.dc601d46.js";import{a as f,d as D}from"./api.2ab8164e.js";import"./index.f6378dda.js";import"./use-id.41c465c4.js";import"./index.e11fdb7d.js";import"./index.ba862406.js";import"./index.48cf055d.js";const V="_creationTablet_2hui8_1",F="_sectionVideo_2hui8_1",T="_videoBg_2hui8_1",R="_btnGroup_2hui8_16",A="_btnCropper_2hui8_40",N="_btnImg_2hui8_52",x="_section_2hui8_1",B="_sectionFile_2hui8_89",M="_muploader_2hui8_101",k="_uploadImg_2hui8_130",U="_tip_2hui8_135",w="_musicDetail_2hui8_161",G="_musicName_2hui8_166",P="_username_2hui8_172";var t={creationTablet:V,sectionVideo:F,videoBg:T,btnGroup:R,btnCropper:A,btnImg:N,section:x,sectionFile:B,muploader:M,uploadImg:k,tip:U,musicDetail:w,musicName:G,username:P},S="./assets/videobg.e5380989.png",X=d({name:"creation-edit",setup(){const{isTablet:a}=n(),c=m(),r=p(),e=_({id:c.query.id,musicDetail:{},playType:"",desc:"",videoImg:"",img:""}),l=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"}),r.back()}catch{}},u=()=>{I({api:"videoCrop",content:{url:e.musicDetail.videoUrl}},i=>{i!=null&&i.content.videoCover&&(e.videoImg=i.content.videoCover)})};return g(async()=>{try{const{data:i}=await f(e.id);e.musicDetail=i,e.desc=i.desc,e.videoImg=i.videoImg,e.img=i.img,(i==null?void 0:i.videoUrl.lastIndexOf("mp4"))!==-1?e.playType="Video":e.playType="Audio"}catch{}}),()=>o("div",{class:a?t.creationTablet:""},[o(y,{position:"top"},{default:()=>[o(h,{background:"#F1F1F1",border:!1},null)]}),o("div",{class:[t.section,t.sectionFile]},[o("div",{class:t.uploadImg},[o(s,{class:t.muploader,cropper:!0,tips:"",deletable:!1,modelValue:e.img,"onUpdate:modelValue":i=>e.img=i},null)]),o("div",{class:t.musicDetail},[o("p",{class:t.musicName},[e.musicDetail.musicSheetName]),o("p",{class:t.username},[e.musicDetail.username])])]),e.playType==="Video"&&o("div",{class:[t.section,t.sectionVideo]},[o("img",{src:e.videoImg||S,class:t.videoBg},null),o("div",{class:t.btnGroup},[o(s,{class:t.btnImg,cropper:!0,tips:"",deletable:!1,onUploadChange:i=>{console.log(i,"img"),e.videoImg=i},options:{fixedNumber:[16,9]}},null),o("div",{class:t.btnCropper,onClick:u},[v("\u89C6\u9891\u622A\u53D6\u5C01\u9762")])])]),o("div",{class:t.section},[o(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":i=>e.desc=i},null)]),o("div",{class:t.btnGroup},[o(b,{type:"primary",round:!0,block:!0,color:"#2DC7AA",onClick:l},{default:()=>[e.musicDetail.type==="FORMAL"?"\u4FDD\u5B58":"\u53D1\u5E03"]})])])}});export{X as default};
