upload.wxml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <view class="{{classPrefix}} {{prefix}}-class">
  2. <t-grid gutter="{{gutter}}" border="{{false}}" align="center" column="{{column}}">
  3. <!-- 图片/视频 -->
  4. <t-grid-item
  5. wx:for="{{customFiles}}"
  6. wx:key="index"
  7. wx:for-item="file"
  8. t-class="{{classPrefix}}__grid {{classPrefix}}__grid-file"
  9. t-class-content="{{classPrefix}}__grid-content"
  10. >
  11. <view class="{{classPrefix}}__wrapper" slot="image" style="{{gridItemStyle}}">
  12. <t-image
  13. wx:if="{{file.type !== 'video'}}"
  14. bindtap="onProofTap"
  15. data-index="{{index}}"
  16. t-class="{{classPrefix}}__thumbnail"
  17. src="{{file.url}}"
  18. mode="{{imageProps.mode}}"
  19. error="{{imageProps.error}}"
  20. lazy="{{imageProps.lazy}}"
  21. loading="{{imageProps.loading}}"
  22. shape="{{imageProps.shape}}"
  23. webp="{{imageProps.webp}}"
  24. showMenuByLongpress="{{image.showMenuByLongpress}}"
  25. />
  26. <video
  27. wx:if="{{file.type === 'video'}}"
  28. class="{{classPrefix}}__thumbnail"
  29. src="{{file.url}}"
  30. controls
  31. autoplay="{{false}}"
  32. objectFit="contain"
  33. />
  34. <!-- 失败重试 -->
  35. <view
  36. data-index="{{index}}"
  37. wx:if="{{file.percent !== undefined && file.percent !== 100}}"
  38. class="{{classPrefix}}__progress-mask"
  39. >
  40. <view wx:if="{{file.percent === -1}}" class="{{classPrefix}}__progress-failed">
  41. <t-icon name="refresh" size="45rpx" color="#fff" />
  42. </view>
  43. <view wx:else class="{{classPrefix}}__progress-value">{{file.percent}}%</view>
  44. </view>
  45. <!-- 删除 -->
  46. <view class="{{classPrefix}}__close-btn hotspot-expanded" bindtap="onDelete" data-index="{{index}}">
  47. <slot wx:if="{{deleteBtn === 'slot'}}" name="deleteBtn" />
  48. <t-icon wx:else name="close" size="34rpx" color="#fff" />
  49. </view>
  50. </view>
  51. </t-grid-item>
  52. <!-- 添加 -->
  53. <t-grid-item
  54. wx:if="{{customLimit > 0}}"
  55. t-class="{{classPrefix}}__grid"
  56. t-class-content="{{classPrefix}}__grid-content"
  57. bindclick="onAddTap"
  58. >
  59. <view class="{{classPrefix}}__wrapper" slot="image" style="{{gridItemStyle}}">
  60. <view class="{{classPrefix}}__add-icon">
  61. <slot wx:if="{{addContent === 'slot'}}" name="addContent" />
  62. <t-icon wx:else name="add" size="40rpx" color="rgba(0,0,0,0.26)" />
  63. </view>
  64. </view>
  65. </t-grid-item>
  66. </t-grid>
  67. </view>