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

303 lines
7.0 KiB

  1. <template>
  2. <view class="page__view highlight">
  3. <!-- 导航栏 -->
  4. <navbar title="活动详情" leftClick @leftClick="$utils.navigateBack" />
  5. <view class="tabs">
  6. <uv-tabs
  7. :list="tabs"
  8. :scrollable="false"
  9. lineColor="#00A9FF"
  10. lineWidth="48rpx"
  11. lineHeight="4rpx"
  12. :activeStyle="{
  13. 'font-family': 'PingFang SC',
  14. 'font-weight': 500,
  15. 'font-size': '32rpx',
  16. 'line-height': 1.4,
  17. 'color': '#00A9FF',
  18. }"
  19. :inactiveStyle="{
  20. 'font-family': 'PingFang SC',
  21. 'font-weight': 400,
  22. 'font-size': '32rpx',
  23. 'line-height': 1.4,
  24. 'color': '#191919',
  25. }"
  26. @click="clickTabs"
  27. ></uv-tabs>
  28. </view>
  29. <scroll-view type="custom" scroll-y="true" :scroll-into-view="scrollIntoView" class="scroll-view">
  30. <view class="scroll-view-content">
  31. <view class="cover-img">
  32. <image class="img" src="@/static/image/temp-20.png" mode="aspectFill"></image>
  33. </view>
  34. <view class="section" id="highlights">
  35. <view class="flex section-header">
  36. <view class="flex">
  37. <view class="flex icon">
  38. <image class="img" src="@/static/image/icon-mark.png" mode="widthFix"></image>
  39. </view>
  40. <view>活动掠影</view>
  41. </view>
  42. <view class="btn btn-mark" @click="onMark">标记有我</view>
  43. </view>
  44. <view class="section-content highlights">
  45. <view class="highlights-item" v-for="(image, idx) in detail.highlights" :key="idx">
  46. <image class="img" :src="image" mode="scaleToFill"></image>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="section" id="thoughts">
  51. <view class="section-header">学员心得</view>
  52. <view class="section-content thoughts">
  53. <view class="card" v-for="item in detail.thoughts" :key="item.id">
  54. <commentCard :data="item" @change="onCommentChange"></commentCard>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="section report" id="report">
  59. <view class="section-header">行后报告</view>
  60. <view class="section-content report">
  61. <!-- todo -->
  62. </view>
  63. </view>
  64. </view>
  65. </scroll-view>
  66. <markPopup ref="markPopup"></markPopup>
  67. <view class="flex bottom">
  68. <button class="flex btn btn-palin" @click="jumpToPoster">生成海报</button>
  69. <button class="flex btn btn-primary" @click="onApplyEmail">申请邮件</button>
  70. </view>
  71. </view>
  72. </template>
  73. <script>
  74. import commentCard from '@/pages_order/comment/commentCard.vue'
  75. import markPopup from '@/pages_order/growing/activity/markPopup.vue'
  76. export default {
  77. components: {
  78. commentCard,
  79. markPopup,
  80. },
  81. data() {
  82. return {
  83. id: null,
  84. tabs: [
  85. { id: 'highlights', name: '活动掠影' },
  86. { id: 'thoughts', name: '学员心得' },
  87. { id: 'report', name: '行后报告' },
  88. ],
  89. current: 0,
  90. detail: {},
  91. scrollIntoView: null,
  92. }
  93. },
  94. onLoad(arg) {
  95. const { id } = arg
  96. this.id = id
  97. this.getData()
  98. },
  99. methods: {
  100. async getData() {
  101. try {
  102. const result = await this.$fetch('queryExperienceById', { recordId: this.id })
  103. const { image, thoughts } = result
  104. this.detail = {
  105. highlights: image?.split?.(',') || [],
  106. // todo: check key
  107. thoughts,
  108. // todo: check key about "行后报告"
  109. }
  110. } catch (err) {
  111. }
  112. return
  113. // todo
  114. this.detail = {
  115. highlights: [
  116. '/pages_order/static/temp-38.png',
  117. '/pages_order/static/temp-38.png',
  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. ],
  126. thoughts: [],
  127. }
  128. },
  129. //点击tab栏
  130. clickTabs({ index }) {
  131. this.current = index
  132. this.scrollIntoView = this.tabs[this.current].id
  133. },
  134. onCommentChange() {
  135. // todo: refresh comment list
  136. },
  137. jumpToPoster() {
  138. // todo
  139. },
  140. onApplyEmail() {
  141. this.$utils.navigateTo(`/pages_order/growing/activity/applyEmail?id=${this.id}`)
  142. },
  143. onMark() {
  144. this.$refs.markPopup.open(this.id)
  145. },
  146. },
  147. }
  148. </script>
  149. <style scoped lang="scss">
  150. .tabs {
  151. background: #D8F2FF;
  152. }
  153. .scroll-view {
  154. $tab-height: 44px;
  155. $bottom-height: 73px;
  156. height: calc(100vh - env(safe-area-inset-bottom) - #{$bottom-height} - #{$tab-height} - #{$navbar-height} - var(--status-bar-height) - 20rpx);
  157. &-content {
  158. padding: 32rpx;
  159. }
  160. }
  161. .cover-img {
  162. width: 100%;
  163. height: 348rpx;
  164. border-radius: 12rpx;
  165. overflow: hidden;
  166. .img {
  167. width: 100%;
  168. height: 100%;
  169. }
  170. }
  171. .section {
  172. margin-top: 32rpx;
  173. &-header {
  174. justify-content: space-between;
  175. font-size: 36rpx;
  176. font-weight: 600;
  177. color: #080808;
  178. .icon {
  179. margin-right: 24rpx;
  180. width: 36rpx;
  181. height: 36rpx;
  182. background: #080808;
  183. border-radius: 50%;
  184. overflow: hidden;
  185. .img {
  186. width: 24rpx;
  187. height: auto;
  188. }
  189. }
  190. .btn-mark {
  191. padding: 6rpx 22rpx;
  192. font-family: PingFang SC;
  193. font-size: 28rpx;
  194. font-weight: 500;
  195. line-height: 1.5;
  196. color: #FFFFFF;
  197. background: linear-gradient(to right, #21FEEC, #019AF9);
  198. border: 2rpx solid #00A9FF;
  199. border-radius: 30rpx;
  200. }
  201. }
  202. &-content {
  203. }
  204. }
  205. .highlights {
  206. margin-top: 18rpx;
  207. display: grid;
  208. grid-template-columns: repeat(3, 1fr);
  209. gap: 16rpx;
  210. &-item {
  211. min-width: 0;
  212. border: 2rpx solid #CDCDCD;
  213. border-radius: 12rpx;
  214. overflow: hidden;
  215. .img {
  216. width: 100%;
  217. height: 304rpx;
  218. }
  219. }
  220. }
  221. .thoughts {
  222. margin-top: 24rpx;
  223. .card + .card {
  224. margin-top: 24rpx;
  225. }
  226. }
  227. .report {
  228. margin-top: 24rpx;
  229. }
  230. .bottom {
  231. position: fixed;
  232. left: 0;
  233. bottom: 0;
  234. z-index: 999;
  235. justify-content: space-between;
  236. column-gap: 32rpx;
  237. width: 100vw;
  238. padding: 32rpx 40rpx;
  239. padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
  240. background: #FFFFFF;
  241. box-sizing: border-box;
  242. .btn {
  243. flex: 1;
  244. font-size: 36rpx;
  245. font-weight: 500;
  246. border-radius: 41rpx;
  247. line-height: 1.4;
  248. &-palin {
  249. padding: 14rpx 0;
  250. color: #252545;
  251. border: 2rpx solid #252545;
  252. }
  253. &-primary {
  254. padding: 14rpx 0;
  255. color: #FFFFFF;
  256. background: linear-gradient(to right, #21FEEC, #019AF9);
  257. border: 2rpx solid #00A9FF;
  258. }
  259. }
  260. }
  261. </style>