鸿宇研学生前端代码
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.

268 lines
6.3 KiB

  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="bannerList"
  8. :current="current"
  9. :autoplay="true"
  10. horizontalMargin="25"
  11. baseOpacity="0.5"
  12. bgColor="transparent"
  13. padding="0"
  14. @click="clickHandler"
  15. @change="changeHandler"
  16. >
  17. </SYStackedCarousel>
  18. <view class="flex flex-column" v-if="swiperCurrent">
  19. <view class="title">{{ swiperCurrent.title }}</view>
  20. <view class="tag">{{ swiperCurrent.createTime }}</view>
  21. </view>
  22. </view>
  23. <view class="main">
  24. <view class="flex header">
  25. <view>图片直播</view>
  26. <view class="btn btn-mark" @click="onMark">标记有我</view>
  27. </view>
  28. <view class="section" v-for="item in list" :key="item.id">
  29. <view class="flex section-header">
  30. <view class="flex title">
  31. <view>{{ item.title }}</view>
  32. <view v-if="isManager" class="btn btn-add" @click="onAdd(item.id)">新增记录</view>
  33. </view>
  34. <button class="flex btn btn-all" @click="showAll(item.id)">
  35. <view>查看全部</view>
  36. <image class="icon" src="@/static/image/icon-arrow-right.png" mode="widthFix"></image>
  37. </button>
  38. </view>
  39. <view class="section-content record">
  40. <view class="record-item" v-for="(image, imgIdx) in item.images" :key="imgIdx">
  41. <image class="img" :src="image" mode="scaleToFill"></image>
  42. </view>
  43. </view>
  44. </view>
  45. </view>
  46. <markPopup ref="markPopup"></markPopup>
  47. <formPopup ref="formPopup" @submitted="getData"></formPopup>
  48. </view>
  49. </template>
  50. <script>
  51. import mixinsList from '@/mixins/list.js'
  52. import SYStackedCarousel from '@/uni_modules/SY-StackedCarousel/components/SY-StackedCarousel/SY-StackedCarousel.vue'
  53. import markPopup from '@/pages_order/growing/activity/markPopup.vue'
  54. import formPopup from './formPopup.vue'
  55. export default {
  56. mixins: [mixinsList],
  57. components: {
  58. SYStackedCarousel,
  59. markPopup,
  60. formPopup,
  61. },
  62. data() {
  63. return {
  64. bannerList: [],
  65. current: 0,
  66. queryParams: {
  67. pageNo: 1,
  68. pageSize: 10,
  69. id: '',
  70. },
  71. // todo
  72. mixinsListApi: '',
  73. // todo: fetch
  74. isManager: true,
  75. }
  76. },
  77. computed: {
  78. swiperCurrent() {
  79. return this.bannerList[this.current]
  80. },
  81. },
  82. onLoad() {
  83. this.fetchBanner()
  84. },
  85. methods: {
  86. async fetchBanner() {
  87. this.bannerList = [
  88. {
  89. url: '/static/image/temp-20.png',
  90. title: '趣玩新加坡',
  91. createTime: '2025-04-18',
  92. },
  93. {
  94. url: '/static/image/temp-20.png',
  95. title: '坝上双草原',
  96. createTime: '2025-04-18',
  97. },
  98. {
  99. url: '/static/image/temp-20.png',
  100. title: '牛湖线',
  101. createTime: '2025-04-18',
  102. },
  103. ]
  104. },
  105. // todo: delete
  106. getData() {
  107. this.list = [
  108. {
  109. id: '001',
  110. title: '桂林深度游',
  111. images: [
  112. '/pages_order/static/temp-38.png',
  113. '/pages_order/static/temp-38.png',
  114. '/pages_order/static/temp-38.png',
  115. '/pages_order/static/temp-38.png',
  116. '/pages_order/static/temp-38.png',
  117. '/pages_order/static/temp-38.png',
  118. ]
  119. },
  120. {
  121. id: '002',
  122. title: '西双版纳雨林10+体验',
  123. images: [
  124. '/pages_order/static/temp-38.png',
  125. '/pages_order/static/temp-38.png',
  126. '/pages_order/static/temp-38.png',
  127. '/pages_order/static/temp-38.png',
  128. '/pages_order/static/temp-38.png',
  129. '/pages_order/static/temp-38.png',
  130. ]
  131. },
  132. ]
  133. },
  134. clickHandler(item, index) {
  135. console.log("item: ", item);
  136. console.log("index: ", index);
  137. this.current = index
  138. },
  139. changeHandler(index) {
  140. console.log("当前触发change事件,返回索引: ", index);
  141. },
  142. onMark() {
  143. this.$refs.markPopup.open(this.id)
  144. },
  145. onAdd() {
  146. this.$refs.formPopup.open()
  147. },
  148. showAll(id) {
  149. this.$utils.navigateTo(`/pages_order/live/index?id=${id}`)
  150. },
  151. },
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. .swiper {
  156. margin-top: 40rpx;
  157. .title {
  158. margin-top: 12rpx;
  159. font-size: 28rpx;
  160. font-weight: 600;
  161. color: #252545;
  162. }
  163. .tag {
  164. margin-top: 4rpx;
  165. padding: 2rpx 8rpx;
  166. font-size: 24rpx;
  167. color: #00A9FF;
  168. background: #E0F5FF;
  169. border-radius: 8rpx;
  170. }
  171. }
  172. .main {
  173. padding: 0 40rpx 40rpx 40rpx;
  174. }
  175. .header {
  176. justify-content: space-between;
  177. font-size: 40rpx;
  178. font-weight: 600;
  179. color: #252545;
  180. .btn-mark {
  181. padding: 6rpx 22rpx;
  182. font-family: PingFang SC;
  183. font-size: 28rpx;
  184. font-weight: 500;
  185. line-height: 1.5;
  186. color: #FFFFFF;
  187. background: linear-gradient(to right, #21FEEC, #019AF9);
  188. border: 2rpx solid #00A9FF;
  189. border-radius: 30rpx;
  190. }
  191. }
  192. .section {
  193. margin-top: 64rpx;
  194. &-header {
  195. justify-content: space-between;
  196. font-size: 36rpx;
  197. font-weight: 500;
  198. color: #191919;
  199. .title {
  200. flex: 1;
  201. justify-content: flex-start;
  202. column-gap: 8rpx;
  203. .btn-add {
  204. padding: 8rpx 24rpx;
  205. font-size: 28rpx;
  206. font-weight: 500;
  207. line-height: 1.5;
  208. color: #252545;
  209. border: 2rpx solid #252545;
  210. border-radius: 30rpx;
  211. }
  212. }
  213. .btn-all {
  214. column-gap: 4rpx;
  215. font-size: 24rpx;
  216. line-height: 1.4;
  217. color: #8B8B8B;
  218. .icon {
  219. width: 32rpx;
  220. height: auto;
  221. }
  222. }
  223. }
  224. &-content {
  225. margin-top: 24rpx;
  226. }
  227. }
  228. .record {
  229. display: grid;
  230. grid-template-columns: repeat(3, 1fr);
  231. gap: 16rpx;
  232. &-item {
  233. height: 300rpx;
  234. border: 2rpx solid #CDCDCD;
  235. border-radius: 12rpx;
  236. overflow: hidden;
  237. .img {
  238. width: 100%;
  239. height: 100%;
  240. }
  241. }
  242. }
  243. </style>