@@ -2,7 +2,7 @@ import { computed, defineComponent, onMounted, PropType, ref, watch } from "vue"
22import { Chart , GenreXml , MusicXmlWithABJacket } from "@/client/apiGen" ;
33import { addVersionList , genreList , selectedADir , selectedMusicBrief , selectMusicId , updateAddVersionList , updateGenreList , updateMusicList } from "@/store/refs" ;
44import api from "@/client/api" ;
5- import { NButton , NFlex , NForm , NFormItem , NInput , NInputNumber , NSelect , NTabPane , NTabs , SelectOption , useDialog } from "naive-ui" ;
5+ import { NButton , NFlex , NForm , NFormItem , NInput , NInputNumber , NSelect , NTabPane , NTabs , SelectOption , useDialog , useMessage } from "naive-ui" ;
66import JacketBox from "./JacketBox" ;
77import dxIcon from "@/assets/dxIcon.png" ;
88import stdIcon from "@/assets/stdIcon.png" ;
@@ -12,23 +12,31 @@ import ProblemsDisplay from "@/components/ProblemsDisplay";
1212import AcbAwb from "@/components/MusicEdit/AcbAwb" ;
1313import GenreInput from "@/components/GenreInput" ;
1414import VersionInput from "@/components/VersionInput" ;
15+ import { captureException } from "@sentry/vue"
1516
1617const Component = defineComponent ( {
1718 setup ( ) {
1819 const info = ref < MusicXmlWithABJacket | null > ( ) ;
1920 const selectedLevel = ref ( 0 ) ;
21+ const message = useMessage ( ) ;
2022
2123 onMounted ( async ( ) => {
2224 if ( ! selectMusicId . value ) {
2325 info . value = null ;
2426 return ;
2527 }
26- const response = await api . GetMusicDetail ( selectMusicId . value ) ;
27- info . value = response . data ;
2828
29- const firstEnabledChart = info . value ! . charts ! . findIndex ( chart => chart . enable ) ;
30- if ( firstEnabledChart >= 0 ) {
31- selectedLevel . value = firstEnabledChart ;
29+ try {
30+ const response = await api . GetMusicDetail ( selectMusicId . value ) ;
31+ info . value = response . data ;
32+
33+ const firstEnabledChart = info . value ?. charts ?. findIndex ( chart => chart . enable ) ;
34+ if ( firstEnabledChart && firstEnabledChart >= 0 ) {
35+ selectedLevel . value = firstEnabledChart ;
36+ }
37+ } catch ( e : any ) {
38+ message . error ( '加载歌曲信息失败' ) ;
39+ captureException ( e . error || e ) ;
3240 }
3341
3442 watch ( ( ) => info . value ?. name , sync ( 'name' , api . EditMusicName ) ) ;
0 commit comments