activityDetails.vue 5.0 KB

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