details.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <template>
  2. <view class="container">
  3. <uni-section :title="info.topic" titleFontSize="18" type="line">
  4. <uni-list>
  5. <uni-list-item :show-extra-icon="true" :extra-icon="extraIcon[0]" title="招募时间" :rightText="`${info.startTime}至${info.endTime}`"></uni-list-item>
  6. <uni-list-item :show-extra-icon="true" :extra-icon="extraIcon[1]" title="负责人" :rightText="info.sponsorName"></uni-list-item>
  7. <uni-list-item :show-extra-icon="true" :extra-icon="extraIcon[2]" title="联系电话" :rightText="info.sponsorPhone"></uni-list-item>
  8. <uni-list-item :show-extra-icon="true" title="招募人数" :rightText="info.count"></uni-list-item>
  9. </uni-list>
  10. </uni-section>
  11. <uni-section title="活动详情" titleFontSize="18" type="line">
  12. <rich-text image-menu-prevent="true" :nodes="info.content" class="content"></rich-text>
  13. </uni-section>
  14. <uni-goods-nav class="goodNav" :fill="true" :options="options" :buttonGroup="buttonGroup" @buttonClick="buttonClick" />
  15. </view>
  16. </template>
  17. <script>
  18. import request from '../../api/recruit.js';
  19. export default {
  20. onLoad: function (option) {
  21. this.id = option.id;
  22. },
  23. data() {
  24. return {
  25. id: '',
  26. info: null,
  27. options: [],
  28. extraIcon: [
  29. {
  30. color: '#c60814',
  31. size: '22',
  32. type: 'calendar'
  33. },
  34. {
  35. color: '#c60814',
  36. size: '22',
  37. type: 'person-filled'
  38. },
  39. {
  40. color: '#c60814',
  41. size: '22',
  42. type: 'phone'
  43. }
  44. ],
  45. buttonGroup: [
  46. {
  47. text: '报名活动',
  48. backgroundColor: '#ff0000',
  49. color: '#fff'
  50. }
  51. ],
  52. statusInfo: true
  53. }
  54. },
  55. mounted() {
  56. this.query();
  57. },
  58. methods: {
  59. async query() {
  60. const res = await request.getDetails({ id: this.id });
  61. const statusInfo = await request.getStatus({ id: this.id });
  62. this.info = res.data;
  63. if (statusInfo.data) {
  64. this.buttonGroup[0].text = '报名成功';
  65. this.buttonGroup[0].backgroundColor = '#999';
  66. this.buttonGroup[0].disable = true;
  67. }
  68. },
  69. buttonClick(e) {
  70. if (e.index == 0){
  71. if (e.content.disable) return;
  72. this.report();
  73. }
  74. },
  75. async report() {
  76. const res = await request.report({ id: this.id });
  77. if (res.code == 200) {
  78. wx.showToast({
  79. title: '报名成功'
  80. })
  81. this.query();
  82. }
  83. },
  84. }
  85. }
  86. </script>
  87. <style>
  88. .container {
  89. position: relative;
  90. padding-bottom: 12vw;
  91. background-color: #fff;
  92. }
  93. .banner {
  94. width: 100%;
  95. height: 50vw;
  96. }
  97. .content {
  98. display: block;
  99. width: 90%;
  100. margin: 10px auto;
  101. }
  102. .goodNav {
  103. width: 100%;
  104. height: 12vw;
  105. position: fixed;
  106. left: 0;
  107. bottom: 0;
  108. }
  109. </style>