From a20811d5bbe06e2fd500363c61512f6f47aa120b Mon Sep 17 00:00:00 2001
From: JinxChen <2183691628@qq.com>
Date: Wed, 13 Sep 2023 16:42:58 +0800
Subject: [PATCH] =?UTF-8?q?=20=20=20=20##=20=E5=8A=9F=E8=83=BD=E6=9B=B4?=
=?UTF-8?q?=E6=96=B0=20=20=20=20=20-=20=E6=9B=B4=E6=96=B0=E5=86=85?=
=?UTF-8?q?=E5=AE=B9=20=20=20=20=20=20=20=20=20-=20A=20=E5=A2=9E=E5=8A=A0?=
=?UTF-8?q?=20=E8=BF=9B=E5=85=A5=E9=A6=96=E9=A1=B5=E8=8E=B7=E5=8F=96wifi?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=97=B6=E9=9A=90=E7=A7=81=E5=8D=8F=E8=AE=AE?=
=?UTF-8?q?=E6=8F=90=E7=A4=BA=E5=BC=B9=E7=AA=97=20=20=20=20=20=20=20=20=20?=
=?UTF-8?q?-=20A=20=E5=A2=9E=E5=8A=A0=20=E4=B8=80=E4=B8=AA=E9=9A=90?=
=?UTF-8?q?=E7=A7=81=E5=8D=8F=E8=AE=AE=E5=BC=B9=E7=AA=97=E7=BB=84=E4=BB=B6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
miniprogram/app.json | 6 +-
.../components/UserPrivacyDialog/index.js | 60 ++++++++++++++++
.../components/UserPrivacyDialog/index.json | 3 +
.../components/UserPrivacyDialog/index.wxml | 12 ++++
.../components/UserPrivacyDialog/index.wxss | 68 +++++++++++++++++++
miniprogram/model/index.js | 2 +-
miniprogram/pages/home/home.js | 19 +++++-
miniprogram/pages/home/home.json | 7 +-
miniprogram/pages/home/home.wxml | 1 +
miniprogram/project.private.config.json | 2 +-
miniprogram/readme.md | 10 ++-
11 files changed, 182 insertions(+), 8 deletions(-)
create mode 100644 miniprogram/components/UserPrivacyDialog/index.js
create mode 100644 miniprogram/components/UserPrivacyDialog/index.json
create mode 100644 miniprogram/components/UserPrivacyDialog/index.wxml
create mode 100644 miniprogram/components/UserPrivacyDialog/index.wxss
diff --git a/miniprogram/app.json b/miniprogram/app.json
index b0e8d37..4244152 100644
--- a/miniprogram/app.json
+++ b/miniprogram/app.json
@@ -1,7 +1,8 @@
{
"pages": [
"pages/home/home",
- "pages/more/more"
+ "pages/more/more",
+ "components/UserPrivacyDialog/index"
],
"permission": {
"scope.userLocation": {
@@ -39,5 +40,6 @@
},
"debug": true,
"sitemapLocation": "sitemap.json",
- "lazyCodeLoading": "requiredComponents"
+ "lazyCodeLoading": "requiredComponents",
+ "__usePrivacyCheck__": true
}
\ No newline at end of file
diff --git a/miniprogram/components/UserPrivacyDialog/index.js b/miniprogram/components/UserPrivacyDialog/index.js
new file mode 100644
index 0000000..c7e4392
--- /dev/null
+++ b/miniprogram/components/UserPrivacyDialog/index.js
@@ -0,0 +1,60 @@
+Component({
+ /**
+ * 组件的初始数据
+ */
+ data: {
+ privacyContractName: '',
+ showPrivacy: false
+ },
+ properties: {
+
+ },
+ /**
+ * 组件的生命周期
+ */
+ pageLifetimes: {
+ show() {
+ const that = this
+ wx.getPrivacySetting({
+ success(res) {
+ if (res.errMsg == "getPrivacySetting:ok") {
+ that.setData({
+ privacyContractName: res.privacyContractName,
+ showPrivacy: res.needAuthorization
+ })
+ }
+ }
+ })
+ }
+ },
+ /**
+ * 组件的方法列表
+ */
+ methods: {
+ // 打开隐私协议页面
+ openPrivacyContract() {
+ wx.openPrivacyContract({
+ fail: () => {
+ wx.showToast({
+ title: '出错了',
+ icon: 'error'
+ })
+ }
+ })
+ },
+ // 拒绝隐私协议
+ exitMiniProgram() {
+ // 直接退出小程序
+ wx.exitMiniProgram();
+ },
+ // 同意隐私协议
+ handleAgreePrivacyAuthorization() {
+ const that = this;
+ that.setData({
+ showPrivacy: false
+ });
+ // 同意后加载wifi模块
+ this.triggerEvent('onStartWifi');
+ },
+ },
+})
\ No newline at end of file
diff --git a/miniprogram/components/UserPrivacyDialog/index.json b/miniprogram/components/UserPrivacyDialog/index.json
new file mode 100644
index 0000000..3928faa
--- /dev/null
+++ b/miniprogram/components/UserPrivacyDialog/index.json
@@ -0,0 +1,3 @@
+{
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/miniprogram/components/UserPrivacyDialog/index.wxml b/miniprogram/components/UserPrivacyDialog/index.wxml
new file mode 100644
index 0000000..0b5277c
--- /dev/null
+++ b/miniprogram/components/UserPrivacyDialog/index.wxml
@@ -0,0 +1,12 @@
+
+
+ 隐私保护指引
+
+ 在使用当前小程序服务之前,请仔细阅读{{privacyContractName}}。如你同意{{privacyContractName}},请点击“同意”开始使用。
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/miniprogram/components/UserPrivacyDialog/index.wxss b/miniprogram/components/UserPrivacyDialog/index.wxss
new file mode 100644
index 0000000..0a3019f
--- /dev/null
+++ b/miniprogram/components/UserPrivacyDialog/index.wxss
@@ -0,0 +1,68 @@
+.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: 15rpx;
+ box-sizing: border-box;
+ border: none;
+}
+
+.btns .reject {
+ background: #f4f4f5;
+ color: #909399;
+}
+
+.btns .agree {
+ background: #07c160;
+ color: #fff;
+ margin-left: 20rpx;
+}
\ No newline at end of file
diff --git a/miniprogram/model/index.js b/miniprogram/model/index.js
index 42bc6f2..9132356 100644
--- a/miniprogram/model/index.js
+++ b/miniprogram/model/index.js
@@ -1 +1 @@
-export const VersionModel = '2.0.3F';
\ No newline at end of file
+export const VersionModel = '2.0.4F';
\ No newline at end of file
diff --git a/miniprogram/pages/home/home.js b/miniprogram/pages/home/home.js
index fc615d1..7aaa253 100644
--- a/miniprogram/pages/home/home.js
+++ b/miniprogram/pages/home/home.js
@@ -23,9 +23,23 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
- this.onStartWifi();
this.checkOptions(options);
this.getAuth();
+ this.getPrivacySetting();
+ },
+ // 获取用户隐私协议授权状态
+ getPrivacySetting() {
+ const that = this
+ wx.getPrivacySetting({
+ success(res) {
+ if (res.errMsg == "getPrivacySetting:ok") {
+ if(!res.needAuthorization) {
+ // 如果已经授权,加载wifi模块
+ that.onStartWifi();
+ }
+ }
+ }
+ })
},
onHide() {
// 点击小程序右上角的关闭按钮时清空authToken
@@ -61,6 +75,9 @@ Page({
console.log("error", error);
})
},
+ agreePrivacy() {
+ this.onStartWifi();
+ },
// 检查并获取从微信公众号传过来的参数
checkOptions(options) {
// todo 获取从微信公众号跳转的参数
diff --git a/miniprogram/pages/home/home.json b/miniprogram/pages/home/home.json
index 72cceb5..95e8c29 100644
--- a/miniprogram/pages/home/home.json
+++ b/miniprogram/pages/home/home.json
@@ -1,3 +1,6 @@
{
- "navigationBarTitleText": "首页"
- }
+ "navigationBarTitleText": "首页",
+ "usingComponents": {
+ "UserPrivacyDialog": "/components/UserPrivacyDialog/index"
+ }
+}
\ No newline at end of file
diff --git a/miniprogram/pages/home/home.wxml b/miniprogram/pages/home/home.wxml
index 09fef15..4192ceb 100644
--- a/miniprogram/pages/home/home.wxml
+++ b/miniprogram/pages/home/home.wxml
@@ -28,4 +28,5 @@
+
\ No newline at end of file
diff --git a/miniprogram/project.private.config.json b/miniprogram/project.private.config.json
index 0a9e27b..629db68 100644
--- a/miniprogram/project.private.config.json
+++ b/miniprogram/project.private.config.json
@@ -18,5 +18,5 @@
]
}
},
- "libVersion": "2.28.1"
+ "libVersion": "2.33.0"
}
\ No newline at end of file
diff --git a/miniprogram/readme.md b/miniprogram/readme.md
index e2428ca..ab9924d 100644
--- a/miniprogram/readme.md
+++ b/miniprogram/readme.md
@@ -22,4 +22,12 @@
- 2023.9.2
## 功能更新
- 更新内容
- - A 增加 保存WIFI信息成功后自动关闭当前小程序
\ No newline at end of file
+ - A 增加 保存WIFI信息成功后自动关闭当前小程序
+
+
+- 2.0.4
+ - 2023.9.13
+ ## 功能更新
+ - 更新内容
+ - A 增加 进入首页获取wifi信息时隐私协议提示弹窗
+ - A 增加 一个隐私协议弹窗组件
\ No newline at end of file