index.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. <template>
  2. <Container
  3. title="挑战"
  4. :scrollStyle="{
  5. padding: 0,
  6. }"
  7. :showBack="false"
  8. >
  9. <view>
  10. <view class="bg">
  11. <div class="setting" @click="toRule">规则</div>
  12. </view>
  13. </view>
  14. <template #stick>
  15. <button class="btn" @click="toAdd">
  16. {{ isPay ? "查看报名信息" : "立即报名!参与挑战!" }}
  17. </button>
  18. </template>
  19. </Container>
  20. </template>
  21. <script setup>
  22. import Container from "../../components/Container/Container.vue";
  23. import { request } from "../../utils/request";
  24. import { router } from "../../utils/router";
  25. import { onShow } from "@dcloudio/uni-app";
  26. import { ref } from "vue";
  27. const isPay = ref(true);
  28. const p = ref(0);
  29. onShow(async () => {
  30. isPay.value = true;
  31. let res;
  32. try {
  33. res = await request(
  34. "api/question_bank/question_reception/challenge_registration_log/detail",
  35. {
  36. showToast: false,
  37. }
  38. );
  39. } catch (e) {
  40. isPay.value = false;
  41. }
  42. request(
  43. "api/question_bank/question_reception/recharge_package/list",
  44. {
  45. package_type: 2,
  46. },
  47. "post"
  48. ).then(async (res) => {
  49. p.value = res.data.data[0].id;
  50. });
  51. if (res.data) return;
  52. isPay.value = false;
  53. });
  54. const toRule = () => {
  55. router.push({
  56. url: "/pages/challenge/rule",
  57. params: {
  58. id: p.value,
  59. },
  60. });
  61. };
  62. const toAdd = async () => {
  63. router.push({
  64. url: !isPay.value
  65. ? "/pages/challenge/registration"
  66. : "/pages/challenge/addContant",
  67. params: {
  68. id: p.value,
  69. isPay: isPay.value,
  70. },
  71. });
  72. };
  73. </script>
  74. <style lang="scss" scoped>
  75. .bg {
  76. width: 100%;
  77. height: 1824rpx;
  78. background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/06/Mta1ISg62sk0DW7GfkD2qGxwa0uQ2p4NH4gUC5op.png");
  79. background-size: cover;
  80. padding: 32rpx;
  81. box-sizing: border-box;
  82. position: relative;
  83. .setting {
  84. position: absolute;
  85. right: 0;
  86. top: 200rpx;
  87. background: rgba(0, 0, 0, 0.5);
  88. border-radius: 500rpx 0rpx 0rpx 500rpx;
  89. font-weight: 500;
  90. font-size: 24rpx;
  91. color: #ffffff;
  92. padding: 8rpx;
  93. }
  94. }
  95. .btn {
  96. width: 660rpx;
  97. position: absolute;
  98. bottom: 3%;
  99. left: 50%;
  100. transform: translateX(-50%);
  101. }
  102. </style>