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

1.5.13

上级 59a76731
* 1、【升级】`vk-unicloud-admin-ui` 包升级至 `1.5.23`
* 2、【修复】`素材管理` 上传图片后有概率无法及时回显的bug。(需同时更新uni_modules/vk-unicloud) [点击查看](https://vkdoc.fsq.pub/admin/components/25%E3%80%81file-select.html)
##### 框架更新步骤 [点击查看](https://vkdoc.fsq.pub/admin/1/update.html)
##### 框架学习Q群:`22466457` 欢迎萌新和大佬来使用和共同改进框架
##### 如果你觉得框架对你有用,可以在下方进行评论,也可以进行赞赏。
## 1.5.13(2021-09-13)
* 1、【升级】`vk-unicloud-admin-ui` 包升级至 `1.5.23`
* 2、【修复】`素材管理` 上传图片后有概率无法及时回显的bug。(需同时更新uni_modules/vk-unicloud) [点击查看](https://vkdoc.fsq.pub/admin/components/25%E3%80%81file-select.html)
##### 框架更新步骤 [点击查看](https://vkdoc.fsq.pub/admin/1/update.html)
##### 框架学习Q群:`22466457` 欢迎萌新和大佬来使用和共同改进框架
##### 如果你觉得框架对你有用,可以在下方进行评论,也可以进行赞赏。
## 1.5.12(2021-09-05)
#### vk-unicloud-admin 框架研究Q群:`22466457` 如有问题或建议可以在群内讨论。
#### 更新内容
......
{
"name": "vk-unicloud-admin",
"version": "1.5.10",
"version": "1.5.12",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
......@@ -104,9 +104,9 @@
}
},
"vk-unicloud-admin-ui": {
"version": "1.5.21",
"resolved": "https://registry.npmjs.org/vk-unicloud-admin-ui/-/vk-unicloud-admin-ui-1.5.21.tgz",
"integrity": "sha512-Vx8ZeE7caLsG865W8BkNNJN81tdZC8WVGa1VhqULbl0dhb+bsFbDnp0nOk1n6I9n+13OdH4jN4kG50z0Jc0tyA=="
"version": "1.5.23",
"resolved": "https://registry.npmjs.org/vk-unicloud-admin-ui/-/vk-unicloud-admin-ui-1.5.23.tgz",
"integrity": "sha512-IS8k58dYo+It+bECoiGsbVo1KgnucT7xXnf24cmI2yotVacAOMx8pju+wOXoyT8rfaF5WjalvPvyLHWpkeEWLw=="
},
"vuedraggable": {
"version": "2.24.3",
......
{
"id": "vk-unicloud-admin",
"name": "vk-unicloud-admin",
"version": "1.5.12",
"version": "1.5.13",
"displayName": "【开箱即用】vk-unicloud-admin - 快速开发框架 - 几分钟即可完成一个页面CRUD",
"description": "vk-unicloud-admin是基于unicloud+uni-id+element+vk-unicloud-router的一套快速PC admin完整开发框架。丰富的API可以让你开发事半功倍。",
"keywords": [
......@@ -22,7 +22,7 @@
"dependencies": {
"element-ui": "^2.15.5",
"umy-ui": "^1.1.6",
"vk-unicloud-admin-ui": "^1.5.21"
"vk-unicloud-admin-ui": "^1.5.23"
},
"engines": {
"HBuilderX": "^3.1.10"
......
......@@ -298,12 +298,18 @@ export default {
let tasks = [];
for (let i in res.tempFilePaths) {
tasks.push(
vk.callFunctionUtil.uploadFile({
filePath: res.tempFilePaths[i],
file: res.tempFiles[i],
needSave: true,
fileType,
category_id: that.queryForm1.formData.category_id
new Promise(function(resolve, reject){
vk.callFunctionUtil.uploadFile({
filePath: res.tempFilePaths[i],
file: res.tempFiles[i],
needSave: true,
fileType,
category_id: that.queryForm1.formData.category_id,
addSuccess:function(res){
// 等保存到数据库后才执行resolve
resolve(res);
}
});
})
);
}
......
......@@ -22,7 +22,7 @@ module.exports = {
dbName:"vk-test",
dataJson:{
"money": Math.floor(Math.random() * 9 + 1),
"user_id": "001",
"user_id": "00"+Math.floor(Math.random() * 2 + 1),
"location":new db.Geo.Point(longitude, latitude),
"position":{
"longitude":longitude,
......
......@@ -28,7 +28,7 @@ module.exports = {
// 随机定位结束-----------------------------------------------------------
dataArr.push({
"money": Math.floor(Math.random() * 9 + 1),
"user_id": "001",
"user_id": "00"+Math.floor(Math.random() * 2 + 1),
"location":new db.Geo.Point(longitude, latitude),
"position":{
"longitude":longitude,
......
module.exports = {
/**
* 数据删除
* @url template/db_api/pub/del 前端调用的url参数地址
* data 请求参数 说明
* res 返回参数说明
* @params {Number} code 错误码,0表示成功
* @params {String} msg 详细信息
*/
main: async (event) => {
/**
* 数据删除
* @url template/db_api/pub/del 前端调用的url参数地址
* data 请求参数 说明
* res 返回参数说明
* @params {Number} code 错误码,0表示成功
* @params {String} msg 详细信息
*/
main: async (event) => {
let { data = {}, userInfo, util, originalParam } = event;
let { uniID, pubFun, vk , db, _ } = util;
let { uid } = data;
let res = { code : 0, msg : 'ok' };
// 业务逻辑开始-----------------------------------------------------------
// 业务逻辑开始-----------------------------------------------------------
/**
* 这里为了防止误删,故vk.baseDao.del API
* 这里为了防止误删,故vk.baseDao.del API
* 会判断如果whereJson为空,则不执行删除操作
* 所以这里加了个user_id:_.neq("___")条件来达到删除全部的功能(实际开发时慎用删除全部功能)
* 所以这里加了个_id: _.exists(true)条件来达到删除全部的功能(实际开发时慎用删除全部功能)
*/
res.num = await vk.baseDao.del({
dbName:"vk-test",
whereJson:{
user_id:_.neq("___")
_id: _.exists(true)
}
});
// 对应的sql:
// delete from vk-test where user_id != '___'
// 业务逻辑结束-----------------------------------------------------------
return res;
}
// 业务逻辑结束-----------------------------------------------------------
return res;
}
}
\ No newline at end of file
}
......@@ -13,7 +13,7 @@ module.exports = {
let { uid } = data;
let res = { code : 0, msg : 'ok' };
// 业务逻辑开始-----------------------------------------------------------
res = await vk.baseDao.select({
res = await vk.baseDao.selects({
dbName:"vk-test",
pageIndex:1,
pageSize:100,
......
module.exports = {
/**
* 分组求count
* @url template/db_api/pub/groupCount 前端调用的url参数地址
* data 请求参数 说明
* res 返回参数说明
* @params {Number} code 错误码,0表示成功
* @params {String} msg 详细信息
*/
main: async (event) => {
let { data = {}, userInfo, util, originalParam } = event;
let { uniID, pubFun, vk , db, _ } = util;
let { uid } = data;
let res = { code : 0, msg : 'ok' };
// 业务逻辑开始-----------------------------------------------------------
let { _id = "___" } = data;
res = await vk.baseDao.selects({
dbName: "vk-test",
pageIndex: 1,
pageSize: 10,
// 主表where条件
whereJson: {
},
groupJson: {
_id: "$money", // _id是分组id, $ 后面接字段名,如按money字段进行分组
count: _.$.addToSet("$user_id"), // $ 后面接字段名,如把user_id原样输出(去重)
},
sortArr: [{ name: "money",type: "desc" }], // 对分组后的结果进行排序
addFields:{
count: _.$.size("$count")
}
});
// 业务逻辑结束-----------------------------------------------------------
return res;
}
}
......@@ -18,7 +18,7 @@ module.exports = {
pageIndex:1,
pageSize:100,
whereJson:{
user_id:"001"
},
});
// 对应的sql:
......
......@@ -34,13 +34,7 @@ module.exports = {
localKey:"_id",
foreignKey:"user_id",
as:"testList",
limit:1,
// 副表where条件
whereJson:{ },
// 副表字段显示规则
fieldJson:{ },
// 副表排序规则
sortArr:[{ "name":"money", "type":"desc" }],
limit:1
},
{
dbName:"gy-shop",
......
module.exports = {
/**
* 连表查询,并返回第一条数据
* @url template/db_api/pub/selects_getOne 前端调用的url参数地址
* data 请求参数 说明
* res 返回参数说明
* @params {Number} code 错误码,0表示成功
* @params {String} msg 详细信息
*/
main: async (event) => {
let { data = {}, userInfo, util, originalParam } = event;
let { uniID, pubFun, vk , db, _ } = util;
let { uid } = data;
let res = { code : 0, msg : 'ok' };
// 业务逻辑开始-----------------------------------------------------------
// 演示3表连接
res.info = await vk.baseDao.selects({
dbName:"uni-id-users",
getOne:true,
getMain:true,
// 主表where条件
whereJson:{
_id:"001"
},
// 主表字段显示规则
fieldJson:{ token:false, password:false },
// 副表列表
foreignDB:[
{
dbName:"vk-test",
localKey:"_id",
foreignKey:"user_id",
as:"testList",
limit:1
},
{
dbName:"gy-shop",
localKey:"_id",
foreignKey:"user_id",
as:"shopList",
limit:1
},
]
});
// 业务逻辑结束-----------------------------------------------------------
return res;
}
}
module.exports = {
/**
* 修改数据,并返回修改后的数据
* @url template/db_api/pub/updateAndReturn 前端调用的url参数地址
* data 请求参数 说明
* res 返回参数说明
* @params {Number} code 错误码,0表示成功
* @params {String} msg 详细信息
*/
main: async (event) => {
let { data = {}, userInfo, util, originalParam } = event;
let { uniID, pubFun, vk, db, _ } = util;
let { uid } = data;
let res = { code: 0, msg: 'ok' };
// 业务逻辑开始-----------------------------------------------------------
let { _id = "___" } = data;
// 非事务版本开始-----------------------------------------------------------
res.info = await vk.baseDao.updateAndReturn({
dbName: "vk-test",
whereJson: {
_id: _id
},
dataJson: {
money: _.inc(1)
},
});
// 非事务版本结束-----------------------------------------------------------
// 事务版本开始-----------------------------------------------------------
/*
const transaction = await vk.baseDao.startTransaction();
try {
res.info = await vk.baseDao.updateAndReturn({
db:transaction,
dbName:"vk-test",
whereJson:{
_id:_id
},
dataJson:{
money:_.inc(1)
},
});
// 提交事物
await transaction.commit();
console.log(`transaction succeeded`);
return res;
}catch (err) {
// 事务回滚
return await vk.baseDao.rollbackTransaction({
db:transaction,
err
});
}
*/
// 事务版本结束-----------------------------------------------------------
// 业务逻辑结束-----------------------------------------------------------
return res;
}
}
......@@ -13,7 +13,7 @@ module.exports = {
*/
main: async (event) => {
let { data = {}, util, originalParam } = event;
let { uniID } = util;
let { uniID, vk } = util;
let { uid } = data;
let res = {};
// 业务逻辑开始-----------------------------------------------------------
......
module.exports = {
/**
* 用户登录(微信手机号授权)
* @url user/pub/loginByWeixinPhoneNumber 前端调用的url参数地址
* @description 用户登录(微信授权)
/**
* 用户登录(微信手机号授权)
* @url user/pub/loginByWeixinPhoneNumber 前端调用的url参数地址
* @description 用户登录(微信授权)
* data 请求参数 说明
* @param {String} encryptedData
* @param {String} iv
......@@ -12,16 +12,16 @@ module.exports = {
* @param {String} msg 详细信息
* @param {String} token 登录成功之后返回的token信息
* @param {String} tokenExpired token过期时间
*/
*/
main: async (event) => {
let { data = {}, util, originalParam } = event;
let { uniID, config, pubFun, vk , db, _ } = util;
let { uniID, config, pubFun, vk, db, _ } = util;
let { uid } = data;
let res = {};
// 业务逻辑开始-----------------------------------------------------------
let {
nickname,
avatar,
let {
nickname,
avatar,
gender,
inviteCode,
encryptedData,
......@@ -30,7 +30,7 @@ module.exports = {
} = data;
// 微信登录(未绑定任何账号时,会新建账号)
res = await vk.openapi.weixin.decrypt.getPhoneNumber(data);
if(res.code === 0){
if (res.code === 0) {
let {
mobile
} = res;
......@@ -38,32 +38,42 @@ module.exports = {
// 指定操作类型,可选值为login、register,不传此参数时表现为手机号已注册则登录,手机号未注册则进行注册
let type;
// 通过手机号登录
await uniID.setVerifyCode({ mobile, code, expiresIn:60, type:"login" });
await uniID.setVerifyCode({ mobile, code, expiresIn: 60, type: "login" });
res = await uniID.loginBySms({ mobile, code, type, inviteCode });
if(res.token){
if(res.type === "register"){
if (res.token) {
if (res.type === "register") {
let wx_openid;
let wx_unionid;
let cacheKey = `sys-weixin-session2openid-${sessionKey}`;
let openidCache = await vk.globalDataCache.get(cacheKey);
if(vk.pubfn.isNotNull(openidCache)){
if (vk.pubfn.isNotNull(openidCache)) {
wx_openid = {};
wx_openid["mp-weixin"] = openidCache.openid;
wx_unionid = openidCache.unionid;
await vk.globalDataCache.del(cacheKey);
// 查询openid或unionid是否已经存在,如果存在,则不绑定微信.
let queryUserInfo = await vk.daoCenter.userDao.findByUserInfo({
"wx_openid.mp-weixin": wx_openid["mp-weixin"],
"wx_unionid": wx_unionid
});
res.bindWeixin = vk.pubfn.isNull(queryUserInfo) ? true : false;
}
// 需要额外添加的字段
let mobileStr = mobile.substring(7);
let dataJson = {
nickname: nickname || `手机尾号${mobileStr}用户`,
avatar,
gender
};
if (res.bindWeixin) {
dataJson["wx_openid"] = wx_openid;
dataJson["wx_unionid"] = wx_unionid;
}
res.userInfo = await vk.baseDao.updateById({
dbName:"uni-id-users",
id:res.uid,
dataJson:{
nickname:nickname || `手机尾号${mobileStr}用户`,
avatar,
gender,
wx_openid,
wx_unionid
},
getUpdateData:true
dbName: "uni-id-users",
id: res.uid,
dataJson,
getUpdateData: true
});
}
// 日志服务
......@@ -73,7 +83,7 @@ module.exports = {
login_type: "weixinPhoneNumber",
user_id: res.uid,
context: originalParam.context
},util);
}, util);
}
}
// 业务逻辑结束-----------------------------------------------------------
......
## 3.3.6(2021-09-08)
- 修复 邀请码可能重复的Bug
## 3.3.5(2021-08-10)
- 修复版本号错误
## 3.3.4(2021-08-10)
......
{
"id": "uni-id",
"displayName": "uni-id",
"version": "3.3.5",
"version": "3.3.6",
"description": "简单、统一、可扩展的用户中心",
"keywords": [
"uniid",
......
{
"name": "uni-id",
"version": "3.3.5",
"version": "3.3.6",
"description": "uni-id for uniCloud",
"main": "index.js",
"homepage": "https://uniapp.dcloud.io/uniCloud/uni-id",
......
## 2.3.25(2021-09-13)
* 1、【优化】文件上传逻辑
* 完整框架项目地址:`https://ext.dcloud.net.cn/plugin?id=2204`[点击查看](https://ext.dcloud.net.cn/plugin?id=2204)
## 2.3.24(2021-09-08)
* 1、【优化】一些细节
* 完整框架项目地址:`https://ext.dcloud.net.cn/plugin?id=2204`[点击查看](https://ext.dcloud.net.cn/plugin?id=2204)
## 2.3.23(2021-09-07)
* 1、【优化】一些细节
* 完整框架项目地址:`https://ext.dcloud.net.cn/plugin?id=2204`[点击查看](https://ext.dcloud.net.cn/plugin?id=2204)
## 2.3.22(2021-09-01)
* 1、【优化】文件上传逻辑
* 完整框架项目地址:`https://ext.dcloud.net.cn/plugin?id=2204`[点击查看](https://ext.dcloud.net.cn/plugin?id=2204)
......
{
"id": "vk-unicloud",
"displayName": "vk-unicloud-router开发框架核心库 - 已集成uni-id 框架内置了众多API。",
"version": "2.3.22",
"version": "2.3.25",
"description": "此为vk-unicloud-router框架核心库(新手建议下载完整框架项目)已集成uni-id支持云函数url化。众多现成API,内置小白也能轻松上手的数据库API。使你项目刚起步进度就是百分之50",
"keywords": [
"vk-unicloud-router",
......
{
"name": "vk-unicloud",
"version": "2.3.10",
"version": "2.3.11",
"description": "【云函数端SDK】VK云函数路由模式uniCloud开发框架,在router目录下执行 npm i vk-unicloud 进行安装和升级",
"main": "index.js",
"homepage": "https://gitee.com/vk-uni/vk-uni-cloud-router.git",
......
......@@ -80,6 +80,8 @@ aliyunOSSUtil.uploadFile = function(obj) {
// 上传成功
res.fileID = fileNameObj.url;
Logger.result = res;
if (typeof obj.success === "function") obj.success(res);
resolve(res);
if (needSave) {
// 保存文件记录到数据库
vk.userCenter.addUploadRecord({
......@@ -94,17 +96,12 @@ aliyunOSSUtil.uploadFile = function(obj) {
filePath,
fileType,
success: function() {
if (typeof obj.success === "function") obj.success(res);
resolve(res);
if (typeof obj.addSuccess == "function") obj.addSuccess(res);
},
fail: function(res) {
if (typeof obj.fail === "function") obj.fail(res);
reject(res);
if (typeof obj.addFail === "function") obj.addFail(res);
}
});
}else{
if (typeof obj.success === "function") obj.success(res);
resolve(res);
}
}
},
......
......@@ -1180,6 +1180,11 @@ pubfn.getListData2 = function (obj = {}){
idKeyName = "_id"
} = obj;
if(listName) listKey = listName;
/**
* 2.0与1.0的区别
* 2.0使用的queryForm1作为查询,而1.0是form1
* 2.0云函数端是getTableData,而1.0是selects
*/
let { vk, queryForm1 } = that;
// 标记为请求中
that.loading = true;
......@@ -1238,12 +1243,15 @@ pubfn.getListData2 = function (obj = {}){
if (typeof obj.success == "function") obj.success(data);
},
fail: function(err) {
console.error(err);
that.state.loadmore = "loadmore";
if (queryForm1.pagination.pageIndex > 1) {
queryForm1.pagination.pageIndex--;
}
if (typeof obj.fail == "function") obj.fail(data);
if (typeof obj.fail == "function"){
obj.fail(data);
} else if(err && err.msg){
vk.toast(err.msg, "none");
}
},
complete: function(res) {
that.loading = false;
......@@ -1256,7 +1264,7 @@ pubfn.getListData2 = function (obj = {}){
};
/**
* 手机端长列表分页加载数据
* 手机端长列表分页加载数据(1.0版本)
* @params {Vue页面对象} that 页面数据对象this
* @params {String} url 请求地址(云函数路径)
* @params {String} listName 后端返回的list数组的字段名称,默认rows
......@@ -1352,9 +1360,12 @@ pubfn.getListData = function (obj = {}){
if(typeof obj.success == "function") obj.success(data);
},
fail : function(err){
console.error(err);
if(form1.pageIndex > 1){form1.pageIndex--;}
if(typeof obj.fail == "function") obj.fail(data);
if(typeof obj.fail == "function"){
obj.fail(data);
} else if(err && err.msg){
vk.toast(err.msg, "none");
}
},
complete : function(res){
if(typeof obj.complete == "function") obj.complete(res);
......@@ -1689,7 +1700,7 @@ pubfn.checkLogin = function(obj = {}) {
try {
let url;
try {
url = vk.pubfn.getCurrentPageRoute();
url = obj.url || vk.pubfn.getCurrentPageRoute();
}catch(err){
url = vk.getVuex("$app.config.index.url") || "/pages/index/index";
}
......@@ -1697,6 +1708,7 @@ pubfn.checkLogin = function(obj = {}) {
url: url,
success: function(res) {
if (res.needLogin) {
// 这里应该记录下之前的页面? 不然登录成功后,只会进入首页。(后面优化)
vk.reLaunch(loginUrl);
// #ifdef MP-WEIXIN
uni.hideHomeButton();
......
......@@ -42,6 +42,7 @@ util.navigateTo = function(obj) {
url: obj.url,
success: function(res) {
if (res.needLogin) {
obj.url = vk.pubfn.getPageFullPath(obj.url);
vk.navigate.originalPage = vk.pubfn.copyObject(obj);
obj.url = config.login.url;
} else {
......
......@@ -10,9 +10,7 @@ export default {
}
if(this.vk){
const url = this.vk.pubfn.getCurrentPageRoute();
this.vk.navigate.checkAllowShare({
url
});
this.vk.navigate.checkAllowShare({ url });
}
},
created(){
......
......@@ -377,6 +377,9 @@ class CallFunctionUtil {
res.fileID = tempFileURL;
res.url = tempFileURL;
res.file_id = fileID;
Logger.result.url = tempFileURL;
if (typeof success == "function") success(res);
resolve(res);
if (needSave) {
// 保存文件记录到数据库
vk.userCenter.addUploadRecord({
......@@ -391,19 +394,14 @@ class CallFunctionUtil {
filePath,
fileType,
success: function() {
if (typeof success == "function") success(res);
resolve(res);
if (typeof obj.addSuccess == "function") obj.addSuccess(res);
},
fail: function(res) {
if (typeof fail === "function") fail(res);
reject(res);
if (typeof obj.addFail === "function") obj.addFail(res);
}
});
}else{
if (typeof success == "function") success(res);
resolve(res);
}
},
}
});
},
fail(err) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册