guardSuccessPopup.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152
  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 formatDate = (dateStr) => {
  42. return dateStr.split(" ")[0].replace(/-/g, ".");
  43. };
  44. const showPopup = ref(false);
  45. const handleClose = () => {
  46. showPopup.value = false;
  47. };
  48. const treeObj = ref({})
  49. watch(
  50. () => props.show,
  51. () => {
  52. showPopup.value = true
  53. treeObj.value = {
  54. ...props.treeData.treeImages[0],
  55. code: props.treeData.buyList[0].code
  56. }
  57. }
  58. );
  59. </script>
  60. <style lang="scss" scoped>
  61. @import "@/static/style/mixin.scss";
  62. .success-popup {
  63. width: 90vw;
  64. color: #fff;
  65. display: flex;
  66. justify-content: center;
  67. align-items: center;
  68. flex-direction: column;
  69. .success-title {
  70. font-size: 56rpx;
  71. text-align: center;
  72. @include ossBg("treePage/ribbon.png");
  73. margin-bottom: 42rpx;
  74. font-family: "PangMenZhengDao";
  75. padding: 14rpx 46rpx 0;
  76. line-height: 130rpx;
  77. }
  78. .success-content {
  79. width: 88%;
  80. border-radius: 40rpx;
  81. padding: 14rpx;
  82. background: rgba(255, 255, 255, 0.15);
  83. box-shadow: 0 0 12rpx 0 rgba(255, 255, 255, 0.63) inset;
  84. box-sizing: border-box;
  85. backdrop-filter: blur(8rpx);
  86. position: relative;
  87. .right-star {
  88. width: 56rpx;
  89. height: 54rpx;
  90. position: absolute;
  91. top: 110rpx;
  92. right: -38rpx;
  93. }
  94. .left-star {
  95. width: 64rpx;
  96. height: 62rpx;
  97. position: absolute;
  98. top: 280rpx;
  99. left: -36rpx;
  100. }
  101. .card {
  102. position: relative;
  103. color: #000;
  104. border-radius: 32rpx;
  105. .img {
  106. border-radius: 32rpx;
  107. width: 100%;
  108. height: 646rpx;
  109. }
  110. .code {
  111. position: absolute;
  112. top: 0;
  113. left: calc(50% - 340rpx / 2);
  114. background: rgba(26, 26, 26, 0.5);
  115. font-size: 24rpx;
  116. color: #fff;
  117. padding: 12rpx 30rpx;
  118. border-radius: 4rpx 4rpx 20rpx 20rpx;
  119. }
  120. }
  121. }
  122. .button {
  123. font-size: 32rpx;
  124. color: #fff;
  125. padding: 20rpx 144rpx;
  126. border: 2rpx solid #fff;
  127. border-radius: 50rpx;
  128. text-align: center;
  129. margin: 50rpx 0 40rpx;
  130. background-image: linear-gradient(120deg, #00d4ff, #008eff);
  131. }
  132. }
  133. </style>