Repository: 94xy/miniprogram-privacy
Branch: main
Commit: ffca1248c219
Files: 18
Total size: 7.7 KB
Directory structure:
gitextract_ar9v3r0d/
├── .eslintrc.js
├── .gitignore
├── LICENSE
├── README.md
├── app.js
├── app.json
├── app.wxss
├── component/
│ └── privacy/
│ ├── privacy.js
│ ├── privacy.json
│ ├── privacy.wxml
│ └── privacy.wxss
├── pages/
│ └── index/
│ ├── index.js
│ ├── index.json
│ ├── index.wxml
│ └── index.wxss
├── project.config.json
├── project.private.config.json
└── sitemap.json
================================================
FILE CONTENTS
================================================
================================================
FILE: .eslintrc.js
================================================
/*
* Eslint config file
* Documentation: https://eslint.org/docs/user-guide/configuring/
* Install the Eslint extension before using this feature.
*/
module.exports = {
env: {
es6: true,
browser: true,
node: true,
},
ecmaFeatures: {
modules: true,
},
parserOptions: {
ecmaVersion: 2018,
sourceType: 'module',
},
globals: {
wx: true,
App: true,
Page: true,
getCurrentPages: true,
getApp: true,
Component: true,
requirePlugin: true,
requireMiniProgram: true,
},
// extends: 'eslint:recommended',
rules: {},
}
================================================
FILE: .gitignore
================================================
.DS_Store
================================================
FILE: LICENSE
================================================
MIT License
Copyright (c) 2023 Jiaqi
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
================================================
FILE: README.md
================================================
<!--
* @Author: Jiaqi s@94xy.com
* @Date: 2023-08-28 18:16:03
* @LastEditTime: 2023-09-14 20:41:23
-->
# 刚刚,微信发布最新公告(要求必须适配的最后日期的 3 个小时前),开发者可以无须修改,自动使用官方默认配置。
================================================
FILE: app.js
================================================
App({
onLaunch() {
}
})
================================================
FILE: app.json
================================================
{
"pages": [
"pages/index/index"
],
"window": {
"backgroundTextStyle": "light",
"navigationBarBackgroundColor": "#fff",
"navigationBarTitleText": "隐私协议弹窗模板",
"navigationBarTextStyle": "black"
},
"style": "v2",
"sitemapLocation": "sitemap.json",
"lazyCodeLoading": "requiredComponents",
"__usePrivacyCheck__": true
}
================================================
FILE: app.wxss
================================================
================================================
FILE: component/privacy/privacy.js
================================================
// component/privacy/privacy.js
Component({
/**
* 组件的初始数据
*/
data: {
privacyContractName: '',
showPrivacy: false
},
/**
* 组件的生命周期
*/
pageLifetimes: {
show() {
const _ = this
const version = wx.getAppBaseInfo().SDKVersion
if (_.compareVersion(version, '2.32.3') >= 0) {
wx.getPrivacySetting({
success(res) {
if (res.errMsg == "getPrivacySetting:ok") {
_.setData({
privacyContractName: res.privacyContractName,
showPrivacy: res.needAuthorization
})
}
}
})
}
}
},
/**
* 组件的方法列表
*/
methods: {
// 打开隐私协议页面
openPrivacyContract() {
const _ = this
wx.openPrivacyContract({
fail: () => {
wx.showToast({
title: '遇到错误',
icon: 'error'
})
}
})
},
// 拒绝隐私协议
exitMiniProgram() {
wx.showToast({
title: '必须同意后才可以继续使用当前小程序',
icon: 'none'
})
},
// 同意隐私协议
handleAgreePrivacyAuthorization() {
const _ = this
_.setData({
showPrivacy: false
})
},
// 比较版本号
compareVersion(v1, v2) {
v1 = v1.split('.')
v2 = v2.split('.')
const len = Math.max(v1.length, v2.length)
while (v1.length < len) {
v1.push('0')
}
while (v2.length < len) {
v2.push('0')
}
for (let i = 0; i < len; i++) {
const num1 = parseInt(v1[i])
const num2 = parseInt(v2[i])
if (num1 > num2) {
return 1
} else if (num1 < num2) {
return -1
}
}
return 0
},
// 通过绑定空事件禁止滑动事件的穿透
handleCatchtouchMove() {
return
}
},
})
================================================
FILE: component/privacy/privacy.json
================================================
{
"component": true,
"usingComponents": {}
}
================================================
FILE: component/privacy/privacy.wxml
================================================
<!--component/privacy/privacy.wxml-->
<view class="privacy" wx:if="{{showPrivacy}}" catchtouchmove="handleCatchtouchMove">
<view class="content">
<view class="title">隐私保护指引</view>
<view class="des">
在使用当前小程序服务之前,请仔细阅读<text class="link" bind:tap="openPrivacyContract">{{privacyContractName}}</text>。如你同意{{privacyContractName}},请点击“同意”开始使用。
</view>
<view class="btns">
<button class="item reject" bind:tap="exitMiniProgram">拒绝</button>
<button id="agree-btn" class="item agree" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="handleAgreePrivacyAuthorization">同意</button>
</view>
</view>
</view>
================================================
FILE: component/privacy/privacy.wxss
================================================
/* component/privacy/privacy.wxss */
.privacy {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, .5);
z-index: 9999999;
display: flex;
align-items: center;
justify-content: center;
}
.content {
width: 632rpx;
padding: 48rpx;
box-sizing: border-box;
background: #fff;
border-radius: 16rpx;
}
.content .title {
text-align: center;
color: #333;
font-weight: bold;
font-size: 32rpx;
}
.content .des {
font-size: 26rpx;
color: #666;
margin-top: 40rpx;
text-align: justify;
line-height: 1.6;
}
.content .des .link {
color: #07c160;
text-decoration: underline;
}
.btns {
margin-top: 48rpx;
display: flex;
}
.btns .item {
justify-content: space-between;
width: 244rpx;
height: 80rpx;
display: flex;
align-items: center;
justify-content: center;
border-radius: 16rpx;
box-sizing: border-box;
border: none;
}
.btns .reject {
background: #f4f4f5;
color: #909399;
}
.btns .agree {
background: #07c160;
color: #fff;
}
================================================
FILE: pages/index/index.js
================================================
Page({})
================================================
FILE: pages/index/index.json
================================================
{
"usingComponents": {
"Privacy": "/component/privacy/privacy"
}
}
================================================
FILE: pages/index/index.wxml
================================================
<view class="tips">
<view>需要授权自动弹窗,不需要则不显示弹窗</view>
</view>
<Privacy />
================================================
FILE: pages/index/index.wxss
================================================
.tips{
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
display: flex;
justify-content: center;
align-items: center;
color: #666;
}
================================================
FILE: project.config.json
================================================
{
"compileType": "miniprogram",
"setting": {
"coverView": true,
"es6": true,
"postcss": true,
"minified": true,
"enhance": true,
"showShadowRootInWxmlPanel": true,
"packNpmRelationList": [],
"babelSetting": {
"ignore": [],
"disablePlugins": [],
"outputPath": ""
},
"ignoreUploadUnusedFiles": true
},
"condition": {},
"editorSetting": {
"tabIndent": "insertSpaces",
"tabSize": 4
},
"packOptions": {
"ignore": [],
"include": []
},
"appid": "wx99d0f0c106f42045"
}
================================================
FILE: project.private.config.json
================================================
{
"description": "项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
"projectname": "minicode-privacy",
"setting": {
"compileHotReLoad": true,
"skylineRenderEnable": true
},
"libVersion": "2.31.1"
}
================================================
FILE: sitemap.json
================================================
{
"desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html",
"rules": [{
"action": "allow",
"page": "*"
}]
}
gitextract_ar9v3r0d/ ├── .eslintrc.js ├── .gitignore ├── LICENSE ├── README.md ├── app.js ├── app.json ├── app.wxss ├── component/ │ └── privacy/ │ ├── privacy.js │ ├── privacy.json │ ├── privacy.wxml │ └── privacy.wxss ├── pages/ │ └── index/ │ ├── index.js │ ├── index.json │ ├── index.wxml │ └── index.wxss ├── project.config.json ├── project.private.config.json └── sitemap.json
SYMBOL INDEX (7 symbols across 2 files)
FILE: app.js
method onLaunch (line 2) | onLaunch() {
FILE: component/privacy/privacy.js
method show (line 14) | show() {
method openPrivacyContract (line 36) | openPrivacyContract() {
method exitMiniProgram (line 48) | exitMiniProgram() {
method handleAgreePrivacyAuthorization (line 55) | handleAgreePrivacyAuthorization() {
method compareVersion (line 62) | compareVersion(v1, v2) {
method handleCatchtouchMove (line 88) | handleCatchtouchMove() {
Condensed preview — 18 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (10K chars).
[
{
"path": ".eslintrc.js",
"chars": 587,
"preview": "/*\n * Eslint config file\n * Documentation: https://eslint.org/docs/user-guide/configuring/\n * Install the Eslint extensi"
},
{
"path": ".gitignore",
"chars": 10,
"preview": ".DS_Store\n"
},
{
"path": "LICENSE",
"chars": 1062,
"preview": "MIT License\n\nCopyright (c) 2023 Jiaqi\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof t"
},
{
"path": "README.md",
"chars": 164,
"preview": "<!--\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# 刚刚,微信发布最新公告"
},
{
"path": "app.js",
"chars": 29,
"preview": "App({\n onLaunch() {\n\n }\n})\n"
},
{
"path": "app.json",
"chars": 387,
"preview": "{\n \"pages\": [\n \"pages/index/index\"\n ],\n \"window\": {\n \"backgroundTextStyle\": \"light\",\n \"nav"
},
{
"path": "app.wxss",
"chars": 0,
"preview": ""
},
{
"path": "component/privacy/privacy.js",
"chars": 2308,
"preview": "// component/privacy/privacy.js\nComponent({\n /**\n * 组件的初始数据\n */\n data: {\n privacyContractName: '',\n"
},
{
"path": "component/privacy/privacy.json",
"chars": 52,
"preview": "{\n \"component\": true,\n \"usingComponents\": {}\n}"
},
{
"path": "component/privacy/privacy.wxml",
"chars": 697,
"preview": "<!--component/privacy/privacy.wxml-->\n<view class=\"privacy\" wx:if=\"{{showPrivacy}}\" catchtouchmove=\"handleCatchtouchMove"
},
{
"path": "component/privacy/privacy.wxss",
"chars": 1108,
"preview": "/* component/privacy/privacy.wxss */\n.privacy {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: "
},
{
"path": "pages/index/index.js",
"chars": 8,
"preview": "Page({})"
},
{
"path": "pages/index/index.json",
"chars": 82,
"preview": "{\n \"usingComponents\": {\n \"Privacy\": \"/component/privacy/privacy\"\n }\n}"
},
{
"path": "pages/index/index.wxml",
"chars": 75,
"preview": "<view class=\"tips\">\n <view>需要授权自动弹窗,不需要则不显示弹窗</view>\n</view>\n<Privacy />"
},
{
"path": "pages/index/index.wxss",
"chars": 173,
"preview": ".tips{\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n display: flex;\n justify-content"
},
{
"path": "project.config.json",
"chars": 644,
"preview": "{\n \"compileType\": \"miniprogram\",\n \"setting\": {\n \"coverView\": true,\n \"es6\": true,\n \"postcss\": "
},
{
"path": "project.private.config.json",
"chars": 329,
"preview": "{\n \"description\": \"项目私有配置文件。此文件中的内容将覆盖 project.config.json 中的相同字段。项目的改动优先同步到此文件中。详见文档:https://developers.weixin.qq.co"
},
{
"path": "sitemap.json",
"chars": 159,
"preview": "{\n \"desc\": \"关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html\",\n \"rules\": [{\n "
}
]
About this extraction
This page contains the full source code of the 94xy/miniprogram-privacy GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 18 files (7.7 KB), approximately 2.5k tokens, and a symbol index with 7 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.