activityDetails.vue 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256
  1. <template>
  2. <view>
  3. <u-navbar :title="detail.title"></u-navbar>
  4. <!-- <view class="img">
  5. <img src="../../static/img/activity.png" alt="">
  6. </view> -->
  7. <view class="details">
  8. <view class="article-con" v-html="detail.introduction" >
  9. </view>
  10. <!-- <view class="detail-item">
  11. <view class="title">
  12. 活动名称:
  13. </view>
  14. <view class="content" v-text="detail.title">
  15. </view>
  16. </view>
  17. <view class="detail-item">
  18. <view class="title">
  19. 活动地址:
  20. </view>
  21. <view class="content">
  22. {{detail.address}}
  23. </view>
  24. </view>
  25. <view class="detail-item">
  26. <view class="title">
  27. 报名时间:
  28. </view>
  29. <view class="content">
  30. {{detail.endTime}}截止
  31. </view>
  32. </view>
  33. <view class="detail-item">
  34. <view class="title">
  35. 活动时间:
  36. </view>
  37. <view class="content">
  38. {{detail.activityStartTime}}~{{detail.activityEndTime}}
  39. </view>
  40. </view>
  41. <view class="detail-item">
  42. <view class="title">
  43. 活动介绍:
  44. </view>
  45. <view class="content" v-html="detail.introduction">
  46. </view>
  47. </view>
  48. <view class="detail-item">
  49. <view class="title">
  50. 特别说明:
  51. </view>
  52. <view class="content">
  53. {{detail.remark}}
  54. </view>
  55. </view> -->
  56. </view>
  57. <view>
  58. <u-toast ref="uToast" />
  59. </view>
  60. <view class="bottom">
  61. <u-modal v-model="show" :show-title="false" :content="content"
  62. :content-style="{color: '#101010',fontSize: '16px'}" @confirm="confirm" confirm-color="#FF7C70"
  63. :show-cancel-button="true" @cancel="cancel" ref="uModal" :async-close="true"></u-modal>
  64. <u-button v-if="detail.isShow && !detail.isJoin" @click="signUp">立即报名</u-button>
  65. <u-button v-if="detail.isShow && detail.isJoin" style="background-color: #CCCCCC;">已报名</u-button>
  66. </view>
  67. </view>
  68. </template>
  69. <script>
  70. import * as API from '@/apis/news.js'
  71. export default {
  72. data() {
  73. return {
  74. navbarTitle: '',
  75. id: '',
  76. detail: {},
  77. userId: '',
  78. show: false,
  79. content: '您已报名成功!',
  80. }
  81. },
  82. onLoad(op) {
  83. if(op.id) {
  84. this.id = op.id;
  85. this.getActivityDetail();
  86. }
  87. },
  88. onShow() {
  89. if(this.carhelp.getPersonInfo()) {
  90. this.userId = this.carhelp.getPersonInfo().id;
  91. }
  92. },
  93. methods: {
  94. getActivityDetail() {
  95. uni.showLoading({
  96. title: "加载中",
  97. mask: true,
  98. })
  99. API.activityDetail({id:this.id}).then(response => {
  100. uni.hideLoading();
  101. this.detail = response.data;
  102. this.navbarTitle = this.detail.title;
  103. }).catch(error => {
  104. uni.showToast({
  105. title: error,
  106. icon: "none"
  107. })
  108. })
  109. },
  110. showToast() {
  111. this.$refs.uToast.show({
  112. title: '不在报名时段内!',
  113. type: 'warning '
  114. })
  115. },
  116. signUp() {
  117. if(this.userId) {
  118. var date = new Date();
  119. var oDate1 = new Date(this.detail.startTime);
  120. var oDate2 = new Date(this.detail.endTime);
  121. if(date.getTime() > oDate1.getTime() && date.getTime() < oDate2.getTime()){
  122. this.show = true;
  123. } else {
  124. this.showToast();
  125. }
  126. } else {
  127. uni.navigateTo({
  128. url:'../../pagesA/pages/login/index'
  129. })
  130. }
  131. },
  132. cancel() {
  133. this.show = false;
  134. },
  135. confirm() {
  136. uni.showLoading({
  137. title: "加载中",
  138. mask: true,
  139. })
  140. API.activitySave({id:this.id}).then(response => {
  141. uni.hideLoading();
  142. this.getActivityDetail();
  143. this.show = false;
  144. }).catch(error => {
  145. uni.showToast({
  146. title: error,
  147. icon: "none"
  148. })
  149. })
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. .slot-wrap {
  156. display: flex;
  157. flex-direction: row;
  158. align-items: center;
  159. justify-content: center;
  160. flex: 1;
  161. position: absolute;
  162. left: 0;
  163. right: 0;
  164. height: 30px;
  165. text-align: center;
  166. flex-shrink: 0;
  167. .slot-title {
  168. color: rgb(96, 98, 102);
  169. font-size: 17px;
  170. left: 125px;
  171. right: 125px;
  172. width: 80%;
  173. overflow: hidden;
  174. white-space: nowrap;
  175. text-overflow: ellipsis;
  176. }
  177. }
  178. .article-con{
  179. padding: 15px 0 35px;
  180. font-size: 14px;
  181. line-height: 28px;
  182. img{
  183. width: 100%;
  184. margin: 10px 0;
  185. }
  186. }
  187. /deep/.u-line-1 {
  188. overflow: inherit;
  189. }
  190. .img {
  191. margin: 32rpx;
  192. height: 404rpx;
  193. img {
  194. width: 100%;
  195. height: 100%;
  196. }
  197. }
  198. .details {
  199. margin: 32rpx;
  200. font-size: 16px;
  201. color: #333333;
  202. padding-bottom: 70px;
  203. .detail-item {
  204. display: flex;
  205. margin-bottom: 24rpx;
  206. .title {
  207. // width: 26%;
  208. }
  209. .content {
  210. flex: 1;
  211. margin-left: 24rpx;
  212. }
  213. }
  214. }
  215. .bottom {
  216. width: 100%;
  217. height: 56px;
  218. position: fixed;
  219. bottom: 0;
  220. background-color: #fff;
  221. display: flex;
  222. }
  223. .u-btn {
  224. width: 74.4%;
  225. line-height: 44px;
  226. border-radius: 50px;
  227. background-color: #FF5E5E;
  228. font-size: 16px;
  229. color: #ffffff;
  230. position: fixed;
  231. bottom: 8px;
  232. left: 0;
  233. right: 0;
  234. }
  235. /deep/.u-hairline-border:after {
  236. border: none;
  237. }
  238. </style>