index.vue 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <script setup lang="ts">
  2. import type { type_dyaw_xlfw_zxhd_log } from '~/types';
  3. import { formatTimestamp, formatTimeToShow } from '~/utils/time';
  4. const props = defineProps<{
  5. left: boolean,
  6. virtualName?: string,
  7. w: number,
  8. d: type_dyaw_xlfw_zxhd_log
  9. }>()
  10. const id2name = {
  11. [props.d.dxzl_stu_user_id]: props.virtualName ?? props.d.dxzl_stu_user_realname,
  12. [props.d.dxzl_tea_user_id]: props.d.dxzl_tea_user_realname,
  13. }
  14. const showMsg = $computed(() => decodeURIComponent(props.d.dxzl_last_msg_content!))
  15. </script>
  16. <template>
  17. <div class="w-full" :class="left ? 'left' : 'right'">
  18. <div class="flex items-end r_flex-row-reverse gap-4">
  19. <div>{{ id2name[d.create_user_id] }}</div>
  20. <div class="text-sm text-hex-AFB2B6">{{ formatTimeToShow(props.d.create_dateline * 1000) }}</div>
  21. </div>
  22. <div class="flex mt-2 r_flex-row-reverse">
  23. <div class=" py-10px px-25px rounded-3xl min-h-44px bg-white text_wrapper" :style="`max-width:${props.w}px`"
  24. v-html="showMsg">
  25. </div>
  26. </div>
  27. </div>
  28. </template>
  29. <style scoped lang="scss">
  30. .text_wrapper :deep(p) {
  31. margin: 0;
  32. padding: 0;
  33. word-wrap: break-word;
  34. }
  35. .left {
  36. .text_wrapper {
  37. border-radius: 2px 24px 24px 24px;
  38. }
  39. }
  40. .right {
  41. .r_flex-row-reverse {
  42. flex-direction: row-reverse;
  43. }
  44. .text_wrapper {
  45. background-color: #F9A7BE;
  46. color: white;
  47. border-radius: 24px 2px 24px 24px;
  48. }
  49. }
  50. </style>