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

254 lines
5.7 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
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="liveInfo.title" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="header">
  5. <image class="cover-img" :src="liveInfo.url" mode="widthFix"></image>
  6. <view class="flex" style="padding: 40rpx 40rpx 0 40rpx;">
  7. <view class="flex flex-column">
  8. <view class="title">{{ liveInfo.title }}</view>
  9. <view class="tag">{{ liveInfo.createTime }}</view>
  10. </view>
  11. <view v-if="isManager" class="flex operate">
  12. <view class="btn btn-add" @click="onMark">标记有我</view>
  13. <view class="btn btn-add" @click="onAdd">新增记录</view>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="main">
  18. <view class="section" v-for="item in list" :key="item.id">
  19. <view class="flex section-header">
  20. <view class="avatar">
  21. <image class="avatar-img" :src="item.user.headImage" mode="scaleToFill"></image>
  22. </view>
  23. <view class="info">
  24. <view class="flex title">
  25. <view>{{ item.user.nickName }}</view>
  26. <image class="icon" src="@/static/image/icon-location.png" mode="widthFix"></image>
  27. <view class="address text-ellipsis">{{ item.address }}</view>
  28. </view>
  29. <view class="desc">{{ item.createTime }}</view>
  30. </view>
  31. </view>
  32. <view class="section-content record">
  33. <view class="record-item" v-for="(image, imgIdx) in item.images" :key="imgIdx">
  34. <image class="img" :src="image" mode="aspectFill" @click="previewImage(item.images, imgIdx)"></image>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <formPopup ref="formPopup" @submitted="getData"></formPopup>
  40. <markPopup ref="markPopup"></markPopup>
  41. </view>
  42. </template>
  43. <script>
  44. import { mapState } from 'vuex'
  45. import mixinsList from '@/mixins/list.js'
  46. import SYStackedCarousel from '@/uni_modules/SY-StackedCarousel/components/SY-StackedCarousel/SY-StackedCarousel.vue'
  47. import formPopup from './formPopup.vue'
  48. import markPopup from '@/pages_order/growing/activity/markPopup.vue'
  49. export default {
  50. mixins: [mixinsList],
  51. components: {
  52. SYStackedCarousel,
  53. formPopup,
  54. markPopup,
  55. },
  56. data() {
  57. return {
  58. current: 0,
  59. activityId: '',
  60. queryParams: {
  61. pageNo: 1,
  62. pageSize: 10,
  63. imageId: '',
  64. },
  65. mixinsListApi: 'queryImageContentList',
  66. // todo: fetch
  67. isManager: true,
  68. }
  69. },
  70. computed: {
  71. ...mapState(['liveInfo']),
  72. },
  73. onLoad(arg) {
  74. const { imageId, activityId } = arg
  75. this.queryParams.imageId = imageId
  76. this.activityId = activityId
  77. this.getData()
  78. },
  79. methods: {
  80. getCoverImage(image) {
  81. return image?.split?.(',')?.[0]
  82. },
  83. getDataThen(records) {
  84. this.list = records.map(item => {
  85. const { id, user, address, image, createTime } = item
  86. return {
  87. id,
  88. user,
  89. address,
  90. images: image?.split?.(',') || [],
  91. createTime,
  92. }
  93. })
  94. },
  95. setData(e) {
  96. console.log('setData', e)
  97. this.mixinsListApi = ''
  98. },
  99. onAdd() {
  100. this.$refs.formPopup.open(this.queryParams.imageId, this.activityId)
  101. },
  102. onMark() {
  103. this.$refs.markPopup.open(this.activityId)
  104. },
  105. previewImage(arr, index) {
  106. uni.previewImage({
  107. urls: arr,
  108. current: arr[index], // 当前显示图片的链接
  109. });
  110. },
  111. },
  112. }
  113. </script>
  114. <style lang="scss" scoped>
  115. .header {
  116. margin-top: 40rpx;
  117. font-size: 0;
  118. .cover-img {
  119. width: 100%;
  120. height: auto;
  121. border-radius: 40rpx;
  122. }
  123. .title {
  124. font-size: 28rpx;
  125. font-weight: 600;
  126. color: #252545;
  127. }
  128. .tag {
  129. margin-top: 4rpx;
  130. padding: 2rpx 8rpx;
  131. font-size: 24rpx;
  132. color: #00A9FF;
  133. background: #E0F5FF;
  134. border-radius: 8rpx;
  135. }
  136. .operate {
  137. flex: 1;
  138. justify-content: flex-end;
  139. column-gap: 16rpx;
  140. .btn-add {
  141. padding: 6rpx 22rpx;
  142. font-family: PingFang SC;
  143. font-size: 28rpx;
  144. font-weight: 500;
  145. line-height: 1.5;
  146. color: #FFFFFF;
  147. background: linear-gradient(to right, #21FEEC, #019AF9);
  148. border: 2rpx solid #00A9FF;
  149. border-radius: 30rpx;
  150. }
  151. }
  152. }
  153. .main {
  154. padding: 0 40rpx 40rpx 40rpx;
  155. }
  156. .section {
  157. margin-top: 40rpx;
  158. &-header {
  159. column-gap: 24rpx;
  160. .avatar {
  161. flex: none;
  162. width: 100rpx;
  163. height: 100rpx;
  164. border: 4rpx solid #FFFFFF;
  165. border-radius: 50%;
  166. overflow: hidden;
  167. &-img {
  168. width: 100%;
  169. height: 100%;
  170. }
  171. }
  172. .info {
  173. flex: 1;
  174. min-width: 0;
  175. .title {
  176. column-gap: 8rpx;
  177. white-space: nowrap;
  178. font-size: 36rpx;
  179. font-weight: 600;
  180. color: #252545;
  181. .icon {
  182. width: 32rpx;
  183. height: 32rpx;
  184. }
  185. .address {
  186. flex: 1;
  187. font-weight: 400;
  188. font-size: 24rpx;
  189. color: #00A9FF;
  190. }
  191. }
  192. .desc {
  193. margin-top: 8rpx;
  194. font-size: 24rpx;
  195. font-weight: 400;
  196. color: #8B8B8B;
  197. }
  198. }
  199. }
  200. &-content {
  201. margin-top: 24rpx;
  202. }
  203. }
  204. .record {
  205. display: grid;
  206. grid-template-columns: repeat(3, 1fr);
  207. gap: 16rpx;
  208. &-item {
  209. height: 300rpx;
  210. border: 2rpx solid #CDCDCD;
  211. border-radius: 12rpx;
  212. overflow: hidden;
  213. .img {
  214. width: 100%;
  215. height: 100%;
  216. }
  217. }
  218. }
  219. </style>