图书馆小程序
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.

187 lines
3.8 KiB

2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
1 month ago
2 months ago
  1. <template>
  2. <view class="activity-detail">
  3. <image class="activity-img" :src="detail.imgUrl" mode="aspectFill"></image>
  4. <view class="activity-base">
  5. <text class="title">{{ detail.title }}</text>
  6. <view class="time">
  7. <uni-icons class="detail-icon" custom-prefix="iconfont" type="icon-shijian" size="15"></uni-icons>
  8. <text>{{ detail.time }}</text>
  9. </view>
  10. <view class="location">
  11. <uni-icons class="detail-icon" type="location" size="20"></uni-icons>
  12. <text>{{ detail.location }}</text>
  13. </view>
  14. </view>
  15. <view class="rich-content">
  16. <text class="content-title">活动介绍/回顾</text>
  17. <div v-if="detail.localImg" style="text-align:center; margin:12px 0;">
  18. <image :src="require(`@/static/${detail.localImg}`)" mode="widthFix" style="width:90%; border-radius:8px;"></image>
  19. </div>
  20. <rich-text :nodes="contentNodes"></rich-text>
  21. </view>
  22. <view class="detail-bottom">
  23. <view class="detail-left">
  24. <button open-type="share" class="handle-btn">
  25. <uni-icons custom-prefix="iconfont" type="icon-fenxiang01" size="20"></uni-icons>
  26. <text>分享</text>
  27. </button>
  28. </view>
  29. <button
  30. class="join-btn"
  31. :class="detail.status === 0 ? 'disabled-btn' : ''"
  32. @click="handleJoin"
  33. >
  34. {{ detail.status === 1 ? '我要参加' : '活动结束' }}
  35. </button>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. export default {
  41. data() {
  42. return {
  43. detail: {},
  44. activityId: "",
  45. contentNodes: ""
  46. };
  47. },
  48. onLoad(options) {
  49. const item = JSON.parse(decodeURIComponent(options.item));
  50. this.detail = item;
  51. this.activityId = item.title;
  52. this.formatContent();
  53. },
  54. methods: {
  55. formatContent() {
  56. let content = this.detail.content || "";
  57. const httpImgReg = /https:\/\/mmbiz\.qpic\.cn[^ \n\r'"]+/g;
  58. content = content.replace(httpImgReg, url => {
  59. return `
  60. <div style="text-align:center; margin:12px 0;">
  61. <img src="${url}" style="width:90%; border-radius:8px;">
  62. </div>
  63. `;
  64. });
  65. this.contentNodes = content;
  66. },
  67. handleJoin() {
  68. if (this.detail.status === 0) {
  69. return;
  70. }
  71. uni.showToast({
  72. title: '报名成功',
  73. icon: 'success'
  74. });
  75. }
  76. },
  77. onShareAppMessage() {
  78. return {
  79. title: this.detail.title,
  80. path: "/subpkg/pages/activity-detail/activity-detail?item=" + encodeURIComponent(JSON.stringify(this.detail)),
  81. imageUrl: this.detail.imgUrl
  82. };
  83. }
  84. };
  85. </script>
  86. <style lang="scss" scoped>
  87. .activity-detail {
  88. padding-bottom: 60px;
  89. background: #f5f5f5;
  90. }
  91. .activity-img {
  92. width: 100%;
  93. height: 180px;
  94. }
  95. .activity-base {
  96. background: #fff;
  97. padding: 15px;
  98. margin-bottom: 10px;
  99. .title {
  100. font-size: 16px;
  101. font-weight: bold;
  102. padding-bottom: 10px;
  103. }
  104. .time,
  105. .location {
  106. display: flex;
  107. align-items: center;
  108. font-size: 12px;
  109. color: #999;
  110. padding-top: 10px;
  111. .detail-icon {
  112. padding-right: 4px;
  113. }
  114. }
  115. .time{
  116. padding-left: 3px;
  117. }
  118. }
  119. .rich-content {
  120. background: #fff;
  121. padding: 10px 0;
  122. .content-title{
  123. position: relative;
  124. font-size: 16px;
  125. font-weight: bold;
  126. color: #333;
  127. padding-left: 12px;
  128. &::before{
  129. position: absolute;
  130. left: 0;
  131. top: 50%;
  132. margin-top: -9px;
  133. content: "";
  134. width: 4px;
  135. height: 18px;
  136. background-color: #01a4fe;
  137. }
  138. }
  139. }
  140. .detail-bottom {
  141. position: fixed;
  142. bottom: 0;
  143. left: 0;
  144. right: 0;
  145. height: 50px;
  146. background: #fff;
  147. display: flex;
  148. align-items: center;
  149. justify-content: space-between;
  150. padding: 0 15px;
  151. box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
  152. }
  153. .detail-left {
  154. display: flex;
  155. gap: 10px;
  156. }
  157. .handle-btn {
  158. display: flex;
  159. align-items: center;
  160. gap: 4px;
  161. background: #f5f5f5;
  162. border-radius: 30px;
  163. padding: 0 12px;
  164. height: 36px;
  165. font-size: 14px;
  166. }
  167. .join-btn {
  168. background: #01a4fe;
  169. color: #fff;
  170. border-radius: 30px;
  171. padding: 0 20px;
  172. height: 36px;
  173. }
  174. .disabled-btn {
  175. background: #ccc !important;
  176. }
  177. </style>