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

2.4.1

上级 905837d7
* 1、【新增】`vk.pubfn.string2Number` 将能转成数字的字符串值转Number类型(支持字符串、对象、数组)(深度遍历)
* 2、【优化】`vk.callFunctionUtil.updateRequestGlobalParam` 设置全局请求参数 `regExp` 参数支持数组(满足数组内任意正则即算匹配) [点击查看](https://vkdoc.fsq.pub/client/pages/updateRequestGlobalParam.html)
##### 框架学习Q群:`22466457` 欢迎萌新和大佬来使用和共同改进框架
##### 如果你觉得框架对你有用,可以在下方进行评论,也可以进行赞赏。
## 2.4.1(2021-09-30)
* 1、【新增】`vk.pubfn.string2Number` 将能转成数字的字符串值转Number类型(支持字符串、对象、数组)(深度遍历)
* 2、【优化】`vk.callFunctionUtil.updateRequestGlobalParam` 设置全局请求参数 `regExp` 参数支持数组(满足数组内任意正则即算匹配) [点击查看](https://vkdoc.fsq.pub/client/pages/updateRequestGlobalParam.html)
##### 框架学习Q群:`22466457` 欢迎萌新和大佬来使用和共同改进框架
##### 如果你觉得框架对你有用,可以在下方进行评论,也可以进行赞赏。
## 2.4.0(2021-09-28)
* 1、【重要】支持微信公众号登录(有头像和昵称)详情见示例项目:`pages_template/openapi/h5-weixin/h5-weixin`
* 2、【优化】APP使用微信登录时,有头像和昵称 详情见示例项目:`pages_template/uni-id/weixin/weixin`
......
{
"id": "vk-cloud-router",
"displayName": "【开箱即用】vk-unicloud-router - 云函数路由模式开发框架 - 已集成uni-id 框架内置了众多API、工具包,为你的业务扫平障碍。",
"version": "2.4.0",
"version": "2.4.1",
"description": "这是一个unicloud快速开发框架+项目模板(已包含核心库)支持URL化,众多现成API供你使用(登录、注册、短信、微信百度服务端API等等)为你的业务扫平障碍。内置小白也能轻松上手的数据库API。",
"keywords": [
"vk-unicloud-router",
......
## 2.4.2(2021-09-30)
* 1、【新增】`vk.pubfn.string2Number` 将能转成数字的字符串值转Number类型(支持字符串、对象、数组)(深度遍历)
* 2、【优化】`vk.callFunctionUtil.updateRequestGlobalParam` 设置全局请求参数 `regExp` 参数支持数组(满足数组内任意正则即算匹配) [点击查看](https://vkdoc.fsq.pub/client/pages/updateRequestGlobalParam.html)
##### 框架学习Q群:`22466457` 欢迎萌新和大佬来使用和共同改进框架
##### 如果你觉得框架对你有用,可以在下方进行评论,也可以进行赞赏。
## 2.4.1(2021-09-28)
* 1、【重要】支持微信公众号登录(有头像和昵称)详情见示例项目:`pages_template/openapi/h5-weixin/h5-weixin`
* 2、【优化】APP使用微信登录时,有头像和昵称 详情见示例项目:`pages_template/uni-id/weixin/weixin`
......
{
"id": "vk-unicloud",
"displayName": "vk-unicloud-router开发框架核心库 - 已集成uni-id 框架内置了众多API。",
"version": "2.4.1",
"version": "2.4.2",
"description": "此为vk-unicloud-router框架核心库(新手建议下载完整框架项目)已集成uni-id支持云函数url化。众多现成API,内置小白也能轻松上手的数据库API。使你项目刚起步进度就是百分之50",
"keywords": [
"vk-unicloud-router",
......
{
"name": "vk-unicloud",
"version": "2.4.1",
"version": "2.4.2",
"description": "【云函数端SDK】VK云函数路由模式uniCloud开发框架,在router目录下执行 npm i vk-unicloud 进行安装和升级",
"main": "index.js",
"homepage": "https://gitee.com/vk-uni/vk-uni-cloud-router.git",
......
......@@ -108,7 +108,7 @@ aliyunOSSUtil.uploadFile = function(obj) {
fail: function(res) {
if (title) vk.hideLoading();
Logger.error = res;
if(res.errMsg && res.errMsg.indexOf('fail url not in domain list')>-1){
if (res.errMsg && res.errMsg.indexOf('fail url not in domain list') > -1) {
vk.toast('上传域名未在白名单中');
}
if (typeof obj.fail === "function") obj.fail(res);
......@@ -122,16 +122,14 @@ aliyunOSSUtil.uploadFile = function(obj) {
let colorArr = config.logger.colorArr;
let colorStr = colorArr[counterNum % colorArr.length];
counterNum++;
console.log("%c--------【开始】【阿里云oss文件上传】--------", 'color: ' + colorStr +
';font-size: 12px;font-weight: bold;');
console.log("%c--------【开始】【阿里云oss文件上传】--------", 'color: ' + colorStr + ';font-size: 12px;font-weight: bold;');
console.log("【本地文件】: ", Logger.filePath);
console.log("【返回数据】: ", Logger.result);
console.log("【预览地址】: ", Logger.result.fileID);
console.log("【上传耗时】: ", Logger.runTime, "毫秒");
console.log("【上传时间】: ", vk.pubfn.timeFormat(Logger.startTime, "yyyy-MM-dd hh:mm:ss"));
if (Logger.error) console.error("【error】:", Logger.error);
console.log("%c--------【结束】【阿里云oss文件上传】--------", 'color: ' + colorStr +
';font-size: 12px;font-weight: bold;');
console.log("%c--------【结束】【阿里云oss文件上传】--------", 'color: ' + colorStr + ';font-size: 12px;font-weight: bold;');
}
}
});
......@@ -181,8 +179,8 @@ function getConfig() {
function createFileName(obj = {}) {
let {
index = 0,
file,
filePath,
file,
filePath,
} = obj;
let vk = getApp().globalData.vk;
let aliyunOSS = getConfig();
......@@ -216,7 +214,8 @@ function createFileName(obj = {}) {
fileObj.fileNickName = fileNickName;
return fileObj;
}
function getFileSuffix(obj = {}){
function getFileSuffix(obj = {}) {
let {
file,
filePath
......@@ -226,7 +225,7 @@ function getFileSuffix(obj = {}){
let suffixName = filePath.substring(filePath.lastIndexOf(".") + 1);
if (suffixName && suffixName.length < 5) suffix = suffixName;
}
if(file){
if (file) {
if (file.path) {
let suffixName = file.path.substring(file.path.lastIndexOf(".") + 1);
if (suffixName && suffixName.length < 5) suffix = suffixName;
......
......@@ -987,6 +987,36 @@ pubfn.snake2camelJson = function(obj) {
pubfn.camel2snakeJson = function(obj) {
return parseObjectKeys(obj, 'camel2snake');
};
/**
* 将能转成数字的字符串转数字(支持字符串、对象、数组)
* @param {Any} obj
* vk.pubfn.string2Number(obj);
*/
pubfn.string2Number = function(obj) {
const type = Object.prototype.toString.call(obj).slice(8, -1).toLowerCase();
switch (type) {
case 'string':
if (!isNaN(obj)) {
return Number(obj);
} else {
return obj;
}
case 'object':
const keys = Object.keys(obj);
for (let i = 0; i < keys.length; i++) {
const key = keys[i];
obj[key] = pubfn.string2Number(obj[key]);
}
return obj;
case 'array':
for (let i = 0; i < obj.length; i++) {
obj[i] = pubfn.string2Number(obj[i]);
}
return obj;
default:
return obj;
}
};
// 前端专属开始 -----------------------------------------------------------
/**
......
......@@ -176,9 +176,7 @@ class CallFunctionUtil {
setTimeout(() => {
if (config.login.url) {
let currentPage = getCurrentPages()[getCurrentPages().length - 1];
if (currentPage && currentPage.route &&
"/" + currentPage.route === config.login.url
) {
if (currentPage && currentPage.route && "/" + currentPage.route === config.login.url) {
return false;
}
uni.navigateTo({
......@@ -650,7 +648,7 @@ class CallFunctionUtil {
fail,
} = params;
// 只有是系统异常时才进行重试
if(params.needRetry){
if (params.needRetry) {
if (sysFail || (res.code && [90001].indexOf(res.code) > -1)) {
if (!obj.hookResult || (typeof obj.hookResult === "function" && !obj.hookResult(err))) {
Logger.sysFail = true;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册