提交 66c84627 编写于 作者: DCloud_JSON's avatar DCloud_JSON 提交者: study夏羽

与uni-admin同步相关uniCloud依赖

上级 4f676fc3
......@@ -18,9 +18,6 @@
console.log('App Launch')
this.globalData.$i18n = this.$i18n
this.globalData.$t = str => this.$t(str)
console.log('uni.getPushClientId',uni.getPushClientId);
initApp();
uniIdPageInit()
......
......@@ -155,6 +155,7 @@ function initAppVersion() {
getApp({
allowDefault: true
}).appVersion.hasNew = true;
console.log(checkUpdate());
}
})
});
......
......@@ -192,7 +192,14 @@
"navigationBarTitleText": "注册管理员账号"
}
}
],
,{
"path": "uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd",
"style": {
"enablePullDownRefresh": false,
"navigationBarTitleText": "设置密码"
}
}
],
"globalStyle": {
// #ifdef H5
"h5": {
......
// 本文件用于,使用JQL语法操作项目关联的uniCloud空间的数据库,方便开发调试和远程数据库管理
// 编写clientDB的js API(也支持常规js语法,比如var),可以对云数据库进行增删改查操作。不支持uniCloud-db组件写法
// 可以全部运行,也可以选中部分代码运行。点击工具栏上的运行按钮或者按下【F5】键运行代码
// 如果文档中存在多条JQL语句,只有最后一条语句生效
// 如果混写了普通js,最后一条语句需是数据库操作语句
// 此处代码运行不受DB Schema的权限控制,移植代码到实际业务中注意在schema中配好permission
// 不支持clientDB的action
// 数据库查询有最大返回条数限制,详见:https://uniapp.dcloud.net.cn/uniCloud/cf-database?id=limit
// 详细JQL语法,请参考 https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=jsquery
// 下面示例查询uni-id-users表的所有数据
db.collection('uni-id-users').where('user_id._id=="610a6daa506cc7000100c07f"').get();
// 本查询文件用于,使用JQL语法查询项目关联的uniCloud空间的数据库,方便开发调试
// 选中查询代码,点击工具栏上的运行按钮或者【F5】运行查询语句
// 如果没有选中代码,直接运行,则会执行整个文档的JQL语句。但如果文档中存在多条JQL语句,只有最后一条语句生效
// 本文档支持简单js,但不支持clientDB的action
// 数据库查询有最大返回条数限制,详见:https://uniapp.dcloud.net.cn/uniCloud/cf-database?id=limit
// 详细JQL语法,请参考 https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=jsquery
// 下面示例查询uni-id-users表的所有数据
db.collection('uni-id-users').get();
// 本文件用于,使用JQL语法操作项目关联的uniCloud空间的数据库,方便开发调试和远程数据库管理
// 编写clientDB的js API(也支持常规js语法,比如var),可以对云数据库进行增删改查操作。不支持uniCloud-db组件写法
// 可以全部运行,也可以选中部分代码运行。点击工具栏上的运行按钮或者按下【F5】键运行代码
// 如果文档中存在多条JQL语句,只有最后一条语句生效
// 如果混写了普通js,最后一条语句需是数据库操作语句
// 此处代码运行不受DB Schema的权限控制,移植代码到实际业务中注意在schema中配好permission
// 不支持clientDB的action
// 数据库查询有最大返回条数限制,详见:https://uniapp.dcloud.net.cn/uniCloud/cf-database.html#limit
// 详细JQL语法,请参考:https://uniapp.dcloud.net.cn/uniCloud/jql.html
// 下面示例查询uni-id-users表的所有数据
db.collection('uni-id-users').get();
{
"bsonType": "object",
"required": ["name"],
"permission": {
"read": true,
"create": false,
"update": false,
"delete": false
},
"properties": {
"_id": {
"description": "ID,系统自动生成"
},
"parent_id": {
"bsonType": "string",
"description": "父级部门ID",
"parentKey": "_id"
},
"name": {
"bsonType": "string",
"description": "部门名称",
"title": "部门名称",
"trim": "both"
},
"level": {
"bsonType": "int",
"description": "部门层级,为提升检索效率而作的冗余设计"
},
"sort": {
"bsonType": "int",
"description": "部门在当前层级下的顺序,由小到大",
"title": "显示顺序"
},
"manager_uid": {
"bsonType": "string",
"description": "部门主管的userid, 参考`uni-id-users` 表",
"foreignKey": "uni-id-users._id"
},
"create_date": {
"bsonType": "timestamp",
"description": "部门创建时间",
"forceDefaultValue": {
"$env": "now"
}
}
}
}
{
"bsonType": "object",
"permission": {
"create": false,
"delete": false,
"read": "doc.is_on_sale == true",
"update": false
},
"properties": {
"_id": {
"description": "存储文档 ID(商品 ID),系统自动生成"
},
"add_date": {
"bsonType": "timestamp",
"defaultValue": {
"$env": "now"
},
"description": "上架时间"
},
"category_id": {
"bsonType": "string",
"description": "分类 id,参考`opendb-mall-categories`表",
"foreignKey": "opendb-mall-categories._id"
},
"comment_count": {
"bsonType": "int",
"description": "累计评论数"
},
"goods_banner_imgs": {
"bsonType": "array",
"description": "商品详情页的banner图地址"
},
"goods_desc": {
"bsonType": "string",
"description": "商品详细描述",
"title": "详细描述",
"trim": "both"
},
"goods_sn": {
"bsonType": "string",
"description": "商品的唯一货号",
"title": "货号",
"trim": "both"
},
"goods_thumb": {
"bsonType": "string",
"description": "商品缩略图,用于在列表或搜索结果中预览显示",
"pattern": "^(http:\/\/|https:\/\/|\/|.\/|@\/)\\S",
"title": "缩略图地址",
"trim": "both"
},
"is_alone_sale": {
"bsonType": "bool",
"description": "是否能单独销售;如果不能单独销售,则只能作为某商品的配件或者赠品销售"
},
"is_best": {
"bsonType": "bool",
"description": "是否精品"
},
"is_hot": {
"bsonType": "bool",
"description": "是否热销"
},
"is_new": {
"bsonType": "bool",
"description": "是否新品",
"title": "是否新品"
},
"is_on_sale": {
"bsonType": "bool",
"description": "是否上架销售",
"title": "是否上架"
},
"is_real": {
"bsonType": "bool",
"description": "是否实物",
"title": "是否为实物"
},
"keywords": {
"bsonType": "string",
"description": "商品关键字,为搜索引擎收录使用",
"title": "关键字",
"trim": "both"
},
"last_modify_date": {
"bsonType": "timestamp",
"defaultValue": {
"$env": "now"
},
"description": "最后修改时间"
},
"month_sell_count": {
"bsonType": "int",
"description": "月销量"
},
"name": {
"bsonType": "string",
"description": "商品名称",
"title": "名称",
"trim": "both"
},
"remain_count": {
"bsonType": "int",
"description": "库存数量",
"title": "库存数量"
},
"seller_note": {
"bsonType": "string",
"description": "商家备注,仅商家可见",
"permission": {
"read": false
},
"trim": "both"
},
"total_sell_count": {
"bsonType": "int",
"description": "总销量"
}
},
"required": ["goods_sn", "name", "remain_count", "month_sell_count", "total_sell_count", "comment_count", "is_real",
"is_on_sale", "is_alone_sale", "is_best", "is_new", "is_hot"
]
}
## 3.5.1(2022-08-11)
v3.5.1
## 4.0.6(2022-12-12)
修复`getDrawModules`,第一次获取结果正常,后续获取`tile`模块不存在的问题;
修复安卓type:normal因Canvas API使用了小数或为0的参数导致生成异常的问题(注:安卓非2d Canvas部分API参数不支持携带小数,部分API参数必须大于0)。
## 4.0.1(2022-11-28)
优化组件loading属性的表现;
新增组件type选项normal,以便于在某些条件编译初始为type=2d时还可以选择使用非2d组件类型;
修复组件条件编译在其他编辑器语法提示报错;
修复原生对es5的支持。
## 4.0.0(2022-11-21)
v4版本源代码全面开放,开源地址:[https://github.com/Sansnn/uQRCode](https://github.com/Sansnn/uQRCode)
修复vue3引入报错;
修复vue导出临时文件失败;
修复在其他dom元素更新时,可能导致二维码重新渲染;
修复size重新赋值导致组件偏移、闪烁。
升级说明:v4为大版本更新,虽然已尽可能兼容上一代版本,但不可避免的还是存在一些细节差异,若更新后出现问题,请参考对照[v3 文档](https://uqrcode.cn/doc/v3)[v4 文档](https://uqrcode.cn/doc)进行修改。
export const cacheImageList = [];
\ No newline at end of file
function Queue() {
let waitingQueue = this.waitingQueue = [];
let isRunning = this.isRunning = false; // 记录是否有未完成的任务
function execute(task, resolve, reject) {
task()
.then((data) => {
resolve(data);
})
.catch((e) => {
reject(e);
})
.finally(() => {
// 等待任务队列中如果有任务,则触发它;否则设置isRunning = false,表示无任务状态
if (waitingQueue.length) {
const next = waitingQueue.shift();
execute(next.task, next.resolve, next.reject);
} else {
isRunning = false;
}
});
}
this.exec = function(task) {
return new Promise((resolve, reject) => {
if (isRunning) {
waitingQueue.push({
task,
resolve,
reject
});
} else {
isRunning = true;
execute(task, resolve, reject);
}
});
}
}
/* 队列实例,某些平台一起使用多个组件时需要通过队列逐一绘制,否则部分绘制方法异常,nvue端的iOS gcanvas尤其明显,在不通过队列绘制时会出现图片丢失的情况 */
export const queueDraw = new Queue();
export const queueLoadImage = new Queue();
\ No newline at end of file
declare module '*/common/cache' {
export const cacheImageList: Array;
}
\ No newline at end of file
declare module '*/common/queue' {
export const queueDraw: any;
export const queueLoadImage: any;
}
\ No newline at end of file
{
"id": "Sansnn-uQRCode",
"displayName": "uQRCode 全端二维码生成插件 支持nvue 支持nodejs服务端",
"version": "3.5.1",
"version": "4.0.6",
"description": "uQRCode是一款基于Javascript环境开发的二维码生成插件,适用所有Javascript运行环境的前端应用和Node.js。",
"keywords": [
"uQRCode",
"二维码",
"uQRCode",
"qrcode",
"qr"
],
"repository": "https://github.com/Sansnn/uQRCode",
"engines": {
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"sale": {
......
......@@ -6,11 +6,29 @@
欢迎加入群聊【uQRCode交流群】:[695070434](https://jq.qq.com/?_wv=1027&k=JRjzDqiw)
# 设计器
uQRCode发布了配套的可视化设计器,可根据自己喜好在设计器中设计二维码样式,一键生成配置代码复制到项目中,详情请在微信小程序搜索“柚子二维码”,或扫描下方小程序码体验。
![uQRCode设计器](https://uqrcode.cn/mp_weixin_code.jpg)
## 设计器模板示例
![uQRCode设计器](https://uqrcode.cn/yz_1.png)
![uQRCode设计器](https://uqrcode.cn/yz_2.png)
![uQRCode设计器](https://uqrcode.cn/yz_3.png)
![uQRCode设计器](https://uqrcode.cn/yz_4.png)
![uQRCode设计器](https://uqrcode.cn/yz_5.png)
![uQRCode设计器](https://uqrcode.cn/yz_6.png)
![uQRCode设计器](https://uqrcode.cn/yz_7.png)
![uQRCode设计器](https://uqrcode.cn/yz_8.png)
![uQRCode设计器](https://uqrcode.cn/yz_9.png)
# 快速上手
> 在`uni-app`中,我们更推荐使用组件方式来生成二维码,组件方式大大提高了页面的可读性以及避开了一些平台容易出问题的地方,当组件无法满足需求的时候,再考虑切换成原生方式。
官方文档:[https://doc.uqrcode.cn](https://doc.uqrcode.cn)
官方文档:[https://uqrcode.cn/doc](https://uqrcode.cn/doc)
github地址:[https://github.com/Sansnn/uQRCode](https://github.com/Sansnn/uQRCode)
......@@ -20,7 +38,7 @@ uni-app插件市场地址:[https://ext.dcloud.net.cn/plugin?id=1287](https://e
## 原生方式
原生方式仅需要获取`uqrcode.js`文件便可使用。
原生方式仅需要获取`uqrcode.js`文件便可使用。详细配置请移步到:文档 > [原生](https://uqrcode.cn/doc/document/native.html)
### 安装
......@@ -38,12 +56,18 @@ npm install @uqrcode/js
- 通过`import`引入。
``` javascript
import UQRCode from 'uqrcode';
// npm安装
import UQRCode from 'uqrcodejs'; // npm install uqrcodejs
// 或者
import UQRCode from '@uqrcode/js'; // npm install @uqrcode/js
```
- `Node.js`通过`require`引入。
``` javascript
const UQRCode = require('uqrcode');
// npm安装
const UQRCode = require('uqrcodejs'); // npm install uqrcodejs
// 或者
const UQRCode = require('@uqrcode/js'); // npm install @uqrcode/js
```
- 原生浏览器环境,在js脚本加载时添加到`window`
......@@ -54,42 +78,112 @@ const UQRCode = require('uqrcode');
</script>
```
> `vue3`推荐使用`npm`安装,非`npm`安装直接引入`uqrcode.js`文件如果出现报错:`SyntaxError: The requested module 'uqrcode.js' does not provide an export named 'default'`,在`uqrcode.js`文件中最后一行添加`export default uQRCode`即可。
### 简单用法
`uQRCode`基于`Canvas API`封装了一套方法,建议开发者使用`canvas`生成,一键调用,非常方便。以下是示例:
- HTML部分
``` html
<canvas id="qrcode" width="200" height="200"></canvas>
```
- HTML示例
- DOM部分
``` html
<canvas id="qrcode" width="200" height="200"></canvas>
```
- JS部分
``` javascript
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://doc.uqrcode.cn";
// 设置二维码大小,必须与canvas设置的宽高一致
qr.size = 200;
// 调用制作二维码方法
qr.make();
// 获取canvas元素
var canvas = document.getElementById("qrcode");
// 获取canvas上下文
var canvasContext = canvas.getContext("2d");
// 设置uQRCode实例的canvas上下文
qr.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
qr.drawCanvas();
```
- JS部分
``` javascript
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小,必须与canvas设置的宽高一致
qr.size = 200;
// 调用制作二维码方法
qr.make();
// 获取canvas元素
var canvas = document.getElementById("qrcode");
// 获取canvas上下文
var canvasContext = canvas.getContext("2d");
// 设置uQRCode实例的canvas上下文
qr.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
qr.drawCanvas();
```
- uni-app示例
- Template部分
``` html
<canvas id="qrcode" canvas-id="qrcode" style="width: 200px;height: 200px;"></canvas>
```
- JS部分
``` javascript
onReady() {
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小,必须与canvas设置的宽高一致
qr.size = 200;
// 调用制作二维码方法
qr.make();
// 获取canvas上下文
var canvasContext = uni.createCanvasContext('qrcode', this); // 如果是组件,this必须传入
// 设置uQRCode实例的canvas上下文
qr.canvasContext = canvasContext;
// 调用绘制方法将二维码图案绘制到canvas上
qr.drawCanvas();
}
```
- 微信小程序,推荐使用Canvas 2D,关于Canvas 2D的使用请参考微信开放文档。
### 高级用法
考虑到部分平台可能不支持`canvas`,所以`uQRCode`并没有强制要求和`canvas`一起使用,您还可以选择其他方式来生成二维码,例如使用`js`操作`dom`进行绘制或是使用`svg`绘制等。以下是示例:
- uni-app v-for+view
```html
<template>
<view>
<view class="qrcode">
<view v-for="(row, rowI) in modules" :key="rowI" style="display: flex;flex-direction: row;">
<view v-for="(col, colI) in row" :key="colI">
<view v-if="col.isBlack" style="width: 10px;height: 10px;background-color: black;">
<!-- 黑色码点 -->
</view>
<view v-else style="width: 10px;height: 10px;background-color: white;">
<!-- 白色码点 -->
</view>
</view>
</view>
</view>
</view>
</template>
<script>
import UQRCode from '../../uni_modules/Sansnn-uQRCode/js_sdk/uqrcode/uqrcode.js';
export default {
data() {
return {
modules: []
}
},
onLoad() {
const qr = new UQRCode();
qr.data = 'uQRCode';
qr.make();
this.modules = qr.modules;
},
methods: {
}
}
</script>
```
- js操作dom
``` html
<!DOCTYPE html>
<html>
......@@ -106,7 +200,7 @@ qr.drawCanvas();
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://doc.uqrcode.cn";
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小,必须与canvas设置的宽高一致
qr.size = 200;
// 设置二维码前景图,可以是路径
......@@ -115,12 +209,13 @@ qr.drawCanvas();
// 调用制作二维码方法
qr.make();
var drawModules = qr.getDrawModules();
// 遍历drawModules创建dom元素
var qrHtml = '';
for (var i = 0; i < qr.drawModules.length; i++) {
var drawModule = qr.drawModules[i];
for (var i = 0; i < drawModules.length; i++) {
var drawModule = drawModules[i];
switch (drawModule.type) {
case 'block':
case 'tile':
/* 绘制小块 */
qrHtml += `<div style="position: absolute;left: ${drawModule.x}px;top: ${drawModule.y}px;width: ${drawModule.width}px;height: ${drawModule.height}px;background: ${drawModule.color};"></div>`;
break;
......@@ -153,7 +248,7 @@ qr.drawCanvas();
// 获取uQRCode实例
var qr = new UQRCode();
// 设置二维码内容
qr.data = "https://doc.uqrcode.cn";
qr.data = "https://uqrcode.cn/doc";
// 设置二维码大小,必须与canvas设置的宽高一致
qr.size = 200;
// 设置二维码前景图,可以是路径
......@@ -162,12 +257,13 @@ qr.drawCanvas();
// 调用制作二维码方法
qr.make();
var drawModules = qr.getDrawModules();
// 遍历drawModules创建svg元素
var qrHtml = '';
for (var i = 0; i < qr.drawModules.length; i++) {
var drawModule = qr.drawModules[i];
for (var i = 0; i < drawModules.length; i++) {
var drawModule = drawModules[i];
switch (drawModule.type) {
case 'block':
case 'tile':
/* 绘制小块 */
qrHtml += `<rect x="${drawModule.x}" y="${drawModule.y}" width="${drawModule.width}" height="${drawModule.height}" style="fill: ${drawModule.color};" />`;
break;
......@@ -250,7 +346,7 @@ aEle.remove(); // 下载之后把创建的元素删除
### 安装
通过uni-app插件市场地址安装:[https://ext.dcloud.net.cn/plugin?id=1287](https://ext.dcloud.net.cn/plugin?id=1287)
通过uni-app插件市场地址安装:[https://ext.dcloud.net.cn/plugin?id=1287](https://ext.dcloud.net.cn/plugin?id=1287)详细配置请移步到:文档 > [uni-app组件](https://uqrcode.cn/doc/document/uni-app.html)
### 引入
......@@ -258,15 +354,15 @@ uni-app默认为easycom模式,可直接键入`<uqrcode>`标签。
### 简单用法
安装`uqrcode`组件后,在`template`中键入`<uqrcode/>`。设置`ref`属性可使用组件内部方法,`canvas-id`属性为组件内部的canvas组件标识,`value`属性为二维码生成对应内容
安装`uqrcode`组件后,在`template`中键入`<uqrcode/>`。设置`ref`属性可使用组件内部方法,`canvas-id`属性为组件内部的canvas组件标识,`value`属性为二维码生成对应内容`options`为配置选项,可配置二维码样式,绘制Logo等,详见:[options](https://uqrcode.cn/doc/document/uni-app.html#options)
``` html
<uqrcode ref="qrcode" canvas-id="qrcode" value="https://doc.uqrcode.cn"></uqrcode>
<uqrcode ref="uqrcode" canvas-id="qrcode" value="https://uqrcode.cn/doc" :options="{ margin: 10 }"></uqrcode>
```
### 导出临时文件路径
为了保证方法调用成功,请在 [complete](/document/uni-app.md#complete) 事件返回`success=true`后调用。
为了保证方法调用成功,请在 [complete](https://uqrcode.cn/doc/document/uni-app.html#complete) 事件返回`success=true`后调用。
```javascript
// uqrcode为组件的ref名称
......@@ -279,7 +375,7 @@ this.$refs.uqrcode.toTempFilePath({
### 保存二维码到本地相册
为了保证方法调用成功,请在 [complete](/document/uni-app.md#complete) 事件返回`success=true`后调用。
为了保证方法调用成功,请在 [complete](https://uqrcode.cn/doc/document/uni-app.html#complete) 事件返回`success=true`后调用。
```javascript
// uqrcode为组件的ref名称
......@@ -293,4 +389,4 @@ this.$refs.uqrcode.save({
});
```
## 更多配置说明请前往官方文档查看:[https://doc.uqrcode.cn](https://doc.uqrcode.cn)。
\ No newline at end of file
## 更多使用说明请前往官方文档查看:[https://uqrcode.cn/doc](https://uqrcode.cn/doc)。
\ No newline at end of file
......@@ -192,11 +192,12 @@
display: flex;
overflow: hidden;
box-sizing: border-box;
min-width: 20px;
font-feature-settings: "tnum";
/* #endif */
justify-content: center;
flex-direction: row;
height: 20px;
min-width: 20px;
padding: 0 4px;
line-height: 18px;
color: #fff;
......@@ -206,7 +207,6 @@
border: 1px solid #fff;
text-align: center;
font-family: 'Helvetica Neue', Helvetica, sans-serif;
font-feature-settings: "tnum";
font-size: $bage-size;
/* #ifdef H5 */
z-index: 999;
......
## 0.6.2(2023-01-10)
- 修复 抖音小程序无法显示的Bug
- 修复 刷新时兼容 device_uuid
## 0.6.1(2022-06-23)
- 修复:部分返回值,不符合响应体规范的问题
## 0.6.0(2022-05-27)
......
{
"id": "uni-captcha",
"displayName": "uni-captcha",
"version": "0.6.1",
"version": "0.6.2",
"description": "云端一体图形验证码组件",
"keywords": [
"captcha",
......@@ -14,11 +14,7 @@
"engines": {
"HBuilderX": "^3.1.0"
},
"dcloudext": {
"category": [
"uniCloud",
"云函数模板"
],
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
......@@ -35,7 +31,8 @@
"data": "无",
"permissions": "无"
},
"npmurl": ""
"npmurl": "",
"type": "unicloud-template-function"
},
"uni_modules": {
"dependencies": [],
......
## 1.0.9(2022-11-30)
- 修复 v-for 为使用 key 值控制台 warning
## 1.0.8(2022-09-16)
- 可以使用 uni-scss 控制主题色
## 1.0.7(2022-07-06)
......
......@@ -14,7 +14,7 @@
<view class="tab-c">
<template v-for="(child, i) in dataList" >
<scroll-view class="list" :key="i" v-if="i==selectedIndex" :scroll-y="true">
<view class="item" :class="{'is-disabled': !!item.disable}" v-for="(item, j) in child"
<view class="item" :class="{'is-disabled': !!item.disable}" v-for="(item, j) in child" :key="j"
@click="handleNodeClick(item, i, j)">
<text class="item-text item-text-overflow">{{item[map.text]}}</text>
<view class="check" v-if="selected.length > i && item[map.value] == selected[i].value"></view>
......
{
"id": "uni-data-picker",
"displayName": "uni-data-picker 数据驱动的picker选择器",
"version": "1.0.8",
"version": "1.0.9",
"description": "单列、多列级联选择器,常用于省市区城市选择、公司部门选择、多级分类等场景",
"keywords": [
"uni-ui",
......
## 0.2.0(2022-12-30)
- 修复 清空选项后多次执行 change
## 0.1.9(2022-09-05)
- 修复 微信小程序下拉框出现后选择会点击到蒙板后面的输入框
## 0.1.8(2022-08-29)
......
......@@ -16,10 +16,9 @@
<view class="uni-select__selector-empty" v-if="mixinDatacomResData.length === 0">
<text>{{emptyTips}}</text>
</view>
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData"
:key="index" @click="change(item)">
<text
:class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
<view v-else class="uni-select__selector-item" v-for="(item,index) in mixinDatacomResData" :key="index"
@click="change(item)">
<text :class="{'uni-select__selector__disabled': item.disable}">{{formatItemName(item)}}</text>
</view>
</scroll-view>
</view>
......@@ -98,7 +97,7 @@
created() {
this.last = `${this.collection}_last_selected_option_value`
if (this.collection && !this.localdata.length) {
this.mixinDatacomEasyGet()
this.query();
}
},
computed: {
......@@ -144,6 +143,14 @@
}
},
methods: {
// 执行数据库查询
query(){
this.mixinDatacomEasyGet();
},
// 监听查询条件变更事件
onMixinDatacomPropsChange(){
this.query();
},
initDefVal() {
let defValue = ''
if ((this.value || this.value === 0) && !this.isDisabled(this.value)) {
......@@ -159,12 +166,14 @@
defValue = strogeValue
} else {
let defItem = ''
if (this.defItem > 0 && this.defItem < this.mixinDatacomResData.length) {
if (this.defItem > 0 && this.defItem <= this.mixinDatacomResData.length) {
defItem = this.mixinDatacomResData[this.defItem - 1].value
}
defValue = defItem
}
if (defValue || defValue === 0) {
this.emit(defValue)
}
}
const def = this.mixinDatacomResData.find(item => item.value === defValue)
this.current = def ? this.formatItemName(def) : ''
......@@ -209,7 +218,7 @@
},
toggleSelector() {
if(this.disabled){
if (this.disabled) {
return
}
......@@ -297,7 +306,7 @@
flex: 1;
height: 35px;
&--disabled{
&--disabled {
background-color: #f5f7fa;
cursor: not-allowed;
}
......
{
"id": "uni-data-select",
"displayName": "uni-data-select 下拉框选择器",
"version": "0.1.9",
"version": "0.2.0",
"description": "通过数据驱动的下拉框选择器",
"keywords": [
"uni-ui",
......
## 2.2.12(2022-12-01)
- 修复 vue3 下 i18n 国际化初始值不正确的bug
## 2.2.11(2022-09-19)
- 修复,支付宝小程序样式错乱,[详情](https://github.com/dcloudio/uni-app/issues/3861)
## 2.2.10(2022-09-19)
......
......@@ -185,6 +185,7 @@
}
},
watch: {
// #ifndef VUE3
value: {
handler(newVal, oldVal) {
if (newVal) {
......@@ -197,6 +198,21 @@
},
immediate: true
},
// #endif
// #ifdef VUE3
modelValue: {
handler(newVal, oldVal) {
if (newVal) {
this.parseValue(this.fixIosDateFormat(newVal)) //兼容 iOS、safari 日期格式
this.initTime(false)
} else {
this.time = ''
this.parseValue(Date.now())
}
},
immediate: true
},
// #endif
type: {
handler(newValue) {
if (newValue === 'date') {
......
......@@ -121,9 +121,7 @@
initVueI18n
} from '@dcloudio/uni-i18n'
import messages from './i18n/index.js'
const {
t
} = initVueI18n(messages)
let t = null
export default {
name: 'UniDatetimePicker',
......@@ -399,11 +397,10 @@
}
},
created() {
// if (this.form && this.formItem) {
// this.$watch('formItem.errMsg', (newVal) => {
// this.localMsg = newVal
// })
// }
if(!t) {
const vueI18n = initVueI18n(messages)
t = vueI18n.t
}
},
mounted() {
this.platform()
......
{
"id": "uni-datetime-picker",
"displayName": "uni-datetime-picker 日期选择器",
"version": "2.2.11",
"version": "2.2.12",
"description": "uni-datetime-picker 日期时间选择器,支持日历,支持范围选择",
"keywords": [
"uni-datetime-picker",
......
## 1.1.5(2022-11-29)
- 优化 主题样式
## 1.1.4(2022-10-27)
- 修复 props 中背景颜色无默认值的bug
## 1.1.0(2022-06-30)
......
......@@ -282,7 +282,8 @@ export default {
'is-input-border': this.inputBorder,
'is-input-error-border': this.inputBorder && this.msg,
'is-textarea': this.type === 'textarea',
'is-disabled': this.disabled
'is-disabled': this.disabled,
'is-focused': this.focusShow
});
},
inputContentStyle() {
......
{
"id": "uni-easyinput",
"displayName": "uni-easyinput 增强输入框",
"version": "1.1.4",
"version": "1.1.5",
"description": "Easyinput 组件是对原生input组件的增强",
"keywords": [
"uni-ui",
......
## 1.0.3(2022-12-21)
- 新增 sourceType 属性, 可以自定义图片和视频选择的来源
## 1.0.2(2022-07-04)
- 修复 在uni-forms下样式不生效的bug
## 1.0.1(2021-11-23)
......
......@@ -7,7 +7,7 @@ function chooseImage(opts) {
const {
count,
sizeType = ['original', 'compressed'],
sourceType = ['album', 'camera'],
sourceType,
extension
} = opts
return new Promise((resolve, reject) => {
......@@ -33,7 +33,7 @@ function chooseVideo(opts) {
camera,
compressed,
maxDuration,
sourceType = ['album', 'camera'],
sourceType,
extension
} = opts;
return new Promise((resolve, reject) => {
......
......@@ -185,6 +185,12 @@
default () {
return ['original', 'compressed']
}
},
sourceType: {
type: Array,
default () {
return ['album', 'camera']
}
}
},
data() {
......@@ -349,6 +355,7 @@
type: this.fileMediatype,
compressed: false,
sizeType: this.sizeType,
sourceType: this.sourceType,
// TODO 如果为空,video 有问题
extension: _extname.length > 0 ? _extname : undefined,
count: this.limitLength - this.files.length, //默认9
......
{
"id": "uni-file-picker",
"displayName": "uni-file-picker 文件选择上传",
"version": "1.0.2",
"version": "1.0.3",
"description": "文件选择上传组件,可以选择图片、视频等任意文件并上传到当前绑定的服务空间",
"keywords": [
"uni-ui",
......@@ -16,11 +16,7 @@
"directories": {
"example": "../../temps/example_temps"
},
"dcloudext": {
"category": [
"前端组件",
"通用组件"
],
"dcloudext": {
"sale": {
"regular": {
"price": "0.00"
......@@ -37,7 +33,8 @@
"data": "无",
"permissions": "无"
},
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui"
"npmurl": "https://www.npmjs.com/package/@dcloudio/uni-ui",
"type": "component-vue"
},
"uni_modules": {
"dependencies": ["uni-scss"],
......
## 1.0.39(2022-12-28)
- uni-id-co 修复 URL化时第三方登录无法获取 uniPlatform 参数
- uni-id-co 修复 validator error
## 1.0.38(2022-12-26)
- uni-id-co 优化 手机号与邮箱验证规则为空字符串时不校验
## 1.0.37(2022-12-09)
- 优化admin端样式
## 1.0.36(2022-12-08)
- uni-id-co 修复 `updateUser` 接口部分参数为空时数据修改异常
## 1.0.35(2022-11-30)
- uni-id-co 新增 匹配到的用户不可在当前应用登录时的错误码 `uni-id-account-not-exists-in-current-app` [错误码说明](https://uniapp.dcloud.net.cn/uniCloud/uni-id-summary.html#errcode)
## 1.0.34(2022-11-29)
- 优化 toast 错误提示时间为3秒
- uni-id-co 修复 无法从 clientInfo 中获取 uniIdToken
## 1.0.33(2022-11-25)
- uni-id-co 新增 外部系统联登接口,可为外部系统创建与uni-id相对应的账号,使该账号可以使用依赖uniId的系统及功能 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#external)
- uni-id-co 新增 URL化请求时鉴权签名验证 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#http-reqeust-auth)
- uni-id-co 修复 微信登录时用户未设置头像的报错问题
## 1.0.32(2022-11-21)
- 新增 设置密码页面
- 新增 登录后跳转设置密码页面配置项`setPasswordAfterLogin` [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#set-pwd-after-login)
- uni-id-co 新增 设置密码接口 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id-pages.html#set-pwd)
## 1.0.31(2022-11-16)
- uni-id-co 修复 验证码可能无法收到的bug
## 1.0.30(2022-11-11)
- uni-id-co 修复 用户只有openid时绑定微信/QQ报错
## 1.0.29(2022-11-10)
......
......@@ -36,7 +36,7 @@ let mixin = {
})
}
this.$nextTick(n => {
console.log(this.$refs.uniFabLogin);
// console.log(this.$refs.uniFabLogin);
this.$refs.uniFabLogin.login({
code:e.code
}, 'weixin')
......
......@@ -115,9 +115,10 @@
text-align: center;
height: 40px;
line-height: 40px;
margin: 15px 0 0 0;
margin: 15px 0 10px 0;
color: #FFF !important;
border-radius: 5px;
font-size: 16px;
}
.uni-body.uni_modules-uni-id-pages-pages-login-login-withoutpwd{
......
import pagesJson from '@/pages.json'
import config from '@/uni_modules/uni-id-pages/config.js'
const uniIdCo = uniCloud.importObject("uni-id-co")
const db = uniCloud.database();
const usersTable = db.collection('uni-id-users')
let hostUserInfo = uni.getStorageSync('uni-id-pages-userInfo')||{}
console.log( hostUserInfo);
// console.log( hostUserInfo);
const data = {
userInfo: hostUserInfo,
hasLogin: Object.keys(hostUserInfo).length != 0
}
console.log('data', data);
// console.log('data', data);
// 定义 mutations, 修改属性
export const mutations = {
// data不为空,表示传递要更新的值(注意不是覆盖是合并),什么也不传时,直接查库获取更新
async updateUserInfo(data = false) {
if (data) {
usersTable.where('_id==$env.uid').update(data).then(e => {
console.log(e);
// console.log(e);
if (e.result.updated) {
uni.showToast({
title: "更新成功",
icon: 'none'
icon: 'none',
duration: 3000
});
this.setUserInfo(data)
} else {
uni.showToast({
title: "没有改变",
icon: 'none'
icon: 'none',
duration: 3000
});
}
})
......@@ -39,7 +41,7 @@ export const mutations = {
let res = await usersTable.where("'_id' == $cloudEnv_uid")
.field('mobile,nickname,username,email,avatar_file')
.get()
console.log('fromDbData',res.result.data);
// console.log('fromDbData',res.result.data);
this.setUserInfo(res.result.data[0])
} catch (e) {
this.setUserInfo({},{cover:true})
......@@ -48,11 +50,11 @@ export const mutations = {
}
},
async setUserInfo(data, {cover}={cover:false}) {
console.log('set-userInfo', data);
// console.log('set-userInfo', data);
let userInfo = cover?data:Object.assign(store.userInfo,data)
store.userInfo = Object.assign({},userInfo)
store.hasLogin = Object.keys(store.userInfo).length != 0
console.log('store.userInfo', store.userInfo);
// console.log('store.userInfo', store.userInfo);
uni.setStorage({
key: "uni-id-pages-userInfo",
data:store.userInfo
......@@ -69,23 +71,9 @@ export const mutations = {
uni.$emit('uni-id-pages-logout')
this.setUserInfo({},{cover:true})
},
loginSuccess(e = {}){
const {
showToast = true, toastText = '登录成功', autoBack = true, uniIdRedirectUrl = ''
} = e
console.log({
toastText,
autoBack
});
if (showToast) {
uni.showToast({
title: toastText,
icon: 'none'
});
}
this.updateUserInfo()
uni.$emit('uni-id-pages-login-success')
if (autoBack) {
loginBack (e = {}) {
const {uniIdRedirectUrl = ''} = e
let delta = 0; //判断需要返回几层
let pages = getCurrentPages();
// console.log(pages);
......@@ -102,7 +90,7 @@ export const mutations = {
}
// #ifdef H5
if (e.loginType == 'weixin') {
console.log('window.history', window.history);
// console.log('window.history', window.history);
return window.history.go(-3)
}
// #endif
......@@ -117,6 +105,34 @@ export const mutations = {
uni.navigateBack({
delta
})
},
loginSuccess(e = {}){
const {
showToast = true, toastText = '登录成功', autoBack = true, uniIdRedirectUrl = '', passwordConfirmed
} = e
// console.log({toastText,autoBack});
if (showToast) {
uni.showToast({
title: toastText,
icon: 'none',
duration: 3000
});
}
this.updateUserInfo()
uni.$emit('uni-id-pages-login-success')
if (config.setPasswordAfterLogin && !passwordConfirmed) {
return uni.redirectTo({
url: uniIdRedirectUrl ? `/uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd?uniIdRedirectUrl=${uniIdRedirectUrl}&loginType=${e.loginType}`: `/uni_modules/uni-id-pages/pages/userinfo/set-pwd/set-pwd?loginType=${e.loginType}`,
fail: (err) => {
console.log(err)
}
})
}
if (autoBack) {
this.loginBack(uniIdRedirectUrl)
}
}
......
......@@ -48,7 +48,7 @@
async mounted() {
// #ifdef H5
this.isPC = !['ios', 'android'].includes(uni.getSystemInfoSync().platform);
console.log(' this.isPC', this.isPC, uni.getSystemInfoSync().platform);
// console.log(' this.isPC', this.isPC, uni.getSystemInfoSync().platform);
// #endif
},
computed: {
......@@ -68,7 +68,7 @@
mutations.updateUserInfo({avatar_file})
},
uploadAvatarImg(res) {
console.log(this.hasLogin);
// console.log(this.hasLogin);
if(!this.hasLogin){
return uni.navigateTo({
url:'/uni_modules/uni-id-pages/pages/login/login-withoutpwd'
......@@ -84,7 +84,7 @@
count: 1,
crop,
success: async (res) => {
console.log(res);
// console.log(res);
let tempFile = res.tempFiles[0],
avatar_file = {
// #ifdef H5
......@@ -109,13 +109,13 @@
}
},
complete(e) {
console.log(e);
// console.log(e);
}
});
})
}
// #endif
console.log(this.userInfo);
// console.log(this.userInfo);
let cloudPath = this.userInfo._id + '' + Date.now()
avatar_file.name = cloudPath
uni.showLoading({
......@@ -131,9 +131,7 @@
});
// console.log(result)
avatar_file.url = fileID
console.log({
avatar_file
});
// console.log({avatar_file});
uni.hideLoading()
this.setAvatarFile(avatar_file)
}
......
......@@ -28,12 +28,12 @@
uni.showLoading({ mask: true })
wx.checkSession({
success() {
console.log('session_key 未过期');
// console.log('session_key 未过期');
resolve()
uni.hideLoading()
},
fail() {
console.log('session_key 已经失效,正在执行更新');
// console.log('session_key 已经失效,正在执行更新');
wx.login({
success({
code
......@@ -41,13 +41,13 @@
uniCloud.importObject("uni-id-co",{
customUI:true
}).loginByWeixin({code}).then(e=>{
console.log(e);
// console.log(e);
resolve()
}).catch(e=>{
console.log(e);
reject()
}).finally(e=>{
console.log(e);
// console.log(e);
uni.hideLoading()
})
},
......@@ -61,13 +61,13 @@
})
},
async bindMobileByMpWeixin(e) {
console.log(e);
// console.log(e);
if (e.detail.errMsg == "getPhoneNumber:ok") {
console.log(e.detail);
// console.log(e.detail);
//检查登录信息是否过期,否则通过重新登录刷新session_key
await this.beforeGetphonenumber()
uniIdCo.bindMobileByMpWeixin(e.detail).then(e => {
console.log(e);
// console.log(e);
this.$emit('success')
}).finally(e => {
this.closeMe()
......
......@@ -123,22 +123,25 @@
this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({
title: '请先输入图形验证码',
icon: 'none'
icon: 'none',
duration: 3000
});
}
if(!this.email) return uni.showToast({
title: "请输入邮箱",
icon: 'none'
icon: 'none',
duration: 3000
});
let reg_email = /@/;
if (!reg_email.test(this.email)) return uni.showToast({
title: "邮箱格式错误",
icon: 'none'
icon: 'none',
duration: 3000
});
const uniIdCo = uniCloud.importObject("uni-id-co", {
customUI: true
})
console.log('uniIdCo', uniIdCo)
// console.log('uniIdCo', uniIdCo)
console.log('sendEmailCode',{
"email": this.email,
"scene": this.type,
......@@ -149,15 +152,16 @@
"scene": this.type,
"captcha": this.captcha
}).then(result => {
console.log(result.code);
// console.log(result.code);
uni.showToast({
title: "邮箱验证码发送成功",
icon: 'none'
icon: 'none',
duration: 3000
});
this.reverseNumber = Number(this.count);
this.getCode();
}).catch(e => {
console.log(JSON.stringify(e));
// console.log(JSON.stringify(e));
if (e.code == "uni-id-invalid-mail-template") {
this.modelValue = "123456"
uni.showToast({
......@@ -171,7 +175,8 @@
this.captcha = ""
uni.showToast({
title: e.message,
icon: 'none'
icon: 'none',
duration: 3000
});
}
})
......
......@@ -49,7 +49,7 @@
return this.getParentComponent().agree
},
set(agree) {
console.log('setAgree', agree);
// console.log('setAgree', agree);
return this.getParentComponent().agree = agree
}
}
......@@ -248,7 +248,8 @@
].includes(type)) {
return uni.showToast({
title: '该登录方式暂未实现,欢迎提交pr',
icon: 'none'
icon: 'none',
duration: 3000
});
}
......@@ -264,7 +265,8 @@
}else{
return uni.showToast({
title: '当前设备不支持此登录,请选择其他登录方式',
icon: 'none'
icon: 'none',
duration: 3000
});
}
}, err => {
......@@ -286,20 +288,19 @@
) {
return uni.showToast({
title: '当前设备不支持此登录,请选择其他登录方式',
icon: 'none'
icon: 'none',
duration: 3000
});
}
//判断是否需要弹出隐私协议授权框
console.log(type, this.agree);
// console.log(type, this.agree);
let needAgreements = (config?.agreements?.scope || []).includes('register')
console.log({
needAgreements
});
// console.log({needAgreements});
if (type != 'univerify' && needAgreements && !this.agree) {
let agreementsRef = this.getParentComponent().$refs.agreements
return agreementsRef.popup(() => {
console.log(type, navigateBack);
// console.log(type, navigateBack);
this.login_before(type, navigateBack, options)
})
}
......@@ -311,7 +312,7 @@
document.domain +
(window.location.href.includes('#')?'/#':'') +
'/uni_modules/uni-id-pages/pages/login/login-withoutpwd?is_weixin_redirect=true&type=weixin'
console.log('redirectUrl----',redirectUrl);
// console.log('redirectUrl----',redirectUrl);
let ua = window.navigator.userAgent.toLowerCase();
if (ua.match(/MicroMessenger/i) == 'micromessenger'){
// console.log('在微信公众号内');
......@@ -337,7 +338,7 @@
if (type == 'univerify') {
let univerifyManager = uni.getUniverifyManager()
let onButtonsClickFn = async res => {
console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
// console.log('点击了第三方登录,provider:', res, res.provider, this.univerifyStyle.buttons.list);
//同步一键登录弹出层隐私协议框是否打勾
let agree = (await uni.getCheckBoxState())[1].state
//console.log('agree',agree);
......@@ -359,7 +360,8 @@
//console.log("你未同意隐私政策协议");
uni.showToast({
title: "你未同意隐私政策协议",
icon: 'none'
icon: 'none',
duration: 3000
});
}
}
......@@ -377,17 +379,18 @@
return univerifyManager.login({
"univerifyStyle": this.univerifyStyle,
success: res => {
console.log('login success', res)
// console.log('login success', res)
this.login(res.authResult, 'univerify')
},
fail(err) {
uni.showToast({
title: JSON.stringify(err),
icon: 'none'
icon: 'none',
duration: 3000
});
},
complete: async e => {
console.log(e);
// console.log(e);
uni.hideLoading()
//同步一键登录弹出层隐私协议框是否打勾
this.agree = (await uni.getCheckBoxState())[1].state
......@@ -410,7 +413,7 @@
"univerifyStyle": this.univerifyStyle,
// #endif
success: async e => {
console.log(e);
// console.log(e);
if (type == 'apple') {
let res = await this.getUserInfo({
provider: "apple"
......@@ -429,21 +432,19 @@
})
},
login(params, type) { //联网验证登录
console.log('执行登录开始----');
console.log({
params,
type
});
// console.log('执行登录开始----');
console.log({params,type});
//toLowerCase
let action = 'loginBy' + type.trim().replace(type[0], type[0].toUpperCase())
const uniIdCo = uniCloud.importObject("uni-id-co",{
customUI:true
})
uniIdCo[action](params).then(result => {
console.log("login-result", result);
// console.log("login-result", result);
uni.showToast({
title: '登录成功',
icon: 'none'
icon: 'none',
duration: 2000
});
// #ifdef MP-WEIXIN
//如果是微信小程序端的微信登录,且为首次登录,就弹出获取微信昵称+头像用于绑定资料
......@@ -462,7 +463,7 @@
mutations.loginSuccess(result)
})
.catch(e=>{
console.log(e);
// console.log(e);
uni.showModal({
content: e.message,
confirmText:"知道了",
......
......@@ -2,7 +2,7 @@
<view>
<uni-captcha :focus="focusCaptchaInput" ref="captcha" scene="send-sms-code" v-model="captcha" />
<view class="box">
<uni-easyinput :focus="focusSmsCodeInput" @blur="focusSmsCodeInput = false" type="number" class="input-box" :inputBorder="false" v-model="modelValue" maxlength="6"
<uni-easyinput :focus="focusSmsCodeInput" @blur="focusSmsCodeInput = false" type="number" class="input-box" :inputBorder="false" v-model="modelValue" maxlength="6" :clearable="false"
placeholder="请输入短信验证码">
</uni-easyinput>
<view class="short-code-btn" hover-class="hover" @click="start">
......@@ -123,13 +123,15 @@
this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({
title: '请先输入图形验证码',
icon: 'none'
icon: 'none',
duration: 3000
});
}
let reg_phone = /^1\d{10}$/;
if (!reg_phone.test(this.phone)) return uni.showToast({
title: "手机号格式错误",
icon: 'none'
icon: 'none',
duration: 3000
});
const uniIdCo = uniCloud.importObject("uni-id-co", {
customUI: true
......@@ -144,15 +146,16 @@
"scene": this.type,
"captcha": this.captcha
}).then(result => {
console.log(result.code);
// console.log(result.code);
uni.showToast({
title: "短信验证码发送成功",
icon: 'none'
icon: 'none',
duration: 3000
});
this.reverseNumber = Number(this.count);
this.getCode();
}).catch(e => {
console.log(JSON.stringify(e));
// console.log(JSON.stringify(e));
if (e.code == "uni-id-invalid-sms-template-id") {
this.modelValue = "123456"
uni.showToast({
......@@ -166,7 +169,8 @@
this.captcha = ""
uni.showToast({
title: e.message,
icon: 'none'
icon: 'none',
duration: 3000
});
}
})
......
......@@ -31,7 +31,7 @@
uni.getUserProfile({
desc: "用于设置账户昵称和头像",
complete: (e) => {
console.log("getUserProfile:", e);
// console.log("getUserProfile:", e);
callBack(e)
}
})
......
......@@ -52,5 +52,16 @@ export default {
* weak(弱:密码必须包含字母和数字,长度范围:6-16位之间)
* 为空或false则不验证密码强度
*/
"passwordStrength":"medium"
"passwordStrength":"medium",
/**
* 登录后允许用户设置密码(只针对未设置密码得用户)
* 开启此功能将 setPasswordAfterLogin 设置为 true 即可
* "setPasswordAfterLogin": false
*
* 如果允许用户跳过设置密码 将 allowSkip 设置为 true
* "setPasswordAfterLogin": {
* "allowSkip": true
* }
* */
"setPasswordAfterLogin": false
}
......@@ -50,7 +50,7 @@ export default async function() {
uni.preLogin({
provider: 'univerify',
complete: e => {
console.log(e);
// console.log(e);
}
})
}
......@@ -65,10 +65,7 @@ export default async function() {
code, // 错误码详见https://uniapp.dcloud.net.cn/uniCloud/clientdb?id=returnvalue
message
}) {
console.error('onDBError', {
code,
message
});
// console.error('onDBError', {code,message});
}
// 解绑clientDB错误事件
//db.off('error', onDBError)
......@@ -77,17 +74,17 @@ export default async function() {
//4. 同步客户端push_clientid至device表
if (uniCloud.onRefreshToken) {
uniCloud.onRefreshToken(() => {
console.log('onRefreshToken');
// console.log('onRefreshToken');
if (uni.getPushClientId) {
uni.getPushClientId({
success: async function(e) {
console.log(e)
// console.log(e)
let pushClientId = e.cid
console.log(pushClientId);
// console.log(pushClientId);
let res = await uniIdCo.setPushCid({
pushClientId
})
console.log('getPushClientId', res);
// console.log('getPushClientId', res);
},
fail(e) {
console.log(e)
......
{
"id": "uni-id-pages",
"displayName": "uni-id-pages",
"version": "1.0.30",
"version": "1.0.39",
"description": "云端一体简单、统一、可扩展的用户中心页面模版",
"keywords": [
"用户管理",
......
......@@ -20,7 +20,7 @@
});
title = "页面路径错误"
}else{
console.log(url,title);
// console.log(url,title);
this.url = url;
}
if(title){
......
......@@ -38,7 +38,7 @@
this.phone = phoneNumber;
},
onShow() {
console.log('onShow');
// console.log('onShow');
// #ifdef H5
document.onkeydown = event => {
var e = event || window.event;
......@@ -59,7 +59,8 @@
this.$refs.smsCode.focusSmsCodeInput = true
return uni.showToast({
title: '验证码不能为空',
icon: 'none'
icon: 'none',
duration: 3000
});
}
uniIdCo.loginBySms({
......@@ -67,14 +68,14 @@
"code": this.code,
"captcha": this.captcha
}).then(e => {
console.log(e);
// console.log(e);
this.loginSuccess(e)
}).catch(e => {
if (e.errCode == 'uni-id-captcha-required') {
this.$refs.popup.open()
} else {
console.log(e.errMsg);
console.log(e.errCode);
// console.log(e.errCode);
}
}).finally(e => {
this.captcha = ''
......
......@@ -11,7 +11,7 @@
<text class="tip">将根据第三方账号服务平台的授权范围获取你的信息</text>
<view class="quickLogin">
<image v-if="type !== 'weixinMobile'" @click="quickLogin" :src="imgSrc" mode="widthFix" class="quickLoginBtn"></image>
<button v-else type="primary" open-type="getPhoneNumber" @getphonenumber="quickLogin">微信授权手机号登录</button>
<button v-else type="primary" open-type="getPhoneNumber" @getphonenumber="quickLogin" class="uni-btn">微信授权手机号登录</button>
<uni-id-pages-agreements scope="register" ref="agreements"></uni-id-pages-agreements>
</view>
</template>
......@@ -56,7 +56,7 @@
}
},
async onLoad(e) {
console.log(e);
// console.log(e);
//获取通过url传递的参数type设置当前登录方式,如果没传递直接默认以配置的登录
let type = e.type || config.loginTypes[0]
this.type = type
......@@ -111,12 +111,13 @@
this.$refs.uniFabLogin.login_before(this.type, true, options)
},
toSmsPage() {
console.log('toSmsPage',this.agree);
// console.log('toSmsPage',this.agree);
if (!this.isPhone) {
this.focusPhone = true
return uni.showToast({
title: "手机号码格式不正确",
icon: 'none'
icon: 'none',
duration: 3000
});
}
if (this.needAgreements && !this.agree) {
......@@ -136,7 +137,8 @@
chooseArea() {
uni.showToast({
title: '暂不支持其他国家',
icon: 'none'
icon: 'none',
duration: 3000
});
},
}
......@@ -146,6 +148,12 @@
<style lang="scss" scoped>
@import "@/uni_modules/uni-id-pages/common/login-page.scss";
@media screen and (min-width: 690px) {
.uni-content{
height: 350px;
}
}
.uni-content,
.quickLogin {
/* #ifndef APP-NVUE */
......
......@@ -84,14 +84,16 @@
this.focusPassword = true
return uni.showToast({
title: '请输入密码',
icon: 'none'
icon: 'none',
duration: 3000
});
}
if (!this.username.length) {
this.focusUsername = true
return uni.showToast({
title: '请输入手机号/用户名/邮箱',
icon: 'none'
icon: 'none',
duration: 3000
});
}
console.log("this.needCaptcha: ",this.needCaptcha);
......@@ -99,7 +101,8 @@
this.$refs.captcha.getImageCaptcha()
return uni.showToast({
title: '请输入验证码',
icon: 'none'
icon: 'none',
duration: 3000
});
}
......@@ -152,7 +155,7 @@
@media screen and (min-width: 690px) {
.uni-content {
max-height: 650px;
height: 600px;
}
}
......
......@@ -89,7 +89,8 @@
this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({
title: '请输入验证码',
icon: 'none'
icon: 'none',
duration: 3000
});
}
if (this.needAgreements && !this.agree) {
......@@ -101,18 +102,18 @@
}).catch((errors) => {
let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase())
console.log(key);
// console.log(key);
this['focus'+key] = true
})
},
submitForm(params) {
uniIdCo.registerAdmin(this.formData).then(e => {
console.log(e);
// console.log(e);
uni.navigateBack()
})
.catch(e => {
console.log(e);
console.log(e.message);
// console.log(e);
// console.log(e.message);
//更好的体验:登录错误,直接刷新验证码
this.$refs.captcha.getImageCaptcha()
uni.showModal({
......@@ -152,6 +153,7 @@
@media screen and (min-width: 690px) {
.uni-content{
padding: 30px 40px 60px;
max-height: 520px;
}
.link-box {
......
......@@ -144,22 +144,22 @@
}).catch((errors) => {
let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase())
console.log(key);
// console.log(key);
this['focus'+key] = true
})
},
submitForm(params) {
uniIdCo.registerUserByEmail(this.formData).then(e => {
console.log(e);
// console.log(e);
uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/login/login-withpwd',
complete: (e) => {
console.log(e);
// console.log(e);
}
})
})
.catch(e => {
console.log(e);
// console.log(e);
console.log(e.message);
})
},
......
......@@ -98,7 +98,8 @@
this.$refs.captcha.focusCaptchaInput = true
return uni.showToast({
title: '请输入验证码',
icon: 'none'
icon: 'none',
duration: 3000
});
}
// close
......@@ -113,7 +114,7 @@
}).catch((errors) => {
let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase())
console.log(key);
// console.log(key);
this['focus' + key] = true
return errors
})
......
......@@ -137,8 +137,8 @@
* 完成并提交
*/
submit() {
console.log("formData", this.formData);
console.log('rules', this.rules);
// console.log("formData", this.formData);
// console.log('rules', this.rules);
this.$refs.form.validate()
.then(res => {
let {
......@@ -153,11 +153,11 @@
password,
captcha
}).then(e => {
console.log(e);
// console.log(e);
uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/login/login-withpwd',
complete: (e) => {
console.log(e);
// console.log(e);
}
})
})
......@@ -171,11 +171,11 @@
}).catch(errors=>{
let key = errors[0].key
if(key == 'code'){
console.log(this.$refs.shortCode);
// console.log(this.$refs.shortCode);
return this.$refs.shortCode.focusSmsCodeInput = true
}
key = key.replace(key[0], key[0].toUpperCase())
console.log(key,'focus'+key);
// console.log(key,'focus'+key);
this['focus'+key] = true
})
},
......
......@@ -166,8 +166,8 @@
* 完成并提交
*/
submit() {
console.log("formData", this.formData);
console.log('rules', this.rules);
// console.log("formData", this.formData);
// console.log('rules', this.rules);
this.$refs.form.validate()
.then(res => {
let {
......@@ -182,7 +182,7 @@
password,
captcha
}).then(e => {
console.log(e);
// console.log(e);
uni.navigateBack()
})
.catch(e => {
......@@ -195,11 +195,11 @@
}).catch(errors=>{
let key = errors[0].key
if(key == 'code'){
console.log(this.$refs.shortCode);
// console.log(this.$refs.shortCode);
return this.$refs.shortCode.focusSmsCodeInput = true
}
key = key.replace(key[0], key[0].toUpperCase())
console.log(key,'focus'+key);
// console.log(key,'focus'+key);
this['focus'+key] = true
})
},
......
......@@ -52,7 +52,8 @@
this.focusMobile = true
return uni.showToast({
title: '手机号码格式不正确',
icon: 'none'
icon: 'none',
duration: 3000
});
}
console.log("this.formData.code: ",this.formData.code);
......@@ -60,20 +61,20 @@
this.$refs.smsForm.focusSmsCodeInput = true
return uni.showToast({
title: '验证码格式不正确',
icon: 'none'
icon: 'none',
duration: 3000
});
}
console.log(this.formData,"1------------");
const uniIdCo = uniCloud.importObject("uni-id-co",{
customUI:true
})
return await uniIdCo.bindMobileBySms(this.formData).then(e => {
console.log(e);
// uni.showToast({
// title: e.errMsg,
// icon: 'none'
// });
// console.log(this.formData);
const uniIdCo = uniCloud.importObject("uni-id-co")
uniIdCo.bindMobileBySms(this.formData).then(e => {
// console.log(e);
uni.showToast({
title: e.errMsg,
icon: 'none',
duration: 3000
});
// #ifdef APP-NVUE
const eventChannel = this.$scope.eventChannel; // 兼容APP-NVUE
// #endif
......
......@@ -81,18 +81,20 @@
/**
* 完成并提交
*/
async submit() {
console.log("formData", this.formData);
console.log('rules', this.rules);
return await this.$refs.form.validate()
.then( async res => {
console.log("res:---------- ",res);
let {oldPassword,newPassword} = this.formData
return await uniIdCo.updatePwd({
submit() {
// console.log("formData", this.formData);
// console.log('rules', this.rules);
this.$refs.form.validate()
.then(res => {
let {
oldPassword,
newPassword
} = this.formData
uniIdCo.updatePwd({
oldPassword,
newPassword
}).then(e => {
console.log(e);
// console.log(e);
uni.removeStorageSync('uni_id_token');
uni.setStorageSync('uni_id_token_expired', 0)
uni.redirectTo({
......@@ -112,7 +114,7 @@
console.log("errors: ------------",errors);
let key = errors[0].key
key = key.replace(key[0], key[0].toUpperCase())
console.log(key, 'focus' + key);
// console.log(key, 'focus' + key);
this['focus' + key] = true
return errors
})
......
......@@ -12,7 +12,7 @@ export default {
data() {return {path: '',options:{"width":600,"height":600}}},
onLoad({path,options}) {
this.path = path
console.log('path-path-path-path',path);
// console.log('path-path-path-path',path);
if(options){
this.options = JSON.parse(options)
}
......
......@@ -506,7 +506,8 @@ export default {
if (!this.image) {
uni.showToast({
title: '请选择图片',
icon: 'none'
icon: 'none',
duration: 3000
});
return;
}
......@@ -536,7 +537,8 @@ export default {
if (!this.image) {
uni.showToast({
title: '请选择图片',
icon: 'none'
icon: 'none',
duration: 3000
});
return;
}
......@@ -721,7 +723,8 @@ export default {
if (!this.image) {
uni.showToast({
title: '请选择图片',
icon: 'none'
icon: 'none',
duration: 3000
});
return;
}
......@@ -739,7 +742,8 @@ export default {
if (!this.image) {
uni.showToast({
title: '请选择图片',
icon: 'none'
icon: 'none',
duration: 3000
});
return;
}
......
......@@ -43,9 +43,10 @@
const uniIdco = uniCloud.importObject("uni-id-co");
uniIdco.closeAccount().then((e) => {
console.log(e);
// console.log(e);
uni.showToast({
title: '注销成功'
title: '注销成功',
duration: 3000
});
uni.removeStorageSync('uni_id_token');
uni.setStorageSync('uni_id_token_expired', 0)
......
<!-- 设置密码 -->
<template>
<view class="uni-content">
<match-media :min-width="690">
<view class="login-logo">
<image :src="logo"></image>
</view>
<!-- 顶部文字 -->
<text class="title title-box ">设置密码</text>
</match-media>
<uni-forms class="set-password-form" ref="form" :value="formData" err-show-type="toast">
<text class="tip">输入密码</text>
<uni-forms-item name="newPassword">
<uni-easyinput :focus="focusNewPassword" @blur="focusNewPassword = false" class="input-box"
type="password" :inputBorder="false" v-model="formData.newPassword" placeholder="请输入密码">
</uni-easyinput>
</uni-forms-item>
<text class="tip">再次输入密码</text>
<uni-forms-item name="newPassword2">
<uni-easyinput :focus="focusNewPassword2" @blur="focusNewPassword2 = false" class="input-box"
type="password" :inputBorder="false" v-model="formData.newPassword2" placeholder="请再次输入新密码">
</uni-easyinput>
</uni-forms-item>
<uni-id-pages-sms-form v-model="formData.code" type="set-pwd-by-sms" ref="smsCode" :phone="userInfo.mobile">
</uni-id-pages-sms-form>
<view class="link-box">
<button class="uni-btn send-btn" type="primary" @click="submit">确认</button>
<button v-if="allowSkip" class="uni-btn send-btn" type="default" @click="skip">跳过</button>
</view>
</uni-forms>
<uni-popup-captcha @confirm="submit" v-model="formData.captcha" scene="set-pwd-by-sms" ref="popup"></uni-popup-captcha>
</view>
</template>
<script>
import passwordMod from '@/uni_modules/uni-id-pages/common/password.js'
import {store, mutations} from '@/uni_modules/uni-id-pages/common/store.js'
import config from '@/uni_modules/uni-id-pages/config.js'
const uniIdCo = uniCloud.importObject("uni-id-co", {
customUI:true
})
export default {
name: "set-pwd.vue",
data () {
return {
uniIdRedirectUrl: '',
loginType: '',
logo: '/static/logo.png',
focusNewPassword: false,
focusNewPassword2: false,
allowSkip: false,
formData: {
code: "",
captcha: "",
newPassword: "",
newPassword2: ""
},
rules: passwordMod.getPwdRules('newPassword', 'newPassword2')
}
},
computed: {
userInfo () {
return store.userInfo
}
},
onReady() {
this.$refs.form.setRules(this.rules)
},
onLoad (e) {
this.uniIdRedirectUrl = e.uniIdRedirectUrl
this.loginType = e.loginType
if (config.setPasswordAfterLogin && config.setPasswordAfterLogin?.allowSkip) {
this.allowSkip = true
}
},
methods: {
submit () {
if(! /^\d{6}$/.test(this.formData.code)){
this.$refs.smsCode.focusSmsCodeInput = true
return uni.showToast({
title: '验证码格式不正确',
icon: 'none'
});
}
this.$refs.form.validate()
.then(res => {
uniIdCo.setPwd({
password: this.formData.newPassword,
code: this.formData.code,
captcha: this.formData.captcha
}).then(e => {
uni.showModal({
content: '密码设置成功',
showCancel: false,
success: () => {
mutations.loginBack({
uniIdRedirectUrl: this.uniIdRedirectUrl,
loginType: this.loginType
})
}
});
}).catch(e => {
uni.showModal({
content: e.message,
showCancel: false
});
})
}).catch(e => {
if (e.errCode == 'uni-id-captcha-required') {
this.$refs.popup.open()
} else {
console.log(e.errMsg);
// console.log(e.errCode);
}
}).finally(e => {
this.formData.captcha = ''
})
},
skip () {
mutations.loginBack(this.uniIdRedirectUrl)
}
}
}
</script>
<style scoped lang="scss">
@import "@/uni_modules/uni-id-pages/common/login-page.scss";
.uni-btn[type="default"] {
color: inherit!important;
}
.uni-content ::v-deep .uni-forms-item {
margin-bottom: 10px;
}
.popup-captcha {
/* #ifndef APP-NVUE */
display: flex;
/* #endif */
padding: 20rpx;
background-color: #FFF;
border-radius: 2px;
flex-direction: column;
position: relative;
}
.popup-captcha .title {
font-weight: normal;
padding: 0;
padding-bottom: 15px;
color: #666;
}
.popup-captcha .close {
position: absolute;
bottom: -40px;
margin-left: -13px;
left: 50%;
}
.popup-captcha .uni-btn {
margin: 0;
}
</style>
......@@ -79,7 +79,7 @@
uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/login/login-withoutpwd',
complete: (e) => {
console.log(e);
// console.log(e);
}
})
},
......@@ -93,7 +93,7 @@
uni.navigateTo({
url: '/uni_modules/uni-id-pages/pages/userinfo/change_pwd/change_pwd',
complete: (e) => {
console.log(e);
// console.log(e);
}
})
},
......@@ -124,14 +124,14 @@
"provider": 'univerify',
"univerifyStyle": this.univerifyStyle,
success: async e => {
console.log(e.authResult);
// console.log(e.authResult);
uniIdCo.bindMobileByUniverify(e.authResult).then(res => {
console.log(res);
// console.log(res);
mutations.updateUserInfo()
}).catch(e => {
console.log(e);
}).finally(e => {
console.log(e);
}).finally(e=>{
// console.log(e);
uni.closeAuthView()
})
},
......@@ -149,11 +149,9 @@
})
},
setNickname(nickname) {
console.log(nickname);
// console.log(nickname);
if (nickname) {
mutations.updateUserInfo({
nickname
})
mutations.updateUserInfo({nickname})
this.$refs.dialog.close()
} else {
this.$refs.dialog.open()
......@@ -171,7 +169,7 @@
alipay: 'ali_openid',
apple: 'apple_openid',
qq: 'qq_openid'
} [provider.toLowerCase()]
}[provider.toLowerCase()]
if (this.userInfo[bindField]) {
await uniIdCo['unbind' + provider]()
......@@ -181,12 +179,11 @@
provider: provider.toLowerCase(),
onlyAuthorize: true,
success: async e => {
const res = await uniIdCo['bind' + provider]({
code: e.code
})
const res = await uniIdCo['bind' + provider]({code: e.code})
if (res.errCode) {
uni.showToast({
title: res.errMsg || '绑定失败'
title: res.errMsg || '绑定失败',
duration: 3000
})
}
await mutations.updateUserInfo()
......@@ -197,7 +194,6 @@
}
})
}
}
}
}
......
......@@ -41,7 +41,8 @@ const CAPTCHA_SCENE = {
RESET_PWD_BY_EMAIL: 'reset-pwd-by-email',
SEND_SMS_CODE: 'send-sms-code',
SEND_EMAIL_CODE: 'send-email-code',
BIND_MOBILE_BY_SMS: 'bind-mobile-by-sms'
BIND_MOBILE_BY_SMS: 'bind-mobile-by-sms',
SET_PWD_BY_SMS: 'set-pwd-by-sms'
}
const LOG_TYPE = {
......@@ -64,7 +65,8 @@ const LOG_TYPE = {
const SMS_SCENE = {
LOGIN_BY_SMS: 'login-by-sms',
RESET_PWD_BY_SMS: 'reset-pwd-by-sms',
BIND_MOBILE_BY_SMS: 'bind-mobile-by-sms'
BIND_MOBILE_BY_SMS: 'bind-mobile-by-sms',
SET_PWD_BY_SMS: 'set-pwd-by-sms'
}
const EMAIL_SCENE = {
......
const ERROR = {
ACCOUNT_EXISTS: 'uni-id-account-exists',
ACCOUNT_NOT_EXISTS: 'uni-id-account-not-exists',
ACCOUNT_NOT_EXISTS_IN_CURRENT_APP: 'uni-id-account-not-exists-in-current-app',
ACCOUNT_CONFLICT: 'uni-id-account-conflict',
ACCOUNT_BANNED: 'uni-id-account-banned',
ACCOUNT_AUDITING: 'uni-id-account-auditing',
......@@ -36,7 +37,8 @@ const ERROR = {
UNBIND_UNIQUE_LOGIN: 'uni-id-unbind-unique-login',
UNBIND_PASSWORD_NOT_EXISTS: 'uni-id-unbind-password-not-exists',
UNBIND_MOBILE_NOT_EXISTS: 'uni-id-unbind-mobile-not-exists',
UNSUPPORTED_REQUEST: 'uni-id-unsupported-request'
UNSUPPORTED_REQUEST: 'uni-id-unsupported-request',
ILLEGAL_REQUEST: 'uni-id-illegal-request'
}
function isUniIdError (errCode) {
......
......@@ -174,10 +174,26 @@ function getNonceStr (length = 16) {
try {
require('lodash.merge')
} catch (error) {
console.error('uni-id-co缺少依赖,请在uniCloud/cloudfunctions/common/uni-id-co目录执行 npm install 安装依赖')
console.error('uni-id-co缺少依赖,请在uniCloud/cloudfunctions/uni-id-co目录执行 npm install 安装依赖')
throw error
}
function isMatchUserApp (userAppList, matchAppList) {
if (userAppList === undefined || userAppList === null) {
return true
}
if (getType(userAppList) !== 'array') {
return false
}
if (userAppList.includes('*')) {
return true
}
if (getType(matchAppList) === 'string') {
matchAppList = [matchAppList]
}
return userAppList.some(item => matchAppList.includes(item))
}
module.exports = {
getType,
isValidString,
......@@ -193,5 +209,6 @@ module.exports = {
getExtension,
getVerifyCode,
coverMobile,
getNonceStr
getNonceStr,
isMatchUserApp
}
......@@ -46,12 +46,12 @@ baseValidator.password = function (password) {
baseValidator.mobile = function (mobile) {
const errCode = ERROR.INVALID_MOBILE
if (!isValidString(mobile)) {
if (getType(mobile) !== 'string') {
return {
errCode
}
}
if (!/^1\d{10}$/.test(mobile)) {
if (mobile && !/^1\d{10}$/.test(mobile)) {
return {
errCode
}
......@@ -60,12 +60,12 @@ baseValidator.mobile = function (mobile) {
baseValidator.email = function (email) {
const errCode = ERROR.INVALID_EMAIL
if (!isValidString(email)) {
if (getType(email) !== 'string') {
return {
errCode
}
}
if (!/@/.test(email)) {
if (email && !/@/.test(email)) {
return {
errCode
}
......@@ -290,6 +290,12 @@ function createPasswordVerifier({
}
}
function isEmpty(value) {
return value === undefined ||
value === null ||
(typeof value === 'string' && value.trim() === '')
}
class Validator {
constructor({
passwordStrength = ''
......@@ -350,7 +356,7 @@ class Validator {
type
} = schemaValue
// value内未传入了schemaKey或对应值为undefined
if (value[schemaKey] === undefined) {
if (isEmpty(value[schemaKey])) {
if (required) {
return {
errCode: ERROR.PARAM_REQUIRED,
......@@ -360,6 +366,7 @@ class Validator {
schemaKey
}
} else {
delete value[schemaKey]
continue
}
}
......
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册