知识付费微信小程序
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.

145 lines
3.1 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. <template>
  2. <uv-popup ref="popup" z-index="99999" :closeOnClickOverlay="false" :customStyle="{ backgroundColor: 'transparent' }">
  3. <view class="privacyPopup">
  4. <view class="title">
  5. <view>协议与隐私政策</view>
  6. </view>
  7. <view class="content_pri">
  8. <view class="text">
  9. 欢迎来到家乐美统计系统!我们根据最新的法律法规监管政策要求更新了用户协议隐私政策,请您认真阅读
  10. </view>
  11. </view>
  12. <view class="config">
  13. <uv-checkbox-group v-model="checkboxValue" shape="circle">
  14. <view class="content">
  15. <view style="display: flex;">
  16. <uv-checkbox size="30rpx" :name="1"></uv-checkbox>
  17. 同意<text @click="goToPrivacy">家乐美统计系统隐私政策</text>
  18. </view>
  19. <view class="">
  20. 以及<text @click="goToPrivacy">用户协议</text>
  21. </view>
  22. </view>
  23. </uv-checkbox-group>
  24. </view>
  25. <view class="pri_btn">
  26. <!-- <button class="confuse_btn" @click="confusePrivacy">拒绝</button> -->
  27. <button class="confirm_btn" id="agree-btn" open-type="agreePrivacyAuthorization"
  28. @agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  29. </view>
  30. </view>
  31. </uv-popup>
  32. </template>
  33. <script>
  34. export default {
  35. name: 'PrivacyAgreementPoup',
  36. data() {
  37. return {
  38. resolvePrivacyAuthorization: {},
  39. checkboxValue : false
  40. }
  41. },
  42. mounted() {
  43. if(wx.getPrivacySetting){
  44. wx.getPrivacySetting({
  45. success: res => {
  46. console.log(res)
  47. if (res.needAuthorization) {
  48. // 需要弹出隐私协议
  49. this.init()
  50. }
  51. },
  52. fail: () => {}
  53. })
  54. }
  55. },
  56. methods: {
  57. //初始化
  58. init(resolve) {
  59. this.$refs.popup.open('center')
  60. this.resolvePrivacyAuthorization = resolve
  61. },
  62. // 打开隐私协议
  63. goToPrivacy() {
  64. wx.openPrivacyContract({
  65. success: () => {
  66. console.log('打开成功');
  67. }, // 打开成功
  68. fail: () => {
  69. uni.showToast({
  70. title: '打开失败,稍后重试',
  71. icon: 'none'
  72. })
  73. } // 打开失败
  74. })
  75. },
  76. // 拒绝
  77. confusePrivacy() {
  78. this.$refs.popup.close()
  79. // this.resolvePrivacyAuthorization({
  80. // event: 'disagree'
  81. // })
  82. },
  83. // 同意
  84. handleAgreePrivacyAuthorization() {
  85. // 告知平台用户已经同意,参数传同意按钮的id
  86. // this.resolvePrivacyAuthorization({
  87. // buttonId: 'agree-btn',
  88. // event: 'agree'
  89. // })
  90. this.$refs.popup.close()
  91. }
  92. }
  93. }
  94. </script>
  95. <style lang="scss" scoped>
  96. .privacyPopup {
  97. width: 90%;
  98. margin: 0rpx auto;
  99. background: white;
  100. border-radius: 20rpx;
  101. box-sizing: border-box;
  102. padding: 40rpx 30rpx;
  103. .title {
  104. text-align: center;
  105. font-size: 36rpx;
  106. }
  107. .content_pri {
  108. padding: 30rpx 0rpx;
  109. font-size: 28rpx;
  110. }
  111. .config {
  112. font-size: 28rpx;
  113. text-align: center;
  114. line-height: 40rpx;
  115. margin-bottom: 30rpx;
  116. text {
  117. color: #00aaff;
  118. }
  119. .content{
  120. display: flex;
  121. }
  122. }
  123. .pri_btn {
  124. button {
  125. background: #00aaff;
  126. outline: none;
  127. color: white;
  128. font-size: 30rpx;
  129. }
  130. }
  131. }
  132. </style>