鸿宇研学生前端代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

233 lines
5.5 KiB

2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
  1. <template>
  2. <view class="page__view highlight">
  3. <navbar title="图片直播" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="swiper">
  5. <SYStackedCarousel
  6. height="536rpx"
  7. :images="list"
  8. :autoplay="true"
  9. horizontalMargin="25"
  10. baseOpacity="0.5"
  11. bgColor="transparent"
  12. padding="0"
  13. @click="clickHandler"
  14. @change="changeHandler"
  15. >
  16. </SYStackedCarousel>
  17. <view class="flex flex-column" v-if="swiperCurrent">
  18. <view class="title">{{ swiperCurrent.title }}</view>
  19. <view class="tag">{{ swiperCurrent.createTime }}</view>
  20. </view>
  21. </view>
  22. <view class="main">
  23. <view class="flex header">
  24. <view>图片直播</view>
  25. <!-- <view class="btn btn-mark" @click="onMark">标记有我</view> -->
  26. </view>
  27. <view class="section" v-for="item in list" :key="item.id">
  28. <view class="flex section-header">
  29. <view class="flex title">
  30. <view>{{ item.title }}</view>
  31. <!-- <view v-if="isManager" class="btn btn-add" @click="onAdd(item.id)">新增记录</view> -->
  32. </view>
  33. <button class="flex btn btn-all" @click="showAll(item.id, item.activityId)">
  34. <view>查看全部</view>
  35. <image class="icon" src="@/static/image/icon-arrow-right.png" mode="widthFix"></image>
  36. </button>
  37. </view>
  38. <view class="section-content record">
  39. <view class="record-item" v-for="(image, imgIdx) in item.images" :key="imgIdx">
  40. <image class="img" :src="image" mode="aspectFill" @click="previewImage(item.images, imgIdx)"></image>
  41. </view>
  42. </view>
  43. </view>
  44. </view>
  45. <!-- <markPopup ref="markPopup"></markPopup> -->
  46. <!-- <formPopup ref="formPopup" @submitted="getData"></formPopup> -->
  47. </view>
  48. </template>
  49. <script>
  50. import mixinsList from '@/mixins/list.js'
  51. import SYStackedCarousel from '@/uni_modules/SY-StackedCarousel/components/SY-StackedCarousel/SY-StackedCarousel.vue'
  52. // import markPopup from '@/pages_order/growing/activity/markPopup.vue'
  53. // import formPopup from './formPopup.vue'
  54. export default {
  55. mixins: [mixinsList],
  56. components: {
  57. SYStackedCarousel,
  58. // markPopup,
  59. // formPopup,
  60. },
  61. data() {
  62. return {
  63. current: 0,
  64. mixinsListApi: 'queryImageList',
  65. // todo: fetch
  66. // isManager: true,
  67. }
  68. },
  69. computed: {
  70. swiperCurrent() {
  71. return this.list[this.current]
  72. },
  73. },
  74. async onLoad() {
  75. this.getData()
  76. },
  77. methods: {
  78. getDataThen(records) {
  79. this.list = records.map(item => {
  80. const { id, image, activityId, activityId_dictText, createTime } = item
  81. const images = image?.split?.(',') || []
  82. return {
  83. id,
  84. activityId,
  85. url: images?.[0],
  86. images,
  87. title: activityId_dictText,
  88. createTime: this.$dayjs(createTime).format('YYYY-MM-DD'),
  89. }
  90. })
  91. },
  92. clickHandler(item, index) {
  93. this.current = index
  94. },
  95. changeHandler(index) {
  96. this.current = index
  97. },
  98. // onMark() {
  99. // this.$refs.markPopup.open(this.id)
  100. // },
  101. // onAdd() {
  102. // this.$refs.formPopup.open()
  103. // },
  104. showAll(id, activityId) {
  105. this.$store.commit('setLiveInfo', this.list.find(item => item.id === id))
  106. this.$utils.navigateTo(`/pages_order/live/index?imageId=${id}&activityId=${activityId}`)
  107. },
  108. previewImage(arr, index) {
  109. uni.previewImage({
  110. urls: arr,
  111. current: arr[index], // 当前显示图片的链接
  112. });
  113. },
  114. },
  115. }
  116. </script>
  117. <style lang="scss" scoped>
  118. .swiper {
  119. margin-top: 40rpx;
  120. .title {
  121. margin-top: 12rpx;
  122. font-size: 28rpx;
  123. font-weight: 600;
  124. color: #252545;
  125. }
  126. .tag {
  127. margin-top: 4rpx;
  128. padding: 2rpx 8rpx;
  129. font-size: 24rpx;
  130. color: #00A9FF;
  131. background: #E0F5FF;
  132. border-radius: 8rpx;
  133. }
  134. }
  135. .main {
  136. padding: 0 40rpx 40rpx 40rpx;
  137. }
  138. .header {
  139. justify-content: space-between;
  140. font-size: 40rpx;
  141. font-weight: 600;
  142. color: #252545;
  143. .btn-mark {
  144. padding: 6rpx 22rpx;
  145. font-family: PingFang SC;
  146. font-size: 28rpx;
  147. font-weight: 500;
  148. line-height: 1.5;
  149. color: #FFFFFF;
  150. background: linear-gradient(to right, #21FEEC, #019AF9);
  151. border: 2rpx solid #00A9FF;
  152. border-radius: 30rpx;
  153. }
  154. }
  155. .section {
  156. margin-top: 64rpx;
  157. &-header {
  158. justify-content: space-between;
  159. font-size: 36rpx;
  160. font-weight: 500;
  161. color: #191919;
  162. .title {
  163. flex: 1;
  164. justify-content: flex-start;
  165. column-gap: 8rpx;
  166. .btn-add {
  167. padding: 8rpx 24rpx;
  168. font-size: 28rpx;
  169. font-weight: 500;
  170. line-height: 1.5;
  171. color: #252545;
  172. border: 2rpx solid #252545;
  173. border-radius: 30rpx;
  174. }
  175. }
  176. .btn-all {
  177. column-gap: 4rpx;
  178. font-size: 24rpx;
  179. line-height: 1.4;
  180. color: #8B8B8B;
  181. .icon {
  182. width: 32rpx;
  183. height: auto;
  184. }
  185. }
  186. }
  187. &-content {
  188. margin-top: 24rpx;
  189. }
  190. }
  191. .record {
  192. display: grid;
  193. grid-template-columns: repeat(3, 1fr);
  194. gap: 16rpx;
  195. &-item {
  196. height: 300rpx;
  197. border: 2rpx solid #CDCDCD;
  198. border-radius: 12rpx;
  199. overflow: hidden;
  200. .img {
  201. width: 100%;
  202. height: 100%;
  203. }
  204. }
  205. }
  206. </style>