index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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. const res = request(
  31. "api/question_bank/question_reception/challenge_registration_log/detail"
  32. );
  33. if (res.data) return;
  34. isPay.value = false;
  35. request(
  36. "api/question_bank/question_reception/recharge_package/list",
  37. {
  38. package_type: 2,
  39. },
  40. "post"
  41. ).then(async (res) => {
  42. p.value = res.data.data[0].id;
  43. });
  44. });
  45. const toRule = () => {
  46. router.push({
  47. url: "/pages/challenge/rule",
  48. params: {
  49. id: p.value,
  50. },
  51. });
  52. };
  53. const toAdd = async () => {
  54. router.push({
  55. url: !isPay.value
  56. ? "/pages/challenge/registration"
  57. : "/pages/challenge/addContant",
  58. params: {
  59. id: p.value,
  60. isPay: isPay.value,
  61. },
  62. });
  63. };
  64. </script>
  65. <style lang="scss" scoped>
  66. .bg {
  67. width: 100%;
  68. height: 1734rpx;
  69. background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/IFolqhKEbaTWdBgII6gjvqMKrf8WUbbgEpoeRH5t.png");
  70. background-size: cover;
  71. padding: 32rpx;
  72. box-sizing: border-box;
  73. position: relative;
  74. .setting {
  75. position: absolute;
  76. right: 0;
  77. top: 200rpx;
  78. background: rgba(0, 0, 0, 0.5);
  79. border-radius: 500rpx 0rpx 0rpx 500rpx;
  80. font-weight: 500;
  81. font-size: 24rpx;
  82. color: #ffffff;
  83. padding: 8rpx;
  84. }
  85. }
  86. .btn {
  87. width: 660rpx;
  88. position: absolute;
  89. bottom: 3%;
  90. left: 50%;
  91. transform: translateX(-50%);
  92. }
  93. </style>