木邻有你前端代码仓库
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.

447 lines
11 KiB

3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
3 months ago
  1. <template>
  2. <view class="activity-detail">
  3. <!-- 轮播图 -->
  4. <view class="banner-container">
  5. <swiper class="banner-swiper" height="450rpx" :indicator-dots="true" :autoplay="true" :interval="3000" :duration="500">
  6. <swiper-item v-for="(image, index) in activityData.image.split(',')" :key="index">
  7. <image class="banner-image" :src="image" mode="aspectFill"></image>
  8. </swiper-item>
  9. </swiper>
  10. </view>
  11. <!-- 活动信息 -->
  12. <view class="activity-info">
  13. <!-- 活动标题和标签 -->
  14. <view class="title-section">
  15. <view class="activity-badge">
  16. <text class="badge-text">{{ activityData.score }}</text>
  17. </view>
  18. <text class="activity-title">{{ activityData.title }}</text>
  19. </view>
  20. <!-- 活动详细信息 -->
  21. <view class="info-section">
  22. <view class="info-item">
  23. <uv-icon name="calendar" size="16" color="#666"></uv-icon>
  24. <text class="info-label">活动时间</text>
  25. <text class="info-value">{{ activityData.activityTime }}</text>
  26. </view>
  27. <view class="info-item">
  28. <uv-icon name="clock" size="16" color="#666"></uv-icon>
  29. <text class="info-label">报名时间</text>
  30. <text class="info-value">{{ activityData.startTime }}</text>
  31. </view>
  32. <view class="info-item">
  33. <uv-icon name="account-fill" size="16" color="#666"></uv-icon>
  34. <text class="info-label">联系人</text>
  35. <text class="info-value">{{ activityData.contact }}</text>
  36. </view>
  37. <view class="info-item">
  38. <uv-icon name="phone" size="16" color="#666"></uv-icon>
  39. <text class="info-label">取消规则</text>
  40. <text class="info-value">{{ activityData.rule }}</text>
  41. </view>
  42. <view class="info-item">
  43. <uv-icon name="map-fill" size="16" color="#666"></uv-icon>
  44. <text class="info-label">活动地点</text>
  45. <text class="info-value">{{ activityData.address }}</text>
  46. </view>
  47. </view>
  48. <!-- 活动详情 -->
  49. <view class="detail-section">
  50. <view class="section-title">
  51. <text class="title-text">活动详情</text>
  52. </view>
  53. <view class="detail-content">
  54. <!-- <text class="detail-text"> -->
  55. <rich-text :nodes="activityData.details"></rich-text>
  56. <!-- </text> -->
  57. </view>
  58. </view>
  59. <!-- 活动图集 -->
  60. <view class="gallery-section">
  61. <view class="section-title">
  62. <text class="title-text">活动图集</text>
  63. </view>
  64. <view class="gallery-grid">
  65. <image
  66. v-for="(image, index) in activityData.atlas.split(',')"
  67. :key="index"
  68. class="gallery-image"
  69. :src="image"
  70. mode="aspectFill"
  71. @click="previewImage(image, activityData.atlas.split(','))"
  72. ></image>
  73. <!-- <uv-album :urls="activityData.gallery"></uv-album> -->
  74. </view>
  75. </view>
  76. </view>
  77. <!-- 固定底部操作栏 -->
  78. <view class="bottom-action">
  79. <view class="action-left">
  80. <view class="action-item" @click="shareActivity">
  81. <uv-icon name="share" size="24" color="#000"></uv-icon>
  82. <text class="action-text">分享</text>
  83. </view>
  84. <view class="action-item" @click="collectActivity">
  85. <uv-icon name="heart-fill" size="24" :color="activityData.isCollection === 1 ? '#ff4757' : '#999'"></uv-icon>
  86. <text class="action-text">收藏</text>
  87. </view>
  88. <view class="action-item">
  89. <text class="participants-count">
  90. <text :style="{'color': activityData.numActivity >= activityData.numLimit ? '#999' : '#1488DB'}">{{ activityData.numActivity }}</text>
  91. /{{ activityData.numLimit }}</text>
  92. <text class="action-text">已报名</text>
  93. </view>
  94. </view>
  95. <view class="action-right">
  96. <uv-button
  97. v-if="activityData.status === '1'"
  98. type="primary"
  99. size="normal"
  100. text="已结束"
  101. shape="circle"
  102. @click="signUpActivity"
  103. :disabled="true"
  104. ></uv-button>
  105. <uv-button
  106. v-else-if="activityData.isApply === 1"
  107. type="primary"
  108. size="normal"
  109. text="您已报名"
  110. shape="circle"
  111. @click="signUpActivity"
  112. :disabled="true"
  113. ></uv-button>
  114. <uv-button
  115. v-else
  116. type="primary"
  117. size="normal"
  118. text="我要报名"
  119. shape="circle"
  120. @click="signUpActivity"
  121. :disabled="activityData.numActivity >= activityData.numLimit "
  122. ></uv-button>
  123. </view>
  124. </view>
  125. <SignUpForm
  126. ref="signUpFormRef"
  127. @close="onSignUpFormClose"
  128. @submit="onSignUpFormSubmit"
  129. />
  130. </view>
  131. <!-- 报名表单弹窗 -->
  132. </template>
  133. <script>
  134. import SignUpForm from '@/subPages/index/components/SignUpForm.vue'
  135. export default {
  136. components: {
  137. SignUpForm
  138. },
  139. data() {
  140. return {
  141. // isCollected: false,
  142. showSignUpForm: false,
  143. activityData: {
  144. title: '关爱自闭症儿童活动',
  145. duration: '30积分',
  146. time: '2025-06-12 14:30',
  147. registrationTime: '2025-06-01 14:30——2025-09-01 14:30',
  148. contact: '柳老师 (13256484512)',
  149. cancelRule: '报名随时可取消',
  150. location: '长沙市雨花区时代阳光大夏国际大厅2145',
  151. registeredCount: 9,
  152. maxCount: 30,
  153. details: [
  154. '身体健康,热爱志愿服务工作,富有责任感和奉献精神',
  155. '遵纪守法,思想上进,作风正派,服从安排',
  156. '年龄在60岁以下,具备广告宣传理能力'
  157. ],
  158. gallery: [
  159. '/static/bannerImage.png',
  160. '/static/bannerImage.png',
  161. '/static/bannerImage.png',
  162. '/static/bannerImage.png'
  163. ]
  164. },
  165. activityId: null
  166. }
  167. },
  168. onLoad(options) {
  169. if (options.id) {
  170. this.activityId = options.id
  171. this.loadActivityDetail(options.id)
  172. }else {
  173. uni.showToast({
  174. title: '没有给活动id',
  175. icon: 'none'
  176. })
  177. }
  178. },
  179. methods: {
  180. async loadActivityDetail(id) {
  181. let params = {}
  182. if (uni.getStorageSync('token')) {
  183. params.token = uni.getStorageSync('token')
  184. }
  185. // 根据ID加载活动详情
  186. const res = await this.$api.activity.queryActivityById({
  187. activityId: id,
  188. ...params
  189. })
  190. this.activityData = res.result
  191. },
  192. previewImage(current, urls) {
  193. uni.previewImage({
  194. current: current,
  195. urls: urls
  196. })
  197. },
  198. shareActivity() {
  199. uni.showToast({
  200. title: '分享功能',
  201. icon: 'none'
  202. })
  203. },
  204. async collectActivity() {
  205. const res = await this.$api.activity.collectionActivity({
  206. activityId: this.activityId
  207. })
  208. await this.loadActivityDetail(this.activityId)
  209. uni.showToast({
  210. title: `${res.message}`,
  211. icon: 'none'
  212. })
  213. },
  214. signUpActivity() {
  215. if (this.activityData.numActivity >= this.activityData.numLimit) {
  216. uni.showToast({
  217. title: '报名人数已满',
  218. icon: 'none'
  219. })
  220. return
  221. }
  222. this.$refs.signUpFormRef.open()
  223. },
  224. onSignUpFormClose() {
  225. this.$refs.signUpFormRef.close()
  226. },
  227. async onSignUpFormSubmit(formData) {
  228. console.log('报名表单数据:', formData)
  229. // 这里可以调用API提交报名数据
  230. const res = await this.$api.activity.applyActivity({
  231. activityId: this.activityId,
  232. ...formData
  233. })
  234. if (res.code === 200) {
  235. uni.showToast({
  236. title: `${res.message}`,
  237. icon: 'success'
  238. })
  239. // 更新状态
  240. this.loadActivityDetail(this.activityId)
  241. }
  242. }
  243. },
  244. async onPullDownRefresh() {
  245. await this.loadActivityDetail(this.activityId)
  246. uni.stopPullDownRefresh()
  247. }
  248. }
  249. </script>
  250. <style lang="scss" scoped>
  251. .activity-detail {
  252. min-height: 100vh;
  253. background: #f8f8f8;
  254. padding-bottom: 120rpx;
  255. .banner-container {
  256. width: 100%;
  257. height: 450rpx;
  258. .banner-swiper {
  259. width: 100%;
  260. height: 100%;
  261. .banner-image {
  262. width: 100%;
  263. height: 100%;
  264. }
  265. }
  266. }
  267. .activity-info {
  268. background: #ffffff;
  269. // border: 1rpx dashed #F3F7F8;
  270. margin: 20rpx;
  271. border-radius: 16rpx;
  272. padding: 30rpx;
  273. .title-section {
  274. display: flex;
  275. align-items: center;
  276. margin-bottom: 30rpx;
  277. .activity-badge {
  278. background: #218CDD;
  279. border-radius: 8rpx;
  280. padding: 4rpx 10rpx;
  281. margin-right: 16rpx;
  282. .badge-text {
  283. color: #ffffff;
  284. font-size: 24rpx;
  285. font-weight: 500;
  286. }
  287. }
  288. .activity-title {
  289. font-size: 36rpx;
  290. font-weight: bold;
  291. color: #333333;
  292. flex: 1;
  293. }
  294. }
  295. .info-section {
  296. background: #F3F7F8;
  297. margin-bottom: 40rpx;
  298. // 虚线属性
  299. border: 2rpx dashed #F3F7F8;
  300. .info-item {
  301. display: flex;
  302. align-items: center;
  303. margin-bottom: 20rpx;
  304. &:last-child {
  305. margin-bottom: 0;
  306. }
  307. .info-label {
  308. font-size: 28rpx;
  309. color: #999999;
  310. margin-left: 12rpx;
  311. margin-right: 8rpx;
  312. }
  313. .info-value {
  314. font-size: 28rpx;
  315. color: #999999;
  316. flex: 1;
  317. }
  318. }
  319. }
  320. .detail-section {
  321. margin-bottom: 40rpx;
  322. .section-title {
  323. margin-bottom: 20rpx;
  324. .title-text {
  325. font-size: 32rpx;
  326. font-weight: bold;
  327. color: #333333;
  328. }
  329. }
  330. .detail-content {
  331. .detail-text {
  332. display: block;
  333. font-size: 28rpx;
  334. color: #666666;
  335. line-height: 1.6;
  336. margin-bottom: 16rpx;
  337. &:last-child {
  338. margin-bottom: 0;
  339. }
  340. }
  341. }
  342. }
  343. .gallery-section {
  344. .section-title {
  345. margin-bottom: 20rpx;
  346. .title-text {
  347. font-size: 32rpx;
  348. font-weight: bold;
  349. color: #333333;
  350. }
  351. }
  352. .gallery-grid {
  353. display: grid;
  354. grid-template-columns: repeat(2, 1fr);
  355. gap: 16rpx;
  356. .gallery-image {
  357. width: 100%;
  358. height: 200rpx;
  359. border-radius: 12rpx;
  360. }
  361. }
  362. }
  363. }
  364. .bottom-action {
  365. position: fixed;
  366. bottom: 0;
  367. left: 0;
  368. right: 0;
  369. background: #ffffff;
  370. padding: 20rpx 30rpx;
  371. border-top: 1rpx solid #eeeeee;
  372. display: flex;
  373. align-items: center;
  374. justify-content: space-between;
  375. z-index: 100;
  376. .action-left {
  377. display: flex;
  378. align-items: center;
  379. gap: 100rpx;
  380. .action-item {
  381. display: flex;
  382. flex-direction: column;
  383. align-items: center;
  384. gap: 8rpx;
  385. .action-text {
  386. font-size: 22rpx;
  387. color: #000;
  388. }
  389. .participants-count {
  390. font-size: 24rpx;
  391. color: #333333;
  392. // font-weight: bold;
  393. }
  394. }
  395. }
  396. .action-right {
  397. flex-shrink: 0;
  398. }
  399. }
  400. }
  401. </style>