推广小程序前端代码
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.

168 lines
3.5 KiB

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