finals.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="container main">
  3. <view class="one">
  4. <view class="title">
  5. <span>决赛时间:</span>
  6. <span>{{info.final_start_time}}</span>
  7. </view>
  8. <view class="button">
  9. <button class="button_1" type="primary" @tap="toSign('0')">确认参加</button>
  10. <button class="button_2" type="warn" @tap="toSign('1')">放弃参加</button>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import moment from 'moment';
  17. export default {
  18. components: {},
  19. data() {
  20. return {
  21. id: '',
  22. user: {},
  23. info: {},
  24. }
  25. },
  26. onLoad: async function(e) {
  27. const that = this;
  28. that.$set(that, `id`, e && e.id || '');
  29. await that.searchToken();
  30. await that.search();
  31. },
  32. methods: {
  33. // 用户信息
  34. searchToken() {
  35. const that = this;
  36. try {
  37. const res = uni.getStorageSync('token');
  38. if (res) {
  39. const user = that.$jwt(res);
  40. that.$set(that, `user`, user);
  41. }
  42. } catch (e) {}
  43. },
  44. // 查询
  45. async search() {
  46. const that = this;
  47. if (that.id) {
  48. let res;
  49. res = await that.$api(`/matchReg/${that.id}`, 'GET', {})
  50. if (res.errcode == '0') {
  51. that.$set(that, `info`, res.data)
  52. } else {
  53. uni.showToast({
  54. title: res.errmsg,
  55. icon: 'none'
  56. });
  57. }
  58. }
  59. },
  60. async toSign(type) {
  61. const that = this;
  62. let res;
  63. if (type == '0') {
  64. res = await that.$api(`/matchExt/step5/confirm/${that.info.match_id}`, 'POST', {
  65. user_id: that.user.id
  66. })
  67. } else {
  68. res = await that.$api(`/matchExt/step5/refuse/${that.info.match_id}`, 'POST', {
  69. user_id: that.user.id
  70. })
  71. }
  72. if (res.errcode == '0') {
  73. uni.showModal({
  74. content: "维护成功!",
  75. showCancel: false
  76. });
  77. uni.navigateBack({
  78. delta: 1
  79. })
  80. } else {
  81. uni.showToast({
  82. title: res.errmsg,
  83. icon: 'none'
  84. });
  85. }
  86. },
  87. }
  88. }
  89. </script>
  90. <style lang="scss" scoped>
  91. .main {
  92. .one {
  93. padding: 2vw;
  94. .title {
  95. padding: 2vw;
  96. text-align: center;
  97. }
  98. .button {
  99. display: flex;
  100. margin: 2vw 0 0 0;
  101. padding: 2vw;
  102. .button_1 {
  103. color: var(--mainColor);
  104. font-size: var(--font14Size);
  105. border-radius: 2vw;
  106. background-color: var(--f3CColor);
  107. }
  108. .button_2 {
  109. color: var(--mainColor);
  110. font-size: var(--font14Size);
  111. border-radius: 2vw;
  112. background-color: var(--fF0Color);
  113. }
  114. }
  115. }
  116. }
  117. </style>