• uniapp微信小程序隐私保护引导新规


    1.components中新建组件PrivacyPop.vue

    1. <script>
    2. export default {
    3. data() {
    4. return {
    5. privacyContractName: '《XXX隐私保护引导》',
    6. showPrivacy: true
    7. }
    8. },
    9. // onShow() {
    10. // const version = uni.getSystemInfoSync().SDKVersion
    11. // if (this.compareVersion(version, '2.32.3') >= 0) {
    12. // uni.getPrivacySetting({
    13. // success: (res) => {
    14. // if (res.errMsg === "getPrivacySetting:ok") {
    15. // this.privacyContractName = res.privacyContractName
    16. // this.showPrivacy = res.needAuthorization
    17. // }
    18. // }
    19. // })
    20. // }
    21. // },
    22. methods: {
    23. openPrivacyContract() {
    24. uni.openPrivacyContract({
    25. fail: () => {
    26. uni.showToast({
    27. title: '遇到错误',
    28. icon: 'error'
    29. })
    30. }
    31. })
    32. },
    33. // 拒绝隐私协议
    34. exitMiniProgram() {
    35. // 直接退出小程序
    36. wx.exitMiniProgram()
    37. },
    38. // 同意隐私协议
    39. handleAgreePrivacyAuthorization() {
    40. this.showPrivacy = false
    41. },
    42. compareVersion(v1, v2) {
    43. v1 = v1.split('.')
    44. v2 = v2.split('.')
    45. const len = Math.max(v1.length, v2.length)
    46. while (v1.length < len) {
    47. v1.push('0')
    48. }
    49. while (v2.length < len) {
    50. v2.push('0')
    51. }
    52. for (let i = 0; i < len; i++) {
    53. const num1 = parseInt(v1[i])
    54. const num2 = parseInt(v2[i])
    55. if (num1 > num2) {
    56. return 1
    57. } else if (num1 < num2) {
    58. return -1
    59. }
    60. }
    61. return 0
    62. }
    63. }
    64. }
    65. script>
    66. <style scoped> .privacy {
    67. position: fixed;
    68. top: 0;
    69. right: 0;
    70. bottom: 0;
    71. left: 0;
    72. background: rgba(0, 0, 0, .5);
    73. z-index: 9999999;
    74. display: flex;
    75. align-items: center;
    76. justify-content: center;
    77. }
    78. .content {
    79. width: 632rpx;
    80. padding: 48rpx;
    81. box-sizing: border-box;
    82. background: #fff;
    83. border-radius: 16rpx;
    84. }
    85. .content .title {
    86. text-align: center;
    87. color: #333;
    88. font-weight: bold;
    89. font-size: 32rpx;
    90. }
    91. .content .des {
    92. font-size: 26rpx;
    93. color: #666;
    94. margin-top: 40rpx;
    95. text-align: justify;
    96. line-height: 1.6;
    97. }
    98. .content .des .link {
    99. color: #07c160;
    100. text-decoration: underline;
    101. }
    102. .btns {
    103. margin-top: 48rpx;
    104. display: flex;
    105. }
    106. .btns .item {
    107. justify-content: space-between;
    108. width: 244rpx;
    109. height: 80rpx;
    110. display: flex;
    111. align-items: center;
    112. justify-content: center;
    113. border-radius: 16rpx;
    114. box-sizing: border-box;
    115. border: none;
    116. }
    117. .btns .reject {
    118. background: #f4f4f5;
    119. color: #909399;
    120. }
    121. .btns .agree {
    122. background: #07c160;
    123. color: #fff;
    124. }
    125. style>

    2.首页引入
     

    1. import PrivacyPop from '../../components/PrivacyPop/PrivacyPop.vue';
    2. components: {
    3. PrivacyPop
    4. },
    5. <PrivacyPop />

  • 相关阅读:
    【爬虫--必须要了解的请求头 user-agent】
    计算机网络-因特网概述
    每日一练 | 华为认证真题练习Day130
    MySQL–innodb存储学习之锁
    销售过程管理的最后一公里——销售日报管理(下)
    缠绕式电子感应水处理器简介
    实战!接口优化的18种方案
    Vue 3 组合式 API 指南:响应式状态管理与跨组件通信
    HTML大学班级活动网页设计 、大学校园HTML实例网页代码 、本实例适合于初学HTML的同学
    ESP32主板-MoonESP32
  • 原文地址:https://blog.csdn.net/qq_43770056/article/details/132690561