activityDetails.vue 5.2 KB

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