|
@@ -12,15 +12,12 @@
|
|
|
<van-cell title="专业等级" >
|
|
|
{{ form.subjectName }}({{ form.level | formatLevel }})
|
|
|
</van-cell>
|
|
|
- <van-cell v-for="(item, index) in performInfo" :key="index" :title="`练习曲${numberToCN(index)}`" @click="onOpen('perform', index)" is-link >
|
|
|
+ <van-cell v-for="(item, index) in practiceInfo" :key="index" :title="`练习曲${numberToCN(index)}`" @click="onOpen('practice', index)" is-link >
|
|
|
{{ item.songName }} {{ item.songAuthor ? '-' + item.songAuthor : item.songAuthor }}
|
|
|
</van-cell>
|
|
|
- <van-cell v-for="(item, index) in practiceInfo" :key="index" :title="`演奏曲${numberToCN(index)}`" @click="onOpen('practice', index)" is-link >
|
|
|
+ <van-cell v-for="(item, index) in performInfo" :key="index" :title="`演奏曲${numberToCN(index)}`" @click="onOpen('perform', index)" is-link >
|
|
|
{{ item.songName }} {{ item.songAuthor ? '-' + item.songAuthor : item.songAuthor }}
|
|
|
</van-cell>
|
|
|
- <!-- <van-cell title="练习曲" is-link />
|
|
|
- <van-cell title="演奏曲" is-link />
|
|
|
- <van-cell title="演奏曲" is-link /> -->
|
|
|
<van-field v-model="form.name" disabled label="考级证书" >
|
|
|
<template #input>
|
|
|
<van-uploader
|
|
@@ -52,13 +49,12 @@
|
|
|
:max-count="1" />
|
|
|
</template>
|
|
|
</van-field>
|
|
|
- <!-- disabled
|
|
|
- :deletable="false" -->
|
|
|
</van-cell-group>
|
|
|
|
|
|
<van-cell-group class="memos">
|
|
|
<van-cell disabled title="报名审核" >
|
|
|
<p class="pass" v-if="form.status === 'AUDIT_PASS'">已通过</p>
|
|
|
+ <p v-else-if="form.status === 'AUDIT_WAIT'">等待审核</p>
|
|
|
<p class="noPass" v-else>未通过</p>
|
|
|
</van-cell>
|
|
|
<van-cell title="备注" >
|
|
@@ -70,10 +66,10 @@
|
|
|
<van-popup class="van-popup-song" v-model="songUpload.songStatus" :close-on-click-overlay="false">
|
|
|
<div class="song-popup">
|
|
|
<div class="title">自定义曲目</div>
|
|
|
- <van-field name="songName" v-model="songUpload.name" :disabled="!form.editStatus" label="曲名" placeholder="请输入曲名" >
|
|
|
+ <van-field name="songName" v-model="songUpload.songName" :disabled="!form.editStatus" label="曲名" placeholder="请输入曲名" >
|
|
|
<template #label><i style="color: #ee0a24">*</i>曲名</template>
|
|
|
</van-field>
|
|
|
- <van-field name="songAuthor" :disabled="!form.editStatus" v-model="songUpload.author" label="作者" placeholder="请输入作者" >
|
|
|
+ <van-field name="songAuthor" :disabled="!form.editStatus" v-model="songUpload.songAuthor" label="作者" placeholder="请输入作者" >
|
|
|
<template #label><i style="color: #ffffff">*</i>作者</template>
|
|
|
</van-field>
|
|
|
<van-field readonly clearable >
|
|
@@ -110,7 +106,7 @@
|
|
|
|
|
|
<div class="popup-group">
|
|
|
<span @click="onSaveCancel">取消</span>
|
|
|
- <span class="popup-sure">确定</span>
|
|
|
+ <span @click="onSaveUpload" class="popup-sure">确定</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
</van-popup>
|
|
@@ -133,6 +129,7 @@ export default {
|
|
|
headerStatus: false,
|
|
|
examRegistrationId: query.examRegistrationId,
|
|
|
form: {
|
|
|
+ id: null,
|
|
|
paymentOrderNo: null,
|
|
|
examBaseName: null,
|
|
|
subjectName: null,
|
|
@@ -153,12 +150,16 @@ export default {
|
|
|
songStatus: false, // 曲目状态
|
|
|
indexName: null,
|
|
|
index: null, // 索引
|
|
|
- name: null, // 曲名
|
|
|
- author: null // 作者
|
|
|
+ songName: null, // 曲名
|
|
|
+ songAuthor: null // 作者
|
|
|
},
|
|
|
+ practiceNum: null,
|
|
|
performUpload: [], // 演奏曲
|
|
|
+ performUploadTemp: [], // 演奏曲
|
|
|
performInfo: [], // 演奏曲基本信息
|
|
|
+ performNum: null,
|
|
|
practiceUpload: [], // 练习曲
|
|
|
+ practiceUploadTemp: [], // 练习曲
|
|
|
practiceInfo: [], // 练习曲基本信息
|
|
|
}
|
|
|
},
|
|
@@ -186,11 +187,12 @@ export default {
|
|
|
rows: 20,
|
|
|
examRegistrationId: this.examRegistrationId
|
|
|
})
|
|
|
+ setLoading(false)
|
|
|
const result = res.data
|
|
|
if(result.code == 200) {
|
|
|
const detail = result.data.rows ? result.data.rows[0] : {}
|
|
|
- // console.log(detail)
|
|
|
this.form = {
|
|
|
+ id: detail.id,
|
|
|
paymentOrderNo: detail.paymentOrderNo,
|
|
|
examBaseName: detail.examBaseName,
|
|
|
subjectName: detail.subjectName,
|
|
@@ -215,7 +217,7 @@ export default {
|
|
|
const songJson = detail.songJson ? JSON.parse(detail.songJson) : []
|
|
|
songJson.forEach(item => {
|
|
|
// 曲谱
|
|
|
- const uploadUrl = item.uploadUrl.split(',')
|
|
|
+ const uploadUrl = item.uploadUrl ? item.uploadUrl.split(',') : []
|
|
|
let tempUrl = []
|
|
|
uploadUrl.forEach(url => {
|
|
|
tempUrl.push({
|
|
@@ -224,39 +226,40 @@ export default {
|
|
|
})
|
|
|
if(item.type === "PRACTICE") {
|
|
|
this.practiceUpload.push(tempUrl)
|
|
|
+ this.practiceUploadTemp.push(tempUrl)
|
|
|
this.practiceInfo.push(item)
|
|
|
} else if(item.type === "PERFORM") {
|
|
|
this.performUpload.push(tempUrl)
|
|
|
+ this.performUploadTemp.push(tempUrl)
|
|
|
this.performInfo.push(item)
|
|
|
}
|
|
|
})
|
|
|
+ this.practiceNum = this.practiceUpload.length
|
|
|
+ this.performNum = this.performUpload.length
|
|
|
}
|
|
|
- // examRegistrationId
|
|
|
- }catch(err) {
|
|
|
+ } catch(err) {
|
|
|
//
|
|
|
+ setLoading(false)
|
|
|
}
|
|
|
- setLoading(false)
|
|
|
},
|
|
|
onOpen(type, index) {
|
|
|
let songUpload = this.songUpload
|
|
|
let practiceSUL = this.practiceInfo[index]
|
|
|
let performSUL = this.performInfo[index]
|
|
|
- // practiceSongIdList: detail.practiceSongIdList,
|
|
|
- // performSongIdList: detail.performSongIdList,
|
|
|
const practiceSongIdList = this.form.practiceSongIdList
|
|
|
const performSongIdList = this.form.performSongIdList
|
|
|
if(type == "perform") {
|
|
|
if(performSongIdList) {
|
|
|
return
|
|
|
}
|
|
|
- songUpload.name = performSUL ? performSUL.songName : null
|
|
|
- songUpload.author = performSUL ? performSUL.songAuthor : null
|
|
|
+ songUpload.songName = performSUL ? performSUL.songName : null
|
|
|
+ songUpload.songAuthor = performSUL ? performSUL.songAuthor : null
|
|
|
} else if(type == "practice") {
|
|
|
if(practiceSongIdList) { // 判断是否是自定义
|
|
|
return
|
|
|
}
|
|
|
- songUpload.name = practiceSUL ? practiceSUL.songName : null
|
|
|
- songUpload.author = practiceSUL ? practiceSUL.songAuthor : null
|
|
|
+ songUpload.songName = practiceSUL ? practiceSUL.songName : null
|
|
|
+ songUpload.songAuthor = practiceSUL ? practiceSUL.songAuthor : null
|
|
|
}
|
|
|
songUpload.indexName = type
|
|
|
songUpload.index = index
|
|
@@ -269,25 +272,26 @@ export default {
|
|
|
this.$toast('上传图片大小不能超过 5MB')
|
|
|
return false
|
|
|
}
|
|
|
- return new Promise((resolve) => {
|
|
|
- fileUtil.getOrientation(file).then((orient) => {
|
|
|
- if (orient && orient != "" && orient != 1) {
|
|
|
- let reader = new FileReader()
|
|
|
- let img = new Image()
|
|
|
- reader.onload = (e) => {
|
|
|
- img.src = e.target.result
|
|
|
- img.onload = function () {
|
|
|
- const data = fileUtil.rotateImage(img, img.width, img.height, orient)
|
|
|
- const newFile = fileUtil.dataURLtoFile(data, file.name)
|
|
|
- resolve(newFile)
|
|
|
- }
|
|
|
- }
|
|
|
- reader.readAsDataURL(file)
|
|
|
- } else {
|
|
|
- resolve(file)
|
|
|
- }
|
|
|
- })
|
|
|
- })
|
|
|
+ return true
|
|
|
+ // return new Promise((resolve) => {
|
|
|
+ // fileUtil.getOrientation(file).then((orient) => {
|
|
|
+ // if (orient && orient != "" && orient != 1) {
|
|
|
+ // let reader = new FileReader()
|
|
|
+ // let img = new Image()
|
|
|
+ // reader.onload = (e) => {
|
|
|
+ // img.src = e.target.result
|
|
|
+ // img.onload = function () {
|
|
|
+ // const data = fileUtil.rotateImage(img, img.width, img.height, orient)
|
|
|
+ // const newFile = fileUtil.dataURLtoFile(data, file.name)
|
|
|
+ // resolve(newFile)
|
|
|
+ // }
|
|
|
+ // }
|
|
|
+ // reader.readAsDataURL(file)
|
|
|
+ // } else {
|
|
|
+ // resolve(file)
|
|
|
+ // }
|
|
|
+ // })
|
|
|
+ // })
|
|
|
},
|
|
|
beforeDelete(file, detail) {
|
|
|
const obj = detail.name.split('-')
|
|
@@ -315,9 +319,9 @@ export default {
|
|
|
form.lastMusicTheoryCertificateUrl = result.data.url // 上传图片地址为空
|
|
|
} else if(obj[0] == "certificate") {
|
|
|
form.lastExamCertificateUrl = result.data.url
|
|
|
- } else if(obj[0] == 'practiceNum') {
|
|
|
+ } else if(obj[0] == 'practice') {
|
|
|
file.url = result.data.url
|
|
|
- } else if(obj[0] == 'performNum') {
|
|
|
+ } else if(obj[0] == 'perform') {
|
|
|
file.url = result.data.url
|
|
|
}
|
|
|
} else {
|
|
@@ -330,11 +334,130 @@ export default {
|
|
|
return false
|
|
|
}
|
|
|
},
|
|
|
- onSubmit() {
|
|
|
- console.log(true)
|
|
|
+ async onSubmit() {
|
|
|
+ if(!this.onCheckFields()) {
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ let songJson = [] // json 数组
|
|
|
+ // 练习课 "PRACTICE"
|
|
|
+ const practiceUpload = this.practiceUpload
|
|
|
+ this.practiceInfo.forEach(item => {
|
|
|
+ let tempUrl = []
|
|
|
+ practiceUpload[item.index].forEach(item => {
|
|
|
+ tempUrl.push(item.url)
|
|
|
+ })
|
|
|
+ songJson.push({
|
|
|
+ songName: item.songName,
|
|
|
+ songAuthor: item.songAuthor,
|
|
|
+ index: item.index,
|
|
|
+ type: "PRACTICE",
|
|
|
+ uploadUrl: tempUrl.join(',')
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 演奏课 "PERFORM"
|
|
|
+ const performNumUpload = this.performNumUpload
|
|
|
+ this.performInfo.forEach(item => {
|
|
|
+ let tempUrl = []
|
|
|
+ performNumUpload[item.index].forEach(item => {
|
|
|
+ tempUrl.push(item.url)
|
|
|
+ })
|
|
|
+ songJson.push({
|
|
|
+ songName: item.songName,
|
|
|
+ songAuthor: item.songAuthor,
|
|
|
+ index: item.index,
|
|
|
+ type: "PERFORM",
|
|
|
+ uploadUrl: tempUrl.join(',')
|
|
|
+ })
|
|
|
+ })
|
|
|
+ let form = this.form
|
|
|
+ let params = {
|
|
|
+ id: form.id,
|
|
|
+ lastExamCertificateUrl: form.lastExamCertificateUrl,
|
|
|
+ lastMusicTheoryCertificateUrl: form.lastMusicTheoryCertificateUrl,
|
|
|
+ songJson: JSON.stringify(songJson),
|
|
|
+ status: "AUDIT_WAIT"
|
|
|
+ }
|
|
|
+ setLoading(true)
|
|
|
+ try {
|
|
|
+ const res = await examRegistrationUpdate(params)
|
|
|
+ setLoading(false)
|
|
|
+ const result = res.data
|
|
|
+ if(result.code == 200) {
|
|
|
+ this.__init()
|
|
|
+ } else {
|
|
|
+ this.$toast(result.msg)
|
|
|
+ }
|
|
|
+ } catch(err) {
|
|
|
+ //
|
|
|
+ setLoading(false)
|
|
|
+ }
|
|
|
+ },
|
|
|
+ onCheckFields() {
|
|
|
+ // 校验数据
|
|
|
+ let form = this.form
|
|
|
+ // 有值说明是列表
|
|
|
+ if(this.practiceUpload.length != this.practiceNum) {
|
|
|
+ this.$toast('请上传练习曲')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if(this.performUpload.length != this.performNum) {
|
|
|
+ this.$toast('请上传演奏曲')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+
|
|
|
+ if(form.level > 2 && form.lastMusicTheoryLevel == 0 && !form.lastMusicTheoryCertificateUrl) {
|
|
|
+ this.$toast("请上传乐理证书")
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ return true
|
|
|
},
|
|
|
onSaveCancel() {
|
|
|
this.songUpload.songStatus = false
|
|
|
+ this.performUpload = JSON.parse(JSON.stringify(this.performUploadTemp)) // 回填数据
|
|
|
+ this.practiceUpload = JSON.parse(JSON.stringify(this.practiceUploadTemp)) // 回填数据
|
|
|
+ },
|
|
|
+ onSaveUpload() {
|
|
|
+ let songUpload = this.songUpload
|
|
|
+ if(!songUpload.songName) {
|
|
|
+ this.$toast("请输入曲名")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(songUpload.indexName == "practice") {
|
|
|
+ const practiceObj = this.practiceUpload[songUpload.index]
|
|
|
+ const practiceLength = practiceObj ? practiceObj.length : 0
|
|
|
+ if(practiceObj && practiceLength > 0 && practiceObj[0].url) {
|
|
|
+ if(practiceObj[practiceLength - 1].url) {
|
|
|
+ this.practiceInfo[songUpload.index] = JSON.parse(JSON.stringify(songUpload))
|
|
|
+ this.practiceUploadTemp = JSON.parse(JSON.stringify(this.practiceUpload))
|
|
|
+ } else {
|
|
|
+ this.$toast("上传曲谱中,请稍等")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast("请上传文件")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else if(songUpload.indexName == "perform") {
|
|
|
+ const performObj = this.performUpload[songUpload.index]
|
|
|
+ const performLength = performObj ? performObj.length : 0
|
|
|
+ if(performObj && performLength > 0) {
|
|
|
+ if(performObj[performLength - 1].url) {
|
|
|
+ this.performInfo[songUpload.index] = JSON.parse(JSON.stringify(songUpload))
|
|
|
+ this.performUploadTemp = JSON.parse(JSON.stringify(this.performUpload))
|
|
|
+ } else {
|
|
|
+ this.$toast("上传曲谱中,请稍等")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ this.$toast("请上传文件")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ }
|
|
|
+ songUpload.songName = null
|
|
|
+ songUpload.songAuthor = null
|
|
|
+ songUpload.songStatus = false
|
|
|
},
|
|
|
numberToCN (value) {
|
|
|
const tempNumber = {
|