useData.ts 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. // 处理 区分处理管乐迷 管乐团的数据
  2. // import { queryTree_gym } from "@/api/cloudPractice.api"
  3. import { URL_TEACH_GYM, URL_TEACH_GYT, URL_TEACH_KLX } from "@/config"
  4. import { getToken } from "@/libs/auth"
  5. // import { httpAjaxErrMsg, httpAjax } from "@/plugin/httpAjax"
  6. // import { CODE_ERR_CANCELED } from "@/libs/auth"
  7. // import { ElMessage } from "element-plus"
  8. import userStore from "@/store/modules/user"
  9. import { ref } from "vue"
  10. /**
  11. * 搜索数据
  12. */
  13. export const useFunction = () => {
  14. const userStoreHook = userStore()
  15. const loading = ref(false)
  16. /** 跳转云教练 */
  17. const goToCloud = (musicId: string, partIndex = 0) => {
  18. const urlObj = {
  19. GYT: `${URL_TEACH_GYT}?id=${musicId}&modelType=practice&modeType=json&part-index=${partIndex}&Authorization=${getToken()}`,
  20. GYM: `${URL_TEACH_GYM}?Authorization=${getToken()}&platform=web&part-index=${partIndex}&liveConfig=1#/detail/${musicId}?isHideBack=true`,
  21. KLX: `${URL_TEACH_KLX}??Authorization=${getToken()}&id=${musicId}&isHideBack=true&part-index=${partIndex}&limitModel=practice`
  22. }
  23. window.open(urlObj[userStoreHook.roles!], "_blank")
  24. }
  25. return { loading, goToCloud }
  26. }
  27. // function chunkArray(array: any[], size: number) {
  28. // const result = []
  29. // for (let i = 0; i < array.length; i += size) {
  30. // result.push(array.slice(i, i + size))
  31. // }
  32. // return result
  33. // }