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

234 lines
5.3 KiB

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="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" 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="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">
  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: '/pages_order/static/temp-23.png',
  90. title: '趣玩新加坡',
  91. createTime: '2025-04-18',
  92. },
  93. {
  94. url: '/pages_order/static/temp-24.png',
  95. title: '坝上双草原',
  96. createTime: '2025-04-18',
  97. },
  98. {
  99. url: '/pages_order/static/temp-25.png',
  100. title: '牛湖线',
  101. createTime: '2025-04-18',
  102. },
  103. ]
  104. },
  105. clickHandler(item, index) {
  106. console.log("item: ", item);
  107. console.log("index: ", index);
  108. this.current = index
  109. },
  110. changeHandler(index) {
  111. console.log("当前触发change事件,返回索引: ", index);
  112. },
  113. onMark() {
  114. this.$refs.markPopup.open(this.id)
  115. },
  116. onAdd() {
  117. this.$refs.formPopup.open()
  118. },
  119. },
  120. }
  121. </script>
  122. <style lang="scss" scoped>
  123. .swiper {
  124. margin-top: 40rpx;
  125. .title {
  126. margin-top: 12rpx;
  127. font-size: 28rpx;
  128. font-weight: 600;
  129. color: #252545;
  130. }
  131. .tag {
  132. margin-top: 4rpx;
  133. padding: 2rpx 8rpx;
  134. font-size: 24rpx;
  135. color: #00A9FF;
  136. background: #E0F5FF;
  137. border-radius: 8rpx;
  138. }
  139. }
  140. .main {
  141. padding: 0 40rpx;
  142. }
  143. .header {
  144. justify-content: space-between;
  145. font-size: 40rpx;
  146. font-weight: 600;
  147. color: #252545;
  148. .btn-mark {
  149. padding: 6rpx 22rpx;
  150. font-family: PingFang SC;
  151. font-size: 28rpx;
  152. font-weight: 500;
  153. line-height: 1.5;
  154. color: #FFFFFF;
  155. background: linear-gradient(to right, #21FEEC, #019AF9);
  156. border: 2rpx solid #00A9FF;
  157. border-radius: 30rpx;
  158. }
  159. }
  160. .section {
  161. margin-top: 64rpx;
  162. &-header {
  163. font-size: 36rpx;
  164. font-weight: 500;
  165. color: #191919;
  166. .title {
  167. flex: 1;
  168. justify-content: flex-start;
  169. column-gap: 8rpx;
  170. .btn-add {
  171. padding: 8rpx 24rpx;
  172. font-size: 28rpx;
  173. font-weight: 500;
  174. line-height: 1.5;
  175. color: #252545;
  176. border: 2rpx solid #252545;
  177. border-radius: 30rpx;
  178. }
  179. }
  180. .btn-all {
  181. column-gap: 4rpx;
  182. font-size: 24rpx;
  183. line-height: 1.4;
  184. color: #8B8B8B;
  185. .icon {
  186. width: 32rpx;
  187. height: auto;
  188. }
  189. }
  190. }
  191. &-content {
  192. margin-top: 24rpx;
  193. }
  194. }
  195. .record {
  196. display: grid;
  197. grid-template-columns: repeat(3, 1fr);
  198. gap: 16rpx;
  199. &-item {
  200. border: 2rpx solid #CDCDCD;
  201. border-radius: 12rpx;
  202. overflow: hidden;
  203. .img {
  204. width: 100%;
  205. height: 100%;
  206. }
  207. }
  208. }
  209. </style>