m-other.vue 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <template>
  2. <view class="quote-box">
  3. <text class="quote-name">
  4. {{ value.senderData.name }}:
  5. <text>{{ renderTextMessage }}</text>
  6. </text>
  7. </view>
  8. </template>
  9. <script>
  10. import { EmojiDecoder, emojiMap } from '@/utils/EmojiDecoder.js';
  11. const emojiUrl = 'https://imgcache.qq.com/open/qcloud/tim/assets/emoji/';
  12. const decoder = new EmojiDecoder(emojiUrl, emojiMap);
  13. export default {
  14. props: {
  15. isMy: {
  16. type: [Boolean, Number],
  17. default: false
  18. },
  19. value: {
  20. type: Object,
  21. default: {}
  22. }
  23. },
  24. data() {
  25. return {};
  26. },
  27. created() {},
  28. computed: {
  29. renderTextMessage() {
  30. const { type = '' } = this.value;
  31. const typeText = {
  32. video: `[视频]${this.getTimes()}`,
  33. red_envelope: '[蝌蚪红包]',
  34. map: `[位置]${this.value.payload?.title}`,
  35. emoji_pack: `[表情包]`,
  36. article: '[文章分享]',
  37. share_SBCF: '[商家分享]',
  38. share_mall: '[商品分享]',
  39. functional_module: '[功能分享]'
  40. };
  41. return typeText[type];
  42. }
  43. },
  44. methods: {
  45. getTimes() {
  46. if (this.value.type !== 'video') return;
  47. const t = this.value.payload.video.duration;
  48. let h = parseInt((t / 60 / 60) % 24);
  49. let m = parseInt((t / 60) % 60);
  50. let s = parseInt(t % 60);
  51. h = h < 10 ? '0' + h : h;
  52. m = m < 10 ? '0' + m : m;
  53. s = s < 10 ? '0' + s : s;
  54. if (h === '00') return `${m}:${s}`;
  55. return `${h}:${m}:${s}`;
  56. }
  57. }
  58. };
  59. </script>
  60. <style scoped lang="scss">
  61. .quote-box {
  62. box-sizing: border-box;
  63. padding: 12rpx 16rpx;
  64. border-radius: 10rpx;
  65. margin-top: 6rpx;
  66. background-color: #e1e1e1;
  67. color: #6b6b6b;
  68. }
  69. .quote-name {
  70. }
  71. .quote-content {
  72. }
  73. </style>