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

187 lines
4.2 KiB

2 months ago
  1. <template>
  2. <uv-popup ref="popup" z-index="99999" :closeOnClickOverlay="false"
  3. :customStyle="{ backgroundColor: 'transparent' }">
  4. <view class="privacyPopup">
  5. <view class="icon">
  6. <image src="@/static/image/PrivacyAgreementPoup/icon.png" mode="widthFix"></image>
  7. </view>
  8. <view class="title">
  9. <view>协议与隐私政策</view>
  10. </view>
  11. <view class="content_pri">
  12. <view class="text">
  13. 请您务必审慎阅读充分理解用户协议和隐私政策各条款包括但不限于用户注意事项用户行为规范以及为了向你提供服务而收集使用存储你个人信息的情况等你可阅读<text
  14. class="blk" @tap="handleOpenPrivacyContract">工程项目打卡平台用户服务协议</text><text
  15. class="blk" @tap="handleOpenPrivacyContract">工程项目打卡平台隐私权政策</text>了解详细信息如你同意请点击下方按钮开始接受我们的服务
  16. </view>
  17. </view>
  18. <!-- <view class="config">
  19. <uv-checkbox-group v-model="checkboxValue" shape="circle">
  20. <view class="content">
  21. <view style="display: flex;">
  22. <uv-checkbox size="30rpx" :name="1"></uv-checkbox>
  23. 同意<text @tap="handleOpenPrivacyContract">工程项目打卡平台用户服务协议</text>
  24. </view>
  25. <view class="">
  26. 以及<text @tap="handleOpenPrivacyContract">工程项目打卡平台隐私权政策</text>
  27. </view>
  28. </view>
  29. </uv-checkbox-group>
  30. </view> -->
  31. <view class="pri_btn">
  32. <button class="confuse_btn" @click="confusePrivacy">拒绝</button>
  33. <button class="confirm_btn" id="agree-btn" 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. handleOpenPrivacyContract() {
  99. // 打开隐私协议页面
  100. wx.openPrivacyContract({
  101. success: () => {}, // 打开成功
  102. fail: () => {}, // 打开失败
  103. complete: () => {}
  104. })
  105. }
  106. }
  107. }
  108. </script>
  109. <style lang="scss" scoped>
  110. .privacyPopup {
  111. width: 90%;
  112. margin: 0rpx auto;
  113. background: white;
  114. border-radius: 20rpx;
  115. box-sizing: border-box;
  116. padding: 40rpx 30rpx;
  117. .icon {
  118. display: flex;
  119. justify-content: center;
  120. image {
  121. width: 100rpx;
  122. }
  123. }
  124. .title {
  125. text-align: center;
  126. font-size: 36rpx;
  127. margin: 30rpx 0rpx;
  128. }
  129. .content_pri {
  130. margin-bottom: 30rpx;
  131. font-size: 28rpx;
  132. color: #707070;
  133. .text {
  134. .blk {
  135. color: black;
  136. }
  137. }
  138. }
  139. .config {
  140. font-size: 28rpx;
  141. text-align: center;
  142. line-height: 40rpx;
  143. margin-bottom: 30rpx;
  144. text {
  145. color: #00aaff;
  146. }
  147. .content {
  148. display: flex;
  149. }
  150. }
  151. .pri_btn {
  152. display: flex;
  153. justify-content: space-around;
  154. flex-wrap: wrap;
  155. button {
  156. width: 40%;
  157. padding: 5rpx 0rpx;
  158. // background: $main-color;
  159. outline: none;
  160. color: white;
  161. font-size: 30rpx;
  162. &:nth-child(1){
  163. background: #F2F2F2;
  164. color: #707070;
  165. }
  166. }
  167. }
  168. }
  169. </style>