1 |
- var T=Object.defineProperty,U=Object.defineProperties;var x=Object.getOwnPropertyDescriptors;var h=Object.getOwnPropertySymbols;var M=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable;var f=(e,a,t)=>a in e?T(e,a,{enumerable:!0,configurable:!0,writable:!0,value:t}):e[a]=t,C=(e,a)=>{for(var t in a||(a={}))M.call(a,t)&&f(e,t,a[t]);if(h)for(var t of h(a))w.call(a,t)&&f(e,t,a[t]);return e},B=(e,a)=>U(e,x(a));import{C as v}from"./index.3411d0b7.js";import{C as p}from"./index.515399a8.js";import{r as c,B as n}from"./index.ec43d267.js";import{v as V}from"./toolsValidate.add49407.js";import{d as q,E as I,c as u,y as S,a as l,z as s,aa as d,ab as o,F,w as E,a1 as g,a7 as _,a2 as b,k as y,a8 as k}from"./vendor.1514baa4.js";const N="_form_1x538_1",j="_tags_1x538_2",P="_tips_1x538_51",L="_tipsTitle_1x538_60",O="_rule_1x538_71";var i={form:N,tags:j,tips:P,tipsTitle:L,rule:O};function D(e){return typeof e=="function"||Object.prototype.toString.call(e)==="[object Object]"&&!k(e)}const $=(e,a,t)=>{console.log(a),a==""?t(new Error("\u8BF7\u8F93\u5165\u6536\u8D39\u4EF7\u683C")):Number(a)<=0?t(new Error("\u6536\u8D39\u91D1\u989D\u5FC5\u987B\u5927\u4E8E0")):t()};var K=q({name:"music-operation",data(){return{type:this.$route.query.type||"create",subjectList:[],tagList:[],submitLoading:!1,reason:"",form:{titleImg:"",accompanimentType:"HOMEMODE",audioType:"MP3",xmlFileUrl:"",mp3Url:"",bgmp3Url:"",midiUrl:"",musicSheetName:"",composer:"",musicSubject:null,tags:[],hasBeat:0,notation:1,canEvaluate:1,showFingering:1,chargeType:0,exquisiteFlag:0,paymentType:"",musicPrice:"",backgroundMp3s:[{url:"",track:""}]},radioList:[],tagStatus:!1,music_sheet_service_fee:0}},async mounted(){document.title=this.type==="create"?"\u65B0\u5EFA\u66F2\u8C31":"\u7F16\u8F91\u66F2\u8C31";try{await c.get("/api-website/sysConfig/queryByParamName",{params:{paramName:"music_sheet_service_fee"}}).then(e=>this.music_sheet_service_fee=e.data.paramValue),await c.get("/api-website/open/subject/subjectSelect").then(e=>{this.subjectList=e.data||[]}),await c.get("/api-website/open/MusicTag/tree").then(e=>{this.tagList=e.data||[]}),this.$route.query.id&&this.setDetail(this.$route.query.id)}catch{}},methods:{async setDetail(e){try{const a=await c.get("/api-website/open/music/sheet/detail/"+e);this.form.chargeType=a.data.chargeType==="FREE"?0:2,this.form.exquisiteFlag=a.data.exquisiteFlag,this.form.showFingering=a.data.showFingering,this.form.notation=a.data.notation,this.form.canEvaluate=a.data.canEvaluate,this.form.chargeType&&(this.form.musicPrice=a.data.musicPrice),this.form.composer=a.data.composer,this.form.musicSheetName=a.data.musicSheetName,this.form.audioType=a.data.audioType,this.form.musicSubject=Number(a.data.musicSubject);const t=a.data.musicTag.split(","),m=t.filter(r=>r!="");this.form.tags=m.map(r=>Number(r)),this.radioList=t.map(r=>Number(r)),this.form.xmlFileUrl=a.data.xmlFileUrl,this.form.accompanimentType=a.data.accompanimentType,this.form.titleImg=a.data.titleImg,this.form.audioType==="MP3"?(this.form.hasBeat=a.data.hasBeat||0,this.form.mp3Url=a.data.audioFileUrl||a.data.metronomeUrl||a.data.url):this.form.midiUrl=a.data.midiUrl,this.form.backgroundMp3s=(a.data.background||[]).map((r,A)=>(A===0&&(this.form.bgmp3Url=r.audioFileUrl||r.metronomeUrl),{url:this.form.hasBeat?r.metronomeUrl:r.audioFileUrl,track:r.track})),this.reason=a.data.reason}catch(a){console.log(a)}},createSubmitData(){const{form:e}=this,a=e.hasBeat?"MP3_METRONOME":"MP3",t=e.audioType==="MP3"?a:"MIDI";return{audioType:e.audioType,sourceType:"TEACHER",mp3Type:t,accompanimentType:e.accompanimentType,titleImg:e.titleImg,hasBeat:Number(e.hasBeat),audioFileUrl:e.mp3Url,showFingering:Number(e.showFingering),notation:Number(e.notation),musicTag:e.tags.join(","),musicSubject:e.musicSubject||void 0,musicSheetName:e.musicSheetName,midiUrl:e.midiUrl,xmlFileUrl:e.xmlFileUrl,canEvaluate:Number(e.canEvaluate),chargeType:e.chargeType===0?"FREE":"CHARGE",exquisiteFlag:e.exquisiteFlag,paymentType:e.paymentType?e.paymentType:e.chargeType===0?"FREE":"CHARGE",composer:e.composer,musicPrice:e.chargeType===0?0:e.musicPrice,background:e.backgroundMp3s.map(m=>({audioFileUrl:e.hasBeat?"":e.bgmp3Url,track:m.track,metronomeUrl:e.hasBeat?e.bgmp3Url:""}))}},onFormatter(e){e.target.value=V(e.target.value)},onSubmit(){this.$refs.form.validate(async e=>{if(e){this.submitLoading=!0,console.log(this.createSubmitData(),"createSubmitData");try{this.$route.query.id?await c.post("/api-website/music/sheet/update",{data:B(C({},this.createSubmitData()),{id:this.$route.query.id})}):await c.post("/api-website/music/sheet/create",{data:this.createSubmitData()}),this.submitLoading=!1,I.success("\u4E0A\u4F20\u6210\u529F"),sessionStorage.setItem("musicActiveName","DOING"),this.$router.back()}catch{this.submitLoading=!1}}else return this.$nextTick(()=>{document.getElementsByClassName("is-error")[0].scrollIntoView({block:"center",behavior:"smooth"})}),!1})},onDetail(e){let a=`${n("/teacher")}/#/registerProtocol`;e==="question"?a=`${n("/teacher")}/muic-standard/question.html`:e==="music"&&(a=`${n("/teacher")}/muic-standard/index.html`),window.open(a)}},render(){let e,a;return u("div",{class:i.form},[u("div",{class:"text-2xl font-semibold text-black leading-none px-6 py-5 "},[this.type==="create"?"\u65B0\u5EFA\u66F2\u8C31":"\u7F16\u8F91\u66F2\u8C31"]),u(S,{size:"large",labelPosition:"left",labelWidth:"150px",model:this.form,ref:"form",class:"px-7 py-5"},{default:()=>[u("div",{class:i.tips},[u("div",{class:i.tipsTitle},[l("\u6CE8\u610F\u4E8B\u9879\uFF1A")]),u("div",{class:i.tipsContent},[l("1\u3001\u5FC5\u987B\u662F\u4E0A\u4F20\u4EBA\u81EA\u5DF1\u53C2\u4E0E\u5236\u4F5C\u7684\u4F5C\u54C1\u3002"),u("br",null,null),l("2\u3001\u6B4C\u66F2\u53CA\u6B4C\u66F2\u4FE1\u606F\u4E2D\u8BF7\u52FF\u6D89\u53CA\u653F\u6CBB\u3001\u5B97\u6559\u3001\u5E7F\u544A\u3001\u6D89\u6BD2\u3001\u72AF\u7F6A\u3001\u8272\u60C5\u3001\u4F4E\u4FD7\u3001\u66B4\u529B\u3001\u8840\u8165\u3001\u6D88\u6781\u7B49\u8FDD\u89C4\u5185\u5BB9\uFF0C\u8FDD\u53CD\u8005\u76F4\u63A5\u5220\u9664\u5185\u5BB9\u3002\u591A\u6B21\u8FDD\u53CD\u5C06\u5C01\u53F7\u3002"),u("br",null,null),l("3\u3001\u70B9\u51FB\u67E5\u770B")," ",u("span",{onClick:()=>this.onDetail("protocol")},[l("\u300A\u7528\u6237\u6CE8\u518C\u534F\u8BAE\u300B")]),l("\uFF0C\u5982\u679C\u60A8\u4E0A\u4F20\u4E86\u6587\u4EF6\uFF0C\u5373\u8BA4\u4E3A\u60A8\u5B8C\u5168\u540C\u610F\u5E76\u9075\u5B88\u8BE5\u534F\u8BAE\u7684\u5185\u5BB9\uFF1B")])]),u(s,{label:"\u4E0A\u4F20XML",prop:"xmlFileUrl",rules:[{required:!0,message:"\u8BF7\u9009\u62E9MusicXML\u6587\u4EF6"}]},{default:()=>[u(p,{modelValue:this.form.xmlFileUrl,"onUpdate:modelValue":t=>this.form.xmlFileUrl=t,bucket:"cloud-coach",accept:"application/xml",uploadType:"file",extraTips:"\u6587\u4EF6\u6700\u5927\u4E0D\u80FD\u8D85\u8FC75MB"},null)]}),u("div",{class:i.tips},[u("div",{class:i.tipsTitle},[l("\u66F2\u8C31\u5BA1\u6838\u6807\u51C6\uFF1A")]),u("div",{class:i.tipsContent},[l("1\u3001\u6587\u4EF6\u5927\u5C0F\u4E0D\u8981\u8D85\u8FC75MB\uFF0C\u4E0D\u7B26\u5408\u7248\u9762\u89C4\u8303\u7684\u4E50\u8C31\uFF0C\u5BA1\u6838\u672A\u901A\u8FC7\u7684\u4E0D\u4E88\u4E0A\u67B6\uFF0C\u8BE6\u60C5\u53C2\u8003"),u("span",{onClick:()=>this.onDetail("music")},[l("\u300A\u66F2\u8C31\u6392\u7248\u89C4\u8303\u300B")]),l("\uFF1B 1\u3001\u5FC5\u987B\u662F\u4E0A\u4F20\u4EBA\u81EA\u5DF1\u53C2\u4E0E\u5236\u4F5C\u7684\u4F5C\u54C1\u3002"),u("br",null,null),l("2\u3001XML\u4E0EMIDI\u6587\u4EF6\u5185\u5BB9\u5FC5\u987B\u4E00\u81F4\uFF0C\u63A8\u8350\u4F7F\u7528Sibelius\u6253\u8C31\u8F6F\u4EF6\u3002\u5BFC\u51FA\u8BBE\u7F6E\uFF1A\u5BFC\u51FAXML-\u672A\u538B\u7F29\uFF08*.xml\uFF09/\u5BFC\u51FAMIDI\uFF1A\u97F3\u8272-\u5176\u4ED6\u56DE\u653E\u8BBE\u5907General MIDI\u3001MIDI\u3001MIDI\u6587\u4EF6\u7C7B\u578B-\u7C7B\u578B0\u3001\u4E0D\u8981\u52FE\u9009\u201C\u5C06\u5F31\u62CD\u5C0F\u8282\u5BFC\u51FA\u4E3A\u5177\u6709\u4F11\u6B62\u7B26\u7684\u5B8C\u6574\u5C0F\u8282\u201D\u3002\u70B9\u51FB\u67E5\u770B"),u("span",{onClick:()=>this.onDetail("question")},[l("\u300A\u5E38\u89C1\u95EE\u9898\u300B")])])]),u(s,{label:"\u64AD\u653E\u7C7B\u578B",prop:"audioType",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u64AD\u653E\u7C7B\u578B"}]},{default:()=>[u(d,{modelValue:this.form.audioType,"onUpdate:modelValue":t=>this.form.audioType=t},{default:()=>[u(o,{label:"MIDI",class:"mr-3 w-24"},{default:()=>[l("MIDI")]}),u(o,{label:"MP3",class:"w-24"},{default:()=>[l("MP3")]})]})]}),this.form.audioType==="MP3"?u(F,null,[u(s,{label:"\u4F34\u594F\u7C7B\u578B",prop:"accompanimentType",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4F34\u594F\u7C7B\u578B"}]},{default:()=>[u(d,{modelValue:this.form.accompanimentType,"onUpdate:modelValue":t=>this.form.accompanimentType=t},{default:()=>[u(o,{label:"HOMEMODE",class:"mr-3 w-24"},{default:()=>[l("\u81EA\u5236\u4F34\u594F")]}),u(o,{label:"COMMON",class:"w-24"},{default:()=>[l("\u666E\u901A\u4F34\u594F")]})]})]}),u(s,{label:"\u4F34\u594F\u6587\u4EF6",prop:"mp3Url"},{default:()=>[u(p,{modelValue:this.form.mp3Url,"onUpdate:modelValue":t=>this.form.mp3Url=t,bucket:"cloud-coach",accept:".mp3",uploadType:"file",size:8,extraTips:"\u6587\u4EF6\u6700\u5927\u4E0D\u80FD\u8D85\u8FC78MB"},null)]})]):u(F,null,[u(s,{label:"\u4F34\u594F\u7C7B\u578B",prop:"accompanimentType",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u4F34\u594F\u7C7B\u578B"}]},{default:()=>[u(d,{modelValue:this.form.accompanimentType,"onUpdate:modelValue":t=>this.form.accompanimentType=t},{default:()=>[u(o,{label:"HOMEMODE",class:"mr-3 w-24"},{default:()=>[l("\u81EA\u5236\u4F34\u594F")]}),u(o,{label:"COMMON",class:"w-24"},{default:()=>[l("\u666E\u901A\u4F34\u594F")]})]})]}),u(s,{label:"MIDI\u6587\u4EF6",prop:"midiUrl",rules:[{required:!0,message:"\u8BF7\u9009\u62E9MIDI\u6587\u4EF6"}]},{default:()=>[u(p,{modelValue:this.form.midiUrl,"onUpdate:modelValue":t=>this.form.midiUrl=t,bucket:"cloud-coach",accept:".midi,.mid",uploadType:"file",size:8,extraTips:"\u6587\u4EF6\u6700\u5927\u4E0D\u80FD\u8D85\u8FC78MB"},null)]})]),u("div",{class:i.tips},[u("div",{class:i.tipsContent},[l("1\u3001\u63A8\u8350\u4E0A\u4F20\u81EA\u5236\u4F34\u594F\uFF0C\u4F34\u594F\u548C\u8C31\u9762\u5FC5\u987B\u5BF9\u9F50\u3002\u81EA\u5236\u4F34\u594F\u53EF\u4EE5\u8BBE\u7F6E\u66F4\u9AD8\u7684\u6536\u8D39\u6807\u51C6\u3002"),u("br",null,null),l("2\u3001\u666E\u901A\u4F34\u594F\u5982\u679C\u6D89\u53CA\u5230\u7248\u6743\u7EA0\u7EB7\uFF0C\u6839\u636E"),u("span",{onClick:()=>this.onDetail("protocol")},[l("\u300A\u7528\u6237\u6CE8\u518C\u534F\u8BAE\u300B")]),l("\u5E73\u53F0\u6709\u6743\u8FDB\u884C\u4E0B\u67B6\u5904\u7406\u3002")])]),this.form.audioType==="MP3"&&u(s,{label:"\u539F\u97F3\u6587\u4EF6",prop:"bgmp3Url",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u539F\u97F3\u6587\u4EF6"}]},{default:()=>[u(p,{modelValue:this.form.bgmp3Url,"onUpdate:modelValue":t=>this.form.bgmp3Url=t,bucket:"cloud-coach",accept:".mp3",uploadType:"file",size:8,extraTips:"\u6587\u4EF6\u6700\u5927\u4E0D\u80FD\u8D85\u8FC78MB"},null)]}),u(s,{label:"\u66F2\u76EE\u540D\u79F0",prop:"musicSheetName",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u66F2\u76EE\u540D\u79F0"}]},{default:()=>[u(E,{modelValue:this.form.musicSheetName,"onUpdate:modelValue":t=>this.form.musicSheetName=t,placeholder:"\u8BF7\u9009\u62E9\u66F2\u76EE\u540D\u79F0"},null)]}),u("div",{class:i.tips},[u("div",{class:i.tipsContent},[l("1\u3001\u540C\u4E00\u9996\u66F2\u76EE\u4E0D\u53EF\u91CD\u590D\u4E0A\u4F20\uFF0C\u5982\u6709\u4E0D\u540C\u7248\u672C\u7EDF\u4E00\u7528\u201C\uFF08\uFF09\u201D\u8865\u5145\u3002\u4E3E\u4F8B\uFF1A\u4EBA\u751F\u7684\u65CB\u8F6C\u6728\u9A6C\uFF08\u957F\u7B1B\u4E8C\u91CD\u594F\u7248\uFF09\u3002"),u("br",null,null),l("2\u3001\u66F2\u76EE\u540D\u540E\u53EF\u6DFB\u52A0\u66F2\u76EE\u4FE1\u606F\u5907\u6CE8\uFF0C\u5305\u542B\u4F46\u4E0D\u9650\u4E8E\u66F2\u76EE\u7C7B\u578B\u7B49\u3002\u66F2\u76EE\u540D\u300Axxxx\u300B\uFF0C\u4E3E\u4F8B\uFF1A\u4EBA\u751F\u7684\u65CB\u8F6C\u6728\u9A6C\u300A\u54C8\u5C14\u7684\u79FB\u52A8\u57CE\u5821\u300B\uFF08\u957F\u7B1B\u4E8C\u91CD\u594F\u7248\uFF09"),u("br",null,null),l("3\u3001\u5176\u4ED6\u4FE1\u606F\u4E0D\u8981\u5199\u5728\u66F2\u76EE\u540D\u91CC\uFF0C\u5982\u6B4C\u624B\u3001\u4E0A\u4F20\u4EBA\u5458\u6635\u79F0\u7B49\u3002")])]),u(s,{label:"\u66F2\u8C31\u5C01\u9762",prop:"titleImg",rules:[{required:!0,message:"\u8BF7\u4E0A\u4F20\u66F2\u8C31\u5C01\u9762"}]},{default:()=>[u(v,{modelValue:this.form.titleImg,bucket:"cloud-coach",cropUploadSuccess:t=>{this.form.titleImg=t},domSize:{height:"150px"},options:{title:"\u66F2\u8C31\u5C01\u9762",enlarge:2,autoCropWidth:300,autoCropHeight:300}},null)]}),u(s,{label:"\u827A\u672F\u5BB6",prop:"composer",rules:[{required:!0,message:"\u8BF7\u8F93\u5165\u827A\u672F\u5BB6"}]},{default:()=>[u(E,{modelValue:this.form.composer,"onUpdate:modelValue":t=>this.form.composer=t,placeholder:"\u8BF7\u8F93\u5165\u827A\u672F\u5BB6"},null)]}),u(s,{label:"\u66F2\u76EE\u58F0\u90E8",prop:"musicSubject",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u66F2\u76EE\u58F0\u90E8",trigger:"change"}]},{default:()=>[u(g,{filterable:!0,modelValue:this.form.musicSubject,"onUpdate:modelValue":t=>this.form.musicSubject=t,placeholder:"\u8BF7\u9009\u62E9\u66F2\u76EE\u58F0\u90E8",class:"w-full"},D(e=this.subjectList.map(t=>u(_,{key:t.id,label:t.name},{default:()=>[t.subjects&&t.subjects.map(m=>u(b,{key:m.id,value:m.id,label:m.name},null))]})))?e:{default:()=>[e]})]}),u("div",{class:i.tips},[u("div",{class:i.tipsContent},[l("XML\u6587\u4EF6\u4E2D\uFF0C\u9009\u62E9\u7684\u66F2\u76EE\u58F0\u90E8\u9700\u8981\u5728\u603B\u8C31\u7684\u7F6E\u9876\u4F4D\u7F6E\u3002")])]),u(s,{label:"\u66F2\u76EE\u6807\u7B7E",prop:"tags",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u66F2\u76EE\u6807\u7B7E"}]},{default:()=>[u(g,{multiple:!0,modelValue:this.form.tags,"onUpdate:modelValue":t=>this.form.tags=t,placeholder:"\u8BF7\u9009\u62E9\u66F2\u76EE\u6807\u7B7E",multipleLimit:3,class:"w-full"},D(a=this.tagList.map(t=>u(b,{key:t.id,value:t.id,label:t.name},null)))?a:{default:()=>[a]})]}),u(s,{label:"\u662F\u5426\u6536\u8D39",prop:"chargeType",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u6536\u8D39"}]},{default:()=>[u(d,{modelValue:this.form.chargeType,"onUpdate:modelValue":t=>this.form.chargeType=t},{default:()=>[u(o,{label:0,class:"mr-3 w-24"},{default:()=>[l("\u5426")]}),u(o,{label:2,class:"w-24"},{default:()=>[l("\u662F")]})]})]}),this.form.chargeType===2&&u(F,null,[u(s,{label:"\u6536\u8D39\u4EF7\u683C",prop:"musicPrice",rules:[{required:!0,validator:$}]},{default:()=>[u(E,{modelValue:this.form.musicPrice,"onUpdate:modelValue":t=>this.form.musicPrice=t,placeholder:"\u8BF7\u8F93\u5165\u6536\u8D39\u4EF7\u683C",maxlength:5,onKeyup:this.onFormatter},{suffix:()=>u("span",{class:"text-base text-[#999]"},[l("\u5143")])})]}),u(s,null,{default:()=>[u("div",{class:i.rule},[u("p",null,[l("\u6263\u9664\u624B\u7EED\u8D39\u540E\u8BE5\u66F2\u76EE\u9884\u8BA1\u6536\u5165\u4E3A\uFF1A")]),u("p",null,[l("\u6BCF\u4EBA\uFF1A"),u("span",null,[(parseFloat(this.form.musicPrice||"0")||0)*(100-this.music_sheet_service_fee)/100]),l("\u5143/\u4EBA")]),u("p",null,[l("\u60A8\u7684\u4E50\u8C31\u6536\u5165\u5C06\u5728\u5B66\u5458\u8D2D\u4E70\u540E\u7ED3\u7B97\u5230\u60A8\u7684\u8D26\u6237\u4E2D")])])]})]),u(s,{label:"\u662F\u5426\u7CBE\u54C1\u4E50\u8C31",prop:"exquisiteFlag",rules:[{required:!0,message:"\u8BF7\u9009\u62E9\u662F\u5426\u7CBE\u54C1\u4E50\u8C31"}]},{default:()=>[u(d,{modelValue:this.form.exquisiteFlag,"onUpdate:modelValue":t=>this.form.exquisiteFlag=t},{default:()=>[u(o,{label:0,class:"mr-3 w-24"},{default:()=>[l("\u5426")]}),u(o,{label:1,class:"w-24"},{default:()=>[l("\u662F")]})]})]})]}),u("div",{class:"text-center pt-6 pb-7"},[u(y,{class:"!w-44 !h-[48px]",round:!0,onClick:()=>{this.$router.back()}},{default:()=>[l("\u53D6\u6D88")]}),u(y,{type:"primary",class:"!w-44 !h-[48px]",round:!0,onClick:this.onSubmit,loading:this.submitLoading},{default:()=>[l("\u63D0\u4EA4\u5BA1\u6838")]})])])}});export{K as default,$ as validator};
|