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

240 lines
5.2 KiB

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="detail.title" leftClick @leftClick="$utils.navigateBack" />
  4. <view class="header">
  5. <image class="icon" :src="detail.image" mode="widthFix"></image>
  6. <view class="flex" style="padding: 0 40rpx;">
  7. <view class="flex">
  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="section-header">
  19. <view class="avatar">
  20. <!-- todo: check key -->
  21. <image class="avatar-img" src="@/pages_order/static/temp-30.png" mode="scaleToFill"></image>
  22. </view>
  23. <view class="info">
  24. <view class="flex title">
  25. <view>{{ item.name }}</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="scaleToFill"></image>
  35. </view>
  36. </view>
  37. </view>
  38. </view>
  39. <formPopup ref="formPopup" @submitted="getData"></formPopup>
  40. </view>
  41. </template>
  42. <script>
  43. import mixinsList from '@/mixins/list.js'
  44. import SYStackedCarousel from '@/uni_modules/SY-StackedCarousel/components/SY-StackedCarousel/SY-StackedCarousel.vue'
  45. import formPopup from './formPopup.vue'
  46. export default {
  47. mixins: [mixinsList],
  48. components: {
  49. SYStackedCarousel,
  50. formPopup,
  51. },
  52. data() {
  53. return {
  54. id: null,
  55. detail: {},
  56. bannerList: [],
  57. current: 0,
  58. queryParams: {
  59. pageNo: 1,
  60. pageSize: 10,
  61. id: '',
  62. },
  63. // todo
  64. mixinsListApi: '',
  65. // todo: fetch
  66. isManager: true,
  67. }
  68. },
  69. computed: {
  70. swiperCurrent() {
  71. return this.bannerList[this.current]
  72. },
  73. },
  74. onLoad(arg) {
  75. const { id } = arg
  76. this.id = id
  77. this.fetchDetail()
  78. this.queryParams.id = id
  79. this.getData()
  80. },
  81. methods: {
  82. async fetchDetail() {
  83. this.bannerList = [
  84. {
  85. url: '/pages_order/static/temp-23.png',
  86. title: '趣玩新加坡',
  87. createTime: '2025-04-18',
  88. },
  89. {
  90. url: '/pages_order/static/temp-24.png',
  91. title: '坝上双草原',
  92. createTime: '2025-04-18',
  93. },
  94. {
  95. url: '/pages_order/static/temp-25.png',
  96. title: '牛湖线',
  97. createTime: '2025-04-18',
  98. },
  99. ]
  100. },
  101. clickHandler(item, index) {
  102. console.log("item: ", item);
  103. console.log("index: ", index);
  104. this.current = index
  105. },
  106. changeHandler(index) {
  107. console.log("当前触发change事件,返回索引: ", index);
  108. },
  109. onAdd() {
  110. this.$refs.formPopup.open()
  111. },
  112. },
  113. }
  114. </script>
  115. <style lang="scss" scoped>
  116. .header {
  117. margin-top: 40rpx;
  118. .title {
  119. margin-top: 12rpx;
  120. font-size: 28rpx;
  121. font-weight: 600;
  122. color: #252545;
  123. }
  124. .tag {
  125. margin-top: 4rpx;
  126. padding: 2rpx 8rpx;
  127. font-size: 24rpx;
  128. color: #00A9FF;
  129. background: #E0F5FF;
  130. border-radius: 8rpx;
  131. }
  132. .operate {
  133. flex: 1;
  134. justify-content: flex-end;
  135. .btn-add {
  136. padding: 6rpx 22rpx;
  137. font-family: PingFang SC;
  138. font-size: 28rpx;
  139. font-weight: 500;
  140. line-height: 1.5;
  141. color: #FFFFFF;
  142. background: linear-gradient(to right, #21FEEC, #019AF9);
  143. border: 2rpx solid #00A9FF;
  144. border-radius: 30rpx;
  145. }
  146. }
  147. }
  148. .main {
  149. padding: 0 40rpx;
  150. }
  151. .section {
  152. margin-top: 40rpx;
  153. &-header {
  154. .avatar {
  155. flex: none;
  156. width: 100rpx;
  157. height: 100rpx;
  158. border: 4rpx solid #FFFFFF;
  159. border-radius: 50%;
  160. overflow: hidden;
  161. &-img {
  162. width: 100%;
  163. height: 100%;
  164. }
  165. }
  166. .info {
  167. flex: 1;
  168. column-gap: 24rpx;
  169. .title {
  170. column-gap: 8rpx;
  171. white-space: nowrap;
  172. font-size: 26rpx;
  173. font-weight: 600;
  174. color: #252545;
  175. .icon {
  176. width: 32rpx;
  177. height: 32rpx;
  178. }
  179. .address {
  180. flex: 1;
  181. font-size: 24rpx;
  182. color: #00A9FF;
  183. }
  184. }
  185. .desc {
  186. margin-top: 8rpx;
  187. }
  188. }
  189. }
  190. &-content {
  191. margin-top: 24rpx;
  192. }
  193. }
  194. .record {
  195. display: grid;
  196. grid-template-columns: repeat(3, 1fr);
  197. gap: 16rpx;
  198. &-item {
  199. border: 2rpx solid #CDCDCD;
  200. border-radius: 12rpx;
  201. overflow: hidden;
  202. .img {
  203. width: 100%;
  204. height: 100%;
  205. }
  206. }
  207. }
  208. </style>