|
@@ -4,7 +4,7 @@ import { Icon, Popup } from 'vant'
|
|
import ChoosePartName from './choosePartName'
|
|
import ChoosePartName from './choosePartName'
|
|
import state, { togglePlay } from "/src/state";
|
|
import state, { togglePlay } from "/src/state";
|
|
import qs from 'query-string'
|
|
import qs from 'query-string'
|
|
-import { getInstrumentName } from "/src/constant/instruments";
|
|
|
|
|
|
+import { getInstrumentName, sortMusical } from "/src/constant/instruments";
|
|
import { getQuery } from "/src/utils/queryString";
|
|
import { getQuery } from "/src/utils/queryString";
|
|
|
|
|
|
export const toggleMusicSheet = reactive({
|
|
export const toggleMusicSheet = reactive({
|
|
@@ -24,14 +24,25 @@ export default defineComponent({
|
|
partList = partList.filter((item: any) => !item?.toLocaleUpperCase()?.includes('COMMON'))
|
|
partList = partList.filter((item: any) => !item?.toLocaleUpperCase()?.includes('COMMON'))
|
|
return partList.map((item: any, index: number) => {
|
|
return partList.map((item: any, index: number) => {
|
|
// 该声轨能否被选
|
|
// 该声轨能否被选
|
|
- const canselect = state.canSelectTracks.includes(item) ? true : false
|
|
|
|
|
|
+ const canselect = state.canSelectTracks.length == 0 || state.canSelectTracks.includes(item) ? true : false
|
|
const instrumentName = getInstrumentName(item)
|
|
const instrumentName = getInstrumentName(item)
|
|
|
|
+ const sortId = sortMusical(instrumentName, index)
|
|
return {
|
|
return {
|
|
text: item + (instrumentName ? `(${instrumentName})` : ''),
|
|
text: item + (instrumentName ? `(${instrumentName})` : ''),
|
|
value: index,
|
|
value: index,
|
|
|
|
+ sortId,
|
|
canselect
|
|
canselect
|
|
}
|
|
}
|
|
- }).filter((item: any) => item.canselect)
|
|
|
|
|
|
+ }).filter((item: any) => item.canselect).sort((a: any, b: any) => a.sortId - b.sortId)
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ const trackIdx: any = computed(() => {
|
|
|
|
+ if (partListNames && partListNames.value.length) {
|
|
|
|
+ // console.log(3333,partListNames)
|
|
|
|
+ return partListNames.value.findIndex((item: any) => item.value == state.partIndex)
|
|
|
|
+ } else {
|
|
|
|
+ return 0
|
|
|
|
+ }
|
|
})
|
|
})
|
|
|
|
|
|
const switchMusic = (index: number) => {
|
|
const switchMusic = (index: number) => {
|
|
@@ -66,7 +77,7 @@ export default defineComponent({
|
|
return () => (
|
|
return () => (
|
|
<Popup class={styles.popup} v-model:show={toggleMusicSheet.show}>
|
|
<Popup class={styles.popup} v-model:show={toggleMusicSheet.show}>
|
|
<ChoosePartName
|
|
<ChoosePartName
|
|
- partIndex={state.partIndex}
|
|
|
|
|
|
+ partIndex={trackIdx.value || 0}
|
|
partListNames={partListNames.value}
|
|
partListNames={partListNames.value}
|
|
onClose={(value) => {
|
|
onClose={(value) => {
|
|
console.log("🚀 ~ value:", value)
|
|
console.log("🚀 ~ value:", value)
|