webviewPoint.vue 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <template>
  2. <u-modal :show="show" title="恭喜您,中奖啦!!!" :show-cancel="false">
  3. <view slot="default" class="modal-content">
  4. <text class="modal-text">恭喜您获得转盘抽奖的机会!</text>
  5. </view>
  6. <view slot="confirmButton" class="modal-footer">
  7. <button class="modal-cancel" @click="show = false">取消</button>
  8. <wx-open-launch-weapp
  9. id="launch-btn"
  10. class="launch-weapp-btn"
  11. appid="wxab9634bf98628a03"
  12. :path="launchButtonHtml"
  13. >
  14. <script type="text/wxtag-template">
  15. <style scoped>
  16. .btn {
  17. width: 100%;
  18. height: 100%;
  19. font-size: 1rem;
  20. text-align: center;
  21. margin: 0; padding: 0;
  22. border: none;
  23. background: none;
  24. color: #FFFFFF; } </style>
  25. <button class="btn">去抽奖</button>
  26. </script>
  27. </wx-open-launch-weapp>
  28. </view>
  29. </u-modal>
  30. </template>
  31. <script>
  32. import {handleServiceAdjustMiniProgram} from '@/utils/share.js'
  33. export default {
  34. data() {
  35. return {
  36. show:false,
  37. launchButtonHtml: ''
  38. }
  39. },
  40. methods: {
  41. getRow(res){
  42. let activityUrl = res?.activityUrl.split('/#/')[1] || '';
  43. let activityId = res?.activityId;
  44. let currentPlatform = 'gyy-aB4cD6eF8gH0iJ2kL4';
  45. let currentUser = uni.getStorageSync('userId');
  46. let url = `/${activityUrl}?activityId=${activityId}&currentPlatform=${currentPlatform}&currentUser=${currentUser}`;
  47. this.initLaunchButton(url)
  48. },
  49. async initLaunchButton(url) {
  50. console.log(url)
  51. try {
  52. await handleServiceAdjustMiniProgram();
  53. this.show = true;
  54. this.launchButtonHtml = url;
  55. } catch (err) {
  56. console.error('初始化跳转按钮失败', err)
  57. this.launchButtonHtml = '';
  58. }
  59. },
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. ::v-deep .u-modal {
  65. .u-modal__title {
  66. background: #E8FFFD;
  67. height: 92rpx;
  68. padding: 0;
  69. font-family: PingFang SC, PingFang SC;
  70. font-weight: bold;
  71. font-size: 32rpx;
  72. color: #000000;
  73. line-height: 92rpx;
  74. }
  75. .u-modal__content,
  76. .u-modal__button-group--confirm-button {
  77. padding: 0;
  78. }
  79. }
  80. // 模态框样式
  81. .modal-content {
  82. padding: 40rpx 32rpx;
  83. text-align: center;
  84. .modal-text {
  85. font-family: PingFang SC, PingFang SC;
  86. font-weight: 500;
  87. font-size: 28rpx;
  88. color: #333333;
  89. line-height: 39rpx;
  90. }
  91. }
  92. .modal-footer {
  93. border-top: 1rpx solid #EEEEEE;
  94. display: flex;
  95. justify-content: center;
  96. padding: 24rpx 58rpx;
  97. button {
  98. width: 225rpx;
  99. height: 68rpx;
  100. border-radius: 60rpx;
  101. font-size: 1rem;
  102. text-align: center;
  103. line-height: 68rpx;
  104. margin: 0 20rpx;
  105. padding: 0;
  106. }
  107. .modal-cancel {
  108. border: 1rpx solid #999999;
  109. color: #333333;
  110. }
  111. .launch-weapp-btn {
  112. width: 225rpx;
  113. height: 68rpx;
  114. border-radius: 60rpx;
  115. margin: 0 20rpx;
  116. display: flex;
  117. align-items: center;
  118. justify-content: center;
  119. background: linear-gradient(78deg, #1AD8CF 0%, #21C8C0 100%);
  120. }
  121. }
  122. </style>