瀏覽代碼

✨ feat: 添加简谱选项

wolyshaw 3 年之前
父節點
當前提交
3672b53868
共有 2 個文件被更改,包括 32 次插入2 次删除
  1. 5 0
      src/constant/music.ts
  2. 27 2
      src/teacher/music/upload/index.tsx

+ 5 - 0
src/constant/music.ts

@@ -18,6 +18,11 @@ export const teacherChargeType = {
   0: '否'
 }
 
+/** 是否支持简谱 */
+export const teacherNotationType = {
+  0: '不支持',
+  1: '支持'
+}
 /** 老师端是否可以评测类型 */
 export const teachercanEvaluateType = {
   0: '否',

+ 27 - 2
src/teacher/music/upload/index.tsx

@@ -15,7 +15,7 @@ import {
   NoticeBar
 } from 'vant'
 import ColFieldGroup from '@/components/col-field-group'
-import { MusicType } from 'src/teacher/music/list/item.d'
+// import { MusicType } from 'src/teacher/music/list/item.d'
 import SubjectModel from '@/business-components/subject-list'
 import ColField from '@/components/col-field'
 import {
@@ -23,7 +23,8 @@ import {
   teacherChargeType,
   teachershowAudiType,
   teachershowFingeringType,
-  teachershowHasBeatType
+  teachershowHasBeatType,
+  teacherNotationType
 } from '@/constant/music'
 import { getXmlInfo, FormatXMLInfo } from '@/helpers/music-xml'
 import Upload from './upload'
@@ -62,6 +63,7 @@ export default defineComponent({
       chargeType: 0,
       showFingering: 1,
       canEvaluate: 1,
+      notation: 0,
       musicPrice: '',
       selectTagVisible: false,
       subJectVisible: false,
@@ -154,6 +156,7 @@ export default defineComponent({
         this.composer = res.data.composer
         this.musicSheetName = res.data.musicSheetName
         this.audioType = res.data.audioType
+        this.notation = res.data.notation
         this.selectedSubjectList = {
           label: res.data.musicSubject,
           value: res.data.subjectNames
@@ -212,6 +215,7 @@ export default defineComponent({
         musicSubject: Number(this.selectedSubjectList?.label) || undefined,
         musicSheetName: this.musicSheetName,
         midiUrl: this.midiUrl,
+        notation: Number(this.notation),
         xmlFileUrl: this.xmlFileUrl,
         canEvaluate: Number(this.canEvaluate),
         chargeType: this.chargeType === 0 ? 'FREE' : 'CHARGE',
@@ -692,6 +696,27 @@ export default defineComponent({
                 })}
               </RadioGroup>
             </ColField>
+            <ColField required title="支持简谱" border={false}>
+              <RadioGroup
+                class={styles['radio-group']}
+                modelValue={this.notation}
+                onUpdate:modelValue={val => {
+                  this.notation = Number(val)
+                }}
+              >
+                {Object.keys(teacherNotationType).map((item: string) => {
+                  const isActive = item === String(this.notation)
+                  const type = isActive ? 'primary' : 'default'
+                  return (
+                    <Radio class={styles.radio} name={item}>
+                      <Tag size="large" plain={isActive} type={type}>
+                        {teacherChargeType[item]}
+                      </Tag>
+                    </Radio>
+                  )
+                })}
+              </RadioGroup>
+            </ColField>
             {this.chargeType === 2 && (
               <ColField required title="收费价格">
                 <Field