lex-xin 4 rokov pred
rodič
commit
0c1f52fc6f
3 zmenil súbory, kde vykonal 166 pridanie a 43 odobranie
  1. 1 1
      src/utils/filters.js
  2. 160 40
      src/views/app/AppDetail.vue
  3. 5 2
      src/views/app/AppRecord.vue

+ 1 - 1
src/utils/filters.js

@@ -54,4 +54,4 @@ Vue.filter("studentPayStatus", value => {
     REFUNDED: '已退款'
   }
   return template[value]
-})
+})

+ 160 - 40
src/views/app/AppDetail.vue

@@ -5,16 +5,22 @@
             <!-- <van-field v-model="form.paymentOrderNo" disabled label="订单编号" /> -->
             <van-field v-model="form.examBaseName" disabled label="考级名称" />
             <van-cell disabled title="缴费状态">
-                {{ form.status | studentPayStatus }}
+                <p class="noPass" v-if="form.status === 'PAY_WAIT'">未缴费</p>
+                <p class="pass" v-else>已缴费</p>
             </van-cell>
             <van-field v-model="form.examStartTime" disabled label="考试日期" />
             <van-cell title="专业等级" >
                 {{ form.subjectName }}({{ form.level | formatLevel }})
             </van-cell>
-            <van-field v-model="form.name" disabled label="练习曲" @click="onOpen" is-link />
-            <van-field v-model="form.name" disabled label="练习曲" is-link />
-            <van-field v-model="form.name" disabled label="演奏曲" is-link />
-            <van-field v-model="form.name" disabled label="演奏曲" 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 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 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
@@ -24,6 +30,7 @@
                         :after-read="afterRead"
                         accept="image/*"
                         disabled
+                        :deletable="false"
                         v-model="uploadCertificate"
                         :max-count="1" />
                 </template>
@@ -40,6 +47,7 @@
                         :after-read="afterRead"
                         v-model="uploadCertificate2"
                         disabled
+                        :deletable="false"
                         accept="image/*"
                         :max-count="1" />
                 </template>
@@ -48,7 +56,8 @@
 
         <van-cell-group style="margin-top: 20px">
             <van-cell disabled title="报名审核" >
-                {{ form.status | studentPayStatus }}
+                <p class="pass" v-if="form.status === 'AUDIT_PASS'">已通过</p>
+                <p class="noPass" v-else>未通过</p>
             </van-cell>
             <van-cell title="备注" >
                 {{ form.memo }}
@@ -59,20 +68,39 @@
         <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" label="曲名" placeholder="请输入曲名" >
+                    <template #label><i style="color: #ee0a24">*</i>曲名</template>
+                </van-field>
+                <van-field name="songAuthor" v-model="songUpload.author" label="作者" placeholder="请输入作者" >
+                    <template #label><i style="color: #ffffff">*</i>作者</template>
+                </van-field>
                 <van-field readonly clearable >
                     <template #input>
                         <van-uploader
-                            :before-read="beforeRead"
-                            :before-delete="beforeDelete"
-                            :after-read="afterRead"
-                            v-model.trim="performNumUpload"
-                            multiple
-                            accept="image/*"
-                            :max-count="5" >
-                        </van-uploader>
+                        v-if="songUpload.indexName == 'practice'"
+                        :name="songUpload.indexName + '-' + songUpload.index"
+                        :before-read="beforeRead"
+                        :before-delete="beforeDelete"
+                        :after-read="afterRead"
+                        v-model.trim="practiceUpload[songUpload.index]"
+                        multiple
+                        accept="image/*"
+                        :max-count="5" >
+                    </van-uploader>
+                    <van-uploader
+                        v-if="songUpload.indexName == 'perform'"
+                        :name="songUpload.indexName + '-' + songUpload.index"
+                        :before-read="beforeRead"
+                        :before-delete="beforeDelete"
+                        :after-read="afterRead"
+                        v-model.trim="performUpload[songUpload.index]"
+                        multiple
+                        accept="image/*"
+                        :max-count="5" >
+                    </van-uploader>
                     </template>
                 </van-field>
-                <p class="song-popup-tips"><i style="color: #ee0a24">*</i>支持格式:pdf,png,jpg,bmp</p>
+                <p class="song-popup-tips"><i style="color: #ee0a24">*</i>支持格式:png,jpg,bmp</p>
 
                 <div class="popup-group">
                     <span @click="onSaveCancel">取消</span>
@@ -86,17 +114,16 @@
 import MHeader from '@/components/MHeader'
 // import { browser } from '@/common/common'
 import dayjs from 'dayjs'
+import setLoading from '@/utils/loading'
 import { uploadFile } from '../signup/SignUpApi'
+import { applyList } from './appApi'
 export default {
     name: 'appDetail',
 	components: { MHeader },
     data () {
-        const recordDetail = localStorage.getItem('recordDetail') ? JSON.parse(localStorage.getItem('recordDetail')) : null
-        if(!recordDetail) {
-            this.$router.replace('/appRecord')
-        }
+        const query = this.$route.query
         return {
-            recordDetail: recordDetail,
+            examRegistrationId: query.examRegistrationId,
             form: {
                 paymentOrderNo: null,
                 examBaseName: null,
@@ -118,6 +145,10 @@ export default {
                 name: null, // 曲名
                 author: null // 作者
             },
+            performUpload: [], // 演奏曲
+            performInfo: [], // 演奏曲基本信息
+            practiceUpload: [], // 练习曲
+            practiceInfo: [], // 练习曲基本信息
             performNumUpload: [{
                 url: "https://daya-online.oss-cn-beijing.aliyuncs.com/202007/S3wXfqp.jpg"
             }, {
@@ -135,30 +166,95 @@ export default {
         // }
         document.title = "报考详情"
 
-        console.log(this.recordDetail)
-        const detail = this.recordDetail
-        this.form = {
-            paymentOrderNo: detail.paymentOrderNo,
-            examBaseName: detail.examBaseName,
-            subjectName: detail.subjectName,
-            level: detail.level,
-            status: detail.status,
-            examStartTime: detail.examStartTime,
-            lastExamCertificateUrl: detail.lastExamCertificateUrl,
-            lastMusicTheoryLevel: detail.lastMusicTheoryLevel,
-            lastMusicTheoryCertificateUrl: detail.lastMusicTheoryCertificateUrl,
-            memo: detail.memo
-        }
+        this.__init()
     },
     methods: {
-        onOpen() {
-            this.songUpload.songStatus = true
+        async __init() {
+            setLoading(true)
+            try {
+                const res = await applyList({
+                    page: 1,
+                    rows: 20,
+                    examRegistrationId: this.examRegistrationId
+                })
+                const result = res.data
+                if(result.code == 200) {
+                    const detail = result.data.rows ? result.data.rows[0] : {}
+                    // console.log(detail)
+                    this.form = {
+                        paymentOrderNo: detail.paymentOrderNo,
+                        examBaseName: detail.examBaseName,
+                        subjectName: detail.subjectName,
+                        level: detail.level,
+                        status: detail.status,
+                        examStartTime: detail.examStartTime,
+                        lastExamCertificateUrl: detail.lastExamCertificateUrl,
+                        lastMusicTheoryLevel: detail.lastMusicTheoryLevel,
+                        lastMusicTheoryCertificateUrl: detail.lastMusicTheoryCertificateUrl,
+                        memo: detail.memo
+                    }
+                    if(detail.lastExamCertificateUrl) {
+                        this.uploadCertificate = [{ url: detail.lastExamCertificateUrl }]
+                    }
+                    if(detail.lastMusicTheoryCertificateUrl) {
+                        this.uploadCertificate2 = [{ url: detail.lastMusicTheoryCertificateUrl }]
+                    }
+
+                    const songJson = detail.songJson ? JSON.parse(detail.songJson) : []
+                    console.log(songJson)
+                    songJson.forEach(item => {
+                        // 曲谱
+                        const uploadUrl = item.uploadUrl.split(',')
+                        let tempUrl = []
+                        uploadUrl.forEach(url => {
+                            tempUrl.push({
+                                url: url
+                            })
+                        })
+                        if(item.type === "PRACTICE") {
+                            this.practiceUpload.push(tempUrl)
+                            this.practiceInfo.push(item)
+                        } else if(item.type === "PERFORM") {
+                            this.performUpload.push(tempUrl)
+                            this.performInfo.push(item)
+                        }
+                    })
+
+                    console.log({
+                        practiceInfo: this.practiceInfo,
+                        practiceUpload: this.practiceUpload,
+                        performInfo: this.performInfo,
+                        performUpload: this.performUpload
+                    })
+                }
+                // examRegistrationId
+            }catch(err) {}
+            setLoading(false)
+        },
+        onOpen(type, index) {
+            let songUpload = this.songUpload
+            console.log({
+                type: type,
+                index: index
+            })
+            songUpload.indexName = type
+            songUpload.index = index
+            let practiceSUL = this.practiceInfo[index]
+            let performSUL = this.performInfo[index]
+            if(type == "perform") {
+                songUpload.name = practiceSUL ? practiceSUL.songName : null
+                songUpload.author = practiceSUL ? practiceSUL.songAuthor : null
+            } else if(type == "practice") {
+                songUpload.name = performSUL ? performSUL.songName : null
+                songUpload.author = performSUL ? performSUL.songAuthor : null
+            }
+            songUpload.songStatus = true
         },
         beforeRead(file) {
-            const isLt2M = file.size / 1024 / 1024 < 2
+            const isLt2M = file.size / 1024 / 1024 < 5
 
             if (!isLt2M) {
-                this.$toast('上传证书大小不能超过 2MB')
+                this.$toast('上传图片大小不能超过 5MB')
                 return false
             }
             return true
@@ -206,6 +302,28 @@ export default {
         },
         onSaveCancel() {
             this.songUpload.songStatus = false
+        },
+        numberToCN (value) {
+            const tempNumber = {
+                0: '一',
+                1: '二',
+                2: '三',
+                3: '四',
+                4: '五',
+            }
+            return tempNumber[value]
+        }
+    },
+    filters: {
+        filterStatus(value) {
+            const template = {
+                PAY_WAIT: '未缴费',
+                AUDIT_WAIT: '等待审核',
+                AUDIT_PASS: '通过',
+                AUDIT_REJECT: '拒绝',
+                REFUNDED: '已退款'
+            }
+            return template[value]
         }
     }
 }
@@ -242,12 +360,14 @@ export default {
     .van-field__control:disabled {
         color: @--font-second-color;
     }
-    &.noPass {
+    .noPass {
+        color: @--red-color;
         .van-field__control:disabled {
             color: @--red-color;
         }
     }
-    &.pass {
+    .pass {
+        color: @--main-color;
         .van-field__control:disabled {
             color: @--main-color;
         }

+ 5 - 2
src/views/app/AppRecord.vue

@@ -160,9 +160,12 @@
 				})
 			},
 			onDetail(item) {
-				localStorage.setItem("recordDetail", JSON.stringify(item))
+				// localStorage.setItem("recordDetail", JSON.stringify(item))
 				this.$router.push({
-					path: '/appDetail'
+					path: '/appDetail',
+					query: {
+						examRegistrationId: item.id
+					}
 				})
 			}
 		}