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

282 lines
6.7 KiB

  1. <template>
  2. <view class="page__view highlight">
  3. <navbar :title="detail.title" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="header">
  5. <image class="cover-img" :src="detail.image" mode="widthFix"></image>
  6. <view class="flex" style="padding: 40rpx 40rpx 0 40rpx;">
  7. <view class="flex flex-column">
  8. <view class="title">{{ detail.title }}</view>
  9. <view class="tag">{{ detail.createTime }}</view>
  10. </view>
  11. <view v-if="isManager" class="flex operate">
  12. <view class="btn btn-add" @click="onAdd">新增记录</view>
  13. </view>
  14. </view>
  15. </view>
  16. <view class="main">
  17. <view class="section" v-for="item in list" :key="item.id">
  18. <view class="flex section-header">
  19. <view class="avatar">
  20. <image class="avatar-img" :src="item.avatar" mode="scaleToFill"></image>
  21. </view>
  22. <view class="info">
  23. <view class="flex title">
  24. <view>{{ item.name }}</view>
  25. <image class="icon" src="@/static/image/icon-location.png" mode="widthFix"></image>
  26. <view class="address text-ellipsis">{{ item.address }}</view>
  27. </view>
  28. <view class="desc">{{ item.createTime }}</view>
  29. </view>
  30. </view>
  31. <view class="section-content record">
  32. <view class="record-item" v-for="(image, imgIdx) in item.images" :key="imgIdx">
  33. <image class="img" :src="image" mode="scaleToFill"></image>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. <formPopup ref="formPopup" @submitted="getData"></formPopup>
  39. </view>
  40. </template>
  41. <script>
  42. import mixinsList from '@/mixins/list.js'
  43. import SYStackedCarousel from '@/uni_modules/SY-StackedCarousel/components/SY-StackedCarousel/SY-StackedCarousel.vue'
  44. import formPopup from './formPopup.vue'
  45. export default {
  46. mixins: [mixinsList],
  47. components: {
  48. SYStackedCarousel,
  49. formPopup,
  50. },
  51. data() {
  52. return {
  53. id: null,
  54. detail: {},
  55. bannerList: [],
  56. current: 0,
  57. queryParams: {
  58. pageNo: 1,
  59. pageSize: 10,
  60. id: '',
  61. },
  62. // todo
  63. mixinsListApi: '',
  64. // todo: fetch
  65. isManager: false,
  66. }
  67. },
  68. computed: {
  69. swiperCurrent() {
  70. return this.bannerList[this.current]
  71. },
  72. },
  73. onLoad(arg) {
  74. const { id } = arg
  75. this.id = id
  76. this.fetchDetail()
  77. this.queryParams.id = id
  78. this.getData()
  79. },
  80. methods: {
  81. async fetchDetail() {
  82. // todo: fetch
  83. this.detail = {
  84. id: '001',
  85. image: '/static/image/temp-20.png',
  86. title: '趣玩新加坡',
  87. createTime: '2025-04-18',
  88. }
  89. },
  90. // todo: delete
  91. getData() {
  92. this.list = [
  93. {
  94. id: '001',
  95. avatar: '/pages_order/static/temp-30.png',
  96. name: '战斗世界',
  97. address: '241 Orchard Road, Singapore 238863',
  98. createTime: '2023-04-18 12:00:00',
  99. images: [
  100. '/pages_order/static/temp-38.png',
  101. '/pages_order/static/temp-38.png',
  102. '/pages_order/static/temp-38.png',
  103. '/pages_order/static/temp-38.png',
  104. '/pages_order/static/temp-38.png',
  105. '/pages_order/static/temp-38.png',
  106. '/pages_order/static/temp-38.png',
  107. '/pages_order/static/temp-38.png',
  108. '/pages_order/static/temp-38.png',
  109. ]
  110. },
  111. {
  112. id: '001',
  113. avatar: '/pages_order/static/temp-30.png',
  114. name: '战斗世界',
  115. address: '10 Bayfront Avenue, Singapore 018956',
  116. createTime: '2023-04-18 12:00:00',
  117. images: [
  118. '/pages_order/static/temp-38.png',
  119. '/pages_order/static/temp-38.png',
  120. '/pages_order/static/temp-38.png',
  121. '/pages_order/static/temp-38.png',
  122. '/pages_order/static/temp-38.png',
  123. '/pages_order/static/temp-38.png',
  124. '/pages_order/static/temp-38.png',
  125. '/pages_order/static/temp-38.png',
  126. '/pages_order/static/temp-38.png',
  127. ]
  128. },
  129. ]
  130. },
  131. clickHandler(item, index) {
  132. console.log("item: ", item);
  133. console.log("index: ", index);
  134. this.current = index
  135. },
  136. changeHandler(index) {
  137. console.log("当前触发change事件,返回索引: ", index);
  138. },
  139. onAdd() {
  140. this.$refs.formPopup.open()
  141. },
  142. },
  143. }
  144. </script>
  145. <style lang="scss" scoped>
  146. .header {
  147. margin-top: 40rpx;
  148. font-size: 0;
  149. .cover-img {
  150. width: 100%;
  151. height: auto;
  152. border-radius: 40rpx;
  153. }
  154. .title {
  155. font-size: 28rpx;
  156. font-weight: 600;
  157. color: #252545;
  158. }
  159. .tag {
  160. margin-top: 4rpx;
  161. padding: 2rpx 8rpx;
  162. font-size: 24rpx;
  163. color: #00A9FF;
  164. background: #E0F5FF;
  165. border-radius: 8rpx;
  166. }
  167. .operate {
  168. flex: 1;
  169. justify-content: flex-end;
  170. .btn-add {
  171. padding: 6rpx 22rpx;
  172. font-family: PingFang SC;
  173. font-size: 28rpx;
  174. font-weight: 500;
  175. line-height: 1.5;
  176. color: #FFFFFF;
  177. background: linear-gradient(to right, #21FEEC, #019AF9);
  178. border: 2rpx solid #00A9FF;
  179. border-radius: 30rpx;
  180. }
  181. }
  182. }
  183. .main {
  184. padding: 0 40rpx 40rpx 40rpx;
  185. }
  186. .section {
  187. margin-top: 40rpx;
  188. &-header {
  189. column-gap: 24rpx;
  190. .avatar {
  191. flex: none;
  192. width: 100rpx;
  193. height: 100rpx;
  194. border: 4rpx solid #FFFFFF;
  195. border-radius: 50%;
  196. overflow: hidden;
  197. &-img {
  198. width: 100%;
  199. height: 100%;
  200. }
  201. }
  202. .info {
  203. flex: 1;
  204. min-width: 0;
  205. .title {
  206. column-gap: 8rpx;
  207. white-space: nowrap;
  208. font-size: 36rpx;
  209. font-weight: 600;
  210. color: #252545;
  211. .icon {
  212. width: 32rpx;
  213. height: 32rpx;
  214. }
  215. .address {
  216. flex: 1;
  217. font-weight: 400;
  218. font-size: 24rpx;
  219. color: #00A9FF;
  220. }
  221. }
  222. .desc {
  223. margin-top: 8rpx;
  224. font-size: 24rpx;
  225. font-weight: 400;
  226. color: #8B8B8B;
  227. }
  228. }
  229. }
  230. &-content {
  231. margin-top: 24rpx;
  232. }
  233. }
  234. .record {
  235. display: grid;
  236. grid-template-columns: repeat(3, 1fr);
  237. gap: 16rpx;
  238. &-item {
  239. height: 300rpx;
  240. border: 2rpx solid #CDCDCD;
  241. border-radius: 12rpx;
  242. overflow: hidden;
  243. .img {
  244. width: 100%;
  245. height: 100%;
  246. }
  247. }
  248. }
  249. </style>