zpub_bas
v0.1.2
Published
base层适合于react和vue和uniapp以及web端
Readme
/// 导入常用封装的对象 import zb from 'zpub_bas/zb.js' window.zb = zb; 使用 !zb.TextUtil.isEmpty(this.data.srcs)
// 动态加载,异步处理保留扩展性 // const mods = require('@/' + filePath) const mods = await import('/src/' + filePath)
isNaN(item.subtime)
#注意事项 1:Framwork层只存放Util相关工具类和slot层和manager,constant,method通用层:适合于react和vue和uniapp以及web端,可以弃用uniapp
2:注意:不需要依赖第三方库
3:注意:即使是添加工具类也不需要依赖第三方库,含有第三方库封装的工具类在其他模块中添加
4:注意:添加类时需要包含头部注释,方法注释,参数注释,每个方法需要经过测试过才可添加
5:注意:zpub_base的添加适用A类型项目,B类型项目,C类型项目 即不同类型的项目通用的类
6:注意:适用于react和vue和web端
7:删除 node_modules 安装 rimraf npm install rimraf -g // 使用命令删除 rimraf node_modules // 也可以删除其它文件夹或文件
8:考虑web,移动端,小程序,react
9:考虑和web端进行融合去使用,大量的工作用他们的东西就可以,节省我们app的人力
10:融合web上的三维上的东西
#使用方法 npm install zpub_bas
#上传方法 1:npm login
Username: zhengchaojun Password: Email: (this IS public) [email protected]
2:npm publish :如果报错则换个名称
// #ifdef H5 || APP-PLUS uni.downloadFile({ url: 'https://www.camining.net/dm_image/QRCode.png', //下载地址,后端接口获取的链接 success: (data) => {
},
fail: (err) => {
},});
// #endif
// #ifdef MP-WEIXIN || APP-PLUS
let path = /pages/index/index?save=true;
// #endif
其他:
1.改变展示顺序 2.加上登录注册页面 3.加上意见反馈功能 4.提供一个二维码,供PC端扫码后进入登录 5.在每个word和pdf文件下加入免责的一个声明 6.权限的管理,添加页面需要审核,未登录状态下只能浏览(已经模拟了) 7、打包微信小程序 8、属性能够动态生成 9、声明成全局变量
? /**
- 解析缓存数据
- @static
- @method
- @param {Array} data 数据 */ static parseCache(data) { let key, objs, obj, data2, cols2, type2
//缓存数据
for (key in data)
{
obj = data[key]
data2 = obj.data
cols2 = obj.cols
type2 = obj.types
if (data2 && cols2 && type2)
{
data[key] = this.parseData(data2, cols2, type2)
delete obj.cols
delete obj.types
}
}
//权限数据
if (data.access)
{
if (data.access.compress)
{
cols2 = data.access.compress.cols
type2 = data.access.compress.types
objs = data.access.obj
for (key in objs)
{
obj = objs[key]
if (obj && obj.length > 0 && typeof obj[0] === 'string')
objs[key] = this.parseData(objs[key], cols2, type2)
}
}
}}
/**
- 解析缓存数据
- @static
- @method
- @param {Array} data 数据
- @param {String} cols 列名
- @param {String} types 类型数据
- @returns {Array} 返回解析后的数据 */ static parseData(data, cols, types) { let ret = [] let obj, jsonTem let arrtype, arrcol, arrdata, value let i, il, j, jl
arrtype = types.split(',')
arrcol = cols.split(',')
jl = arrtype.length
for (i = 0, il = data.length; i < il; i++)
{
arrdata = data[i].split(';')
obj = {}
for (j = 0; j < jl; j++)
{
value = arrdata[j]
switch (arrtype[j])
{
case 'i':
obj[arrcol[j]] = value === '' ? 0 : parseInt(value)
break
case 'r':
obj[arrcol[j]] = value === '' ? 0 : parseFloat(value)
break
case 's':
try
{
jsonTem = JSON.parse(value)
if (typeof jsonTem == 'object' && jsonTem)
obj[arrcol[j]] = jsonTem
else
obj[arrcol[j]] = value
}
catch (e)
{
obj[arrcol[j]] = value
}
break
default:
obj[arrcol[j]] = value
break
}
}
ret.push(obj)
}
return ret} /**
- 解析缓存数据
- @static
- @method
- @param {Array} data 数据 */ static parseCache(data) { let key, objs, obj, data2, cols2, type2
//缓存数据
for (key in data)
{
obj = data[key]
data2 = obj.data
cols2 = obj.cols
type2 = obj.types
if (data2 && cols2 && type2)
{
data[key] = this.parseData(data2, cols2, type2)
delete obj.cols
delete obj.types
}
}
//权限数据
if (data.access)
{
if (data.access.compress)
{
cols2 = data.access.compress.cols
type2 = data.access.compress.types
objs = data.access.obj
for (key in objs)
{
obj = objs[key]
if (obj && obj.length > 0 && typeof obj[0] === 'string')
objs[key] = this.parseData(objs[key], cols2, type2)
}
}
}}
/**
- 解析缓存数据
- @static
- @method
- @param {Array} data 数据
- @param {String} cols 列名
- @param {String} types 类型数据
- @returns {Array} 返回解析后的数据 */ static parseData(data, cols, types) { let ret = [] let obj, jsonTem let arrtype, arrcol, arrdata, value let i, il, j, jl
arrtype = types.split(',')
arrcol = cols.split(',')
jl = arrtype.length
for (i = 0, il = data.length; i < il; i++)
{
arrdata = data[i].split(';')
obj = {}
for (j = 0; j < jl; j++)
{
value = arrdata[j]
switch (arrtype[j])
{
case 'i':
obj[arrcol[j]] = value === '' ? 0 : parseInt(value)
break
case 'r':
obj[arrcol[j]] = value === '' ? 0 : parseFloat(value)
break
case 's':
try
{
jsonTem = JSON.parse(value)
if (typeof jsonTem == 'object' && jsonTem)
obj[arrcol[j]] = jsonTem
else
obj[arrcol[j]] = value
}
catch (e)
{
obj[arrcol[j]] = value
}
break
default:
obj[arrcol[j]] = value
break
}
}
ret.push(obj)
}
return ret}
