toolsPopup.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  1. <template>
  2. <su-popup :show="showTools" @close="handleClose">
  3. <view class="ss-modal-box ss-flex-col">
  4. <slot></slot>
  5. <view class="content ss-flex ss-flex-1">
  6. <template v-if="toolsMode === 'emoji'">
  7. <swiper class="emoji-swiper" :indicator-dots="true" circular indicator-active-color="#7063D2"
  8. indicator-color="rgba(235, 231, 255, 1)" :autoplay="false" :interval="3000" :duration="1000">
  9. <swiper-item v-for="emoji in emojiPage" :key="emoji">
  10. <view class="ss-flex ss-flex-wrap">
  11. <image v-for="item in emoji" :key="item" class="emoji-img"
  12. :src="sheep.$url.cdn(`/static/img/chat/emoji/${item.file}`)" @tap="onEmoji(item)">
  13. </image>
  14. </view>
  15. </swiper-item>
  16. </swiper>
  17. </template>
  18. <template v-else>
  19. <view class="image">
  20. <s-uploader file-mediatype="image" :imageStyles="{ width: 50, height: 50, border: false }"
  21. @select="imageSelect({ type: 'image', data: $event })">
  22. <image class="icon" :src="sheep.$url.static('/static/img/shop/chat/image.png')" mode="aspectFill"></image>
  23. </s-uploader>
  24. <view>图片</view>
  25. </view>
  26. <view class="goods" @tap="onShowSelect('goods')">
  27. <image class="icon" :src="sheep.$url.static('/static/img/shop/chat/goods.png')" mode="aspectFill"></image>
  28. <view>产品</view>
  29. </view>
  30. <!-- <view class="order" @tap="onShowSelect('order')">
  31. <image
  32. class="icon"
  33. :src="sheep.$url.static('/static/img/shop/chat/order.png')"
  34. mode="aspectFill"
  35. ></image>
  36. <view>订单</view>
  37. </view> -->
  38. </template>
  39. </view>
  40. </view>
  41. </su-popup>
  42. </template>
  43. <script setup>
  44. /**
  45. * 聊天工具
  46. */
  47. import { emojiPage } from '@/pages/chat/util/emoji';
  48. import sheep from '@/sheep';
  49. const props = defineProps({
  50. // 工具模式
  51. toolsMode: {
  52. type: String,
  53. default: '',
  54. },
  55. // 控制工具菜单弹出
  56. showTools: {
  57. type: Boolean,
  58. default: () => false,
  59. },
  60. });
  61. const emits = defineEmits(['onEmoji', 'imageSelect', 'onShowSelect', 'close']);
  62. // 关闭弹出工具菜单
  63. function handleClose() {
  64. emits('close');
  65. }
  66. // 选择表情
  67. function onEmoji(emoji) {
  68. emits('onEmoji', emoji);
  69. }
  70. // 选择图片
  71. function imageSelect(val) {
  72. emits('imageSelect', val);
  73. }
  74. // 选择产品或订单
  75. function onShowSelect(mode) {
  76. emits('onShowSelect', mode);
  77. }
  78. </script>
  79. <style scoped lang="scss">
  80. .content {
  81. width: 100%;
  82. align-content: space-around;
  83. border-top: 1px solid #dfdfdf;
  84. padding: 20rpx 0 0;
  85. .emoji-swiper {
  86. width: 100%;
  87. height: 280rpx;
  88. padding: 0 20rpx;
  89. .emoji-img {
  90. width: 50rpx;
  91. height: 50rpx;
  92. display: inline-block;
  93. margin: 10rpx;
  94. }
  95. }
  96. .image,
  97. .goods,
  98. .order {
  99. width: 33.3%;
  100. height: 280rpx;
  101. text-align: center;
  102. font-size: 24rpx;
  103. color: #333;
  104. display: flex;
  105. flex-direction: column;
  106. align-items: center;
  107. justify-content: center;
  108. .icon {
  109. width: 50rpx;
  110. height: 50rpx;
  111. margin-bottom: 21rpx;
  112. }
  113. }
  114. :deep() {
  115. .uni-file-picker__container {
  116. justify-content: center;
  117. }
  118. .file-picker__box {
  119. display: none;
  120. &:last-of-type {
  121. display: flex;
  122. }
  123. }
  124. }
  125. }
  126. </style>