浏览代码

## 功能更新

- 更新内容
        - A 增加 进入首页获取wifi信息时隐私协议提示弹窗
        - A 增加 一个隐私协议弹窗组件
develop^2
JinxChen 1年前
父节点
当前提交
a20811d5bb
共有 11 个文件被更改,包括 182 次插入8 次删除
  1. +4
    -2
      miniprogram/app.json
  2. +60
    -0
      miniprogram/components/UserPrivacyDialog/index.js
  3. +3
    -0
      miniprogram/components/UserPrivacyDialog/index.json
  4. +12
    -0
      miniprogram/components/UserPrivacyDialog/index.wxml
  5. +68
    -0
      miniprogram/components/UserPrivacyDialog/index.wxss
  6. +1
    -1
      miniprogram/model/index.js
  7. +18
    -1
      miniprogram/pages/home/home.js
  8. +5
    -2
      miniprogram/pages/home/home.json
  9. +1
    -0
      miniprogram/pages/home/home.wxml
  10. +1
    -1
      miniprogram/project.private.config.json
  11. +9
    -1
      miniprogram/readme.md

+ 4
- 2
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
}

+ 60
- 0
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');
},
},
})

+ 3
- 0
miniprogram/components/UserPrivacyDialog/index.json 查看文件

@@ -0,0 +1,3 @@
{
"usingComponents": {}
}

+ 12
- 0
miniprogram/components/UserPrivacyDialog/index.wxml 查看文件

@@ -0,0 +1,12 @@
<view class="privacy" wx:if="{{showPrivacy}}">
<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>

+ 68
- 0
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;
}

+ 1
- 1
miniprogram/model/index.js 查看文件

@@ -1 +1 @@
export const VersionModel = '2.0.3F';
export const VersionModel = '2.0.4F';

+ 18
- 1
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 获取从微信公众号跳转的参数


+ 5
- 2
miniprogram/pages/home/home.json 查看文件

@@ -1,3 +1,6 @@
{
"navigationBarTitleText": "首页"
}
"navigationBarTitleText": "首页",
"usingComponents": {
"UserPrivacyDialog": "/components/UserPrivacyDialog/index"
}
}

+ 1
- 0
miniprogram/pages/home/home.wxml 查看文件

@@ -28,4 +28,5 @@
<view class="footer">
<image class="help" src="../../images/icon/help.png"></image><text bindtap="onHelp">搜索不到WLAN</text>
</view>
<UserPrivacyDialog bind:onStartWifi='onStartWifi'></UserPrivacyDialog>
</view>

+ 1
- 1
miniprogram/project.private.config.json 查看文件

@@ -18,5 +18,5 @@
]
}
},
"libVersion": "2.28.1"
"libVersion": "2.33.0"
}

+ 9
- 1
miniprogram/readme.md 查看文件

@@ -22,4 +22,12 @@
- 2023.9.2
## 功能更新
- 更新内容
- A 增加 保存WIFI信息成功后自动关闭当前小程序
- A 增加 保存WIFI信息成功后自动关闭当前小程序


- 2.0.4
- 2023.9.13
## 功能更新
- 更新内容
- A 增加 进入首页获取wifi信息时隐私协议提示弹窗
- A 增加 一个隐私协议弹窗组件

正在加载...
取消
保存