main.ts 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. import { createApp } from "vue";
  2. import "./style.css";
  3. import App from "./App.vue";
  4. import store from "./storex";
  5. import {
  6. // create naive ui
  7. create,
  8. // component
  9. NSpin,
  10. NButton,
  11. NTabPane,
  12. NTabs,
  13. NInput,
  14. NEmpty,
  15. NImage,
  16. NScrollbar
  17. } from "naive-ui";
  18. // n-tab-pane
  19. const naive = create({
  20. components: [NButton, NTabs, NTabPane, NInput, NEmpty, NImage, NSpin, NScrollbar],
  21. });
  22. import qs from "query-string";
  23. const parseSearch: any = qs.parse(location.search);
  24. const hashSearch = qs.parse(location.hash.split("?")[1]);
  25. const Authorization: string = parseSearch.Authorization || hashSearch.Authorization || "";
  26. // 授权
  27. sessionStorage.setItem("Authorization", Authorization);
  28. /**
  29. * 平台
  30. * classroom 课堂乐器
  31. * orchestra 管乐团
  32. */
  33. sessionStorage.setItem("platform", parseSearch.platform || hashSearch.platform || "");
  34. import { TUIComponents, TUICore, genTestUserSig } from "./TUIKit";
  35. // import TUICallKit
  36. // import { TUICallKit } from "@tencentcloud/call-uikit-vue";
  37. console.log(import.meta.env.DEV, "import.meta.env.DEV");
  38. // 判断是否是测试环境的
  39. // import.meta.env.DEV ? 1400805079 : 1400799837; // 1400805079; // Your SDKAppID
  40. const SDKAppID = parseSearch.appId || hashSearch.appId || 1400805079;
  41. //import.meta.env.DEV ? "c5f4ea6140128a36c842990446a2c89249ab886b5e1ea6893555aa635a0b3c30" : "37bfb220843e25e78768cadd0dc06756e460e55bd631354930a4149565a1d0c9"; //"c5f4ea6140128a36c842990446a2c89249ab886b5e1ea6893555aa635a0b3c30"; // Your secretKey
  42. const secretKey = parseSearch.secretKey || hashSearch.secretKey || "c5f4ea6140128a36c842990446a2c89249ab886b5e1ea6893555aa635a0b3c30";
  43. const userID = parseSearch.userID; //|| "KT:140:TEACHER"; // User ID
  44. // init TUIKit
  45. const TUIKit = TUICore.init({
  46. SDKAppID,
  47. });
  48. // TUIKit add TUIComponents
  49. TUIKit.use(TUIComponents);
  50. // TUIKit add TUICallKit
  51. // TUIKit.use(TUICallKit);
  52. // login TUIKit
  53. TUIKit.login({
  54. userID: userID,
  55. userSig: genTestUserSig({
  56. SDKAppID,
  57. secretKey,
  58. userID,
  59. }).userSig, // The password with which the user logs in to IM. It is the ciphertext generated by encrypting information such as userID.For the detailed generation method, see Generating UserSig
  60. });
  61. createApp(App).use(naive).use(store).use(TUIKit).mount("#app");
  62. export { SDKAppID, secretKey, userID };