import ColCropper from '@/components/col-cropper' import ColUpload from '@/components/col-upload' import request from '@/helpers/request' import { verifyNumberIntegerAndFloat } from '@/helpers/toolsValidate' import { getCodeBaseUrl } from '@/helpers/utils' import { ElButton, ElForm, ElFormItem, ElInput, ElOption, ElOptionGroup, ElRadioButton, ElRadioGroup, ElSelect, ElDialog, ElMessage } from 'element-plus' import { defineComponent } from 'vue' import styles from './index.module.less' export type BackgroundMp3 = { url?: string track?: string } export const validator = (rule, value, callback) => { console.log(value) if (value == '') { callback(new Error('请输入收费价格')) } else if (Number(value) <= 0) { callback(new Error('收费金额必须大于0')) } else { callback() } } export default defineComponent({ name: 'music-operation', data() { const query = this.$route.query return { type: query.type || 'create', subjectList: [], tagList: [], submitLoading: false, reason: '', form: { titleImg: '', accompanimentType: 'HOMEMODE', audioType: 'MP3', xmlFileUrl: '', hasBeat: 0, mp3Url: '', bgmp3Url: '', midiUrl: '', musicSheetName: '', composer: '', musicSubject: null as any, tags: [] as string[], notation: 0, canEvaluate: 1, showFingering: 1, chargeType: 0, musicPrice: '', backgroundMp3s: [ { url: '', track: '' } ] as BackgroundMp3[] }, radioList: [], // 选中的人数 tagStatus: false, music_sheet_service_fee: 0 } }, async mounted() { document.title = this.type === 'create' ? '新建曲谱' : '编辑曲谱' try { await request .get('/api-website/sysConfig/queryByParamName', { params: { paramName: 'music_sheet_service_fee' } }) .then(res => (this.music_sheet_service_fee = res.data.paramValue)) await request.get('/api-website/open/subject/subjectSelect').then(res => { this.subjectList = res.data || [] }) await request.get('/api-website/open/MusicTag/tree').then(res => { this.tagList = res.data || [] }) if (this.$route.query.id) { this.setDetail(this.$route.query.id as string) } } catch {} }, methods: { async setDetail(id: string) { try { const res = await request.get( '/api-website/open/music/sheet/detail/' + id ) this.form.chargeType = res.data.chargeType === 'FREE' ? 0 : 2 this.form.showFingering = res.data.showFingering this.form.notation = res.data.notation this.form.canEvaluate = res.data.canEvaluate if (this.form.chargeType) { this.form.musicPrice = res.data.musicPrice } this.form.composer = res.data.composer this.form.musicSheetName = res.data.musicSheetName this.form.audioType = res.data.audioType this.form.musicSubject = Number(res.data.musicSubject) const musicTag = res.data.musicTag.split(',') this.form.tags = musicTag.map((item: any) => { return Number(item) }) this.radioList = this.form.tags as any this.form.xmlFileUrl = res.data.xmlFileUrl this.form.accompanimentType = res.data.accompanimentType this.form.titleImg = res.data.titleImg // this.form.audioType = res.data.mp3Type if (this.form.audioType === 'MP3') { this.form.hasBeat = res.data.hasBeat || 0 this.form.mp3Url = res.data.metronomeUrl || res.data.url } else { this.form.midiUrl = res.data.midiUrl } this.form.backgroundMp3s = (res.data.background || []).map( (item: any, index: any) => { if (index === 0) { this.form.bgmp3Url = item.metronomeUrl || item.audioFileUrl } return { url: this.form.hasBeat ? item.metronomeUrl : item.audioFileUrl, track: item.track } } ) this.reason = res.data.reason console.log(this.form.bgmp3Url) } catch (error) { console.log(error) } }, createSubmitData() { const { form } = this const beatType = form.hasBeat ? 'MP3_METRONOME' : 'MP3' const mp3Type = form.audioType === 'MP3' ? beatType : 'MIDI' return { audioType: form.audioType, sourceType: 'TEACHER', mp3Type, accompanimentType: form.accompanimentType, titleImg: form.titleImg, hasBeat: form.hasBeat, url: form.hasBeat ? '' : form.mp3Url, metronomeUrl: form.hasBeat ? form.mp3Url : '', showFingering: Number(form.showFingering), notation: Number(form.notation), musicTag: form.tags.join(','), musicSubject: form.musicSubject || undefined, musicSheetName: form.musicSheetName, midiUrl: form.midiUrl, xmlFileUrl: form.xmlFileUrl, canEvaluate: Number(form.canEvaluate), chargeType: form.chargeType === 0 ? 'FREE' : 'CHARGE', composer: form.composer, musicPrice: form.musicPrice, background: form.backgroundMp3s.map(item => ({ audioFileUrl: form.hasBeat ? '' : form.bgmp3Url, track: item.track, metronomeUrl: form.hasBeat ? form.bgmp3Url : '' })) } }, onFormatter(e: any) { e.target.value = verifyNumberIntegerAndFloat(e.target.value) }, onSubmit() { ;(this as any).$refs.form.validate(async (valid: any) => { if (valid) { this.submitLoading = true console.log(this.createSubmitData(), 'createSubmitData') try { if (this.$route.query.id) { await request.post('/api-website/music/sheet/update', { data: { ...this.createSubmitData(), id: this.$route.query.id } }) } else { await request.post('/api-website/music/sheet/create', { data: this.createSubmitData() }) } this.submitLoading = false ElMessage.success('上传成功') sessionStorage.setItem('musicActiveName', 'DOING') this.$router.back() } catch (error) { this.submitLoading = false } } else { this.$nextTick(() => { const isError = document.getElementsByClassName('is-error') isError[0].scrollIntoView({ block: 'center', behavior: 'smooth' }) }) return false } }) }, onDetail(type: string) { let url = `${getCodeBaseUrl('/teacher')}/#/registerProtocol` if (type === 'question') { url = `${getCodeBaseUrl('/teacher')}/muic-standard/question.html` } else if (type === 'music') { url = `${getCodeBaseUrl('/teacher')}/muic-standard/index.html` } window.open(url) } }, render() { return (
{this.type === 'create' ? '新建曲谱' : '编辑曲谱'}
注意事项:
1、必须是上传人自己参与制作的作品。
2、歌曲及歌曲信息中请勿涉及政治、宗教、广告、涉毒、犯罪、色情、低俗、暴力、血腥、消极等违规内容,违反者直接删除内容。多次违反将封号。
3、点击查看{' '} this.onDetail('protocol')}> 《用户注册协议》 ,如果您上传了文件,即认为您完全同意并遵守该协议的内容;
曲谱审核标准:
1、文件大小不要超过5MB,不符合版面规范的乐谱,审核未通过的不予上架,详情参考 this.onDetail('music')}> 《曲谱排版规范》 ; 1、必须是上传人自己参与制作的作品。
2、XML与MIDI文件内容必须一致,推荐使用Sibelius打谱软件。导出设置:导出XML-未压缩(*.xml)/导出MIDI:音色-其他回放设备General MIDI、MIDI、MIDI文件类型-类型0、不要勾选“将弱拍小节导出为具有休止符的完整小节”。点击查看 this.onDetail('question')}> 《常见问题》
MIDI MP3 {this.form.audioType === 'MP3' ? ( <> 自制伴奏 普通伴奏 ) : ( <> 自制伴奏 普通伴奏 )}
1、推荐上传自制伴奏,伴奏和谱面必须对齐。自制伴奏可以设置更高的收费标准。
2、普通伴奏如果涉及到版权纠纷,根据 this.onDetail('protocol')}> 《用户注册协议》 平台有权进行下架处理。
{this.form.audioType === 'MP3' && ( )}
1、同一首曲目不可重复上传,如有不同版本统一用“()”补充。举例:人生的旋转木马(长笛二重奏版)。
2、曲目名后可添加曲目信息备注,包含但不限于曲目类型等。曲目名《xxxx》,举例:人生的旋转木马《哈尔的移动城堡》(长笛二重奏版)
3、其他信息不要写在曲目名里,如歌手、上传人员昵称等。
{ this.form.titleImg = data }} domSize={{ height: '150px' }} options={{ title: '曲谱封面', enlarge: 2, autoCropWidth: 300, autoCropHeight: 300 }} /> {this.subjectList.map((group: any) => ( {group.subjects && group.subjects.map((item: any) => ( ))} ))}
XML文件中,选择的曲目声部需要在总谱的置顶位置。
{ console.log(111) this.tagStatus = true }} >
{this.tagList.map((group: any) => ( {group.children && group.children.map((item: any) => ( ))} ))}
{this.form.chargeType === 2 && ( <> }} />

扣除手续费后该曲目预计收入为:

每人: {((parseFloat(this.form.musicPrice || '0') || 0) * (100 - this.music_sheet_service_fee)) / 100} 元/人

您的乐谱收入将在学员购买后结算到您的账户中

)}
{ this.$router.back() }} > 取消 提交审核
(this.tagStatus = val)} width="35%" title="全部标签" > {this.tagList.map((item: any, index: number) => (
{item.name}
{item.children.map((child: any) => ( {child.name} ))}
))}
{ this.radioList = [] }} > 重置 { this.form.tags = this.radioList this.tagStatus = false ;(this as any).$refs.form.clearValidate('tags') }} > 确认
) } })