Преглед изворни кода

feat: 评测报告跳转曲谱页,增加校验曲子状态

TIANYONG пре 9 месеци
родитељ
комит
99737eaeea
2 измењених фајлова са 25 додато и 3 уклоњено
  1. 24 2
      src/subpages/colexiu-report/header/index.tsx
  2. 1 1
      vite.config.js

+ 24 - 2
src/subpages/colexiu-report/header/index.tsx

@@ -1,5 +1,5 @@
 import { defineComponent, toRefs, PropType, ref, Transition, onMounted, computed, nextTick } from 'vue'
-import { Button, Grid, GridItem, Popup } from 'vant'
+import { Button, Grid, GridItem, Popup, Toast } from 'vant'
 import qs from 'query-string'
 import { MusicSheelDetail, ShaeetStatusType } from '../../colexiu/index.d'
 import BackIcon from '../../colexiu/buttons/icons/icon-back.png'
@@ -20,6 +20,7 @@ import { browser } from '/src/helpers/utils'
 import videobg from './videobg.png'
 import 'plyr/dist/plyr.css'
 import Plyr from 'plyr'
+import request from '/src/helpers/request'
 
 export const active = ref<'pitch' | 'rhythm' | 'completion'>('pitch')
 
@@ -66,11 +67,32 @@ export default defineComponent({
       }
     }
 
-    const again = () => {
+    // 校验曲子的状态
+    const checkMusicStatus = async () => {
+      try {
+        const res = await request.get('/musicSheet/checkSelect', {
+          params: {
+            musicSheetId: detail?.value?.id,
+          },
+        })
+        return res.data
+      } catch (error) {
+        console.log(error)
+        return false
+      }
+    }
+
+    const again = async () => {
       if (search.source == 'evaluation') {
         back()
         return
       }
+      // 校验曲子状态
+      const checkStatus = await checkMusicStatus();
+      if (!checkStatus) {
+        Toast('该曲目无效')
+        return
+      }
       const behaviorId = sessionStorage.getItem('behaviorId') || '' + new Date().valueOf()
       const url = qs.stringifyUrl({
         url: location.origin + '/orchestra-music-score',

+ 1 - 1
vite.config.js

@@ -5,7 +5,7 @@ import glsl from 'vite-plugin-glsl'
 const vueJsx = require('@vitejs/plugin-vue-jsx')
 const legacy = require('@vitejs/plugin-legacy')
 
-const proxyUrl = 'https://online.lexiaoya.cn/' // test 环境
+const proxyUrl = 'https://test.lexiaoya.cn/' // test 环境
 // const proxyUrl = 'http://192.168.3.70:8989/' // test 环境
 // const proxyUrl = 'https://online.colexiu.com/' // online 环境