details.vue 2.4 KB

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