提交 059a90cb 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: study夏羽

新增app端列表页面使用原生list下拉刷新

上级 a27daf0a
<script> <script>
import initApp from '@/common/appInit.js'; import initApp from '@/common/appInit.js';
import openApp from '@/common/openApp.js'; import openApp from '@/common/openApp.js';
import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js'; import checkIsAgree from '@/pages/uni-agree/utils/uni-agree.js';
export default { export default {
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
}, },
onLaunch: function() { onLaunch: function() {
console.log('App Launch') console.log('App Launch')
this.globalData.$i18n = this.$i18n this.globalData.$i18n = this.$i18n
this.globalData.$t = str => this.$t(str) this.globalData.$t = str => this.$t(str)
......
...@@ -42,16 +42,16 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、.. ...@@ -42,16 +42,16 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、..
- 新闻的搜索、列表、详情、分享。通过clientDB实现,开发者直接修改定义的表名等参数,即可轻松改为自己的业务 - 新闻的搜索、列表、详情、分享。通过clientDB实现,开发者直接修改定义的表名等参数,即可轻松改为自己的业务
- 可覆盖原生层的分享菜单 - 可覆盖原生层的分享菜单
- h5版在页面顶部(全局悬浮)引导用户点击下载App - h5版在页面顶部(全局悬浮)引导用户点击下载App
- 营销裂变:点击“分销推荐”,生成带用户inviteCode参数的应用下载页(H5),一键分享到微信或微信朋友圈等。被邀请人打开下载页面点击下载,设备剪贴板的内容会被自动设置为邀请者的inviteCode。被邀请人下载app之后通过任何方式登陆(含:注册并登陆),uni-starter框架会自动获取设备剪切板中的inviteCode提交到服务端绑定关联关系。 - 营销裂变:点击“分销推荐”,生成带用户inviteCode参数的应用下载页(H5),一键分享到微信或微信朋友圈等。被邀请人打开下载页面点击下载,设备剪贴板的内容会被自动设置为邀请者的inviteCode。被邀请人下载app之后通过任何方式登录(含:注册并登录),uni-starter框架会自动获取设备剪切板中的inviteCode提交到服务端绑定关联关系。
6. 更好的性能:首页采用nvue,fast编译模式,加快App端启动速度 6. 更好的性能:首页采用nvue,fast编译模式,加快App端启动速度
7. 内置拦截器: 7. 内置拦截器:
- 页面路由拦截,配置需强制登录的页面;打开时自动检测`token`若无效就自动跳转到登录页 - 页面路由拦截,配置需强制登录的页面;打开时自动检测`token`若无效就自动跳转到登录页
- 调用云函数(callFunction)拦截器,自动携带必要参数、自动处理响应体。详见9.自动完成1-2 - 调用云函数(callFunction)拦截器,自动携带必要参数、自动处理响应体。详见9.自动完成1-2
8. 自动完成: 8. 自动完成:
- 分析uniCloud.callfunction和clientDB操作的响应体,判断code执行对应的操作如跳转到登页,自动续期token - 分析uniCloud.callfunction和clientDB操作的响应体,判断code执行对应的操作如跳转到登页,自动续期token
- 操作注册/登操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device - 操作注册/登操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device
- 异常恢复处理:断网恢复后自动重连“因网络错误导致的”网络请求 - 异常恢复处理:断网恢复后自动重连“因网络错误导致的”网络请求
- 为迎合苹果App Store的规则,登陆与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登陆和微信分享选项 - 为迎合苹果App Store的规则,登录与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登录和微信分享选项
* 更多功能模块会不断更新,请持续关注本插件 * 更多功能模块会不断更新,请持续关注本插件
...@@ -67,7 +67,7 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、.. ...@@ -67,7 +67,7 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、..
## 功能模块介绍 ## 功能模块介绍
### 1.登录模块 ### 1.登录模块
|登类型 |描述 | |登类型 |描述 |
|-- |-- | |-- |-- |
|smsCode |验证码登录 | |smsCode |验证码登录 |
|univerify |读取手机SIM卡一键登录 | |univerify |读取手机SIM卡一键登录 |
...@@ -84,7 +84,7 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、.. ...@@ -84,7 +84,7 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、..
} }
``` ```
#### 启用登方式 #### 启用登方式
如上示例配置为:`["username","smsCode"]` 表示启用:验证码登录、账号密码登录。 如上示例配置为:`["username","smsCode"]` 表示启用:验证码登录、账号密码登录。
同理配置为:`["weixin","username","smsCode"]` 则表示启用:微信登录、验证码登录、账号密码登录。 同理配置为:`["weixin","username","smsCode"]` 则表示启用:微信登录、验证码登录、账号密码登录。
...@@ -92,11 +92,11 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、.. ...@@ -92,11 +92,11 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、..
总结:需要几项列举几项即可。 总结:需要几项列举几项即可。
#### 优先级 #### 优先级
在uni-starter框架中执行`uni.navigateTo({url: "/pages/ucenter/login-page/index/index"})`,会根据配置跳转到相应的登页面。如果配置内容为:`["username","smsCode"]`会自动切换到"配置的第0项,也就是`username`类型的登录方式对应的页面”,即`账户登录`方式页面,路径:`/pages/ucenter/login-page/pwd-login/pwd-login` 在uni-starter框架中执行`uni.navigateTo({url: "/pages/ucenter/login-page/index/index"})`,会根据配置跳转到相应的登页面。如果配置内容为:`["username","smsCode"]`会自动切换到"配置的第0项,也就是`username`类型的登录方式对应的页面”,即`账户登录`方式页面,路径:`/pages/ucenter/login-page/pwd-login/pwd-login`
#### 平台差异性配置 #### 平台差异性配置
这里支持用[条件编译](https://uniapp.dcloud.io/platform?id=%e6%9d%a1%e4%bb%b6%e7%bc%96%e8%af%91)因此你可以配置在不同平台下拥有的登录方式。 这里支持用[条件编译](https://uniapp.dcloud.io/platform?id=%e6%9d%a1%e4%bb%b6%e7%bc%96%e8%af%91)因此你可以配置在不同平台下拥有的登录方式。
如下配置,即表示仅在APP端启用“短信验证码登 如下配置,即表示仅在APP端启用“短信验证码登
```js ```js
"login": [ "login": [
"username","univerify","weixin","apple" "username","univerify","weixin","apple"
...@@ -107,8 +107,8 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、.. ...@@ -107,8 +107,8 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、..
``` ```
#### 生效策略 #### 生效策略
陆方式有如上5种,虽然你希望有几种登陆方式就在配置中列举几种。但是有的登陆方式可能因为设备环境问题而不被支持; 录方式有如上5种,虽然你希望有几种登录方式就在配置中列举几种。但是有的登录方式可能因为设备环境问题而不被支持;
比如你正确地配置了微信登陆,而用户的手机并没有安装微信,这样微信登陆功能就无法使用。 比如你正确地配置了微信登录,而用户的手机并没有安装微信,这样微信登录功能就无法使用。
并且如果出现这种情况你的app会被iOS的App Store拒绝上架。 并且如果出现这种情况你的app会被iOS的App Store拒绝上架。
所以在这里,我们的生效策略在检测:你是否有列举到某个配置项为前提的情况下,增加了检测当前环境是否支持,如果不支持会自动隐藏。 所以在这里,我们的生效策略在检测:你是否有列举到某个配置项为前提的情况下,增加了检测当前环境是否支持,如果不支持会自动隐藏。
...@@ -117,11 +117,11 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、.. ...@@ -117,11 +117,11 @@ APP有很多通用的功能,比如登录注册、头像、设置、banner、..
+ 一键登录: + 一键登录:
[开通配置](https://dev.dcloud.net.cn/uniLogin) [开通配置](https://dev.dcloud.net.cn/uniLogin)
[使用指南](https://uniapp.dcloud.io/univerify) [使用指南](https://uniapp.dcloud.io/univerify)
+ [苹果登集成指南](https://ask.dcloud.net.cn/article/36651) + [苹果登集成指南](https://ask.dcloud.net.cn/article/36651)
+ 短信登 + 短信登
使用本功能需要在[DCloud开发者中心](https://dev.dcloud.net.cn/uniSms)开通并充值 使用本功能需要在[DCloud开发者中心](https://dev.dcloud.net.cn/uniSms)开通并充值
教程参考[短信服务开通指南](https://ask.dcloud.net.cn/article/37534) 教程参考[短信服务开通指南](https://ask.dcloud.net.cn/article/37534)
修改短信注册/登发生验证码的模板id,在文件`/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js` 搜索 `const templateId = '11753'` 替换为自己申请的模板id 修改短信注册/登发生验证码的模板id,在文件`/uniCloud-aliyun/cloudfunctions/uni-id-cf/index.js` 搜索 `const templateId = '11753'` 替换为自己申请的模板id
#### 服务端配置 #### 服务端配置
uni-starter服务端使用[uni-config-center](https://ext.dcloud.net.cn/plugin?id=4425)统一管理这些配置, uni-starter服务端使用[uni-config-center](https://ext.dcloud.net.cn/plugin?id=4425)统一管理这些配置,
...@@ -130,16 +130,16 @@ uni-starter服务端使用[uni-config-center](https://ext.dcloud.net.cn/plugin?i ...@@ -130,16 +130,16 @@ uni-starter服务端使用[uni-config-center](https://ext.dcloud.net.cn/plugin?i
### 2.路由拦截 ### 2.路由拦截
#### 应用场景 #### 应用场景
有些页面,限允许已经登后用户才访问。 有些页面,限允许已经登后用户才访问。
常规的做法是打开这类页面之前,检查(前端校验)uni_id_token的值是否有效,如果无效会自动跳转到登页面。 常规的做法是打开这类页面之前,检查(前端校验)uni_id_token的值是否有效,如果无效会自动跳转到登页面。
而这样的页面有很多,入口也不少。面向过程的写法会产生大量的代码冗余,且不易维护。 而这样的页面有很多,入口也不少。面向过程的写法会产生大量的代码冗余,且不易维护。
而uni-starter基于拦截器(`uni.addInterceptor`),提供了仅需简单配置即可实现的路由拦截功能。 而uni-starter基于拦截器(`uni.addInterceptor`),提供了仅需简单配置即可实现的路由拦截功能。
#### 配置方式 #### 配置方式
支持两种模式(二选一) 支持两种模式(二选一)
##### 黑名单模式 ##### 黑名单模式
列举需要强制登的页面完整路径(支持正则) 列举需要强制登的页面完整路径(支持正则)
##### 白名单模式 ##### 白名单模式
列举不需要强制登即可访问的页面完整路径(支持正则) 列举不需要强制登即可访问的页面完整路径(支持正则)
#### 配置示例 #### 配置示例
配置文件:`项目根目录/uni-starter.config.js` 配置文件:`项目根目录/uni-starter.config.js`
...@@ -173,8 +173,8 @@ uni-starter服务端使用[uni-config-center](https://ext.dcloud.net.cn/plugin?i ...@@ -173,8 +173,8 @@ uni-starter服务端使用[uni-config-center](https://ext.dcloud.net.cn/plugin?i
为此`uni-starter`基于`uni.addInterceptor`(拦截器)实现路由管理。 为此`uni-starter`基于`uni.addInterceptor`(拦截器)实现路由管理。
##### 注意: ##### 注意:
- uni-starter的路由拦截,仅在调用路由API(navigateTo、redirectTo、reLaunch、switchTab)时触发。应用的首页是由系统自动打开,不会触发拦截器。首页需要强制登陆才能访问的场景,不由路由控制。但不用担心,如果未登陆的用户,打开了需要登陆才能访问页面,必定会触发需要携带有效token才能访问的API。此时则会返回相应的响应体,uni-starter监测到token无效这类的响应体也会自动跳转到登陆页(这种效果需要前后端都开发完成才体验到)。 - uni-starter的路由拦截,仅在调用路由API(navigateTo、redirectTo、reLaunch、switchTab)时触发。应用的首页是由系统自动打开,不会触发拦截器。首页需要强制登录才能访问的场景,不由路由控制。但不用担心,如果未登录的用户,打开了需要登录才能访问页面,必定会触发需要携带有效token才能访问的API。此时则会返回相应的响应体,uni-starter监测到token无效这类的响应体也会自动跳转到登录页(这种效果需要前后端都开发完成才体验到)。
- uni-starter框架不能将登`/pages/ucenter/login-page/index/index`设置为首页,否则由拦截器实现的路由管理将生效。 - uni-starter框架不能将登`/pages/ucenter/login-page/index/index`设置为首页,否则由拦截器实现的路由管理将生效。
- 拦截器实现的路由控制,是在路由跳转未完成之前触发。路由切换方式(navigateTo、redirectTo、reLaunch、switchTab)URL参数必须使用绝对路径路 - 拦截器实现的路由控制,是在路由跳转未完成之前触发。路由切换方式(navigateTo、redirectTo、reLaunch、switchTab)URL参数必须使用绝对路径路
### 3.h5版在页面顶部引导用户`点击下载App` ### 3.h5版在页面顶部引导用户`点击下载App`
...@@ -268,11 +268,11 @@ uni-starter集成了这个功能,你只需直接在`项目根目录/uni-starte ...@@ -268,11 +268,11 @@ uni-starter集成了这个功能,你只需直接在`项目根目录/uni-starte
} }
``` ```
2. 断网自动重试,当callFunction为fail时检测是否因断网引起。如果是会提醒用户并且会在恢复网络之后自动重新发起请求 2. 断网自动重试,当callFunction为fail时检测是否因断网引起。如果是会提醒用户并且会在恢复网络之后自动重新发起请求
3. 常规的errCoder自动执行对应程序,如token无效/过期自动跳转到登页面。 3. 常规的errCoder自动执行对应程序,如token无效/过期自动跳转到登页面。
4. token自动续期。 4. token自动续期。
### 11.举例路由控制原理,深入了解拦截器的使用 ### 11.举例路由控制原理,深入了解拦截器的使用
比如你希望在打开用户中心等页面之前,都检查一下该用户是否登陆,否则就重定向到登陆页面。使用拦截器你可以用以下写法在应用入口定义全局生效: 比如你希望在打开用户中心等页面之前,都检查一下该用户是否登录,否则就重定向到登录页面。使用拦截器你可以用以下写法在应用入口定义全局生效:
```js ```js
//定义各个页面,这里为了演示uni-starter框架是把该定义写在全局配置uni-starter.config.js中 //定义各个页面,这里为了演示uni-starter框架是把该定义写在全局配置uni-starter.config.js中
...@@ -284,7 +284,7 @@ uni-starter集成了这个功能,你只需直接在`项目根目录/uni-starte ...@@ -284,7 +284,7 @@ uni-starter集成了这个功能,你只需直接在`项目根目录/uni-starte
const token = uni.getStorageSync('uni_id_token') const token = uni.getStorageSync('uni_id_token')
//获取当前页面路径(即url去掉"?"和"?"后的参数) //获取当前页面路径(即url去掉"?"和"?"后的参数)
const url = e.url.split('?')[0] const url = e.url.split('?')[0]
//判断要打开的页面是否需要验证登 //判断要打开的页面是否需要验证登
if (needLogin.includes(url) && token == '') { if (needLogin.includes(url) && token == '') {
uni.showToast({ uni.showToast({
title: '该页面需要登录才能访问,请先登录', title: '该页面需要登录才能访问,请先登录',
...@@ -302,7 +302,7 @@ uni-starter集成了这个功能,你只需直接在`项目根目录/uni-starte ...@@ -302,7 +302,7 @@ uni-starter集成了这个功能,你只需直接在`项目根目录/uni-starte
}) })
``` ```
- 而路由跳转方法不仅有`uni.navigateTo`还有`uni.redirectTo`,`uni.reLaunch`,`uni.switchTab` - 而路由跳转方法不仅有`uni.navigateTo`还有`uni.redirectTo`,`uni.reLaunch`,`uni.switchTab`
- 另外我们还希望控制直接跳转至哪种登类型 - 另外我们还希望控制直接跳转至哪种登类型
所以在uni-starter框架中我们这样定义: 所以在uni-starter框架中我们这样定义:
uni-starter/common/appInit.js 的第228-280行 uni-starter/common/appInit.js 的第228-280行
```js ```js
...@@ -315,7 +315,7 @@ uni-starter/common/appInit.js 的第228-280行 ...@@ -315,7 +315,7 @@ uni-starter/common/appInit.js 的第228-280行
const token = uni.getStorageSync('uni_id_token') const token = uni.getStorageSync('uni_id_token')
//获取当前页面路径(即url去掉"?"和"?"后的参数) //获取当前页面路径(即url去掉"?"和"?"后的参数)
const url = e.url.split('?')[0] const url = e.url.split('?')[0]
//判断要打开的页面是否需要验证登 //判断要打开的页面是否需要验证登
if (needLogin.includes(url) && token == '') { if (needLogin.includes(url) && token == '') {
uni.showToast({ uni.showToast({
title: '该页面需要登录才能访问,请先登录', title: '该页面需要登录才能访问,请先登录',
...@@ -554,6 +554,13 @@ uni-starter ...@@ -554,6 +554,13 @@ uni-starter
1. 提示“公共模块uni-id缺少配置信息”解决方案:在cloudfunctions右键‘上传所有云函数、公共模块及actions’之后,需要在cloudfunctions -> common -> uni-config-center 目录单独上传一次,右键‘上传公共模块’。 1. 提示“公共模块uni-id缺少配置信息”解决方案:在cloudfunctions右键‘上传所有云函数、公共模块及actions’之后,需要在cloudfunctions -> common -> uni-config-center 目录单独上传一次,右键‘上传公共模块’。
2. 本项目代码可以商用,无需为DCloud付费。但不能把本项目的代码改造用于非uni-app和uniCloud的技术体系。即,不能将后台改成php、java等其他后台,这将违反使用许可协议。 2. 本项目代码可以商用,无需为DCloud付费。但不能把本项目的代码改造用于非uni-app和uniCloud的技术体系。即,不能将后台改成php、java等其他后台,这将违反使用许可协议。
## 相关案例
[
![](https://vkceyugu.cdn.bspapp.com/VKCEYUGU-f184e7c3-1912-41b2-b81f-435d1b37c7b4/dd4c366f-6165-46c0-8500-5a679d7e5463.jpg)
](https://ext.dcloud.net.cn/search?q=uni-starter)
(点击跳转到案例列表)
## 第三方插件(感谢插件作者,排名不分前后): ## 第三方插件(感谢插件作者,排名不分前后):
1. 图片裁剪 [limeClipper](https://ext.dcloud.net.cn/plugin?id=3594) @作者: 陌上华年 1. 图片裁剪 [limeClipper](https://ext.dcloud.net.cn/plugin?id=3594) @作者: 陌上华年
2. 二维码生成 [Sansnn-uQRCode](https://ext.dcloud.net.cn/plugin?id=1287) @作者: 3snn 2. 二维码生成 [Sansnn-uQRCode](https://ext.dcloud.net.cn/plugin?id=1287) @作者: 3snn
......
## 1.1.21(2021-11-10)
新增app端列表页面使用原生list下拉刷新
## 1.1.20(2021-11-08)
修复vue3版某些情况下i18n报错的问题
## 1.1.19(2021-11-08)
配置文件`uni-starter.config.js`默认关闭i18n多语言国际化
## 1.1.18(2021-10-14) ## 1.1.18(2021-10-14)
使用2.0版`uni-share`。当显示分享窗口时,监听返回操作(如:物理返回,全面屏手机侧滑)关闭分享窗口,而不是关闭当前页面。 使用2.0版`uni-share`。当显示分享窗口时,监听返回操作(如:物理返回,全面屏手机侧滑)关闭分享窗口,而不是关闭当前页面。
## 1.1.17(2021-10-12) ## 1.1.17(2021-10-12)
...@@ -14,7 +20,7 @@ ...@@ -14,7 +20,7 @@
} }
` `
## 1.1.14(2021-09-30) ## 1.1.14(2021-09-30)
1. 通过微信小程序登自动保存`sessionKey``uni-id-users` 1. 通过微信小程序登自动保存`sessionKey``uni-id-users`
2. 我的-设置-个人资料 点击绑定手机号码,完善账号信息支持以下三种策略: 2. 我的-设置-个人资料 点击绑定手机号码,完善账号信息支持以下三种策略:
- APP端,(如果支持)使用"通过运营商一键获取手机号码" - APP端,(如果支持)使用"通过运营商一键获取手机号码"
- 微信小程序端,支持"一键获取微信绑定的手机号" - 微信小程序端,支持"一键获取微信绑定的手机号"
...@@ -22,8 +28,8 @@ ...@@ -22,8 +28,8 @@
## 1.1.13(2021-09-29) ## 1.1.13(2021-09-29)
修复search页面因多语言国际化导致的白屏问题 修复search页面因多语言国际化导致的白屏问题
## 1.1.12(2021-09-28) ## 1.1.12(2021-09-28)
1. 改造微信登逻辑,直接使用`uni.login`参数`"onlyAuthorize":true`实现 1. 改造微信登逻辑,直接使用`uni.login`参数`"onlyAuthorize":true`实现
2. 修复,一键登录弹出层,已勾选“同意隐私政策协议”点击自定义登按钮,报“你未同意隐私政策协议”的bug 2. 修复,一键登录弹出层,已勾选“同意隐私政策协议”点击自定义登按钮,报“你未同意隐私政策协议”的bug
## 1.1.11(2021-09-24) ## 1.1.11(2021-09-24)
优化邀请下载app页(`pages/ucenter/invite`)下载按钮闪烁的问题 优化邀请下载app页(`pages/ucenter/invite`)下载按钮闪烁的问题
## 1.1.10(2021-09-23) ## 1.1.10(2021-09-23)
...@@ -37,7 +43,7 @@ ...@@ -37,7 +43,7 @@
## 1.1.6(2021-09-13) ## 1.1.6(2021-09-13)
纠正错误schema权限表达式`doc.uid``doc.user_id` 纠正错误schema权限表达式`doc.uid``doc.user_id`
## 1.1.5(2021-09-01) ## 1.1.5(2021-09-01)
为了更直观理解路由拦截。移除路由拦截器中,默认过滤登相关页面拦截的逻辑。确保所有白名单页面均在配置文件router.visitor中体现 为了更直观理解路由拦截。移除路由拦截器中,默认过滤登相关页面拦截的逻辑。确保所有白名单页面均在配置文件router.visitor中体现
## 1.1.4(2021-08-31) ## 1.1.4(2021-08-31)
修改错误的文章表`SChema`的读权限表达式 修改错误的文章表`SChema`的读权限表达式
## 1.1.3(2021-08-31) ## 1.1.3(2021-08-31)
...@@ -52,11 +58,11 @@ ...@@ -52,11 +58,11 @@
- 新增留言板示例 - 新增留言板示例
- 修复签到的时区问题 - 修复签到的时区问题
## 1.0.48(2021-08-10) ## 1.0.48(2021-08-10)
- 修复登成功后响应体包含`userInfo.password`的问题 - 修复登成功后响应体包含`userInfo.password`的问题
- 修改了`uni-id-users`表的schema中字段username的编辑权限,防止用户通过clientDB绕过用户名不能重复的规则更新用户名的问题 - 修改了`uni-id-users`表的schema中字段username的编辑权限,防止用户通过clientDB绕过用户名不能重复的规则更新用户名的问题
## 1.0.47(2021-08-09) ## 1.0.47(2021-08-09)
- 更新文档快速体验部署流程 - 更新文档快速体验部署流程
- 修复一键登优先时报变量找不到的问题 - 修复一键登优先时报变量找不到的问题
## 1.0.46(2021-08-05) ## 1.0.46(2021-08-05)
清理多余文件 清理多余文件
## 1.0.45(2021-08-05) ## 1.0.45(2021-08-05)
...@@ -65,8 +71,8 @@ ...@@ -65,8 +71,8 @@
解决首页为非nvue页面时白屏的问题。 解决首页为非nvue页面时白屏的问题。
- 注意:本次在`common/appInit.js`中修改了路由拦截的逻辑,是个兼容方案;当首页为非nvue页面,路由拦截器逻辑会在加载首页时执行。接下来新版本的hx编译的uni-app项目无论首页是否为nvue都不走拦截器,保持各端逻辑一致。 - 注意:本次在`common/appInit.js`中修改了路由拦截的逻辑,是个兼容方案;当首页为非nvue页面,路由拦截器逻辑会在加载首页时执行。接下来新版本的hx编译的uni-app项目无论首页是否为nvue都不走拦截器,保持各端逻辑一致。
## 1.0.43(2021-08-02) ## 1.0.43(2021-08-02)
1. 微信小程序端,新增:微信登成功后,弹出是否"获取微信头像和昵称,完善个人资料"的弹框 1. 微信小程序端,新增:微信登成功后,弹出是否"获取微信头像和昵称,完善个人资料"的弹框
2. APP端,新增逻辑:微信登成功后,自动获取用户的微信昵称和头像完善用户个人资料 2. APP端,新增逻辑:微信登成功后,自动获取用户的微信昵称和头像完善用户个人资料
- 提示:因为微信的头像一旦更换,微信返回的头像url会失效。所以,以上两示例功能将url(客户端:下载到临时目录/服务端:转为Buffer)再上传到uniCloud云存储中再使用。 - 提示:因为微信的头像一旦更换,微信返回的头像url会失效。所以,以上两示例功能将url(客户端:下载到临时目录/服务端:转为Buffer)再上传到uniCloud云存储中再使用。
## 1.0.42(2021-07-29) ## 1.0.42(2021-07-29)
新增绑定手机号码页面前端校验 新增绑定手机号码页面前端校验
...@@ -74,11 +80,11 @@ ...@@ -74,11 +80,11 @@
1. 支持vue3.0 1. 支持vue3.0
2. 去掉App.vue全局样式,避免与非flex布局的页面样式冲突 2. 去掉App.vue全局样式,避免与非flex布局的页面样式冲突
## 1.0.40(2021-07-22) ## 1.0.40(2021-07-22)
1. 调整使用正则表达式配置强制登功能的写法,解决在小程序端的兼容问题。 1. 调整使用正则表达式配置强制登功能的写法,解决在小程序端的兼容问题。
2. 新增签到功能(培养用户习惯,提升用户粘性)。支持:每日签到奖励、周期性连续7日签到,奖励翻倍。 2. 新增签到功能(培养用户习惯,提升用户粘性)。支持:每日签到奖励、周期性连续7日签到,奖励翻倍。
## 1.0.39(2021-07-19) ## 1.0.39(2021-07-19)
1. 强制登配置,新增白名单模式 1. 强制登配置,新增白名单模式
2. 强制登配置,支持正则表达式 2. 强制登配置,支持正则表达式
## 1.0.38(2021-07-17) ## 1.0.38(2021-07-17)
删除多余文件 删除多余文件
## 1.0.37(2021-07-14) ## 1.0.37(2021-07-14)
...@@ -89,9 +95,9 @@ ...@@ -89,9 +95,9 @@
1. H5端默认不开启,隐私权限协议签署页面。因为网页端没有什么隐私权限能被获取,目前全球仅欧盟有要求;如有需要请手动开启 1. H5端默认不开启,隐私权限协议签署页面。因为网页端没有什么隐私权限能被获取,目前全球仅欧盟有要求;如有需要请手动开启
2. 在列表页演示,如何在onShow生命周期获取设备位置,并在设备或者应用没有权限时自动引导。设置完毕自动重新获取。[更多点此查看插件介绍](https://ext.dcloud.net.cn/plugin?name=json-gps) 2. 在列表页演示,如何在onShow生命周期获取设备位置,并在设备或者应用没有权限时自动引导。设置完毕自动重新获取。[更多点此查看插件介绍](https://ext.dcloud.net.cn/plugin?name=json-gps)
## 1.0.34(2021-07-08) ## 1.0.34(2021-07-08)
修复,打开登陆页时携带参数,导致的快捷登陆方式重复的问题 修复,打开登录页时携带参数,导致的快捷登录方式重复的问题
## 1.0.33(2021-07-06) ## 1.0.33(2021-07-06)
修复,点击短信验证码登打开的页面不正确的问题 修复,点击短信验证码登打开的页面不正确的问题
## 1.0.32(2021-07-06) ## 1.0.32(2021-07-06)
修复,仅配置一种快捷登录时的错误 修复,仅配置一种快捷登录时的错误
## 1.0.31(2021-07-02) ## 1.0.31(2021-07-02)
...@@ -101,7 +107,7 @@ ...@@ -101,7 +107,7 @@
2. uni-id-cf发送短信验证码api,默认注释掉:虚拟发送短信验证码的代码块。 2. uni-id-cf发送短信验证码api,默认注释掉:虚拟发送短信验证码的代码块。
3. uni-id-cf统一action名称为驼峰法 3. uni-id-cf统一action名称为驼峰法
## 1.0.29(2021-06-29) ## 1.0.29(2021-06-29)
1. 修复在安卓10以下设备,操作登陆获取不到oaid会直接导致登陆失败的bug 1. 修复在安卓10以下设备,操作登录获取不到oaid会直接导致登录失败的bug
2. 修复uniCloud版本为阿里云版时删除头像设置失败,腾讯云版删除头像后二次上传失败的问题 2. 修复uniCloud版本为阿里云版时删除头像设置失败,腾讯云版删除头像后二次上传失败的问题
## 1.0.28(2021-06-28) ## 1.0.28(2021-06-28)
修复云函数uni-id-cf的resetPwdBySmsCode接口,未注册过的用户也能调用的问题 修复云函数uni-id-cf的resetPwdBySmsCode接口,未注册过的用户也能调用的问题
...@@ -116,41 +122,41 @@ ...@@ -116,41 +122,41 @@
## 1.0.23(2021-06-22) ## 1.0.23(2021-06-22)
更正调试遗留的uni-config-center/uni-id/config.json的tokenExpiresIn=1配置问题,改为默认值7200 更正调试遗留的uni-config-center/uni-id/config.json的tokenExpiresIn=1配置问题,改为默认值7200
## 1.0.22(2021-06-22) ## 1.0.22(2021-06-22)
1. 新增一键登录授权界面的其他快捷登按钮 1. 新增一键登录授权界面的其他快捷登按钮
2. 优化uni-quick-login组件代码 2. 优化uni-quick-login组件代码
3. 调整隐私政策协议框勾选逻辑:在登页面已勾选,同步勾选。如果没勾选需要手动勾选(为符合应用市场上架要求) 3. 调整隐私政策协议框勾选逻辑:在登页面已勾选,同步勾选。如果没勾选需要手动勾选(为符合应用市场上架要求)
4. 调整登页隐私政策协议框位置。 4. 调整登页隐私政策协议框位置。
5. 增强路由拦截,新增判断token是否过期。 5. 增强路由拦截,新增判断token是否过期。
## 1.0.21(2021-06-21) ## 1.0.21(2021-06-21)
优化:uni_modules模式使用uni-id-cf,方便uni-starter与uniCloud-admin的uni-id-cf同步更新。 优化:uni_modules模式使用uni-id-cf,方便uni-starter与uniCloud-admin的uni-id-cf同步更新。
## 1.0.20(2021-06-18) ## 1.0.20(2021-06-18)
1.H5端新增,强制要求用户同意隐私协议 2.兼容ios端自动设置打开下载页用户的剪切板为邀请者的inviteCode 3.成功注册用户,且请求体含邀请码inviteCode自动关联裂变关系 1.H5端新增,强制要求用户同意隐私协议 2.兼容ios端自动设置打开下载页用户的剪切板为邀请者的inviteCode 3.成功注册用户,且请求体含邀请码inviteCode自动关联裂变关系
## 1.0.19(2021-06-17) ## 1.0.19(2021-06-17)
1.新增获取邀请码接口getUserInviteCode 2.在邀请用户下载应用页面,自动设置被邀请用户的剪切板为邀请者的code(仅支持安卓端) 3.在注册或登并注册请求时自动添加剪切板中的请求参数 4.统一接口名称为驼峰法 1.新增获取邀请码接口getUserInviteCode 2.在邀请用户下载应用页面,自动设置被邀请用户的剪切板为邀请者的code(仅支持安卓端) 3.在注册或登并注册请求时自动添加剪切板中的请求参数 4.统一接口名称为驼峰法
## 1.0.18(2021-06-15) ## 1.0.18(2021-06-15)
修复,APP端有安装微信客户端但未显示微信登快捷键的问题 修复,APP端有安装微信客户端但未显示微信登快捷键的问题
## 1.0.17(2021-06-09) ## 1.0.17(2021-06-09)
修复,非APP端deviceInfo为空引起的登失败问题 修复,非APP端deviceInfo为空引起的登失败问题
## 1.0.16(2021-06-08) ## 1.0.16(2021-06-08)
新增,操作注册/登陆操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device新增,操作注册/登陆操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device 新增,操作注册/登录操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device新增,操作注册/登录操作自动获取客户端设备:push_clientid、imei、oaid、idfa新增/更新到数据表uni-id-device
## 1.0.15(2021-06-07) ## 1.0.15(2021-06-07)
为迎合苹果App Store的规则,登陆与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登陆和微信分享选项。为迎合苹果App Store的规则,登陆与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登陆和微信分享选项。 为迎合苹果App Store的规则,登录与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登录和微信分享选项。为迎合苹果App Store的规则,登录与分享功能项显示之前自动检测是否安装了对应客户端。比如:设备未安装微信则不显示微信快捷登录和微信分享选项。
## 1.0.14(2021-06-07) ## 1.0.14(2021-06-07)
修改错误的表名称uni-verify为opendb-verify-codes 修改错误的表名称uni-verify为opendb-verify-codes
## 1.0.13(2021-06-04) ## 1.0.13(2021-06-04)
新增一键登陆界面的第三方快捷登陆按钮 新增一键登录界面的第三方快捷登录按钮
## 1.0.12(2021-05-28) ## 1.0.12(2021-05-28)
修复拦截器在ios app端会报错:Unhandled promise...的问题 修复拦截器在ios app端会报错:Unhandled promise...的问题
## 1.0.10(2021-05-27) ## 1.0.10(2021-05-27)
新增callfunction的拦截器废除this.request的写法。为callFunction添加:请求失败是否断网判断并提示、恢复网络自动重新执行、自动处理响应体:token过期自动跳转到登页面、token自动续期 新增callfunction的拦截器废除this.request的写法。为callFunction添加:请求失败是否断网判断并提示、恢复网络自动重新执行、自动处理响应体:token过期自动跳转到登页面、token自动续期
## 1.0.9(2021-05-23) ## 1.0.9(2021-05-23)
修复变量被重复定义的问题 修复变量被重复定义的问题
## 1.0.8(2021-05-22) ## 1.0.8(2021-05-22)
宫格页(/pages/grid/grid),新增根据当前用户是否登、是否为管理员的角色来决定是否显示的示范 宫格页(/pages/grid/grid),新增根据当前用户是否登、是否为管理员的角色来决定是否显示的示范
## 1.0.7(2021-05-22) ## 1.0.7(2021-05-22)
删除多余数据 删除多余数据
## 1.0.6(2021-05-22) ## 1.0.6(2021-05-22)
修复当username(用户名&密码)为第一优先级的登陆方式时。无法切换到smsCode(短信验证码)登陆方式 修复当username(用户名&密码)为第一优先级的登录方式时。无法切换到smsCode(短信验证码)登录方式
## 1.0.5(2021-05-20) ## 1.0.5(2021-05-20)
改用uni_modules方式处理图片选择api时无权限,引导用户快捷打开系统设置 改用uni_modules方式处理图片选择api时无权限,引导用户快捷打开系统设置
## 1.0.4(2021-05-19) ## 1.0.4(2021-05-19)
......
此差异已折叠。
<template>
<refresh @refresh="refresh" @pullingdown="onpullingdown" :display="showRefresh ? 'show' : 'hide'">
<view class="refreshBox">
<!-- 可以自己添加图片路径或base64实现图片 <image class="refreshImg" :src="config[state].img" mode="widthFix" resize="cover"></image> -->
<text class="refreshText">{{config[state].text}}</text>
</view>
</refresh>
</template>
<script>
export default {
data() {
return {
showRefresh:false,
state:0
}
},
methods:{
onpullingdown({pullingDistance,viewHeight}) {
if(pullingDistance < viewHeight){
this.state = 0
}else{
this.state = 1
}
},
refresh(){
console.log('refresh');
this.showRefresh = true
this.state = 2
this.$emit('refresh')
}
},
watch: {
loading(loading, oldValue) {
if(!loading){
this.showRefresh = false
this.state = 3
}
}
},
props: {
loading: {
type:Boolean,
default(){
return false
}
},
config: {
type: Array,
default(){
return [
{
text:"继续下拉执行刷新",
img:""//可以自己添加图片路径或base64实现图片
},
{
text:"释放立即刷新",
img:""//可以自己添加图片路径或base64实现图片
},
{
text:"正在疯狂的加载中",
img:""//可以自己添加图片路径或base64实现图片
},
{
text:"加载成功",
img:""//可以自己添加图片路径或base64实现图片
}
]
}
},
},
}
</script>
<style lang="scss" scoped>
.refreshBox{
width: 750rpx;
height: 50px;
justify-content: center;
align-items: center;
flex-direction: row;
/* #ifndef APP-PLUS */
margin-top: -50px;
/* #endif */
}
.refreshImg{
width: 55rpx;
height: 55rpx;
z-index: 111;
}
.refreshText{
font-size: 26rpx;
color: #999999;
padding-left: 6rpx;
}
</style>
<template> <template>
<view style="width: 750rpx;"> <view @appear="appear">
<template v-if="!state.error"> <view v-if="state.error">
<uni-load-more v-if="state.loading||state.pagination.current!=1||state.data.length!=0" :status="state.loading?'loading':(state.hasMore?'hasMore':'noMore')"></uni-load-more> <view class="box" v-if="networkType == 'none'">
<text class="noData" v-else>{{noData}}</text> <image class="icon-image" src="@/static/uni-load-state/disconnection.png" mode="widthFix"></image>
</template> <text class="tip-text">{{noNetwork}}</text>
<view v-else> <view class="btn btn-default" @click="openSettings">
<view class="box" v-if="networkType == 'none'"> <text class="btn-text">{{toSet}}</text>
<image class="icon-image" src="@/static/uni-load-state/disconnection.png" mode="widthFix"></image> </view>
<text class="tip-text">{{noNetwork}}</text> </view>
<view class="btn btn-default" @click="openSettings"> <text class="error" v-else>{{error}}{{JSON.stringify(state.error)}}</text>
<text class="btn-text">{{toSet}}</text>
</view>
</view>
<text class="err" v-else>{{error}}:{{JSON.stringify(state.error)}}</text>
</view> </view>
</view> <template v-else>
<!-- #ifdef APP-NVUE -->
<text class="state-text">{{state.loading?'加载中...':(state.hasMore?'上拉加载更多':'没有更多数据了')}}</text>
<!-- #endif -->
<!-- #ifndef APP-NVUE -->
<uni-load-more class="uni-load-more" :status="state.loading?'loading':(state.hasMore?'hasMore':'noMore')"></uni-load-more>
<!-- #endif -->
</template>
</view>
</template> </template>
<script> <script>
import { import {
initVueI18n initVueI18n
} from '@dcloudio/uni-i18n' } from '@dcloudio/uni-i18n'
import messages from './i18n/index.js' import messages from './i18n/index.js'
const { t } = initVueI18n(messages) const {
t
} = initVueI18n(messages)
export default { export default {
name: "uni-load-state", name: "uni-load-state",
computed:{ computed: {
noData(){ noData() {
return t('noData') return t('noData')
}, },
noNetwork(){ noNetwork() {
return t('noNetwork') return t('noNetwork')
}, },
toSet(){ toSet() {
return t('toSet') return t('toSet')
}, },
error(){ error() {
return t('error') return t('error')
} }
}, },
data() { data() {
return { return {
"networkType": "" "networkType": ""
}; };
},
props: {
state:{
type: Object,
default(){
return {
"loading":true,
"hasMore":false,
"pagination":{"pages":0},
"data":[],
"error":{}
}
}
}
}, },
mounted() { props: {
state: {
type: Object,
default () {
return {
"loading": true,
"hasMore": false,
"pagination": {
"pages": 0
},
"data": [],
"error": {}
}
}
}
},
mounted() {
uni.onNetworkStatusChange(({ uni.onNetworkStatusChange(({
networkType networkType
}) => { }) => {
if(this.networkType == 'none' && networkType != 'none'){ //之前没网现在有了 if (this.networkType == 'none' && networkType != 'none') { //之前没网现在有了
this.$emit('networkResume') this.$emit('networkResume')
} }
this.networkType = networkType; this.networkType = networkType;
}); });
...@@ -75,48 +84,65 @@ ...@@ -75,48 +84,65 @@
this.networkType = networkType; this.networkType = networkType;
} }
}); });
}, },
methods:{ methods: {
openSettings(){ appear() {
if (uni.getSystemInfoSync().platform == "ios") { if (!this.state.loading && this.state.hasMore) {
var UIApplication = plus.ios.import("UIApplication"); this.$emit('loadMore')
var application2 = UIApplication.sharedApplication(); }
var NSURL2 = plus.ios.import("NSURL"); },
var setting2 = NSURL2.URLWithString("App-prefs:root=General"); openSettings() {
application2.openURL(setting2); if (uni.getSystemInfoSync().platform == "ios") {
plus.ios.deleteObject(setting2); var UIApplication = plus.ios.import("UIApplication");
plus.ios.deleteObject(NSURL2); var application2 = UIApplication.sharedApplication();
var NSURL2 = plus.ios.import("NSURL");
var setting2 = NSURL2.URLWithString("App-prefs:root=General");
application2.openURL(setting2);
plus.ios.deleteObject(setting2);
plus.ios.deleteObject(NSURL2);
plus.ios.deleteObject(application2); plus.ios.deleteObject(application2);
} else { } else {
var Intent = plus.android.importClass("android.content.Intent"); var Intent = plus.android.importClass("android.content.Intent");
var Settings = plus.android.importClass("android.provider.Settings"); var Settings = plus.android.importClass("android.provider.Settings");
var mainActivity = plus.android.runtimeMainActivity(); var mainActivity = plus.android.runtimeMainActivity();
var intent = new Intent(Settings.ACTION_SETTINGS); var intent = new Intent(Settings.ACTION_SETTINGS);
mainActivity.startActivity(intent); mainActivity.startActivity(intent);
} }
} }
} }
} }
</script> </script>
<style scoped> <style scoped>
.box{ .box {
flex: 1; flex: 1;
margin:100rpx 0; flex-direction: column;
flex-direction: column; align-items: center;
justify-content: center;
}
.uni-load-more{
align-items: center; align-items: center;
justify-content: center; justify-content: center;
width: 690rpx;
} }
.state-text {
.icon-image{ text-align: center;
width: 300rpx; font-size: 26rpx;
} width: 690rpx;
.tip-text{ padding: 10rpx;
color: #999999; color: #999999;
font-size: 32rpx; }
margin-bottom: 30rpx;
} .icon-image {
width: 300rpx;
}
.tip-text {
color: #999999;
font-size: 32rpx;
margin-bottom: 30rpx;
}
.btn { .btn {
padding: 5px 10px; padding: 5px 10px;
width: 128px; width: 128px;
...@@ -136,18 +162,10 @@ ...@@ -136,18 +162,10 @@
border-style: solid; border-style: solid;
border-width: 1px; border-width: 1px;
border-radius: 3px; border-radius: 3px;
} }
.noData{ .error {
text-align: center; width: 690rpx;
padding: 30rpx; color: #DD524D;
width: 750rpx;
/* #ifndef APP-PLUS-NVUE */
display: block;
/* #endif */
}
.err{
width: 750rpx;
color: #DD524D;
} }
</style> </style>
...@@ -76,7 +76,7 @@ ...@@ -76,7 +76,7 @@
univerifyStyle: { //一键登录弹出窗的样式配置参数 univerifyStyle: { //一键登录弹出窗的样式配置参数
"fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。 "fullScreen": true, // 是否全屏显示,true表示全屏模式,false表示非全屏模式,默认值为false。
"backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff "backgroundColor": "#ffffff", // 授权页面背景颜色,默认值:#ffffff
"buttons": { // 自定义登按钮 "buttons": { // 自定义登按钮
"iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px "iconWidth": "45px", // 图标宽度(高度等比例缩放) 默认值:45px
"list": [] "list": []
}, },
...@@ -106,12 +106,12 @@ ...@@ -106,12 +106,12 @@
}, },
async created() { async created() {
let servicesList = this.servicesList let servicesList = this.servicesList
//去掉配置中不存在的 注意,在/common/appInit.js中已清除有配置但设备环境不支持的登 //去掉配置中不存在的 注意,在/common/appInit.js中已清除有配置但设备环境不支持的登
servicesList = servicesList.filter(item => this.loginConfig.includes(item.id)) servicesList = servicesList.filter(item => this.loginConfig.includes(item.id))
//处理一键登录 //处理一键登录
if (this.loginConfig.includes('univerify')) { if (this.loginConfig.includes('univerify')) {
this.univerifyStyle.privacyTerms.privacyItems = this.agreements this.univerifyStyle.privacyTerms.privacyItems = this.agreements
//设置一键登录功能底下的快捷登按钮 //设置一键登录功能底下的快捷登按钮
servicesList.forEach(({ servicesList.forEach(({
id, id,
logo logo
...@@ -125,7 +125,7 @@ ...@@ -125,7 +125,7 @@
}) })
} }
console.log(servicesList); console.log(servicesList);
//如果当前页面为默认登陆界面。当前第一优先级的“微信和苹果登陆”要隐藏,因为他已经被渲染在默认登陆界面顶部 //如果当前页面为默认登录界面。当前第一优先级的“微信和苹果登录”要隐藏,因为他已经被渲染在默认登录界面顶部
if ( if (
this.getRoute(1) == '/pages/ucenter/login-page/index/index' && ['weixin', 'apple'].includes(this this.getRoute(1) == '/pages/ucenter/login-page/index/index' && ['weixin', 'apple'].includes(this
.loginConfig[0]) .loginConfig[0])
...@@ -265,9 +265,9 @@ ...@@ -265,9 +265,9 @@
title: this.$t('uniQuickLogin').chooseOtherLogin, title: this.$t('uniQuickLogin').chooseOtherLogin,
icon: 'none' icon: 'none'
}); });
console.log('点击了第三方登,provider:', err.provider); console.log('点击了第三方登,provider:', err.provider);
//同步一键登弹出层隐私协议框是否打勾 //同步一键登弹出层隐私协议框是否打勾
let agree = (await uni.getCheckBoxState())[1].state let agree = (await uni.getCheckBoxState())[1].state
console.log('agree',agree); console.log('agree',agree);
uni.$emit('setAgreementsAgree',agree) uni.$emit('setAgreementsAgree',agree)
......
export default { export default {
tabbar:'List,Grid,Mine', tabbar:'List,Grid,contacts,Mine',
agreementsTitle:'User service agreement,Privacy policy', agreementsTitle:'User service agreement,Privacy policy',
common: { common: {
wechatFriends: "friends", wechatFriends: "friends",
......
...@@ -12,7 +12,7 @@ if(i18nEnable){ ...@@ -12,7 +12,7 @@ if(i18nEnable){
}else{ }else{
currentLang = "zh-Hans" currentLang = "zh-Hans"
} }
console.log(uni.getStorageSync('CURRENT_LANG'),currentLang); // console.log(uni.getStorageSync('CURRENT_LANG'),currentLang);
if (!currentLang) { if (!currentLang) {
if (uni.getLocale) { if (uni.getLocale) {
console.log('获取应用语言:', uni.getLocale()); console.log('获取应用语言:', uni.getLocale());
...@@ -69,17 +69,20 @@ console.log(` ...@@ -69,17 +69,20 @@ console.log(`
`); `);
let initLanguageAfter = () => { let initLanguageAfter = () => {
function $i18n(e){ function $i18n(e){
// #ifdef VUE3
return i18n.global.messages[i18n.global.locale][e]
// #endif
return i18n.messages[i18n.locale][e] return i18n.messages[i18n.locale][e]
} }
setTimeout(function(){ setTimeout(function(){
//底部tabbar更新 //底部tabbar更新
$i18n('tabbar').split(',').forEach((text, index) => { $i18n('tabbar').split(',').forEach((text, index) => {
console.log(text); // console.log(text);
uni.setTabBarItem({ uni.setTabBarItem({
index, index,
text, text,
complete: e => { complete: e => {
console.log("e: " + JSON.stringify(e)); // console.log("e: " + JSON.stringify(e));
} }
}) })
}) })
......
export default { export default {
tabbar:'列表,宫格,我的', tabbar:'列表,宫格,通讯录,我的',
agreementsTitle:'用户服务协议,隐私政策', agreementsTitle:'用户服务协议,隐私政策',
common:{ common:{
wechatFriends: "微信好友", wechatFriends: "微信好友",
wechatBbs: "微信朋友圈", wechatBbs: "微信朋友圈",
weibo:"微博", weibo:"微博",
more: "更多", more: "更多",
agree:"同意", agree:"同意",
copy: "复制", copy: "复制",
wechatApplet: "微信小程序", wechatApplet: "微信小程序",
cancelShare: "取消分享", cancelShare: "取消分享",
updateSucceeded: "更新成功", updateSucceeded: "更新成功",
phonePlaceholder: "请输入手机号", phonePlaceholder: "请输入手机号",
verifyCodePlaceholder: "请输入验证码", verifyCodePlaceholder: "请输入验证码",
newPasswordPlaceholder: "请输入新密码", newPasswordPlaceholder: "请输入新密码",
confirmNewPasswordPlaceholder: "请确认新密码", confirmNewPasswordPlaceholder: "请确认新密码",
confirmPassword: "请确认密码", confirmPassword: "请确认密码",
verifyCodeSend: "验证码已通过短信发送至", verifyCodeSend: "验证码已通过短信发送至",
passwordDigits: "密码为6 - 20位", passwordDigits: "密码为6 - 20位",
getVerifyCode: "获取验证码", getVerifyCode: "获取验证码",
noAgree: "你未同意隐私政策协议", noAgree: "你未同意隐私政策协议",
gotIt: "知道了", gotIt: "知道了",
login: "登录", login: "登录",
error: "错误", error: "错误",
complete: "完成", complete: "完成",
submit: "提交", submit: "提交",
formatErr:"手机号码格式不正确", formatErr:"手机号码格式不正确",
sixDigitCode:"请输入6位验证码", sixDigitCode:"请输入6位验证码",
resetNavTitle:"重置密码" resetNavTitle:"重置密码"
}, },
list: { list: {
inputPlaceholder: "请输入搜索内容", inputPlaceholder: "请输入搜索内容",
}, },
search:{ search:{
cancelText: '取消', cancelText: '取消',
searchHistory: "搜索历史", searchHistory: "搜索历史",
searchDiscovery: "搜索发现", searchDiscovery: "搜索发现",
deleteAll: "全部删除", deleteAll: "全部删除",
delete: "删除", delete: "删除",
deleteTip: "确认清空搜索历史吗?", deleteTip: "确认清空搜索历史吗?",
complete: "完成", complete: "完成",
searchHiddenTip: "当前搜索发现已隐藏", searchHiddenTip: "当前搜索发现已隐藏",
}, },
grid:{ grid:{
grid: "宫格组件", grid: "宫格组件",
visibleToAll: "所有人可见", visibleToAll: "所有人可见",
invisibleToTourists: "游客不可见", invisibleToTourists: "游客不可见",
adminVisible: "管理员可见", adminVisible: "管理员可见",
clickTip: "点击第", clickTip: "点击第",
clickTipGrid: "个宫格", clickTipGrid: "个宫格",
}, },
mine:{ mine:{
showText: "文字", showText: "文字",
signIn: "签到有奖", signIn: "签到有奖",
toEvaluate: "去评分", toEvaluate: "去评分",
readArticles: "阅读过的文章", readArticles: "阅读过的文章",
myScore: "我的积分", myScore: "我的积分",
invite: "分销推荐", invite: "分销推荐",
guestBook: "留言板示例", guestBook: "留言板示例",
feedback: "问题与反馈", feedback: "问题与反馈",
settings: "设置", settings: "设置",
checkUpdate: "检查更新", checkUpdate: "检查更新",
about: "关于", about: "关于",
clicked: "你点击了", clicked: "你点击了",
checkScore: "请登录后查看积分", checkScore: "请登录后查看积分",
currentScore: "当前积分为", currentScore: "当前积分为",
noScore: "当前无积分", noScore: "当前无积分",
notLogged: "未登录", notLogged: "未登录",
}, },
userinfo:{ userinfo:{
navigationBarTitle:"个人资料", navigationBarTitle:"个人资料",
ProfilePhoto: "头像", ProfilePhoto: "头像",
nickname: "昵称", nickname: "昵称",
notSet: "未设置", notSet: "未设置",
phoneNumber: "手机号", phoneNumber: "手机号",
notSpecified: "未绑定", notSpecified: "未绑定",
setNickname: "设置昵称", setNickname: "设置昵称",
setNicknamePlaceholder: "请输入要设置的昵称", setNicknamePlaceholder: "请输入要设置的昵称",
bindPhoneNumber: "本机号码一键绑定", bindPhoneNumber: "本机号码一键绑定",
bindOtherLogin: "其他号码绑定", bindOtherLogin: "其他号码绑定",
noChange: "没有变化", noChange: "没有变化",
uploading: "正在上传", uploading: "正在上传",
requestFail: "请求服务失败", requestFail: "请求服务失败",
setting: "设置中", setting: "设置中",
deleteSucceeded: "删除成功", deleteSucceeded: "删除成功",
setSucceeded: "设置成功", setSucceeded: "设置成功",
}, },
smsCode:{ smsCode:{
resendVerifyCode: "重新发送", resendVerifyCode: "重新发送",
phoneErrTip: "手机号格式错误", phoneErrTip: "手机号格式错误",
sendSuccessTip: "短信验证码发送成功", sendSuccessTip: "短信验证码发送成功",
}, },
loadMore:{ loadMore:{
noData: "暂无数据", noData: "暂无数据",
noNetwork: "网络异常", noNetwork: "网络异常",
toSet: "前往设置", toSet: "前往设置",
error: "错误", error: "错误",
}, },
guestbook:{ guestbook:{
navigationBarTitle:"留言板", navigationBarTitle:"留言板",
msgContent: "发表留言内容", msgContent: "发表留言内容",
notAvailable: "未登陆游客不可用", notAvailable: "未登录游客不可用",
send: "发送", send: "发送",
addSucceeded: "新增成功", addSucceeded: "新增成功",
noPermission: "你没有该操作权限", noPermission: "你没有该操作权限",
}, },
uniFeedback:{ uniFeedback:{
navigationBarTitle:"问题与反馈", navigationBarTitle:"问题与反馈",
msgTitle: "留言内容", msgTitle: "留言内容",
imgTitle: "图片列表", imgTitle: "图片列表",
contacts: "联系人", contacts: "联系人",
phone: "联系电话", phone: "联系电话",
submit: "提交", submit: "提交",
}, },
settings:{ settings:{
navigationBarTitle:"设置", navigationBarTitle:"设置",
userInfo: "个人资料", userInfo: "个人资料",
changePassword: "修改密码", changePassword: "修改密码",
clearTmp: "清理缓存", clearTmp: "清理缓存",
pushServer: "推送功能", pushServer: "推送功能",
fingerPrint: "指纹解锁", fingerPrint: "指纹解锁",
facial: "人脸解锁", facial: "人脸解锁",
deactivate: "注销账号", deactivate: "注销账号",
logOut: "退出登录", logOut: "退出登录",
login: "登录", login: "登录",
failTip: "认证失败请重试", failTip: "认证失败请重试",
authFailed: "认证失败", authFailed: "认证失败",
changeLanguage: "切换语言", changeLanguage: "切换语言",
please: "请用", please: "请用",
successText: "成功", successText: "成功",
deviceNoOpen: "设备未开启", deviceNoOpen: "设备未开启",
fail: "失败", fail: "失败",
tips: "提示", tips: "提示",
exitLogin: "是否退出登录?", exitLogin: "是否退出登录?",
clearing: "清除中", clearing: "清除中",
clearedSuccessed: "清除成功", clearedSuccessed: "清除成功",
confirmText: "确定", confirmText: "确定",
cancelText: '取消', cancelText: '取消',
}, },
deactivate:{ deactivate:{
cancelText: '取消', cancelText: '取消',
nextStep: "下一步", nextStep: "下一步",
navigationBarTitle:"注销提示" navigationBarTitle:"注销提示"
}, },
about:{ about:{
sacnQR: "扫描二维码,您的朋友也可以下载", sacnQR: "扫描二维码,您的朋友也可以下载",
client: "客户端", client: "客户端",
and: "", and: "",
about: "关于", about: "关于",
}, },
invite:{ invite:{
download: "下载", download: "下载",
}, },
login:{ login:{
phoneLogin: "登录后即可展示自己", phoneLogin: "登录后即可展示自己",
phoneLoginTip: "未注册的手机号验证通过后将自动注册", phoneLoginTip: "未注册的手机号验证通过后将自动注册",
getVerifyCode: "获取验证码", getVerifyCode: "获取验证码",
}, },
uniQuickLogin:{ uniQuickLogin:{
accountLogin: "账号登录", accountLogin: "账号登录",
SMSLogin: "短信验证码", SMSLogin: "短信验证码",
wechatLogin: "微信登录", wechatLogin: "微信登录",
appleLogin: "苹果登录", appleLogin: "苹果登录",
oneClickLogin: "一键登录", oneClickLogin: "一键登录",
QQLogin: "QQ登录", QQLogin: "QQ登录",
xiaomiLogin: "小米登录", xiaomiLogin: "小米登录",
getProviderFail: "获取服务供应商失败", getProviderFail: "获取服务供应商失败",
loginErr: "登录服务初始化错误", loginErr: "登录服务初始化错误",
chooseOtherLogin: "点击了第三方登", chooseOtherLogin: "点击了第三方登",
}, },
pwdLogin:{ pwdLogin:{
pwdLogin: "用户名密码登录", pwdLogin: "用户名密码登录",
placeholder: "请输入手机号/用户名", placeholder: "请输入手机号/用户名",
passwordPlaceholder: "请输入密码", passwordPlaceholder: "请输入密码",
verifyCodePlaceholder: "请输入验证码", verifyCodePlaceholder: "请输入验证码",
login: "登录", login: "登录",
forgetPassword: "忘记密码", forgetPassword: "忘记密码",
register: "注册账号", register: "注册账号",
}, },
register:{ register:{
navigationBarTitle:"注册", navigationBarTitle:"注册",
usernamePlaceholder: "请输入用户名", usernamePlaceholder: "请输入用户名",
nicknamePlaceholder: "请输入用户昵称", nicknamePlaceholder: "请输入用户昵称",
registerAndLogin: "注册并登录", registerAndLogin: "注册并登录",
passwordDigitsPlaceholder: "请输入6-20位密码", passwordDigitsPlaceholder: "请输入6-20位密码",
passwordAgain: "再次输入密码", passwordAgain: "再次输入密码",
}, },
listDetail:{ listDetail:{
follow: "点击关注", follow: "点击关注",
newsErr: "出错了,新闻ID为空", newsErr: "出错了,新闻ID为空",
}, },
newsLog:{ newsLog:{
navigationBarTitle:"阅读记录" navigationBarTitle:"阅读记录"
}, },
bindMobile:{ bindMobile:{
navigationBarTitle:"绑定手机号码" navigationBarTitle:"绑定手机号码"
} }
} }
{ {
"id": "uni-starter", "id": "uni-starter",
"displayName": "uni-starter", "displayName": "uni-starter",
"version": "1.1.18", "version": "1.1.21",
"description": "云端一体应用快速开发基本项目模版", "description": "云端一体应用快速开发基本项目模版",
"keywords": [ "keywords": [
"login", "login",
......
{ {
"pages": [{ "pages": [{
"path": "pages/list/list", "path": "pages/list/list",
"style": { "style": {
"navigationStyle": "custom", // #ifndef APP-PLUS
"enablePullDownRefresh": true "enablePullDownRefresh": true,
// #endif
"navigationStyle": "custom"
} }
}, },
{ {
...@@ -187,7 +189,7 @@ ...@@ -187,7 +189,7 @@
} }
} }
} }
], ],
"globalStyle": { "globalStyle": {
"navigationBarTextStyle": "black", "navigationBarTextStyle": "black",
"navigationBarTitleText": "uni-starter", "navigationBarTitleText": "uni-starter",
...@@ -227,7 +229,8 @@ ...@@ -227,7 +229,8 @@
"iconPath": "static/tabbar/grid.png", "iconPath": "static/tabbar/grid.png",
"selectedIconPath": "static/tabbar/grid_active.png", "selectedIconPath": "static/tabbar/grid_active.png",
"text": "宫格" "text": "宫格"
}, { }
, {
"pagePath": "pages/ucenter/ucenter", "pagePath": "pages/ucenter/ucenter",
"iconPath": "static/tabbar/me.png", "iconPath": "static/tabbar/me.png",
"selectedIconPath": "static/tabbar/me_active.png", "selectedIconPath": "static/tabbar/me_active.png",
......
...@@ -3,17 +3,27 @@ ...@@ -3,17 +3,27 @@
<!-- #ifndef H5 --> <!-- #ifndef H5 -->
<statusBar></statusBar> <statusBar></statusBar>
<!-- #endif --> <!-- #endif -->
<!-- 搜索功能 --> <!-- 搜索功能 -->
<uni-search-bar @click="searchClick" class="uni-search-box" v-model="keyword" ref="searchBar" radius="100" <view class="uni-search-box">
cancelButton="none" disabled :placeholder="inputPlaceholder" /> <uni-search-bar v-model="keyword" ref="searchBar" radius="100" cancelButton="none" disabled
<view class="cover-search-bar" @click="searchClick"></view> :placeholder="inputPlaceholder" />
<view class="cover-search-bar" @click="searchClick"></view>
</view>
<unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror" <unicloud-db ref='udb' v-slot:default="{data,pagination,hasMore, loading, error, options}" @error="onqueryerror"
:where="where" collection="opendb-news-articles,uni-id-users" :page-size="10" :where="where" collection="opendb-news-articles,uni-id-users" :page-size="10"
field="avatar,title,last_modify_date,user_id.username" @load="loadData" field="avatar,title,last_modify_date,user_id.username" @load="loadData"
> >
<!-- 基于 uni-list 的页面布局 --> <!-- 基于 uni-list 的页面布局 -->
<uni-list class="uni-list" :border="false" :bounce="true" :alwaysScrollableVertical="true" <uni-list class="uni-list" :border="false" :style="{height:listHight}">
:style="{height:listHight}">
<!-- 作用于app端nvue页面的下拉加载 -->
<!-- #ifdef APP-NVUE -->
<refreshBox @refresh="refresh" :loading="loading"></refreshBox>
<!-- #endif -->
<!-- 列表渲染 -->
<uni-list-item :to="'/pages/list/detail?id='+item._id+'&title='+item.title" v-for="(item,index) in data" <uni-list-item :to="'/pages/list/detail?id='+item._id+'&title='+item.title" v-for="(item,index) in data"
:key="index"> :key="index">
<!-- 通过header插槽定义列表左侧图片 --> <!-- 通过header插槽定义列表左侧图片 -->
...@@ -32,9 +42,12 @@ ...@@ -32,9 +42,12 @@
</view> </view>
</template> </template>
</uni-list-item> </uni-list-item>
<!-- 加载状态:上拉加载更多,加载中,没有更多数据了,加载错误 -->
<uni-list-item> <uni-list-item>
<template v-slot:body> <template v-slot:body>
<uni-load-state @networkResume="refresh" :state="{data,pagination,hasMore, loading, error}"> <uni-load-state @networkResume="refresh" :state="{data,pagination,hasMore, loading, error}"
@loadMore="loadMore">
</uni-load-state> </uni-load-state>
</template> </template>
</uni-list-item> </uni-list-item>
...@@ -70,13 +83,14 @@ ...@@ -70,13 +83,14 @@
refreshState: 0, refreshState: 0,
listHight: 0, listHight: 0,
dataList:[] dataList:[]
showRefresh: false,
} }
}, },
watch: { watch: {
keyword(keyword, oldValue) { keyword(keyword, oldValue) {
let where = '"article_status" == 1 ' let where = '"article_status" == 1 '
if (keyword) { if (keyword) {
this.where = where + `& /${keyword}/.test(title)`; this.where = where + `&& /${keyword}/.test(title)`;
} else { } else {
this.where = where; this.where = where;
} }
...@@ -84,13 +98,14 @@ ...@@ -84,13 +98,14 @@
}, },
async onReady() { async onReady() {
// #ifdef APP-NVUE // #ifdef APP-NVUE
this.listHight = uni.getSystemInfoSync().windowHeight - 96 + 'px' /* 可用窗口高度 - 搜索框高 - 状态栏高 */
this.listHight = uni.getSystemInfoSync().windowHeight - uni.getSystemInfoSync().statusBarHeight - 50 +
'px';
// #endif // #endif
// #ifndef APP-NVUE // #ifndef APP-NVUE
this.listHight = 'auto' this.listHight = 'auto'
// #endif // #endif
cdbRef = this.$refs.udb cdbRef = this.$refs.udb
}, },
async onShow() { async onShow() {
this.keyword = getApp().globalData.searchText this.keyword = getApp().globalData.searchText
...@@ -128,27 +143,39 @@ ...@@ -128,27 +143,39 @@
this.refresh() this.refresh()
}, },
refresh() { refresh() {
console.log('----platform----');
console.log(JSON.stringify(process.env.VUE_APP_PLATFORM));
cdbRef.loadData({ cdbRef.loadData({
clear: true clear: true
}, () => { }, () => {
uni.stopPullDownRefresh() uni.stopPullDownRefresh()
// #ifdef APP-NVUE
this.showRefresh = false
// #endif
console.log('end');
}) })
console.log('refresh'); console.log('refresh');
}, },
loadMore() {
cdbRef.loadMore()
},
onqueryerror(e) { onqueryerror(e) {
console.error(e); console.error(e);
},
onpullingdown(e) {
console.log(e);
this.showRefresh = true
if(e.pullingDistance>100){
this.refresh()
}
} }
}, },
// #ifndef APP-NVUE
onPullDownRefresh() { onPullDownRefresh() {
this.refresh() this.refresh()
}, },
onReachBottom() { onReachBottom() {
cdbRef.loadMore({ this.loadMore()
clear: true
})
} }
// #endif
} }
</script> </script>
...@@ -159,7 +186,6 @@ ...@@ -159,7 +186,6 @@
box-sizing: border-box; box-sizing: border-box;
flex-direction: column; flex-direction: column;
} }
/* #endif */ /* #endif */
.pages { .pages {
background-color: #FFFFFF; background-color: #FFFFFF;
...@@ -191,21 +217,10 @@ ...@@ -191,21 +217,10 @@
color: #999999; color: #999999;
} }
.refresh-tip {
color: #67c23a;
font-size: 14px;
line-height: 40px;
text-align: center;
background-color: #f0f9eb;
height: 0;
opacity: 0;
transform: translateY(-100%);
transition: height 0.3s;
}
.uni-search-box { .uni-search-box {
background-color: #FFFFFF; background-color: #FFFFFF;
position: sticky; position: sticky;
height: 50px;
top: 0; top: 0;
left: 0; left: 0;
/* #ifndef APP-PLUS */ /* #ifndef APP-PLUS */
...@@ -215,37 +230,6 @@ ...@@ -215,37 +230,6 @@
width: 580rpx; width: 580rpx;
/* #endif */ /* #endif */
} }
.show-refresh-tip {
transform: translateY(0);
height: 40px;
opacity: 1;
}
.get-data-state {
width: 750rpx;
align-items: center;
}
.get-data-state-img {
width: 500rpx;
}
.get-data-state-text {
width: 32rpx;
color: #999999;
line-height: 50rpx;
height: 50rpx;
width: 750rpx;
text-align: center;
}
.uni-list {}
.f1 {
flex: 1;
}
.cover-search-bar { .cover-search-bar {
height: 50px; height: 50px;
position: relative; position: relative;
......
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
} }
.box { .box {
margin-top: 100px; margin-top: 60px;
flex-direction: column; flex-direction: column;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
......
...@@ -3,14 +3,14 @@ export default { ...@@ -3,14 +3,14 @@ export default {
"h5": { "h5": {
"url": "https://uni-starter.dcloud.net.cn", // 前端网页托管的域名 "url": "https://uni-starter.dcloud.net.cn", // 前端网页托管的域名
// 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改 // 在h5端全局悬浮引导用户下载app的功能 更多自定义要求在/common/openApp.js中修改
"openApp": { //如不需要本功能直接移除本节点即可 // "openApp": { //如不需要本功能直接移除本节点即可
//点击悬浮下载栏后打开的网页链接 // //点击悬浮下载栏后打开的网页链接
"openUrl": '/#/pages/ucenter/invite/invite', // "openUrl": '/#/pages/ucenter/invite/invite',
//左侧显示的应用名称 // //左侧显示的应用名称
"appname": 'uni-starter', // "appname": 'uni-starter',
//应用的图标 // //应用的图标
"logo": './static/logo.png', // "logo": './static/logo.png',
} // }
}, },
"mp": { "mp": {
"weixin": { "weixin": {
...@@ -20,9 +20,9 @@ export default { ...@@ -20,9 +20,9 @@ export default {
}, },
"router": { "router": {
/* /*
名词解释:“强制登页” 名词解释:“强制登页”
在打开定义的需强制登的页面之前会自动检查(前端校验)uni_id_token的值是否有效, 在打开定义的需强制登的页面之前会自动检查(前端校验)uni_id_token的值是否有效,
如果无效会自动跳转到登页面 如果无效会自动跳转到登页面
两种模式: 两种模式:
1.needLogin:黑名单模式。枚举游客不可访问的页面。 1.needLogin:黑名单模式。枚举游客不可访问的页面。
2.visitor:白名单模式。枚举游客可访问的页面。 2.visitor:白名单模式。枚举游客可访问的页面。
...@@ -46,7 +46,7 @@ export default { ...@@ -46,7 +46,7 @@ export default {
// ], // ],
/* /*
login:配置登类型与优先级 login:配置登类型与优先级
未列举到的,或设备环境不支持的选项,将被隐藏。如果你需要在不同平台有不同的配置,直接用条件编译即可 未列举到的,或设备环境不支持的选项,将被隐藏。如果你需要在不同平台有不同的配置,直接用条件编译即可
根据数组的第0项,决定登录方式的第一优先级。 根据数组的第0项,决定登录方式的第一优先级。
*/ */
...@@ -89,6 +89,6 @@ export default { ...@@ -89,6 +89,6 @@ export default {
}, },
//配置多语言国际化。i18n为英文单词 internationalization的首末字符i和n,18为中间的字符数 是“国际化”的简称 //配置多语言国际化。i18n为英文单词 internationalization的首末字符i和n,18为中间的字符数 是“国际化”的简称
"i18n":{ "i18n":{
"enable":true //默认启用,国际化。如果你不想使用国际化相关功能,请改为false "enable":false //默认关闭,国际化。如果你想使用国际化相关功能,请改为true
} }
} }
\ No newline at end of file
## 1.1.6(2021-09-22)
- 修复 在字节小程序上样式不生效的 bug
## 1.1.5(2021-07-30) ## 1.1.5(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.4 ## 1.1.4(2021-07-29)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 修复 去掉 nvue 不支持css 的 align-self 属性,nvue 下不暂支持 absolute 属性
## 1.1.3(2021-06-24) ## 1.1.3(2021-06-24)
- 优化 示例项目 - 优化 示例项目
## 1.1.1(2021-05-12) ## 1.1.1(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.1.0(2021-05-12) ## 1.1.0(2021-05-12)
- 新增 uni-badge 的 absolute 属性,支持定位 - 新增 uni-badge 的 absolute 属性,支持定位
- 新增 uni-badge 的 offset 属性,支持定位偏移 - 新增 uni-badge 的 offset 属性,支持定位偏移
- 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点 - 新增 uni-badge 的 is-dot 属性,支持仅显示有一个小点
- 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+ - 新增 uni-badge 的 max-num 属性,支持自定义封顶的数字值,超过 99 显示99+
- 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式 - 优化 uni-badge 属性 custom-style, 支持以对象形式自定义样式
## 1.0.7(2021-05-07) ## 1.0.7(2021-05-07)
- 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug - 修复 uni-badge 在 App 端,数字小于10时不是圆形的bug
- 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug - 修复 uni-badge 在父元素不是 flex 布局时,宽度缩小的bug
- 新增 uni-badge 属性 custom-style, 支持自定义样式 - 新增 uni-badge 属性 custom-style, 支持自定义样式
## 1.0.6(2021-02-04) ## 1.0.6(2021-02-04)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
...@@ -90,7 +90,7 @@ ...@@ -90,7 +90,7 @@
'uni-badge--' + type, 'uni-badge--' + type,
'uni-badge--' + size, 'uni-badge--' + size,
absolute ? 'uni-badge--absolute' : '' absolute ? 'uni-badge--absolute' : ''
] ].join(' ')
}, },
positionStyle() { positionStyle() {
if (!this.absolute) return {} if (!this.absolute) return {}
......
{ {
"id": "uni-badge", "id": "uni-badge",
"displayName": "uni-badge 数字角标", "displayName": "uni-badge 数字角标",
"version": "1.1.5", "version": "1.1.6",
"description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。", "description": "数字角标(徽章)组件,在元素周围展示消息提醒,一般用于列表、九宫格、按钮等地方。",
"keywords": [ "keywords": [
"", "",
"badge", "badge",
"uni-ui", "uni-ui",
"uniui", "uniui",
"数字角标", "数字角标",
"徽章" "徽章"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "y", "华为": "y",
"联盟": "y" "联盟": "y"
} },
} "Vue": {
} "vue2": "y",
} "vue3": "y"
}
}
}
}
} }
\ No newline at end of file
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
> 用途:主要使用在登录、需要人机校验或其他限制调用的场景 > 用途:主要使用在登录、需要人机校验或其他限制调用的场景
> 验证码生成、校验都在服务端。页面使用返回的 base64 显示。[云端一体登模板](https://ext.dcloud.net.cn/plugin?id=13)已集成,可下载体验。 > 验证码生成、校验都在服务端。页面使用返回的 base64 显示。[云端一体登模板](https://ext.dcloud.net.cn/plugin?id=13)已集成,可下载体验。
> 数据表使用[opendb-verify-codes](https://gitee.com/dcloud/opendb/blob/master/collection/opendb-verify-codes/collection.json) > 数据表使用[opendb-verify-codes](https://gitee.com/dcloud/opendb/blob/master/collection/opendb-verify-codes/collection.json)
......
## 1.2.1(2021-09-17)
- 新增 支持使用 css 图标库扩展组件(仅 vue 支持)
## 1.2.0(2021-07-30) ## 1.2.0(2021-07-30)
- 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834) - 组件兼容 vue3,如何创建vue3项目,详见 [uni-app 项目支持 vue3 介绍](https://ask.dcloud.net.cn/article/37834)
## 1.1.5(2021-05-12) ## 1.1.5(2021-05-12)
- 新增 组件示例地址 - 新增 组件示例地址
## 1.1.4(2021-02-05) ## 1.1.4(2021-02-05)
- 调整为uni_modules目录规范 - 调整为uni_modules目录规范
<template> <template>
<text :style="{ color: color, 'font-size': size + 'px' }" class="uni-icons" :class="[customIcons,customIcons?type:'']" @click="_onClick">{{icons[type]}}</text> <text :style="{ color: color, 'font-size': size + 'px' }" class="uni-icons" :class="[fontFamily,fontFamily?type:'']" @click="_onClick">{{fontFamily ? '' : icons[type]}}</text>
</template> </template>
<script> <script>
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
type: [Number, String], type: [Number, String],
default: 16 default: 16
}, },
customIcons:{ fontFamily:{
type: String, type: String,
default: '' default: ''
} }
...@@ -59,7 +59,7 @@ ...@@ -59,7 +59,7 @@
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
@font-face { @font-face {
font-family: uniicons; font-family: uniicons;
src: url('/static/uni.ttf') format('truetype'); src: url('./uni.ttf') format('truetype');
} }
/* #endif */ /* #endif */
......
{ {
"id": "uni-icons", "id": "uni-icons",
"displayName": "uni-icons 图标", "displayName": "uni-icons 图标",
"version": "1.2.0", "version": "1.2.1",
"description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。", "description": "图标组件,用于展示移动端常见的图标,可自定义颜色、大小。",
"keywords": [ "keywords": [
"uni-ui", "uni-ui",
"uniui", "uniui",
"icon", "icon",
"图标" "图标"
], ],
"repository": "https://github.com/dcloudio/uni-ui", "repository": "https://github.com/dcloudio/uni-ui",
"engines": { "engines": {
"HBuilderX": "" "HBuilderX": ""
}, },
"directories": { "directories": {
"example": "../../temps/example_temps" "example": "../../temps/example_temps"
}, },
"dcloudext": { "dcloudext": {
"category": [ "category": [
"前端组件", "前端组件",
"通用组件" "通用组件"
], ],
"sale": { "sale": {
"regular": { "regular": {
"price": "0.00" "price": "0.00"
}, },
"sourcecode": { "sourcecode": {
"price": "0.00" "price": "0.00"
} }
}, },
"contact": { "contact": {
"qq": "" "qq": ""
}, },
"declaration": { "declaration": {
"ads": "无", "ads": "无",
"data": "无", "data": "无",
"permissions": "无" "permissions": "无"
}, },
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui" "npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
}, },
"uni_modules": { "uni_modules": {
"dependencies": [], "dependencies": [],
"encrypt": [], "encrypt": [],
"platforms": { "platforms": {
"cloud": { "cloud": {
"tcb": "y", "tcb": "y",
"aliyun": "y" "aliyun": "y"
}, },
"client": { "client": {
"App": { "App": {
"app-vue": "y", "app-vue": "y",
"app-nvue": "y" "app-nvue": "y"
}, },
"H5-mobile": { "H5-mobile": {
"Safari": "y", "Safari": "y",
"Android Browser": "y", "Android Browser": "y",
"微信浏览器(Android)": "y", "微信浏览器(Android)": "y",
"QQ浏览器(Android)": "y" "QQ浏览器(Android)": "y"
}, },
"H5-pc": { "H5-pc": {
"Chrome": "y", "Chrome": "y",
"IE": "y", "IE": "y",
"Edge": "y", "Edge": "y",
"Firefox": "y", "Firefox": "y",
"Safari": "y" "Safari": "y"
}, },
"小程序": { "小程序": {
"微信": "y", "微信": "y",
"阿里": "y", "阿里": "y",
"百度": "y", "百度": "y",
"字节跳动": "y", "字节跳动": "y",
"QQ": "y" "QQ": "y"
}, },
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
} },
} "Vue": {
} "vue2": "y",
} "vue3": "y"
}
}
}
}
} }
\ No newline at end of file
...@@ -21,6 +21,23 @@ ...@@ -21,6 +21,23 @@
<uni-icons type="contact" size="30"></uni-icons> <uni-icons type="contact" size="30"></uni-icons>
``` ```
### 扩展图标用法
1. 需要自行在项目 App.vue 中引入 css 图标扩展库(注意: css 图标库引用的 .ttf 文件路径是否正确)
```html
<style lang="scss">
/* 扩展图标库 */
@import '@/static/iconfont.css';
</style>
```
2.``template`` 中使用组件
```html
<uni-icons class="mr-30" type="icon-kongxincai" font-family="iconfont" color="#007AFF" size="20"></uni-icons>
```
## API ## API
...@@ -32,6 +49,7 @@ ...@@ -32,6 +49,7 @@
|size |Number |24 |图标大小 | |size |Number |24 |图标大小 |
|type |String |- |图标图案,参考示例 | |type |String |- |图标图案,参考示例 |
|color |String |- |图标颜色 | |color |String |- |图标颜色 |
|font-family(仅 vue 支持) |String |uniicons |图标库字体家族 |
### Icons Events ### Icons Events
......
## 1.0.7(2021-10-20) ## 1.0.7(2021-10-20)
新增bindMobileByMpWeixin,一键获取微信绑定的手机号 新增bindMobileByMpWeixin,一键获取微信绑定的手机号
## 1.0.6(2021-09-23) ## 1.0.6(2021-09-23)
修复微信登成功后没有添加日志的问题 修复微信登成功后没有添加日志的问题
## 1.0.5(2021-08-10) ## 1.0.5(2021-08-10)
- 修复登成功后响应体包含userInfo.password的问题 - 修复登成功后响应体包含userInfo.password的问题
- 新增微信登成功后,自动获取用户的微信昵称和头像完善用户个人资料 - 新增微信登成功后,自动获取用户的微信昵称和头像完善用户个人资料
## 1.0.4(2021-07-31) ## 1.0.4(2021-07-31)
- 修复 登录日志在登录失败时不写入记录的 bug - 修复 登录日志在登录失败时不写入记录的 bug
- 修复 写入记录登录是未传递 type 参数的 bug - 修复 写入记录登录是未传递 type 参数的 bug
......
...@@ -13,10 +13,10 @@ exports.main = async (event, context) => { ...@@ -13,10 +13,10 @@ exports.main = async (event, context) => {
uniID = uniID.createInstance({ uniID = uniID.createInstance({
context context
}) })
console.log('event : ' + JSON.stringify(event)) console.log('event : ' + JSON.stringify(event))
/* /*
1.event为客户端 uniCloud.callFunction填写的data的值,这里介绍一下其中的属性 1.event为客户端 uniCloud.callFunction填写的data的值,这里介绍一下其中的属性
action:表示要执行的任务名称、比如:登陆login、退出登陆 logout等 action:表示要执行的任务名称、比如:登录login、退出登录 logout等
params:业务数据内容 params:业务数据内容
uniIdToken:系统自动传递的token,数据来源客户端的 uni.getStorageSync('uni_id_token') uniIdToken:系统自动传递的token,数据来源客户端的 uni.getStorageSync('uni_id_token')
*/ */
...@@ -41,7 +41,7 @@ exports.main = async (event, context) => { ...@@ -41,7 +41,7 @@ exports.main = async (event, context) => {
} }
} }
}) })
用户就这样轻易地伪造了他人的uid传递给服务端,有一句话叫:前端从来的数据是不可信任的 用户就这样轻易地伪造了他人的uid传递给服务端,有一句话叫:前端传来的数据都是不可信任的
所以这里我们需要将uniID.checkToken返回的uid写入到params.uid 所以这里我们需要将uniID.checkToken返回的uid写入到params.uid
*/ */
let noCheckAction = ['register', 'checkToken', 'login', 'logout', 'sendSmsCode', 'createCaptcha', let noCheckAction = ['register', 'checkToken', 'login', 'logout', 'sendSmsCode', 'createCaptcha',
...@@ -88,7 +88,7 @@ exports.main = async (event, context) => { ...@@ -88,7 +88,7 @@ exports.main = async (event, context) => {
}) })
} }
//4.记录成功登录的日志方法 //4.记录成功登录的日志方法
const loginLog = async (res = {}) => { const loginLog = async (res = {}) => {
const now = Date.now() const now = Date.now()
const uniIdLogCollection = db.collection('uni-id-log') const uniIdLogCollection = db.collection('uni-id-log')
let logData = { let logData = {
...@@ -97,71 +97,71 @@ exports.main = async (event, context) => { ...@@ -97,71 +97,71 @@ exports.main = async (event, context) => {
type: res.type, type: res.type,
ua: context.CLIENTUA, ua: context.CLIENTUA,
create_date: now create_date: now
}; };
if(res.code === 0){ if(res.code === 0){
logData.user_id = res.uid logData.user_id = res.uid
logData.state = 1 logData.state = 1
if(res.userInfo&&res.userInfo.password){ if(res.userInfo&&res.userInfo.password){
delete res.userInfo.password delete res.userInfo.password
} }
if (res.type == 'register') { if (res.type == 'register') {
await registerSuccess(res.uid) await registerSuccess(res.uid)
} else { } else {
if (Object.keys(deviceInfo).length) { if (Object.keys(deviceInfo).length) {
// console.log(979797, { // console.log(979797, {
// deviceInfo, // deviceInfo,
// user_id: res // user_id: res
// }); // });
//更新当前用户设备信息 //更新当前用户设备信息
await db.collection('uni-id-device').where({ await db.collection('uni-id-device').where({
user_id: res.uid user_id: res.uid
}).update(deviceInfo) }).update(deviceInfo)
} }
} }
}else{ }else{
logData.state = 0 logData.state = 0
} }
return await uniIdLogCollection.add(logData) return await uniIdLogCollection.add(logData)
} }
let res = {} let res = {}
switch (action) { //根据action的值执行对应的操作 switch (action) { //根据action的值执行对应的操作
case 'refreshSessionKey': case 'refreshSessionKey':
let getSessionKey = await uniID.code2SessionWeixin({code:params.code}); let getSessionKey = await uniID.code2SessionWeixin({code:params.code});
if(getSessionKey.code){ if(getSessionKey.code){
return getSessionKey return getSessionKey
} }
res = await uniID.updateUser({ res = await uniID.updateUser({
uid: params.uid, uid: params.uid,
sessionKey:getSessionKey.sessionKey sessionKey:getSessionKey.sessionKey
}) })
console.log(res); console.log(res);
break; break;
case 'bindMobileByMpWeixin': case 'bindMobileByMpWeixin':
console.log(params); console.log(params);
let getSessionKeyRes = await uniID.getUserInfo({ let getSessionKeyRes = await uniID.getUserInfo({
uid: params.uid, uid: params.uid,
field: ['sessionKey'] field: ['sessionKey']
}) })
if(getSessionKeyRes.code){ if(getSessionKeyRes.code){
return getSessionKeyRes return getSessionKeyRes
} }
let sessionKey = getSessionKeyRes.userInfo.sessionKey let sessionKey = getSessionKeyRes.userInfo.sessionKey
console.log(getSessionKeyRes); console.log(getSessionKeyRes);
res = await uniID.wxBizDataCrypt({ res = await uniID.wxBizDataCrypt({
...params, ...params,
sessionKey sessionKey
}) })
console.log(res); console.log(res);
if(res.code){ if(res.code){
return res return res
} }
res = await uniID.bindMobile({ res = await uniID.bindMobile({
uid: params.uid, uid: params.uid,
mobile: res.purePhoneNumber mobile: res.purePhoneNumber
}) })
console.log(res); console.log(res);
break; break;
case 'bindMobileByUniverify': case 'bindMobileByUniverify':
let { let {
...@@ -304,20 +304,20 @@ exports.main = async (event, context) => { ...@@ -304,20 +304,20 @@ exports.main = async (event, context) => {
}else{ }else{
return wxRes return wxRes
} }
} }
if(context.PLATFORM == "mp-weixin"){ if(context.PLATFORM == "mp-weixin"){
let resUpdateUser = await uniID.updateUser({ let resUpdateUser = await uniID.updateUser({
uid: loginRes.uid, uid: loginRes.uid,
sessionKey:loginRes.sessionKey sessionKey:loginRes.sessionKey
}) })
console.log(resUpdateUser); console.log(resUpdateUser);
} }
delete loginRes.openid delete loginRes.openid
delete loginRes.sessionKey delete loginRes.sessionKey
delete loginRes.accessToken delete loginRes.accessToken
delete loginRes.refreshToken delete loginRes.refreshToken
} }
await loginLog(loginRes) await loginLog(loginRes)
return loginRes return loginRes
break; break;
case 'loginByUniverify': case 'loginByUniverify':
......
## 1.1.2(2021-07-30) ## 1.1.3(2021-08-30)
- 优化 vue3下事件警告的问题 - 修复 在vue3中to属性在发行应用的时候报错的bug
## 1.1.2(2021-07-30)
- 优化 vue3下事件警告的问题
## 1.1.1(2021-07-21) ## 1.1.1(2021-07-21)
- 修复 与其他组件嵌套使用时,点击失效的Bug - 修复 与其他组件嵌套使用时,点击失效的Bug
## 1.1.0(2021-07-13) ## 1.1.0(2021-07-13)
......
...@@ -54,7 +54,7 @@ export default { ...@@ -54,7 +54,7 @@ export default {
} }
}; };
</script> </script>
<style lang="scss"> <style lang="scss" scoped>
.uni-list { .uni-list {
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
......
{ {
"id": "uni-list", "id": "uni-list",
"displayName": "uni-list 列表", "displayName": "uni-list 列表",
"version": "1.1.2", "version": "1.1.3",
"description": "List 组件 ,帮助使用者快速构建列表。", "description": "List 组件 ,帮助使用者快速构建列表。",
"keywords": [ "keywords": [
"", "",
...@@ -80,6 +80,10 @@ ...@@ -80,6 +80,10 @@
"快应用": { "快应用": {
"华为": "u", "华为": "u",
"联盟": "u" "联盟": "u"
},
"Vue": {
"vue2": "y",
"vue3": "u"
} }
} }
} }
......
{ {
"name" : "统一应用基本项目", "name" : "统一应用基本项目",
"appid" : "__UNI__03B096E", "appid" : "__UNI__E5373F7",
"description" : "云端一体应用快速开发模版", "description" : "云端一体应用快速开发模版",
"versionName" : "1.0.0", "versionName" : "1.0.0",
"versionCode" : "100", "versionCode" : "100",
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册