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

323 lines
7.7 KiB

2 months ago
2 months ago
2 months ago
2 months ago
  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" @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" @click="previewImage(detail.highlights, idx)"></image>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="section" id="thoughts">
  51. <view class="flex section-header">
  52. <view>学员心得</view>
  53. <view class="btn" @click="onAdd">新增心得</view>
  54. </view>
  55. <view class="section-content thoughts">
  56. <view class="card" v-for="item in detail.thoughts" :key="item.id">
  57. <commentCard :data="item" @change="onCommentChange"></commentCard>
  58. </view>
  59. </view>
  60. </view>
  61. <view class="section report" id="report">
  62. <view class="section-header">行后报告</view>
  63. <view class="section-content report">
  64. <!-- todo -->
  65. </view>
  66. </view>
  67. </view>
  68. </scroll-view>
  69. <markPopup ref="markPopup"></markPopup>
  70. <record-form-popup ref="recordFormPopup" @submitted="getData"></record-form-popup>
  71. <posterPopup ref="posterPopup"></posterPopup>
  72. <view class="flex bottom">
  73. <button class="flex btn btn-palin" @click="openPosterPopup">生成海报</button>
  74. <button class="flex btn btn-primary" @click="onApplyEmail">申请邮件</button>
  75. </view>
  76. </view>
  77. </template>
  78. <script>
  79. // import commentCard from '@/pages_order/comment/commentCard.vue'
  80. import commentCard from './commentCard.vue'
  81. import markPopup from '@/pages_order/growing/activity/markPopup.vue'
  82. import recordFormPopup from '@/pages_order/comment/recordFormPopup.vue'
  83. import posterPopup from '@/components/base/posterPopup.vue'
  84. export default {
  85. components: {
  86. commentCard,
  87. markPopup,
  88. recordFormPopup,
  89. posterPopup,
  90. },
  91. data() {
  92. return {
  93. id: null,
  94. tabs: [
  95. { id: 'highlights', name: '活动掠影' },
  96. { id: 'thoughts', name: '学员心得' },
  97. { id: 'report', name: '行后报告' },
  98. ],
  99. current: 0,
  100. detail: {},
  101. scrollIntoView: null,
  102. }
  103. },
  104. onLoad(arg) {
  105. const { id, shareId } = arg
  106. if (shareId) {
  107. uni.setStorageSync('shareId', shareId)
  108. }
  109. if (shareId && !uni.getStorageSync('token')) {
  110. uni.navigateTo({
  111. url: '/pages_order/auth/wxLogin'
  112. })
  113. return
  114. }
  115. this.id = id
  116. this.getData()
  117. },
  118. methods: {
  119. async getData() {
  120. try {
  121. const result = await this.$fetch('queryExperienceById', { recordId: this.id })
  122. const { imageContentList, experienceList } = result
  123. this.detail = {
  124. highlights: imageContentList.reduce((arr, item) => {
  125. return arr.concat(item.image?.split?.(',') || [])
  126. }, []),
  127. thoughts: experienceList,
  128. // todo: check key about "行后报告"
  129. }
  130. } catch (err) {
  131. }
  132. },
  133. //点击tab栏
  134. clickTabs({ index }) {
  135. this.current = index
  136. this.scrollIntoView = this.tabs[this.current].id
  137. },
  138. onCommentChange() {
  139. // todo: refresh comment list
  140. },
  141. openPosterPopup() {
  142. const path = `/pages_order/growing/activity/index?id=${this.id}&shareId=${this.userInfo.id}`
  143. this.$refs.posterPopup.open(path)
  144. },
  145. onApplyEmail() {
  146. this.$utils.navigateTo(`/pages_order/growing/activity/applyEmail?id=${this.id}`)
  147. },
  148. onMark() {
  149. this.$refs.markPopup.open(this.id)
  150. },
  151. onAdd() {
  152. this.$refs.recordFormPopup.open()
  153. },
  154. previewImage(arr, index) {
  155. uni.previewImage({
  156. urls: arr,
  157. current: arr[index], // 当前显示图片的链接
  158. });
  159. },
  160. },
  161. }
  162. </script>
  163. <style scoped lang="scss">
  164. .tabs {
  165. background: #D8F2FF;
  166. }
  167. .scroll-view {
  168. $tab-height: 44px;
  169. $bottom-height: 73px;
  170. height: calc(100vh - env(safe-area-inset-bottom) - #{$bottom-height} - #{$tab-height} - #{$navbar-height} - var(--status-bar-height) - 20rpx);
  171. &-content {
  172. padding: 32rpx;
  173. }
  174. }
  175. .cover-img {
  176. width: 100%;
  177. height: 348rpx;
  178. border-radius: 12rpx;
  179. overflow: hidden;
  180. .img {
  181. width: 100%;
  182. height: 100%;
  183. }
  184. }
  185. .section {
  186. margin-top: 32rpx;
  187. &-header {
  188. justify-content: space-between;
  189. font-size: 36rpx;
  190. font-weight: 600;
  191. color: #080808;
  192. .icon {
  193. margin-right: 24rpx;
  194. width: 36rpx;
  195. height: 36rpx;
  196. background: #080808;
  197. border-radius: 50%;
  198. overflow: hidden;
  199. .img {
  200. width: 24rpx;
  201. height: auto;
  202. }
  203. }
  204. .btn {
  205. padding: 6rpx 22rpx;
  206. font-family: PingFang SC;
  207. font-size: 28rpx;
  208. font-weight: 500;
  209. line-height: 1.5;
  210. color: #FFFFFF;
  211. background: linear-gradient(to right, #21FEEC, #019AF9);
  212. border: 2rpx solid #00A9FF;
  213. border-radius: 30rpx;
  214. }
  215. }
  216. &-content {
  217. }
  218. }
  219. .highlights {
  220. margin-top: 18rpx;
  221. display: grid;
  222. grid-template-columns: repeat(3, 1fr);
  223. gap: 16rpx;
  224. &-item {
  225. min-width: 0;
  226. border: 2rpx solid #CDCDCD;
  227. border-radius: 12rpx;
  228. overflow: hidden;
  229. .img {
  230. width: 100%;
  231. height: 304rpx;
  232. }
  233. }
  234. }
  235. .thoughts {
  236. margin-top: 24rpx;
  237. .card + .card {
  238. margin-top: 24rpx;
  239. }
  240. }
  241. .report {
  242. margin-top: 24rpx;
  243. }
  244. .bottom {
  245. position: fixed;
  246. left: 0;
  247. bottom: 0;
  248. z-index: 999;
  249. justify-content: space-between;
  250. column-gap: 32rpx;
  251. width: 100vw;
  252. padding: 32rpx 40rpx;
  253. padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
  254. background: #FFFFFF;
  255. box-sizing: border-box;
  256. .btn {
  257. flex: 1;
  258. font-size: 36rpx;
  259. font-weight: 500;
  260. border-radius: 41rpx;
  261. line-height: 1.4;
  262. &-palin {
  263. padding: 14rpx 0;
  264. color: #252545;
  265. border: 2rpx solid #252545;
  266. }
  267. &-primary {
  268. padding: 14rpx 0;
  269. color: #FFFFFF;
  270. background: linear-gradient(to right, #21FEEC, #019AF9);
  271. border: 2rpx solid #00A9FF;
  272. }
  273. }
  274. }
  275. </style>