index.vue 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  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">立即报名!参与挑战!</button>
  16. </template>
  17. </Container>
  18. </template>
  19. <script setup>
  20. import Container from "../../components/Container/Container.vue";
  21. import { request } from "../../utils/request";
  22. import { router } from "../../utils/router";
  23. import { onShow } from "@dcloudio/uni-app";
  24. import { ref } from "vue";
  25. const isPay = ref(true);
  26. const p = ref(0);
  27. onShow(async () => {
  28. const res = request(
  29. "api/question_bank/question_reception/challenge_registration_log/detail"
  30. );
  31. if (res.data) return;
  32. isPay.value = false;
  33. request(
  34. "api/question_bank/question_reception/recharge_package/list",
  35. {
  36. package_type: 2,
  37. },
  38. "post"
  39. ).then(async (res) => {
  40. p.value = res.data.data[0].id;
  41. });
  42. });
  43. const toRule = () => {
  44. router.push({
  45. url: "/pages/challenge/rule",
  46. params: {
  47. id: p.value,
  48. },
  49. });
  50. };
  51. const toAdd = async () => {
  52. router.push({
  53. url: "/pages/challenge/registration",
  54. params: {
  55. id: p.value,
  56. isPay: isPay.value,
  57. },
  58. });
  59. };
  60. </script>
  61. <style lang="scss" scoped>
  62. .bg {
  63. width: 100%;
  64. height: 1734rpx;
  65. background: url("https://openwork-oss.oss-cn-shenzhen.aliyuncs.com/uploads/question/2025/05/IFolqhKEbaTWdBgII6gjvqMKrf8WUbbgEpoeRH5t.png");
  66. background-size: cover;
  67. padding: 32rpx;
  68. box-sizing: border-box;
  69. position: relative;
  70. .setting {
  71. position: absolute;
  72. right: 0;
  73. top: 200rpx;
  74. background: rgba(0, 0, 0, 0.5);
  75. border-radius: 500rpx 0rpx 0rpx 500rpx;
  76. font-weight: 500;
  77. font-size: 24rpx;
  78. color: #ffffff;
  79. padding: 8rpx;
  80. }
  81. }
  82. .btn {
  83. width: 660rpx;
  84. position: absolute;
  85. bottom: 3%;
  86. left: 50%;
  87. transform: translateX(-50%);
  88. }
  89. </style>