[
  {
    "path": ".eslintrc.js",
    "content": "/*\n * Eslint config file\n * Documentation: https://eslint.org/docs/user-guide/configuring/\n * Install the Eslint extension before using this feature.\n */\nmodule.exports = {\n  env: {\n    es6: true,\n    browser: true,\n    node: true,\n  },\n  ecmaFeatures: {\n    modules: true,\n  },\n  parserOptions: {\n    ecmaVersion: 2018,\n    sourceType: 'module',\n  },\n  globals: {\n    wx: true,\n    App: true,\n    Page: true,\n    getCurrentPages: true,\n    getApp: true,\n    Component: true,\n    requirePlugin: true,\n    requireMiniProgram: true,\n  },\n  // extends: 'eslint:recommended',\n  rules: {},\n}\n"
  },
  {
    "path": ".gitignore",
    "content": ".DS_Store\n"
  },
  {
    "path": "LICENSE",
    "content": "MIT License\n\nCopyright (c) 2023 Jiaqi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n"
  },
  {
    "path": "README.md",
    "content": "<!--\n * @Author: Jiaqi s@94xy.com\n * @Date: 2023-08-28 18:16:03\n * @LastEditTime: 2023-09-14 20:41:23\n-->\n\n# 刚刚，微信发布最新公告（要求必须适配的最后日期的 3 个小时前），开发者可以无须修改，自动使用官方默认配置。\n"
  },
  {
    "path": "app.js",
    "content": "App({\n  onLaunch() {\n\n  }\n})\n"
  },
  {
    "path": "app.json",
    "content": "{\n    \"pages\": [\n        \"pages/index/index\"\n    ],\n    \"window\": {\n        \"backgroundTextStyle\": \"light\",\n        \"navigationBarBackgroundColor\": \"#fff\",\n        \"navigationBarTitleText\": \"隐私协议弹窗模板\",\n        \"navigationBarTextStyle\": \"black\"\n    },\n    \"style\": \"v2\",\n    \"sitemapLocation\": \"sitemap.json\",\n    \"lazyCodeLoading\": \"requiredComponents\",\n    \"__usePrivacyCheck__\": true\n}"
  },
  {
    "path": "app.wxss",
    "content": ""
  },
  {
    "path": "component/privacy/privacy.js",
    "content": "// component/privacy/privacy.js\nComponent({\n    /**\n     * 组件的初始数据\n     */\n    data: {\n        privacyContractName: '',\n        showPrivacy: false\n    },\n    /**\n     * 组件的生命周期\n     */\n    pageLifetimes: {\n        show() {\n            const _ = this\n            const version = wx.getAppBaseInfo().SDKVersion\n            if (_.compareVersion(version, '2.32.3') >= 0) {\n                wx.getPrivacySetting({\n                    success(res) {\n                        if (res.errMsg == \"getPrivacySetting:ok\") {\n                            _.setData({\n                                privacyContractName: res.privacyContractName,\n                                showPrivacy: res.needAuthorization\n                            })\n                        }\n                    }\n                })\n            }\n        }\n    },\n    /**\n     * 组件的方法列表\n     */\n    methods: {\n        // 打开隐私协议页面\n        openPrivacyContract() {\n            const _ = this\n            wx.openPrivacyContract({\n                fail: () => {\n                    wx.showToast({\n                        title: '遇到错误',\n                        icon: 'error'\n                    })\n                }\n            })\n        },\n        // 拒绝隐私协议\n        exitMiniProgram() {\n            wx.showToast({\n                title: '必须同意后才可以继续使用当前小程序',\n                icon: 'none'\n            })\n        },\n        // 同意隐私协议\n        handleAgreePrivacyAuthorization() {\n            const _ = this\n            _.setData({\n                showPrivacy: false\n            })\n        },\n        // 比较版本号\n        compareVersion(v1, v2) {\n            v1 = v1.split('.')\n            v2 = v2.split('.')\n            const len = Math.max(v1.length, v2.length)\n\n            while (v1.length < len) {\n                v1.push('0')\n            }\n            while (v2.length < len) {\n                v2.push('0')\n            }\n\n            for (let i = 0; i < len; i++) {\n                const num1 = parseInt(v1[i])\n                const num2 = parseInt(v2[i])\n\n                if (num1 > num2) {\n                    return 1\n                } else if (num1 < num2) {\n                    return -1\n                }\n            }\n\n            return 0\n        },\n        // 通过绑定空事件禁止滑动事件的穿透\n        handleCatchtouchMove() {\n            return\n        }\n    },\n})"
  },
  {
    "path": "component/privacy/privacy.json",
    "content": "{\n    \"component\": true,\n    \"usingComponents\": {}\n}"
  },
  {
    "path": "component/privacy/privacy.wxml",
    "content": "<!--component/privacy/privacy.wxml-->\n<view class=\"privacy\" wx:if=\"{{showPrivacy}}\" catchtouchmove=\"handleCatchtouchMove\">\n    <view class=\"content\">\n        <view class=\"title\">隐私保护指引</view>\n        <view class=\"des\">\n            在使用当前小程序服务之前，请仔细阅读<text class=\"link\" bind:tap=\"openPrivacyContract\">{{privacyContractName}}</text>。如你同意{{privacyContractName}}，请点击“同意”开始使用。\n        </view>\n        <view class=\"btns\">\n            <button class=\"item reject\" bind:tap=\"exitMiniProgram\">拒绝</button>\n            <button id=\"agree-btn\" class=\"item agree\" open-type=\"agreePrivacyAuthorization\" bindagreeprivacyauthorization=\"handleAgreePrivacyAuthorization\">同意</button>\n        </view>\n    </view>\n</view>"
  },
  {
    "path": "component/privacy/privacy.wxss",
    "content": "/* component/privacy/privacy.wxss */\n.privacy {\n    position: fixed;\n    top: 0;\n    right: 0;\n    bottom: 0;\n    left: 0;\n    background: rgba(0, 0, 0, .5);\n    z-index: 9999999;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n}\n\n.content {\n    width: 632rpx;\n    padding: 48rpx;\n    box-sizing: border-box;\n    background: #fff;\n    border-radius: 16rpx;\n}\n\n.content .title {\n    text-align: center;\n    color: #333;\n    font-weight: bold;\n    font-size: 32rpx;\n}\n\n.content .des {\n    font-size: 26rpx;\n    color: #666;\n    margin-top: 40rpx;\n    text-align: justify;\n    line-height: 1.6;\n}\n\n.content .des .link {\n    color: #07c160;\n    text-decoration: underline;\n}\n\n.btns {\n    margin-top: 48rpx;\n    display: flex;\n}\n\n.btns .item {\n    justify-content: space-between;\n    width: 244rpx;\n    height: 80rpx;\n    display: flex;\n    align-items: center;\n    justify-content: center;\n    border-radius: 16rpx;\n    box-sizing: border-box;\n    border: none;\n}\n\n.btns .reject {\n    background: #f4f4f5;\n    color: #909399;\n}\n\n.btns .agree {\n    background: #07c160;\n    color: #fff;\n}"
  },
  {
    "path": "pages/index/index.js",
    "content": "Page({})"
  },
  {
    "path": "pages/index/index.json",
    "content": "{\n    \"usingComponents\": {\n        \"Privacy\": \"/component/privacy/privacy\"\n    }\n}"
  },
  {
    "path": "pages/index/index.wxml",
    "content": "<view class=\"tips\">\n    <view>需要授权自动弹窗，不需要则不显示弹窗</view>\n</view>\n<Privacy />"
  },
  {
    "path": "pages/index/index.wxss",
    "content": ".tips{\n    position: fixed;\n    top: 0;\n    right: 0;\n    bottom: 0;\n    left: 0;\n    display: flex;\n    justify-content: center;\n    align-items: center;\n    color: #666;\n}"
  },
  {
    "path": "project.config.json",
    "content": "{\n    \"compileType\": \"miniprogram\",\n    \"setting\": {\n        \"coverView\": true,\n        \"es6\": true,\n        \"postcss\": true,\n        \"minified\": true,\n        \"enhance\": true,\n        \"showShadowRootInWxmlPanel\": true,\n        \"packNpmRelationList\": [],\n        \"babelSetting\": {\n            \"ignore\": [],\n            \"disablePlugins\": [],\n            \"outputPath\": \"\"\n        },\n        \"ignoreUploadUnusedFiles\": true\n    },\n    \"condition\": {},\n    \"editorSetting\": {\n        \"tabIndent\": \"insertSpaces\",\n        \"tabSize\": 4\n    },\n    \"packOptions\": {\n        \"ignore\": [],\n        \"include\": []\n    },\n    \"appid\": \"wx99d0f0c106f42045\"\n}"
  },
  {
    "path": "project.private.config.json",
    "content": "{\n    \"description\": \"项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档：https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html\",\n    \"projectname\": \"minicode-privacy\",\n    \"setting\": {\n        \"compileHotReLoad\": true,\n        \"skylineRenderEnable\": true\n    },\n    \"libVersion\": \"2.31.1\"\n}"
  },
  {
    "path": "sitemap.json",
    "content": "{\n  \"desc\": \"关于本文件的更多信息，请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html\",\n  \"rules\": [{\n  \"action\": \"allow\",\n  \"page\": \"*\"\n  }]\n}"
  }
]