小说小程序前端代码仓库(小程序)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

148 lines
2.9 KiB

  1. <template>
  2. <view class="subscription-popup" :class="{'dark-mode': isDarkMode}">
  3. <uv-popup ref="popup"
  4. mode="bottom"
  5. :closeOnClickOverlay="false"
  6. @maskClick="$emit('maskClick')"
  7. :customStyle="popupStyle">
  8. <view class="content theme-transition">
  9. <view class="popup-title theme-transition">{{ title }}</view>
  10. <view class="popup-btns">
  11. <button class="popup-btn theme-transition" @click="handleSubscribe">订阅本章</button>
  12. <button class="popup-btn theme-transition">观看视频解锁</button>
  13. <button class="popup-btn theme-transition">批量订阅</button>
  14. </view>
  15. </view>
  16. </uv-popup>
  17. </view>
  18. </template>
  19. <script>
  20. import themeMixin from '@/mixins/themeMode.js'
  21. export default {
  22. name: 'subscriptionPopup',
  23. mixins: [themeMixin],
  24. props: {
  25. title: {
  26. type: String,
  27. default: '这是付费章节 需要订阅后才能阅读'
  28. },
  29. },
  30. data() {
  31. return {
  32. }
  33. },
  34. computed: {
  35. popupStyle() {
  36. return {
  37. 'background': this.isDarkMode ? '#232323' : '#fff',
  38. 'padding': '48rpx 32rpx',
  39. 'text-align': 'center',
  40. 'border-radius': '24rpx',
  41. 'min-width': '500rpx'
  42. }
  43. }
  44. },
  45. methods: {
  46. // 打开弹窗
  47. open() {
  48. this.$refs.popup.open();
  49. },
  50. // 关闭弹窗
  51. close() {
  52. this.$refs.popup.close();
  53. },
  54. // 处理订阅按钮点击
  55. handleSubscribe() {
  56. this.$emit('subscribe');
  57. this.close();
  58. }
  59. }
  60. }
  61. </script>
  62. <style lang="scss" scoped>
  63. .subscription-popup {
  64. .content {
  65. .popup-title {
  66. font-size: 32rpx;
  67. font-weight: bold;
  68. color: #222;
  69. margin-bottom: 24rpx;
  70. word-wrap: break-word;
  71. white-space: normal;
  72. }
  73. .popup-desc {
  74. font-size: 26rpx;
  75. color: #999;
  76. margin-bottom: 40rpx;
  77. word-wrap: break-word;
  78. white-space: normal;
  79. }
  80. .popup-btns {
  81. display: flex;
  82. flex-wrap: wrap;
  83. justify-content: center;
  84. gap: 24rpx;
  85. .popup-btn {
  86. background: #ff9800;
  87. color: #fff;
  88. border-radius: 32rpx;
  89. font-size: 28rpx;
  90. padding: 0 32rpx;
  91. border: none;
  92. margin-bottom: 16rpx;
  93. word-break: keep-all;
  94. &.popup-btn-video {
  95. background: #fff3e0;
  96. color: #ff9800;
  97. border: 1px solid #ff9800;
  98. }
  99. &.popup-btn-batch {
  100. background: #fff;
  101. color: #ff9800;
  102. border: 1px solid #ff9800;
  103. }
  104. }
  105. }
  106. }
  107. &.dark-mode {
  108. .content {
  109. .popup-title {
  110. color: $dark-text-color-primary;
  111. }
  112. .popup-desc {
  113. color: $dark-text-color-tertiary;
  114. }
  115. .popup-btns {
  116. .popup-btn {
  117. background: #ff9800;
  118. color: #fff;
  119. &.popup-btn-video {
  120. background: rgba(255, 152, 0, 0.1);
  121. color: #ff9800;
  122. border: 1px solid #ff9800;
  123. }
  124. &.popup-btn-batch {
  125. background: $dark-bg-color-secondary;
  126. color: #ff9800;
  127. border: 1px solid #ff9800;
  128. }
  129. }
  130. }
  131. }
  132. }
  133. }
  134. </style>