艺易修小程序24.08.21
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.

167 lines
3.6 KiB

9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 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 @tap="handleOpenPrivacyContract">校园报修隐私政策</text>
  18. </view>
  19. <view class="">
  20. 以及<text @tap="handleOpenPrivacyContract">用户协议</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
  28. class="confirm_btn" id="agree-btn"
  29. open-type="agreePrivacyAuthorization"
  30. @agreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
  31. </view>
  32. </view>
  33. </uv-popup>
  34. </template>
  35. <script>
  36. export default {
  37. name: 'PrivacyAgreementPoup',
  38. data() {
  39. return {
  40. resolvePrivacyAuthorization: {},
  41. checkboxValue : false
  42. }
  43. },
  44. mounted() {
  45. if(wx.getPrivacySetting){
  46. wx.getPrivacySetting({
  47. success: res => {
  48. // console.log(res)
  49. if (res.needAuthorization) {
  50. // 需要弹出隐私协议
  51. this.init()
  52. }
  53. },
  54. fail: () => {}
  55. })
  56. }
  57. },
  58. // created(){
  59. // setTimeout(() => {
  60. // this.init()
  61. // },2000)
  62. // },
  63. methods: {
  64. //初始化
  65. init(resolve) {
  66. this.$refs.popup.open('center')
  67. this.resolvePrivacyAuthorization = resolve
  68. },
  69. // 打开隐私协议
  70. goToPrivacy() {
  71. wx.openPrivacyContract({
  72. success: () => {
  73. console.log('打开成功');
  74. }, // 打开成功
  75. fail: () => {
  76. uni.showToast({
  77. title: '打开失败,稍后重试',
  78. icon: 'none'
  79. })
  80. } // 打开失败
  81. })
  82. },
  83. // 拒绝
  84. confusePrivacy() {
  85. this.$refs.popup.close()
  86. this.resolvePrivacyAuthorization({
  87. event: 'disagree'
  88. })
  89. },
  90. // 同意
  91. handleAgreePrivacyAuthorization() {
  92. // 告知平台用户已经同意,参数传同意按钮的id
  93. // this.resolvePrivacyAuthorization({
  94. // buttonId: 'agree-btn',
  95. // event: 'agree'
  96. // })
  97. if(!this.checkboxValue){
  98. return uni.showToast({
  99. icon: 'none',
  100. title: '请勾选同意《校园报修隐私政策》和《用户协议》'
  101. })
  102. }
  103. this.$refs.popup.close()
  104. },
  105. handleOpenPrivacyContract() {
  106. // 打开隐私协议页面
  107. wx.openPrivacyContract({
  108. success: () => {}, // 打开成功
  109. fail: () => {}, // 打开失败
  110. complete: () => {}
  111. })
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .privacyPopup {
  118. width: 90%;
  119. margin: 0rpx auto;
  120. background: white;
  121. border-radius: 20rpx;
  122. box-sizing: border-box;
  123. padding: 40rpx 30rpx;
  124. .title {
  125. text-align: center;
  126. font-size: 36rpx;
  127. }
  128. .content_pri {
  129. padding: 30rpx 0rpx;
  130. font-size: 28rpx;
  131. }
  132. .config {
  133. font-size: 28rpx;
  134. text-align: center;
  135. line-height: 40rpx;
  136. margin-bottom: 30rpx;
  137. text {
  138. color: #00aaff;
  139. }
  140. .content{
  141. display: flex;
  142. }
  143. }
  144. .pri_btn {
  145. button {
  146. background: #00aaff;
  147. outline: none;
  148. color: white;
  149. font-size: 30rpx;
  150. }
  151. }
  152. }
  153. </style>