Privacy-Authorization.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  1. <template>
  2. <view class="privacy-authorization">
  3. <u-popup :show="show" @close="close" :mode="mode" :round="round" :safeAreaInsetBottom="false"
  4. :closeOnClickOverlay="false">
  5. <view class="pop_content center column">
  6. <text class="title">用户服务协议及隐私政策</text>
  7. <!-- #ifdef MP-WEIXIN -->
  8. <view class="content_text">
  9. <view>亲爱的燕飞凡上门选车用户感谢您信任并使用燕飞凡上门洗车小程序!依据微信开放平台要求,,请您在点击同意前仔细阅读<text class="url_text"
  10. @click="handleOpenPrivacyContract">{{privacyContractName}}</text> 并充分理解相关条款。为便于您理解,特向您说明如下:</view>
  11. <view class="mt10">
  12. 1.为向您提供基本服务,我们可能会基于您的授权进行收票和使用您的位置和必要个人的信息。
  13. </view>
  14. <view class="mt10">
  15. 2.我们会努力保护您的信息安全。
  16. </view>
  17. <view class="mt10">
  18. 3.您可以查询,更正,删除您的个人人信息或注销您的账号。
  19. </view>
  20. <view class="mt10">
  21. 4.未经您同意,我们不会将上述信息共享至第三方或用于您未授权的其他用途。
  22. </view>
  23. </view>
  24. <!-- #endif -->
  25. <!-- #ifdef APP-PLUS -->
  26. <view class="pop_content center column">
  27. <view class="content_text">
  28. 请你务必审慎阅读、充分理解<text class="base-color"
  29. @click="navTo('pages/article/index',{code:'agreement'})">《用户协议》</text>和<text
  30. @click="navTo('pages/article/index',{code:'policy'})" class="base-color">《隐私政策》</text>各条款
  31. ,包括但不限于:通讯录、相册读取、写入、位置信息等服务,
  32. <!-- 我们需要收集你的设备信息、操作日志等个人信息。 -->
  33. 你可以阅读<text class="base-color" @click="navTo('pages/article/index',{code:'agreement'})">《用户协议》</text>和<text
  34. @click="navTo('pages/article/index',{code:'policy'})" class="base-color">《隐私政策》</text>了解详细信息。
  35. 如你同意,请点击“同意”开始接受我们的服务。
  36. </view>
  37. </view>
  38. <!-- #endif -->
  39. <view class="buttom justify-between">
  40. <u-button :custom-style="{margin:'0 10rpx 0 0',height:'97rpx'}" @click="cancel" shape="circle">拒绝</u-button>
  41. <!-- #ifdef MP-WEIXIN -->
  42. <u-button type="primary" open-type="agreePrivacyAuthorization"
  43. :custom-style="{margin:'0 0 0 10rpx',height:'97rpx'}" @click="confirm" shape="circle">同意并继续</u-button>
  44. <!-- #endif -->
  45. <!-- #ifdef APP-PLUS -->
  46. <u-button type="primary" :custom-style="{margin:'0 0 0 10rpx',height:'97rpx'}" @click="confirm"
  47. shape="circle">同意并继续</u-button>
  48. <!-- #endif -->
  49. </view>
  50. </view>
  51. </u-popup>
  52. </view>
  53. </template>
  54. <script setup>
  55. import {
  56. navTo
  57. } from '@/core/app';
  58. import {
  59. onMounted,
  60. ref
  61. } from "vue";
  62. /**
  63. * 请在manifest.json中加上:"__usePrivacyCheck__": true
  64. */
  65. name: "Privacy-Authorization"
  66. const props = defineProps({
  67. mode: {
  68. type: String,
  69. default: 'center'
  70. },
  71. round: {
  72. type: String,
  73. default: '20rpx'
  74. }
  75. })
  76. const emits = defineEmits(['confirm', 'close', 'cancel'])
  77. const show = ref(false)
  78. const privacyContractName = ref('')
  79. onMounted(() => {
  80. // #ifdef MP-WEIXIN
  81. if (wx.getPrivacySetting) {
  82. wx.getPrivacySetting({
  83. success: res => {
  84. privacyContractName.value = res.privacyContractName
  85. if (res.needAuthorization) {
  86. show.value = true
  87. } else {
  88. confirm()
  89. }
  90. },
  91. fail: () => {},
  92. complete: () => {},
  93. })
  94. } else {
  95. // 低版本基础库不支持 wx.getPrivacySetting 接口,隐私接口可以直接调用
  96. emits('confirm', '用户同意隐私授权')
  97. }
  98. // #endif
  99. // #ifdef APP-PLUS
  100. let userEmpower = uni.getStorageSync('userEmpower')
  101. if (userEmpower) {
  102. if (userEmpower.isEmpower) confirm()
  103. else show.value = true
  104. } else show.value = true
  105. // #endif
  106. })
  107. const close = () => {
  108. show.value = false
  109. emits('close', '关闭弹窗')
  110. }
  111. const confirm = () => {
  112. uni.setStorageSync('userEmpower', {
  113. isEmpower: true
  114. })
  115. show.value = false
  116. emits('confirm', true)
  117. }
  118. const cancel = () => {
  119. emits('cancel', false)
  120. show.value = false
  121. }
  122. // 打开隐私协议页面
  123. const handleOpenPrivacyContract = () => {
  124. wx.openPrivacyContract({
  125. success: res => {
  126. console.log('openPrivacyContract success')
  127. },
  128. fail: res => {
  129. console.error('openPrivacyContract fail', res)
  130. }
  131. })
  132. }
  133. </script>
  134. <style lang="scss" scoped>
  135. .pop_content {
  136. width: 600rpx;
  137. padding: 30rpx 0 0 0;
  138. .title {
  139. font-weight: bold;
  140. padding: 0 20rpx;
  141. color: #111;
  142. font-size: 32rpx;
  143. }
  144. .content_text {
  145. margin-top: 27rpx;
  146. padding: 0 20rpx;
  147. color: #959595;
  148. font-size: 28rpx;
  149. ;
  150. }
  151. .buttom {
  152. width: calc(100% - 60rpx);
  153. margin: 30rpx 30rpx;
  154. }
  155. .url_text {
  156. color: $--base-color;
  157. }
  158. }
  159. </style>