act_album.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. <template>
  2. <view class="container">
  3. <!-- 图片列表区域 -->
  4. <view class="list">
  5. <image v-for="(item, index) in imgList" :key="index" class="img" mode="aspectFill" :src="item" />
  6. </view>
  7. <!-- 没有数据时展示的页面 -->
  8. <noData v-if="!imgList.length"></noData>
  9. <!-- 上传照片按钮区域 -->
  10. <view class="btn" @click="clickUpload">
  11. <uni-icons type="upload" size="22" color="#fff"></uni-icons>
  12. &nbsp;&nbsp;上传照片
  13. </view>
  14. </view>
  15. </template>
  16. <script setup>
  17. import { onLoad } from '@dcloudio/uni-app'
  18. import { ref } from 'vue'
  19. // 图片数组
  20. const imgList = ref([])
  21. // 活动ID
  22. const currentId = ref()
  23. onLoad((options) => {
  24. if (options.imgList) {
  25. imgList.value = JSON.parse(decodeURIComponent(options.imgList))
  26. }
  27. if (options.currentId) {
  28. currentId.value = options.currentId
  29. }
  30. })
  31. // 点击上传照片的回调
  32. const clickUpload = () => {
  33. uni.navigateTo({
  34. url: `/pages/school_photo_upload/school_photo_upload?type=1&currentId=${currentId.value}`
  35. })
  36. }
  37. </script>
  38. <style lang="scss" scoped>
  39. .container {
  40. padding: 20rpx 18rpx;
  41. min-height: 100vh;
  42. .list {
  43. display: grid;
  44. grid-template-columns: repeat(3, 1fr);
  45. gap: 20rpx;
  46. .img {
  47. width: 220rpx;
  48. height: 220rpx;
  49. border-radius: 10rpx;
  50. }
  51. }
  52. .btn {
  53. position: fixed;
  54. left: 50%;
  55. bottom: 30rpx;
  56. transform: translateX(-50%);
  57. display: flex;
  58. align-items: center;
  59. justify-content: center;
  60. width: 243rpx;
  61. height: 100rpx;
  62. color: #fff;
  63. font-size: 28rpx;
  64. border-radius: 8rpx;
  65. background-color: #007aff;
  66. }
  67. }
  68. </style>