main.ts 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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. NButton,
  10. NTabPane,
  11. NTabs,
  12. NInput,
  13. NEmpty,
  14. NImage,
  15. NSpin,
  16. NScrollbar,
  17. NPopover,
  18. NTooltip
  19. } from "naive-ui";
  20. // n-tab-pane
  21. const naive = create({
  22. components: [NButton, NTabs, NTabPane, NInput, NEmpty, NImage, NSpin, NScrollbar, NPopover, NTooltip],
  23. });
  24. import qs from "query-string";
  25. const parseSearch: any = qs.parse(location.search);
  26. const hashSearch = qs.parse(location.hash.split("?")[1]);
  27. const Authorization: string = parseSearch.Authorization || hashSearch.Authorization || "";
  28. // 授权
  29. sessionStorage.setItem("Authorization", Authorization);
  30. /**
  31. * 平台
  32. * classroom 课堂乐器
  33. * orchestra 管乐团
  34. */
  35. sessionStorage.setItem("platform", parseSearch.platform || hashSearch.platform || "");
  36. import { TUIComponents, TUICore, genTestUserSig } from "./TUIKit";
  37. // import TUICallKit
  38. // import { TUICallKit } from "@tencentcloud/call-uikit-vue";
  39. console.log(import.meta.env.DEV, "import.meta.env.DEV");
  40. // 判断是否是测试环境的
  41. // import.meta.env.DEV ? 1400805079 : 1400799837; // 1400805079; // Your SDKAppID
  42. const SDKAppID = parseSearch.appId || hashSearch.appId || 1400805079;
  43. //import.meta.env.DEV ? "c5f4ea6140128a36c842990446a2c89249ab886b5e1ea6893555aa635a0b3c30" : "37bfb220843e25e78768cadd0dc06756e460e55bd631354930a4149565a1d0c9"; //"c5f4ea6140128a36c842990446a2c89249ab886b5e1ea6893555aa635a0b3c30"; // Your secretKey
  44. const secretKey = parseSearch.secretKey || hashSearch.secretKey || "c5f4ea6140128a36c842990446a2c89249ab886b5e1ea6893555aa635a0b3c30";
  45. const userID = parseSearch.userID; //|| "KT:140:TEACHER"; // User ID
  46. // init TUIKit
  47. const TUIKit = TUICore.init({
  48. SDKAppID,
  49. });
  50. // TUIKit add TUIComponents
  51. TUIKit.use(TUIComponents);
  52. // TUIKit add TUICallKit
  53. // TUIKit.use(TUICallKit);
  54. // login TUIKit
  55. TUIKit.login({
  56. userID: userID,
  57. userSig: genTestUserSig({
  58. SDKAppID,
  59. secretKey,
  60. userID,
  61. }).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
  62. });
  63. createApp(App).use(naive).use(store).use(TUIKit).mount("#app");
  64. export { SDKAppID, secretKey, userID };