main.ts 2.1 KB

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