提交 16a3e0a8 编写于 作者: VK1688's avatar VK1688

1.7.4

上级 25e25abd
* 1、【升级】`vk-unicloud-admin-ui` 包升级至 `1.7.7`
* 2、【优化】一些细节
##### 框架更新步骤 [点击查看](https://vkdoc.fsq.pub/admin/1/update.html)
##### 框架学习Q群:`22466457` 欢迎萌新和大佬来使用和共同改进框架
##### 如果你觉得框架对你有用,可以在下方进行评论,也可以进行赞赏。
......@@ -28,7 +28,8 @@ export default {
* 如果 mode = 1 则代表list内的页面需要登录,不在list内的页面不需要登录
* 如果 mode = 2 则代表list内的页面不需要登录,不在list内的页面需要登录
* 注意1: list内是通配符表达式,非正则表达式
* 注意2: 需要使用 vk.navigateTo 代替 uni.navigateTo 进行页面跳转才会生效
* 注意3: 首次进入的页面暂无法检测,故不会生效。
* 但只要页面上执行kh或sys函数,会自动判断是否登录,未登录也会自动跳登录页面,登录成功后会自动返回本来要跳转的页面。
*/
mode: 2,
list: [
......
## 1.7.4(2021-11-13)
* 1、【升级】`vk-unicloud-admin-ui` 包升级至 `1.7.7`
* 2、【优化】一些细节
##### 框架更新步骤 [点击查看](https://vkdoc.fsq.pub/admin/1/update.html)
##### 框架学习Q群:`22466457` 欢迎萌新和大佬来使用和共同改进框架
##### 如果你觉得框架对你有用,可以在下方进行评论,也可以进行赞赏。
## 1.7.3(2021-11-09)
* 1、【升级】`vk-unicloud-admin-ui` 包升级至 `1.7.6`
* 2、【优化】`万能表单` `radio` `checkbox` `select` `cascader` `tree-select``data` 静态模式数据源 支持 `function` 模式 [点击查看](https://vkdoc.fsq.pub/admin/components/9%E3%80%81select.html#%E9%9D%99%E6%80%81%E6%95%B0%E6%8D%AE%E6%96%B9%E5%BC%8F2)
......
{
"id": "vk-unicloud-admin",
"name": "vk-unicloud-admin",
"version": "1.7.3",
"version": "1.7.4",
"displayName": "【开箱即用】vk-unicloud-admin-快速开发框架-打造unicloud最好用的admin",
"description": "vk-unicloud-admin是基于unicloud+uni-id+element+vk-unicloud-router的一套快速PC admin完整开发框架。小白几分钟即可完成一个页面CRUD。",
"keywords": [
......@@ -22,7 +22,7 @@
"dependencies": {
"element-ui": "^2.15.6",
"umy-ui": "^1.1.6",
"vk-unicloud-admin-ui": "^1.7.6"
"vk-unicloud-admin-ui": "^1.7.7"
},
"engines": {
"HBuilderX": "^3.1.10"
......
const uniIdConfig = require('../uni-id/config.json');
var uniIdConfig;
try {
uniIdConfig = require('../uni-id/config.json');
} catch(err) {
throw new Error("配置文件:uniCloud/cloudfunctions/common/uni-config-center/uni-id/config.json \n编译错误,请检查!"+err.message);
}
module.exports = {
"uni":uniIdConfig,
"vk":{
......
## 3.3.9(2021-11-09)
- 去除重复的context.xxx未找到的提示语
## 3.3.8(2021-10-28)
- 新增 用户账户封禁接口 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=ban-account)
- 新增 用户账户注销接口 [详情](https://uniapp.dcloud.net.cn/uniCloud/uni-id?id=close-account)
......
{
"id": "uni-id",
"displayName": "uni-id",
"version": "3.3.8",
"version": "3.3.9",
"description": "简单、统一、可扩展的用户中心",
"keywords": [
"uniid",
......
{
"name": "uni-id",
"version": "3.3.8",
"version": "3.3.9",
"description": "uni-id for uniCloud",
"main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
......
## 2.5.6(2021-11-13)
* 1、【优化】一些细节
* 完整框架项目地址:`https://ext.dcloud.net.cn/plugin?id=2204`[点击查看](https://ext.dcloud.net.cn/plugin?id=2204)
## 2.5.5(2021-11-11)
* 1、【新增】`vk.pubfn.getOffsetTime` 获得指定时间偏移 year年 month月 day天 hours时 minutes分 seconds秒前或后的时间戳 [点击查看](https://vkdoc.fsq.pub/client/jsapi.html#vk-pubfn-getoffsettime-%E8%8E%B7%E5%BE%97%E6%8C%87%E5%AE%9A%E6%97%B6%E9%97%B4%E5%81%8F%E7%A7%BB-year%E5%B9%B4-month%E6%9C%88-day%E5%A4%A9-hours%E6%97%B6-minutes%E5%88%86-seconds%E7%A7%92%E5%89%8D%E6%88%96%E5%90%8E%E7%9A%84%E6%97%B6%E9%97%B4%E6%88%B3)
* 完整框架项目地址:`https://ext.dcloud.net.cn/plugin?id=2204`[点击查看](https://ext.dcloud.net.cn/plugin?id=2204)
## 2.5.4(2021-11-10)
* 1、【优化】前端请求云函数的一处细节。
* 完整框架项目地址:`https://ext.dcloud.net.cn/plugin?id=2204`[点击查看](https://ext.dcloud.net.cn/plugin?id=2204)
## 2.5.3(2021-11-09)
* 1、【优化】`vk.pubfn.base64ToFile` 支持 APP 环境执行
* 2、【优化】`vk.pubfn.fileToBase64` 支持 APP 环境执行
......
{
"id": "vk-unicloud",
"displayName": "vk-unicloud-router开发框架核心库 - 已集成uni-id 框架内置了众多API。",
"version": "2.5.3",
"version": "2.5.6",
"description": "此为vk-unicloud-router框架核心库(新手建议下载完整框架项目)已集成uni-id支持云函数url化。众多现成API,内置小白也能轻松上手的数据库API。使你项目刚起步进度就是百分之50",
"keywords": [
"vk-unicloud-router",
......
......@@ -34,7 +34,7 @@
#### 5、全面支持`url化`的云函数请求,您无需关心url化后参数的获取问题
#### 6、已集成`uni-id` 当前版本:`3.3.7`(已支持真实发送邮箱验证码和阿里云短信验证码)
#### 6、已集成`uni-id` 当前版本:`3.3.8`(已支持真实发送邮箱验证码和阿里云短信验证码)
```
6.1、由于每个应用基本都会用上用户系统,官方建议所有`uniCloud`应用均使用`uni-id`作为用户体系,
有了统一的账户规范,并且围绕这套账户规范,有各种各样插件,那么开发者可以随意整合这些插件,让数据连同。
......
{
"name": "vk-unicloud",
"version": "2.5.3",
"version": "2.5.6",
"description": "【云函数端SDK】VK云函数路由模式uniCloud开发框架,在router目录下执行 npm i vk-unicloud 进行安装和升级",
"main": "index.js",
"homepage": "https://gitee.com/vk-uni/vk-uni-cloud-router.git",
......
......@@ -68,6 +68,43 @@ pubfn.timeFormat = pubfn.timeUtil.timeFormat;
*/
pubfn.getFullTime = pubfn.timeUtil.getFullTime;
/**
* 获取时间范围
* @param {Date} date 日期对象 可以指定时间计算节点,默认使用当前时间进行计算
* 返回的是时间戳(防止时区问题)
* 返回数据如下:
{
todayStart 今日开始时间
todayEnd 今日结束时间
today12End 今日上午结束时间
monthStart 本月开始时间
monthEnd 本月结束时间
yearStart 本年开始时间
yearEnd 本年结束时间
weekStart 本周开始时间
weekEnd 本周结束时间
now 现在的时间点(含月年日时分秒)
months 本年度每月的开始和结束时间 months[1] 代表1月
}
* vk.pubfn.getCommonTime();
*/
pubfn.getCommonTime = pubfn.timeUtil.getCommonTime;
/**
* 获得指定时间偏移 year年 month月 day天 hours时 minutes分 seconds秒前或后的时间戳
* 返回时间戳形式
vk.pubfn.getOffsetTime(new Date(), {
year:0,
month:0,
day:0,
hours:0,
minutes:0,
seconds:0,
mode:"after", // after 之后 before 之前
});
*/
pubfn.getOffsetTime = pubfn.timeUtil.getOffsetTime;
/**
* 获得相对当前周addWeekCount个周的起止日期
* @param {Number} addWeekCount 默认0 (0代表本周 为-1代表上周 为1代表下周以此类推 为2代表下下周)
......@@ -101,28 +138,6 @@ pubfn.getMonthOffsetStartAndEnd = pubfn.timeUtil.getMonthOffsetStartAndEnd;
*/
pubfn.getYearOffsetStartAndEnd = pubfn.timeUtil.getYearOffsetStartAndEnd;
/**
* 获取时间范围
* @param {Date} date 日期对象 可以指定时间计算节点,默认使用当前时间进行计算
* 返回的是时间戳(防止时区问题)
* 返回数据如下:
{
todayStart 今日开始时间
todayEnd 今日结束时间
today12End 今日上午结束时间
monthStart 本月开始时间
monthEnd 本月结束时间
yearStart 本年开始时间
yearEnd 本年结束时间
weekStart 本周开始时间
weekEnd 本周结束时间
now 现在的时间点(含月年日时分秒)
months 本年度每月的开始和结束时间 months[1] 代表1月
}
* vk.pubfn.getCommonTime();
*/
pubfn.getCommonTime = pubfn.timeUtil.getCommonTime;
/**
* 获得指定年份和月份后的该月的开始时间和结束时间
* 返回数据如下:(时间戳形式)
......@@ -1032,6 +1047,7 @@ pubfn.snake2camelJson = function(obj) {
pubfn.camel2snakeJson = function(obj) {
return parseObjectKeys(obj, 'camel2snake');
};
/**
* 将能转成数字的字符串转数字(支持字符串、对象、数组)
* @param {Any} obj
......@@ -1040,6 +1056,7 @@ pubfn.camel2snakeJson = function(obj) {
* mobile:true 手机号,如 15200000001
* idCard:true 身份证,如 330154202109301214
* startFrom0:true 第一位是0,且长度大于1的,同时第二位不是.的字符串 如 01,057189101254
* maxLength:14 超过此长度的字符串排除
* vk.pubfn.string2Number(obj, option);
*/
pubfn.string2Number = function(obj, option = {}) {
......@@ -1050,9 +1067,12 @@ pubfn.string2Number = function(obj, option = {}) {
let {
mobile = true,
idCard = true,
startFrom0 = true
startFrom0 = true,
maxLength = 14,
} = option;
if (mobile && pubfn.test(obj, "mobile")) {
if (obj.length > maxLength) {
return obj;
} else if (mobile && pubfn.test(obj, "mobile")) {
return obj;
} else if (idCard && pubfn.test(obj, "card")) {
return obj;
......@@ -1079,6 +1099,7 @@ pubfn.string2Number = function(obj, option = {}) {
return obj;
}
};
/**
* 保留小数
* @param {Number} val 原值
......@@ -1219,6 +1240,9 @@ pubfn.numStr = function(n) {
* vk.pubfn.priceFilter(money);
*/
pubfn.priceFilter = function(money, nullValue = "") {
if (isNaN(money)){
return money;
}
if (pubfn.isNull(money)) {
return nullValue;
}
......@@ -1249,6 +1273,9 @@ pubfn.priceRightFilter = function(n) {
* vk.pubfn.priceFilter(money);
*/
pubfn.percentageFilter = function(value, needShowSymbol = true, nullValue = "") {
if (isNaN(value)){
return value;
}
if (pubfn.isNull(value)) {
return nullValue;
}
......
......@@ -410,4 +410,61 @@ util.isQingming = function(data = new Date()) {
}
/**
* 获得指定时间偏移 year年 month月 day天 hours时 minutes分 seconds秒前或后的时间戳
* 返回时间戳
vk.pubfn.getOffsetTime(new Date(), {
year:0,
month:0,
day:0,
hours:0,
minutes:0,
seconds:0,
mode:"after", // after 之后 before 之前
});
*/
util.getOffsetTime = function(date = new Date(), obj) {
let time = (typeof date === "number") ? new Date(date) : date;
let year = obj.year || obj.y;
let month = obj.month || obj.m;
let day = obj.day || obj.d;
let hours = obj.hours || obj.hh;
let minutes = obj.minutes || obj.mm;
let seconds = obj.seconds || obj.ss;
let { mode="after" } = obj;
if (mode == "before") {
year *= -1;
month *= -1;
day *= -1;
hours *= -1;
minutes *= -1;
seconds *= -1;
}
if (year) {
time = time.setFullYear(time.getFullYear() + year);
time = new Date(time);
}
if (month) {
time = time.setMonth(time.getMonth() + month);
time = new Date(time);
}
if (day) {
time = time.setDate(time.getDate() + day);
time = new Date(time);
}
if (hours) {
time = time.setHours(time.getHours() + hours);
time = new Date(time);
}
if (minutes) {
time = time.setMinutes(time.getMinutes() + minutes);
time = new Date(time);
}
if (seconds) {
time = time.setSeconds(time.getSeconds() + seconds);
time = new Date(time);
}
return time.getTime();
}
export default util;
......@@ -174,6 +174,8 @@ class CallFunctionUtil {
let config = this.config;
let callFunction = this.callFunction;
if (config.debug) console.log("跳登录页面");
let { tokenExpiredAutoDelete = true } = config;
if (tokenExpiredAutoDelete) this.deleteToken();
setTimeout(() => {
if (config.login.url) {
let currentPage = getCurrentPages()[getCurrentPages().length - 1];
......@@ -231,7 +233,8 @@ class CallFunctionUtil {
* @params {Function} complete 无论请求成功与否,都会执行的回调函数
*/
this.callFunction = (obj = {}) => {
let config = this.config;
let that = this;
let { config } = that;
let {
url,
data = {},
......@@ -240,7 +243,7 @@ class CallFunctionUtil {
if (obj.retryCount) {
// 系统异常重试机制(表单提交时慎用,建议只用在查询请求中,即无任何数据库修改的请求中)
return this.callFunctionRetry(obj);
return that.callFunctionRetry(obj);
}
// 去除值为 undefined 的参数
if (typeof data === "object") {
......@@ -271,7 +274,7 @@ class CallFunctionUtil {
}
}
// 根据指定globalParamName匹配全局请求参数
let customDate = this.getRequestGlobalParam(globalParamName);
let customDate = that.getRequestGlobalParam(globalParamName);
if (customDate && JSON.stringify(customDate) !== "{}") {
if (customDate.regExp) {
obj.data = Object.assign(customDate.data, obj.data); // 新版本
......@@ -280,13 +283,32 @@ class CallFunctionUtil {
}
}
// 注入自定义全局参数结束-----------------------------------------------------------
// 缓存开始
// 若执行的函数是kh或sys类型函数,先本地判断下token,可以提高效率。
if (url.indexOf("/kh/") > -1 || url.indexOf("/sys/") > -1) {
if (!vk.checkToken()) {
// 若本地token校验未通过,则直接执行 interceptor.login 拦截器函数
return new Promise((resolve, reject) => {
// 执行 interceptor.login 拦截器函数(跳转到页面页面)
let res = { code: 30204, msg: "本地token校验未通过" };
let params = obj;
if (typeof that.interceptor.login === "function") {
that.interceptor.login({
res,
params,
vk
});
}
reject(res);
});
}
}
// 执行请求
if (obj.isRequest) {
return this.runRequest(obj);
return that.runRequest(obj);
} else {
return this.runCallFunction(obj);
return that.runCallFunction(obj);
}
}
......@@ -607,9 +629,7 @@ class CallFunctionUtil {
if (typeof success == "function") success(res);
resolve(res);
} else if ([1301, 1302, 30201, 30202, 30203, 30204].indexOf(code) > -1 && res.msg.indexOf("token") > -1) {
let { tokenExpiredAutoDelete = true } = config;
if (tokenExpiredAutoDelete) that.deleteToken();
// 跳转到页面页面
// 执行 interceptor.login 拦截器函数(跳转到页面页面)
if (typeof that.interceptor.login === "function") {
that.interceptor.login({
res,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册