金诚优选前端代码
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.

151 lines
3.7 KiB

  1. <template>
  2. <view>
  3. <lf-nav title="活动详情" :showIcon="true"></lf-nav>
  4. <view class="content">
  5. <view class="title">{{activity_details.name}}</view>
  6. <view class="level2-title">
  7. {{activity_details.username}}
  8. </view>
  9. <view class="level3-title">
  10. <text>活动时间</text>
  11. <text class="color1">{{activity_details.time_start}}</text>
  12. </view>
  13. <view class="level3-title">
  14. <text>报名时间</text>
  15. <text class="color2">{{activity_details.apply_start}}</text>
  16. </view>
  17. <view class="level3-title lf-flex">
  18. <text>活动内容</text>
  19. <rich-text :nodes="activity_details.content" v-if="activity_details.content"></rich-text>
  20. </view>
  21. <view class="level3-title">
  22. <text>活动人数</text>
  23. <text class="color2">{{activity_details.member_count}}</text>
  24. </view>
  25. <view class="level3-title">
  26. <text>活动报名</text>
  27. <text class="color1" v-if="activity_details.price == 0">免费</text>
  28. <text class="color1" v-else>{{activity_details.price}}</text>
  29. </view>
  30. <view class="level3-title lf-flex">
  31. <view>活动规则</view>
  32. <view class="color2">
  33. <view>{{activity_details.rule}}</view>
  34. </view>
  35. </view>
  36. <button v-if="enter_type==0" class="btn"
  37. hover-class="lf-opacity"
  38. :disabled="is_end"
  39. :class="{'lf-opacity': is_end}"
  40. @click="submit">{{ is_end ? '名额已满' : '立即报名' }}
  41. </button>
  42. </view>
  43. </view>
  44. </template>
  45. <script>
  46. export default {
  47. data(){
  48. return {
  49. is_end: false ,// 是否可报名,false为活动为结束可报名,否则不可报名
  50. activity_id: 0,
  51. activity_details: '',
  52. enter_type: 0
  53. }
  54. },
  55. onLoad(e){
  56. this.activity_id = e.activity_id;
  57. this.enter_type = e.enter_type;
  58. if(e.is_end == 0) {
  59. this.is_end = false;
  60. }else {
  61. this.is_end = true;
  62. }
  63. console.log('传来的type',this.is_end);
  64. this.getActivityDetails();
  65. },
  66. methods: {
  67. getActivityDetails() {
  68. this.$http
  69. .get({
  70. api: 'api/activity/detail',
  71. data: {
  72. activity_id: this.activity_id
  73. }
  74. })
  75. .then(res => {
  76. if (res.data.code == 200) {
  77. if (res.data.status) {
  78. this.activity_details = res.data.data;
  79. console.log('活动详情',this.activity_details);
  80. } else {
  81. wx.showModal({
  82. content: res.message || '请下拉页面刷新重试',
  83. showCancel: false
  84. });
  85. }
  86. } else {
  87. wx.showModal({
  88. content: '请下拉页面刷新重试',
  89. showCancel: false
  90. });
  91. }
  92. wx.hideLoading();
  93. })
  94. .catch(() => {
  95. wx.hideLoading();
  96. wx.showModal({
  97. content: '请求失败',
  98. showCancel: false
  99. });
  100. });
  101. },
  102. submit(){
  103. if(this.is_end) return;
  104. this.$url('/pages/index/activity/confirm?activity_id='+this.activity_id);
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss" scoped="scoped">
  110. .content{
  111. width: 750rpx;
  112. height: max-content;
  113. padding: 30rpx 32rpx;
  114. box-sizing: border-box;
  115. .title{
  116. font-size: 36rpx;
  117. color: #222222;
  118. font-weight: bold;
  119. min-height: 100rpx;
  120. }
  121. .level2-title{
  122. font-size: 28rpx;
  123. color: #222222;
  124. font-weight: bold;
  125. margin-top: 20rpx;
  126. }
  127. .level3-title{
  128. margin-top: 30rpx;
  129. font-size: 28rpx;
  130. color: #777777;
  131. }
  132. .btn{
  133. width: 550rpx;
  134. height: 100rpx;
  135. line-height: 100rpx;
  136. background-color: #15716E;
  137. border-radius: 50rpx;
  138. color: #FFFFFF;
  139. font-size: 32rpx;
  140. margin-top: 60rpx;
  141. }
  142. }
  143. .color1{
  144. color: #F63434;
  145. }
  146. .color2{
  147. color: #222222;
  148. }
  149. </style>