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

325 lines
7.7 KiB

2 months ago
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="aspectFill" @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 { activityId, imageContentList, experienceList } = result
  123. this.detail = {
  124. activityId,
  125. highlights: imageContentList.reduce((arr, item) => {
  126. return arr.concat(item.image?.split?.(',') || [])
  127. }, []),
  128. thoughts: experienceList,
  129. // todo: check key about "行后报告"
  130. }
  131. } catch (err) {
  132. }
  133. },
  134. //点击tab栏
  135. clickTabs({ index }) {
  136. this.current = index
  137. this.scrollIntoView = this.tabs[this.current].id
  138. },
  139. onCommentChange() {
  140. // todo: refresh comment list
  141. },
  142. openPosterPopup() {
  143. const path = `/pages_order/growing/activity/index?id=${this.id}&shareId=${this.userInfo.id}`
  144. this.$refs.posterPopup.open(path)
  145. },
  146. onApplyEmail() {
  147. this.$utils.navigateTo(`/pages_order/growing/activity/applyEmail?id=${this.id}`)
  148. },
  149. onMark() {
  150. this.$refs.markPopup.open(this.detail.activityId)
  151. },
  152. onAdd() {
  153. this.$refs.recordFormPopup.open()
  154. },
  155. previewImage(arr, index) {
  156. uni.previewImage({
  157. urls: arr,
  158. current: arr[index], // 当前显示图片的链接
  159. });
  160. },
  161. },
  162. }
  163. </script>
  164. <style scoped lang="scss">
  165. .tabs {
  166. background: #D8F2FF;
  167. }
  168. .scroll-view {
  169. $tab-height: 44px;
  170. $bottom-height: 73px;
  171. height: calc(100vh - env(safe-area-inset-bottom) - #{$bottom-height} - #{$tab-height} - #{$navbar-height} - var(--status-bar-height) - 20rpx);
  172. &-content {
  173. padding: 32rpx;
  174. }
  175. }
  176. .cover-img {
  177. width: 100%;
  178. height: 348rpx;
  179. border-radius: 12rpx;
  180. overflow: hidden;
  181. .img {
  182. width: 100%;
  183. height: 100%;
  184. }
  185. }
  186. .section {
  187. margin-top: 32rpx;
  188. &-header {
  189. justify-content: space-between;
  190. font-size: 36rpx;
  191. font-weight: 600;
  192. color: #080808;
  193. .icon {
  194. margin-right: 24rpx;
  195. width: 36rpx;
  196. height: 36rpx;
  197. background: #080808;
  198. border-radius: 50%;
  199. overflow: hidden;
  200. .img {
  201. width: 24rpx;
  202. height: auto;
  203. }
  204. }
  205. .btn {
  206. padding: 6rpx 22rpx;
  207. font-family: PingFang SC;
  208. font-size: 28rpx;
  209. font-weight: 500;
  210. line-height: 1.5;
  211. color: #FFFFFF;
  212. background: linear-gradient(to right, #21FEEC, #019AF9);
  213. border: 2rpx solid #00A9FF;
  214. border-radius: 30rpx;
  215. }
  216. }
  217. &-content {
  218. }
  219. }
  220. .highlights {
  221. margin-top: 18rpx;
  222. display: grid;
  223. grid-template-columns: repeat(3, 1fr);
  224. gap: 16rpx;
  225. &-item {
  226. min-width: 0;
  227. height: 304rpx;
  228. border: 2rpx solid #CDCDCD;
  229. border-radius: 12rpx;
  230. overflow: hidden;
  231. .img {
  232. width: 100%;
  233. height: 100%;
  234. }
  235. }
  236. }
  237. .thoughts {
  238. margin-top: 24rpx;
  239. .card + .card {
  240. margin-top: 24rpx;
  241. }
  242. }
  243. .report {
  244. margin-top: 24rpx;
  245. }
  246. .bottom {
  247. position: fixed;
  248. left: 0;
  249. bottom: 0;
  250. z-index: 999;
  251. justify-content: space-between;
  252. column-gap: 32rpx;
  253. width: 100vw;
  254. padding: 32rpx 40rpx;
  255. padding-bottom: calc(env(safe-area-inset-bottom) + 32rpx);
  256. background: #FFFFFF;
  257. box-sizing: border-box;
  258. .btn {
  259. flex: 1;
  260. font-size: 36rpx;
  261. font-weight: 500;
  262. border-radius: 41rpx;
  263. line-height: 1.4;
  264. &-palin {
  265. padding: 14rpx 0;
  266. color: #252545;
  267. border: 2rpx solid #252545;
  268. }
  269. &-primary {
  270. padding: 14rpx 0;
  271. color: #FFFFFF;
  272. background: linear-gradient(to right, #21FEEC, #019AF9);
  273. border: 2rpx solid #00A9FF;
  274. }
  275. }
  276. }
  277. </style>