guardSuccessPopup.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. <template>
  2. <up-popup :show="showPopup" @close="handleClose" mode="center" bgColor="transparent" overlayOpacity="0.8">
  3. <view class="success-popup">
  4. <view class="success-title">恭喜你,已守护成功!</view>
  5. <view class="success-content">
  6. <image class="right-star" :src="`${config.BASIC_IMG}img/treePage/star.png`" alt="" />
  7. <image class="left-star" :src="`${config.BASIC_IMG}img/treePage/star.png`" alt="" />
  8. <view class="card">
  9. <image class="img" mode="aspectFill" :src="getImageUrl(treeObj.filename)" alt="" />
  10. <view class="code">{{treeObj.code}}</view>
  11. </view>
  12. </view>
  13. <view class="button" @click="handleClose">我知道了</view>
  14. </view>
  15. </up-popup>
  16. </template>
  17. <script setup>
  18. import {
  19. ref,
  20. watch
  21. } from "vue";
  22. import config from "@/api/config.js"
  23. const resize = "?x-oss-process=image/resize,w_1000";
  24. const props = defineProps({
  25. show: {
  26. type: Boolean,
  27. defalut: false,
  28. },
  29. treeData: {
  30. type: Object,
  31. defalut: () => {},
  32. },
  33. });
  34. const getImageUrl = (filename) =>{
  35. if (filename?.startsWith("https")) {
  36. return filename; // 直接使用完整 URL
  37. } else {
  38. return config.BASE_IMG_URL + filename + resize; // 拼接基础 URL
  39. }
  40. };
  41. const showPopup = ref(false);
  42. const handleClose = () => {
  43. showPopup.value = false;
  44. emit('closedGuardSuccessPopup')
  45. };
  46. const treeObj = ref({})
  47. watch(
  48. () => props.show,
  49. () => {
  50. showPopup.value = true
  51. treeObj.value = {
  52. ...props.treeData.treeImages[0],
  53. code: props.treeData.buyList[0].code
  54. }
  55. }
  56. );
  57. const emit = defineEmits(['closedGuardSuccessPopup'])
  58. </script>
  59. <style lang="scss" scoped>
  60. @import "@/static/style/mixin.scss";
  61. .success-popup {
  62. width: 90vw;
  63. color: #fff;
  64. display: flex;
  65. justify-content: center;
  66. align-items: center;
  67. flex-direction: column;
  68. .success-title {
  69. font-size: 56rpx;
  70. text-align: center;
  71. @include ossBg("treePage/ribbon.png");
  72. margin-bottom: 42rpx;
  73. font-family: "PangMenZhengDao";
  74. padding: 14rpx 46rpx 0;
  75. line-height: 130rpx;
  76. }
  77. .success-content {
  78. width: 88%;
  79. border-radius: 40rpx;
  80. padding: 14rpx;
  81. background: rgba(255, 255, 255, 0.15);
  82. box-shadow: 0 0 12rpx 0 rgba(255, 255, 255, 0.63) inset;
  83. box-sizing: border-box;
  84. backdrop-filter: blur(8rpx);
  85. position: relative;
  86. .right-star {
  87. width: 56rpx;
  88. height: 54rpx;
  89. position: absolute;
  90. top: 110rpx;
  91. right: -38rpx;
  92. }
  93. .left-star {
  94. width: 64rpx;
  95. height: 62rpx;
  96. position: absolute;
  97. top: 280rpx;
  98. left: -36rpx;
  99. }
  100. .card {
  101. position: relative;
  102. color: #000;
  103. border-radius: 32rpx;
  104. .img {
  105. border-radius: 32rpx;
  106. width: 100%;
  107. height: 646rpx;
  108. }
  109. .code {
  110. position: absolute;
  111. top: 0;
  112. left: calc(50% - 340rpx / 2);
  113. background: rgba(26, 26, 26, 0.5);
  114. font-size: 24rpx;
  115. color: #fff;
  116. padding: 12rpx 30rpx;
  117. border-radius: 4rpx 4rpx 20rpx 20rpx;
  118. }
  119. }
  120. }
  121. .button {
  122. font-size: 32rpx;
  123. color: #fff;
  124. padding: 20rpx 144rpx;
  125. border: 2rpx solid #fff;
  126. border-radius: 50rpx;
  127. text-align: center;
  128. margin: 50rpx 0 40rpx;
  129. background-image: linear-gradient(120deg, #00d4ff, #008eff);
  130. }
  131. }
  132. </style>