App.vue 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <template>
  2. <div :class="['home']" :id="'preloadedImages'">
  3. <main class="home-main">
  4. <div class="home-main-box">
  5. <div class="home-TUIKit">
  6. <div class="home-TUIKit-main">
  7. <div class="conversation">
  8. <n-tabs
  9. style="padding-left: 22px; --n-tab-padding: 6px 0; --n-tab-gap: 34px; --n-tab-text-color: #000; --n-tab-text-color-hover: #0f0f0f; --n-tab-text-color-active: #000; --n-tab-font-weight-active: 600; padding-top: 6px; --n-bar-color: #198cfe"
  10. :bar-width="20"
  11. :value="currentModel"
  12. @update:value="
  13. (val: any) => {
  14. currentModel = val;
  15. }
  16. "
  17. >
  18. <n-tab-pane name="message" tab="聊天"></n-tab-pane>
  19. <n-tab-pane name="group" tab="群聊" v-if="platform != 'orchestra'"></n-tab-pane>
  20. <n-tab-pane name="contact" tab="联系人" v-if="platform != 'orchestra'"></n-tab-pane>
  21. </n-tabs>
  22. <TUIConversation v-show="currentModel === 'message'" @current="handleCurrentConversation" :displayOnlineStatus="displayOnlineStatus" />
  23. <TUIGroup v-if="platform != 'orchestra' && currentModel === 'group'" @current="handleCurrentConversation" :displayOnlineStatus="displayOnlineStatus" />
  24. <TUIPerson v-if="platform != 'orchestra' && currentModel === 'contact'" @current="handleCurrentConversation" :displayOnlineStatus="displayOnlineStatus" />
  25. </div>
  26. <div class="chat">
  27. <TUIChat :isMsgNeedReadReceipt="isMsgNeedReadReceipt" :isNeedTyping="true" :isNeedEmojiReact="true">
  28. <div class="chat-default"></div>
  29. </TUIChat>
  30. </div>
  31. </div>
  32. </div>
  33. </div>
  34. </main>
  35. <i class="closeModal" @click="onClose"></i>
  36. </div>
  37. </template>
  38. <script lang="ts">
  39. import {
  40. computed,
  41. defineComponent,
  42. // getCurrentInstance,
  43. reactive,
  44. toRefs,
  45. } from "vue";
  46. // import { useI18nLocale } from '../../TUIKit/TUIPlugin/TUIi18n';
  47. import { TUICore } from "./TUIKit";
  48. import { useStore } from "vuex";
  49. export default defineComponent({
  50. setup(props, context) {
  51. // const instance = getCurrentInstance();
  52. // const locale = useI18nLocale();
  53. // const TUIKit: any = instance?.appContext.config.globalProperties.$TUIKit;
  54. const store = useStore && useStore();
  55. // const taskList = computed(() => store.state.taskList);
  56. // const dragRef = ref();
  57. const isMsgNeedReadReceipt = computed(() => JSON.parse(store.state.isMsgNeedReadReceipt));
  58. const displayOnlineStatus = computed(() => JSON.parse(store.state.displayOnlineStatus));
  59. const data = reactive({
  60. currentConversationID: "",
  61. currentModel: "message",
  62. platform: sessionStorage.getItem("platform"), // 平台
  63. // env: TUIKit.TUIEnv
  64. });
  65. const onClose = () => {
  66. if (window.parent) {
  67. window.parent.postMessage(
  68. {
  69. api: "onImClose",
  70. },
  71. "*"
  72. );
  73. }
  74. };
  75. const handleCurrentConversation = (value: string) => {
  76. data.currentModel = "message";
  77. data.currentConversationID = value;
  78. };
  79. return {
  80. ...toRefs(data),
  81. // dragRef,
  82. // taskList,
  83. handleCurrentConversation,
  84. isMsgNeedReadReceipt,
  85. displayOnlineStatus,
  86. onClose,
  87. };
  88. },
  89. });
  90. </script>
  91. <style scoped lang="scss" src="./index.scss"></style>