12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 |
- // 处理 区分处理管乐迷 管乐团的数据
- // import { queryTree_gym } from "@/api/cloudPractice.api"
- import { URL_TEACH_GYM, URL_TEACH_GYT, URL_TEACH_KLX } from "@/config"
- import { getToken } from "@/libs/auth"
- // import { httpAjaxErrMsg, httpAjax } from "@/plugin/httpAjax"
- // import { CODE_ERR_CANCELED } from "@/libs/auth"
- // import { ElMessage } from "element-plus"
- import userStore from "@/store/modules/user"
- import { ref } from "vue"
- /**
- * 搜索数据
- */
- export const useFunction = () => {
- const userStoreHook = userStore()
- const loading = ref(false)
- /** 跳转云教练 */
- const isPracticeShow = ref(false)
- const practiceUrl = ref("")
- function goToCloud(musicId: string, partIndex = 0) {
- // GYM,GYT,KLX 区分 云教练
- const urlObj = {
- GYT: `${URL_TEACH_GYT}?id=${musicId}&modelType=practice&modeType=json&part-index=${partIndex}&Authorization=${getToken()}&isYjt=1&&isHideBack=false`,
- GYM: `${URL_TEACH_GYM}#/?id=${musicId}&Authorization=${getToken()}&platform=pc&part-index=${partIndex}&isYjt=1`,
- KLX: `${URL_TEACH_KLX}?Authorization=${getToken()}&id=${musicId}&limitModel=practice&part-index=${partIndex}&isYjt=1&client=teacher`
- }
- isPracticeShow.value = true
- practiceUrl.value = urlObj[userStoreHook.roles!]
- //window.open(urlObj[userStoreHook.roles!], "_blank")
- }
- function handlePracticeClose() {
- isPracticeShow.value = false
- practiceUrl.value = ""
- }
- function getPreViewCloud(musicId: string, partIndex = 0) {
- // GYM,GYT,KLX 区分 云教练
- const urlObj = {
- GYT: `${URL_TEACH_GYT}?id=${musicId}&modelType=practice&modeType=json&part-index=${partIndex}&Authorization=${getToken()}&isYjt=1&&isHideBack=false`,
- GYM: `${URL_TEACH_GYM}?t=${Date.now()}#/?id=${musicId}&Authorization=${getToken()}&platform=web&part-index=${partIndex}&isPreView=true&systemType=teacher`,
- KLX: `${URL_TEACH_KLX}?Authorization=${getToken()}&id=${musicId}&limitModel=practice&part-index=${partIndex}&isYjt=1&client=teacher`
- }
- return urlObj[userStoreHook.roles!]
- }
- return { loading, goToCloud, getPreViewCloud, isPracticeShow, practiceUrl, handlePracticeClose }
- }
- // function chunkArray(array: any[], size: number) {
- // const result = []
- // for (let i = 0; i < array.length; i += size) {
- // result.push(array.slice(i, i + size))
- // }
- // return result
- // }
|