import{d as h,f as C,Q as D,S as b,U as f,W as I,a6 as y,j as i,B as A,E as k,n as a}from"./ResizeObserver.es.62ab429c.js";import{C as T}from"./index.786e83cc.js";import{C as F}from"./index.105e15bd.js";import"./index.d7a13e47.js";import{F as V}from"./index.82be4917.js";import{C as l}from"./index.1a2d53c5.js";import{a as B,d as x}from"./api.86641843.js";import"./index.a6e5e68b.js";import"./use-id.1bbe472d.js";import"./index.021584f9.js";import"./index.3d6f6bcd.js";import"./index.7f3546e4.js";const R="_creationTablet_4veag_1",N="_sectionVideo_4veag_1",U="_videoBg_4veag_1",M="_btnGroup_4veag_16",S="_btnCropper_4veag_40",w="_btnImg_4veag_52",G="_section_4veag_1",P="_sectionFile_4veag_89",L="_muploader_4veag_101",O="_uploadImg_4veag_130",W="_tip_4veag_135",j="_musicDetail_4veag_161",q="_musicName_4veag_166",z="_username_4veag_172";var o={creationTablet:R,sectionVideo:N,videoBg:U,btnGroup:M,btnCropper:S,btnImg:w,section:G,sectionFile:P,muploader:L,uploadImg:O,tip:W,musicDetail:j,musicName:q,username:z},E="./assets/videobg.e5380989.png",ae=h({name:"creation-edit",setup(){const{isTablet:r,ios:u,iPhone:d}=C(),m=D(),p=b(),e=f({id:m.query.id,musicDetail:{},playType:"",desc:"",videoImg:"",img:"",needCheckDevice:!!(u||d),hasDeviceAuth:!1}),v=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 x({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"}),p.back()}catch{}},g=()=>{a({api:"checkDeviceCamera",content:{hideAlert:!0}},t=>{t!=null&&t.content.status&&(e.hasDeviceAuth=!0)})},c=()=>{console.log("\u6821\u9A8Capp",e.needCheckDevice),e.needCheckDevice?a({api:"checkDeviceCamera"},t=>{const{content:s}=t;s!=null&&s.status?e.hasDeviceAuth=!0:e.hasDeviceAuth=!1}):e.hasDeviceAuth=!0},_=()=>{a({api:"videoCrop",content:{url:e.musicDetail.videoUrl}},t=>{t!=null&&t.content.videoCover&&(e.videoImg=t.content.videoCover)})};function n(t){a({api:"setStatusBarTextColor",content:{statusBarTextColor:t}})}return I(async()=>{g(),n(!1);try{const{data:t}=await B(e.id);e.musicDetail=t,e.desc=t.desc,e.videoImg=t.videoImg,e.img=t.img,(t==null?void 0:t.videoUrl.lastIndexOf("mp4"))!==-1?e.playType="Video":e.playType="Audio"}catch{}}),y(()=>{n(!0)}),()=>i("div",{class:r?o.creationTablet:""},[i(F,{position:"top"},{default:()=>[i(T,{background:"#F1F1F1",border:!1},null)]}),i("div",{class:[o.section,o.sectionFile]},[i("div",{class:o.uploadImg,onClick:c},[i(l,{class:o.muploader,cropper:!0,tips:"",deletable:!1,hasDeviceAuth:e.hasDeviceAuth,modelValue:e.img,"onUpdate:modelValue":t=>e.img=t},null)]),i("div",{class:o.musicDetail},[i("p",{class:o.musicName},[e.musicDetail.musicSheetName]),i("p",{class:o.username},[e.musicDetail.username])])]),e.playType==="Video"&&i("div",{class:[o.section,o.sectionVideo]},[i("img",{src:e.videoImg||E,class:o.videoBg},null),i("div",{class:o.btnGroup},[i("div",{onClick:c},[i(l,{class:o.btnImg,cropper:!0,tips:"",deletable:!1,hasDeviceAuth:e.hasDeviceAuth,onUploadChange:t=>{console.log(t,"img"),e.videoImg=t},options:{fixedNumber:[16,9]}},null)]),i("div",{class:o.btnCropper,onClick:_},[A("\u89C6\u9891\u622A\u53D6\u5C01\u9762")])])]),i("div",{class:o.section},[i(V,{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":t=>e.desc=t},null)]),i("div",{class:o.btnGroup},[i(k,{type:"primary",round:!0,block:!0,color:"#2DC7AA",onClick:v},{default:()=>[e.musicDetail.type==="FORMAL"?"\u4FDD\u5B58":"\u53D1\u5E03"]})])])}});export{ae as default};
