开源 企业版 高校版 私有云 模力方舟 AI 队友
代码拉取完成,页面将自动刷新
捐赠
捐赠前请先登录
扫描微信二维码支付
取消
支付完成
支付提示
将跳转至支付宝完成支付
确定
取消
1 Star 0 Fork 906

越挫越萌/MetaLowCode 企业级全栈低代码平台

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
已有帐号? 立即登录
文件
master
分支 (13)
master
feature/20240108_审批流程签名
feature/20231222_复制实体功能开发
feature/231218_审批添加左侧实体选择
feature/20231214_触发器发送通知新增
feature/20231214_数据库备份开发
feature/20231127_单点登录
feature/20231205_筛选条件重置
feature/231204_迭代任务开发
feature/20231130修复数据延迟问题
feature/20231127_移动端开发
feature/231123_实体列表修改
feature/2023-11-16开发
master
分支 (13)
master
feature/20240108_审批流程签名
feature/20231222_复制实体功能开发
feature/231218_审批添加左侧实体选择
feature/20231214_触发器发送通知新增
feature/20231214_数据库备份开发
feature/20231127_单点登录
feature/20231205_筛选条件重置
feature/231204_迭代任务开发
feature/20231130修复数据延迟问题
feature/20231127_移动端开发
feature/231123_实体列表修改
feature/2023-11-16开发
克隆/下载
克隆/下载
提示
下载代码请复制以下命令到终端执行
为确保你提交的代码身份被 Gitee 正确识别,请执行以下命令完成配置
初次使用 SSH 协议进行代码克隆、推送等操作时,需按下述提示完成 SSH 配置
1 生成 RSA 密钥
2 获取 RSA 公钥内容,并配置到 SSH公钥
在 Gitee 上使用 SVN,请访问 使用指南
使用 HTTPS 协议时,命令行会出现如下账号密码验证步骤。基于安全考虑,Gitee 建议 配置并使用私人令牌 替代登录密码进行克隆、推送等操作
Username for 'https://gitee.com': userName
Password for 'https://userName@gitee.com': # 私人令牌
master
分支 (13)
master
feature/20240108_审批流程签名
feature/20231222_复制实体功能开发
feature/231218_审批添加左侧实体选择
feature/20231214_触发器发送通知新增
feature/20231214_数据库备份开发
feature/20231127_单点登录
feature/20231205_筛选条件重置
feature/231204_迭代任务开发
feature/20231130修复数据延迟问题
feature/20231127_移动端开发
feature/231123_实体列表修改
feature/2023-11-16开发
MetaLowCode
/
src
/
utils
/
tool.js
MetaLowCode
/
src
/
utils
/
tool.js
tool.js 7.57 KB
一键复制 编辑 原始数据 按行查看 历史
formdesigner 提交于 2023年10月14日 10:35 +08:00 . 修改链接信息。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259
/*
* @Descripttion: 工具集
* @version: 1.2
* @LastEditors: sakuya
* @LastEditTime: 2022年5月24日00:28:56
*/
import CryptoJS from 'crypto-js';
import sysConfig from "@/config";
const tool = {}
/* localStorage */
tool.data = {
set(key, data, datetime = 0) {
//加密
if (sysConfig.LS_ENCRYPTION == "AES") {
data = tool.crypto.AES.encrypt(JSON.stringify(data), sysConfig.LS_ENCRYPTION_key)
}
let cacheValue = {
content: data,
datetime: parseInt(datetime) === 0 ? 0 : new Date().getTime() + parseInt(datetime) * 1000
}
return localStorage.setItem(key, JSON.stringify(cacheValue))
},
get(key) {
try {
const value = JSON.parse(localStorage.getItem(key))
if (value) {
let nowTime = new Date().getTime()
if (nowTime > value.datetime && value.datetime != 0) {
localStorage.removeItem(key)
return null;
}
//解密
if (sysConfig.LS_ENCRYPTION == "AES") {
value.content = JSON.parse(tool.crypto.AES.decrypt(value.content, sysConfig.LS_ENCRYPTION_key))
}
return value.content
}
return null
} catch (err) {
return null
}
},
remove(key) {
return localStorage.removeItem(key)
},
clear() {
return localStorage.clear()
}
}
/*sessionStorage*/
tool.session = {
set(table, settings) {
var _set = JSON.stringify(settings)
return sessionStorage.setItem(table, _set);
},
get(table) {
var data = sessionStorage.getItem(table);
try {
data = JSON.parse(data)
} catch (err) {
return null
}
return data;
},
remove(table) {
return sessionStorage.removeItem(table);
},
clear() {
return sessionStorage.clear();
}
}
/*cookie*/
tool.cookie = {
set(name, value, config = {}) {
var cfg = {
expires: null,
path: null,
domain: null,
secure: false,
httpOnly: false,
...config
}
var cookieStr = `${name}=${escape(value)}`
if (cfg.expires) {
var exp = new Date()
exp.setTime(exp.getTime() + parseInt(cfg.expires) * 1000)
cookieStr += `;expires=${exp.toGMTString()}`
}
if (cfg.path) {
cookieStr += `;path=${cfg.path}`
}
if (cfg.domain) {
cookieStr += `;domain=${cfg.domain}`
}
document.cookie = cookieStr
},
get(name) {
var arr = document.cookie.match(new RegExp("(^| )" + name + "=([^;]*)(;|$)"))
if (arr != null) {
return unescape(arr[2])
} else {
return null
}
},
remove(name) {
var exp = new Date()
exp.setTime(exp.getTime() - 1)
document.cookie = `${name}=;expires=${exp.toGMTString()}`
}
}
/* Fullscreen */
tool.screen = function (element) {
var isFull = !!(document.webkitIsFullScreen || document.mozFullScreen || document.msFullscreenElement || document.fullscreenElement);
if (isFull) {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.msExitFullscreen) {
document.msExitFullscreen();
} else if (document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if (document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
} else {
if (element.requestFullscreen) {
element.requestFullscreen();
} else if (element.msRequestFullscreen) {
element.msRequestFullscreen();
} else if (element.mozRequestFullScreen) {
element.mozRequestFullScreen();
} else if (element.webkitRequestFullscreen) {
element.webkitRequestFullscreen();
}
}
}
/* 复制对象 */
tool.objCopy = function (obj) {
return JSON.parse(JSON.stringify(obj));
}
/* 日期格式化 */
tool.dateFormat = function (date, fmt = 'yyyy-MM-dd hh:mm:ss') {
date = new Date(date)
var o = {
"M+": date.getMonth() + 1, //月份
"d+": date.getDate(), //日
"h+": date.getHours(), //小时
"m+": date.getMinutes(), //分
"s+": date.getSeconds(), //秒
"q+": Math.floor((date.getMonth() + 3) / 3), //季度
"S": date.getMilliseconds() //毫秒
};
if (/(y+)/.test(fmt)) {
fmt = fmt.replace(RegExp.1ドル, (date.getFullYear() + "").substr(4 - RegExp.1ドル.length));
}
for (var k in o) {
if (new RegExp("(" + k + ")").test(fmt)) {
fmt = fmt.replace(RegExp.1ドル, (RegExp.1ドル.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
}
}
return fmt;
}
/* 千分符 */
tool.groupSeparator = function (num) {
num = num + '';
if (!num.includes('.')) {
num += '.'
}
return num.replace(/(\d)(?=(\d{3})+\.)/g, function (0ドル, 1ドル) {
return 1ドル + ',';
}).replace(/\.$/, '');
}
/* 常用加解密 */
tool.crypto = {
//MD5加密
MD5(data) {
return CryptoJS.MD5(data).toString()
},
//BASE64加解密
BASE64: {
encrypt(data) {
return CryptoJS.enc.Base64.stringify(CryptoJS.enc.Utf8.parse(data))
},
decrypt(cipher) {
return CryptoJS.enc.Base64.parse(cipher).toString(CryptoJS.enc.Utf8)
}
},
//AES加解密
AES: {
encrypt(data, secretKey, config = {}) {
if (secretKey.length % 8 != 0) {
console.warn("[ML error]: 秘钥长度需为8的倍数,否则解密将会失败。")
}
const result = CryptoJS.AES.encrypt(data, CryptoJS.enc.Utf8.parse(secretKey), {
iv: CryptoJS.enc.Utf8.parse(config.iv || ""),
mode: CryptoJS.mode[config.mode || "ECB"],
padding: CryptoJS.pad[config.padding || "Pkcs7"]
})
return result.toString()
},
decrypt(cipher, secretKey, config = {}) {
const result = CryptoJS.AES.decrypt(cipher, CryptoJS.enc.Utf8.parse(secretKey), {
iv: CryptoJS.enc.Utf8.parse(config.iv || ""),
mode: CryptoJS.mode[config.mode || "ECB"],
padding: CryptoJS.pad[config.padding || "Pkcs7"]
})
return CryptoJS.enc.Utf8.stringify(result);
}
}
}
// 检测数据是否有变化
tool.checkIsEdit = (oldVal, newVal) => {
// 如果两个都是对象类型,检测对象
if (typeof oldVal == "object" && typeof newVal == "object") {
if (JSON.stringify(oldVal) != JSON.stringify(newVal)) {
return true;
}
}
// 如果两个数据 有一个是object 另一个不是,表示有修改
if (typeof oldVal == "object" && typeof newVal != "object") {
return true;
}
if (typeof newVal == "object" && typeof oldVal != "object") {
return true;
}
if (oldVal != newVal) {
return true;
}
return false;
};
// 获取权限
tool.getRole = (key) => {
let rightMap = tool.data.get('rightMap') || {};
return rightMap[key]
}
// 获取权限
tool.checkRole = (key) => {
let rightMap = tool.data.get('rightMap') || {};
let auto = rightMap[key];
if (key.indexOf('-') != -1) {
return auto != null && auto != 0
} else {
return !!auto
}
}
export default tool
Loading...
举报
举报成功
我们将于2个工作日内通过站内信反馈结果给你!
请认真填写举报原因,尽可能描述详细。
请选择举报类型
取消
发送
误判申诉

此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。

如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。

取消
提交

简介

MetaLowCode——美乐低代码,企业级全栈低代码开发平台! 潜心打造强大核心技术底座: 内置元数据引擎、业务流程引擎、业务触发器、可视化表单、仪表盘设计、智能报表引擎、数据挖掘和插件扩展框架。
取消

发行版

暂无发行版

贡献者

全部

近期动态

不能加载更多了
编辑仓库简介
简介内容
主页
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/Pattern/MetaLowCode.git
git@gitee.com:Pattern/MetaLowCode.git
Pattern
MetaLowCode
MetaLowCode 企业级全栈低代码平台
master
点此查找更多帮助

搜索帮助

仓库举报
回到顶部
登录提示
该操作需登录 Gitee 帐号,请先登录后再操作。
立即登录
没有帐号,去注册

AltStyle によって変換されたページ (->オリジナル) /