小程序用户协议页面实现
小程序用户协议页面设计思路
- 新增用户协议页面
- 首页加载(
onLoad()
)的时候,检查是否已经同意过,没有的话则弹出用户协议界面。点击详情跳转到用户协议页面(使用wx.navigateTo
) - 用户点击同意后,才能继续使用小程序,并且保存到storage
效果图如下
控制显示用户协议窗口
在首页新增一个view,根据全局userAgree
的值,决定是否显示弹窗
1 2 3 4 5 6 7 8 9 10 11 12 |
<view wx:if='{{userAgree==false}}'><view catchtouchmove="catchtouchmove" class="tips"><view class="tips_box"><view class="hint_view"><view class="text"><view class="hint1" bindtap='goToUserLicence'>点击查看《xx小程序》使用协议</view></view></view><button bindtap='tipAgree' class="agreeBtn" type='primary'>我已阅读并同意</button></view></view> </view> |
因此要在首页增加一个全局变量
1 2 |
// 用户协议 var userAgree = false |
更新onLoad()
事件从storage读取userAgree
字段
1 2 3 4 5 |
var that = this var userAgree = wx.getStorageSync('userAgree') || false that.setData({userAgree }) |
因为用户协议很长,因此点击查看会导航到另一个页面
1 2 3 4 5 6 7 8 |
goToUserLicence: function(){wx.navigateTo({url: '/pages/licence/licence',success: function(res) {},fail: function(res) {},complete: function(res) {},}) } |
首页用户协议弹窗用到的css
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
.tips {display: flex;justify-content: center;align-items: center;position: fixed;left: 0;top: 0;z-index: 100;width: 100%;height: 100%;background: rgba(0,0,0,0.7); }.tips .tips_box {display: flex;flex-direction: column;align-items: center;width: 75%;height: auto;border-radius: 45rpx;background: #fff;overflow: hidden; }.tips .tips_box .hint_view {display: flex;align-items: center; }.tips .tips_box .hint_view .text {display: flex;flex-direction: column;margin: 12rpx 24rpx; }.tips .tips_box .hint1 {margin-top: 38rpx;text-align: center;font-size: 30rpx;color: #1a1a1a;line-height:52rpx;border-bottom:1px solid; }.agreeBtn {display: flex;justify-content: center;align-items: center;margin: 32rpx 0 32px;width: 70%;line-height: 64rpx;border-radius: 80rpx;font-size: 32rpx;letter-spacing: 6rpx;color: #fff; } .isTipShow {display: block; }.isTipHide {display: none; } |
用户协议页面设计
作为Java后端架构汪,写起前端页面也就hehehe的水平,仅供参考。
css在线调试,用到这个工具 https://tool.chinaz.com/tools/cssdesigner.aspx
licence.wxml
1 2 3 4 5 6 7 8 9 10 11 12 13 |
<view><view class='title'>用户授权协议</view><view class='h1'>使用条款及声明</view><view>xxx</view><view class='h1'>小程序用途</view><view>yyy</view> <view> |
licence.wxss
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
/* pages/licence/licence.wxss */.title {text-align: center;font-size: 20pt;font-weight : bold;margin: 20px; }.h1 {text-align: left;font-size: 16pt;margin: 10px; } |
参考
- 小程序开发:在登录时弹窗用户使用协议
https://ycwu314.github.io/p/minapp-user-licence-implementation/
小程序用户协议页面实现相关推荐
- 微信小程序 用户协议和隐私协议
<template><view class="myOne"><view class="my-div"><text cl ...
- 微信小程序 解决内层页面分享出去后 用户无法通过分享页面返回首页问题
微信小程序 解决内层页面分享出去后 用户无法通过分享页面返回首页问题 本质就是设置一个变量isshare来判断是否是分享页面中进入的 data设置 isshare: 0,//不是分享页面进入 js o ...
- vue和小程序哪个好学一点_litemall,Spring Boot后端,微信小程序用户前端 + Vue用户移动端...
litemall 又一个小商场系统. litemall = Spring Boot后端 + Vue管理员前端 + 微信小程序用户前端 + Vue用户移动端 注意: 由于第一次加载数据量较大,建议wif ...
- 【微信小程序控制硬件⑦ 进阶篇】动起来做一个微信小程序Mqtt协议控制智能硬件的框架,为心里全栈工程师梦想浇水。
文章目录 一.前言: 二.涉及的技术点: 三.框架的运行原理: 四.框架代码流程: 4.1 主线程: 4.2 获取设备列表显示设备,以及订阅在线的设备: 4.3 点击某设备如何实现携带此设备信息到控制 ...
- 微信小程序开发教程第七章:微信小程序编辑名片页面开发
前面我们更新了六篇的微信小程序开发教程,现在更新第七章:微信小程序编辑名片页面开发,(第一二章:微信小程序开发教程,第三四章:微信小程序项目结构以及配置&微信小程序首页面开发,第五章:微信小程 ...
- 小程序内嵌h5页面分享_微信小程序webview内页面分享
因为项目原因,之前在微信小程序内部使用 webview 嵌套了 h5 页面,现在要添加一个新的功能,用户在哪个页面进行了分享,被分享的用户从链接进来就跳转到哪个分享页面. 先了解一下 web-view ...
- 小程序用户拒绝授权解决方法
众所周知,小程序进入首先都要进行微信授权的,那万一用户不小心点了拒绝按钮怎么办呢?不要慌,官方早已预料到此情况,并提供了api供开发者使用,下面就一起来研究下api吧 一.API接口 wx.openS ...
- webform窗体怎么实现session唯一标识_微信小程序用户登录和登录态维护的实现_javascript技巧...
这篇文章主要介绍了微信小程序用户登录和登录态维护的实现,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧 让用户登录,标识用户和获取 ...
- 微信小程序webview内页面分享
因为项目原因,之前在微信小程序内部使用 webview 嵌套了 h5 页面,现在要添加一个新的功能,用户在哪个页面进行了分享,被分享的用户从链接进来就跳转到哪个分享页面. 先了解一下 web-view ...
最新文章
- 跟踪算法基准--Tracking the Trackers: An Analysis of the State of the Art in Multiple Object Tracking
- Spark 把RDD数据保存到hdfs单个文件中,而不是目录
- Minionda3环境的迁移
- 安卓性能测试之 adb shell 常用命令
- python树莓派设备_Python+树莓派制作IoT(物联网)门控设备
- VMware 当中出现:无法将 Ethernet0 连接到虚拟网络VMnet8的问题
- RSA非对称加密算法的安全性何在
- glide 压缩图拍呢_用Glide-图片的压缩-图片压缩原理
- java equals方法可变_java中equals方法和“==”的区别
- VsCode 配置java环境(详细教程)
- Linux应急响应入侵排查思路
- 双光耦开关电源电路图_双路输出回扫式开关电源电路图
- 远程智能开关安装方法
- 【raft】学习六:etcd/raft 选举和选举优化
- 考研二战日记-第34天——高数6.2可分离变量的微分方程
- 在计算机硬盘使用前需要做的工作是,工作电脑的硬盘该如何保养
- 某微信公众号运营数据分析报告
- 【深度学习】BioBERT文章翻译及个人感悟
- docker portainer agent 安装
- LocalDateTime获取服务器当前时间----24小时与12小时