import musicResourcesElement from "./musicResourcesElement.vue"
export default musicResourcesElement

import { getToken } from "@/libs/auth"
import { stringifyQuery } from "@/libs/cipher"
import { CLASSROOM_URL_API, CLASSAPP_URL_API } from "@/config"
import queryParams from "@/queryParams"

export type pptContentType = "INSTRUMENT" | "MUSICIAN" | "MUSIC" | "THEORY"
type pptType = "modal" | "preview"

const typeObj = {
  MUSIC: "MUSIC_WIKI",
  INSTRUMENT: "INSTRUMENT",
  MUSICIAN: "MUSICIAN",
  THEORY: "THEORY"
}
/**
 * 获取资源url
 */
export function getMusicResourcesUrl(pptContentType: pptContentType, pptType: pptType, pptId: string) {
  if (queryParams.fromType == "CLASS") {
    return `${CLASSAPP_URL_API}/#/pptResources?${`Authorization=${getToken()}&pptContentType=${typeObj[pptContentType]}&pptType=${pptType}&pptId=${pptId}`}`
    //return `http://192.168.0.147:9002/#/pptResources?${`Authorization=${getToken()}&pptContentType=${typeObj[pptContentType]}&pptType=${pptType}&pptId=${pptId}`}`
  } else {
    return `${CLASSROOM_URL_API}/#/pptResources?${stringifyQuery(`Authorization=${getToken()}&source=admin&pptContentType=${typeObj[pptContentType]}&pptType=${pptType}&pptId=${pptId}`)}`
    //return `http://localhost:5005/#/pptResources?${stringifyQuery(`Authorization=${getToken()}&source=admin&pptContentType=${typeObj[pptContentType]}&pptType=${pptType}&pptId=${pptId}`)}`
  }
}
