敢为人鲜小程序前端代码仓库
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.

156 lines
2.9 KiB

  1. <template>
  2. <view class="privacy-popup">
  3. <uv-popup ref="privacyPopup"
  4. mode="center"
  5. :round="10"
  6. :closeable="false"
  7. :maskClick="false"
  8. :closeOnClickOverlay="false"
  9. :safeAreaInsetBottom="false"
  10. :customStyle="{backgroundColor: '#fff', padding: 0, width: '85%'}"
  11. overlayOpacity="0.7">
  12. <view class="privacy-container">
  13. <!-- 标题 -->
  14. <view class="privacy-title">
  15. {{ title }}
  16. </view>
  17. <!-- 内容区域 - 使用插槽 -->
  18. <scroll-view scroll-y class="privacy-content">
  19. <slot></slot>
  20. </scroll-view>
  21. <!-- 底部按钮 -->
  22. <view class="privacy-actions">
  23. <view class="action-btn reject-btn" hover-class="active-btn" @tap="handleReject">{{ rejectText }}</view>
  24. <view class="action-btn agree-btn" hover-class="active-btn" @tap="handleAgree">{{ agreeText }}</view>
  25. </view>
  26. </view>
  27. </uv-popup>
  28. </view>
  29. </template>
  30. <script>
  31. export default {
  32. name: 'PrivacyPopup',
  33. props: {
  34. // 弹窗标题
  35. title: {
  36. type: String,
  37. default: '隐私政策'
  38. },
  39. // 拒绝按钮文字
  40. rejectText: {
  41. type: String,
  42. default: '拒绝'
  43. },
  44. // 同意按钮文字
  45. agreeText: {
  46. type: String,
  47. default: '同意'
  48. }
  49. },
  50. data() {
  51. return {
  52. }
  53. },
  54. methods: {
  55. // 打开弹窗
  56. open() {
  57. this.$refs.privacyPopup.open();
  58. },
  59. // 关闭弹窗
  60. close() {
  61. this.$refs.privacyPopup.close();
  62. },
  63. // 处理拒绝操作
  64. handleReject() {
  65. this.$emit('reject');
  66. this.close();
  67. },
  68. // 处理同意操作
  69. handleAgree() {
  70. this.$emit('agree');
  71. this.close();
  72. }
  73. }
  74. }
  75. </script>
  76. <style lang="scss" scoped>
  77. .privacy-popup {
  78. // padding: 0;
  79. .privacy-container {
  80. display: flex;
  81. flex-direction: column;
  82. justify-content: space-between;
  83. width: 100%;
  84. background-color: #fff;
  85. }
  86. .privacy-title {
  87. font-size: 36rpx;
  88. font-weight: bold;
  89. text-align: center;
  90. padding: 30rpx 0;
  91. // border-bottom: 1rpx solid #e6e6e6;
  92. background-color: #fff;
  93. }
  94. .privacy-content {
  95. flex: 1;
  96. padding: 30rpx;
  97. box-sizing: border-box;
  98. height: 600rpx;
  99. background-color: #fff;
  100. max-height: 50vh;
  101. }
  102. .privacy-actions {
  103. display: flex;
  104. border-top: 4rpx solid #e6e6e6;
  105. height: 100rpx;
  106. background-color: #fff;
  107. .action-btn {
  108. flex: 1;
  109. display: flex;
  110. justify-content: center;
  111. align-items: center;
  112. font-size: 32rpx;
  113. position: relative;
  114. background-color: #fff;
  115. transition: all 0.3s ease;
  116. // &::after {
  117. // content: '';
  118. // position: absolute;
  119. // right: 0;
  120. // top: 20rpx;
  121. // bottom: 20rpx;
  122. // width: 1rpx;
  123. // background-color: #e6e6e6;
  124. // }
  125. &:last-child::after {
  126. display: none;
  127. }
  128. }
  129. .reject-btn {
  130. color: #999;
  131. // background-color: red;
  132. border-right: 4rpx solid #e6e6e6;
  133. }
  134. .agree-btn {
  135. color: $uni-color;
  136. }
  137. .active-btn {
  138. background-color: $uni-color;
  139. color: #fff;
  140. }
  141. }
  142. }
  143. </style>