Commit 46f33341 by limin

init

0 parents
.DS_Store
node_modules
/dist
# local env files
.env.local
.env.*.local
# Log files
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
# Editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
{
"printWidth": 800,
"tabWidth": 2,
"singleQuote": true,
"trailingComma": "none",
"semi": false,
"wrap_line_length": 820,
"wrap_attributes": "auto",
"proseWrap": "always",
"arrowParens": "avoid",
"bracketSpacing": true,
"htmlWhitespaceSensitivity": "ignore",
"javascript.format.insertSpaceBeforeFunctionParenthesis": true,
"jsxBracketSameLine": true,
"files.insertFinalNewline": true,
"useTabs": false,
"prettier.ignorePath": ".prettierignore",
"eslintIntegration": true,
"overrides": [
{
"files": ".prettierrc",
"options": {
"parser": "json"
}
}
],
"endOfLine": "auto"
}
{
"name": "glsx-common",
"version": "1.3.2",
"description": "glsx common",
"main": "./dist/glsx-common.js",
"private": false,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack",
"clean": "./node_modules/.bin/rimraf dist",
"pre": "npm run clean && npm run build"
},
"author": "limin",
"license": "ISC",
"dependencies": {
"axios": "^0.21.3",
"md5": "^2.3.0"
},
"devDependencies": {
"rimraf": "^3.0.2",
"webpack": "^5.53.0",
"webpack-cli": "^4.8.0"
}
}
/*
* @Author: limin
* @Date: 2018-06-25 10:28:18
* @Last Modified by: huyue
* @Last Modified time: 2021-07-16 18:02:05
*/
import { createSign } from "./util";
import axios from "axios";
function Http(options = {}) {
this.service = axios.create({
withCredentials: true,
});
const {
response = {},
request: {
baseURL,
timeout = 3000,
withCredentials = true,
responseType = "json",
},
headers,
alert,
sign,
secret,
} = options;
this.customer = {
response,
alert,
sign,
secret,
};
Object.assign(
this.service.defaults,
{ headers },
{ baseURL, timeout, withCredentials, responseType }
);
return this.create();
}
Http.prototype.create = function () {
this.service.interceptors.request.use(
(config) => {
let { data = {}, sign = true, noSignAttr = [] } = config;
if (sign) {
let _configSign = this.customer.sign || {};
data = createSign(
Object.assign({}, _configSign, data),
this.customer.secret,
noSignAttr
);
}
if (config.method.toLocaleLowerCase() == "get") {
config.params = data;
} else if (config.method.toLocaleLowerCase() == "post") {
config.data = data;
}
return config;
},
(error) => Promise.reject(error)
);
this.service.interceptors.response.use(
(response) => {
const { response: result } = this.customer;
const res = response.data;
let code = res[result.code_key || "returnCode"];
let errId = res[result.errId || "errId"];
// 特殊的code处理,可以增加
switch (code + "") {
case "200":
// 请求成功,不弹提示框,成功code可以更改
break;
default:
this.customer.alert &&
this.customer.alert(
res.message || res.msg || "出错了,请联系管理员"
);
break;
}
return response.config.returnAll ? res : res[result.data_key || "data"];
},
(error) => {
this.customer.alert &&
this.customer.alert(error.message || "出错了,请联系管理员");
// 返回接口返回的错误信息
return Promise.reject(error);
}
);
return this.service;
};
export default Http;
/* Logo 字体 */
@font-face {
font-family: "iconfont logo";
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834');
src: url('https://at.alicdn.com/t/font_985780_km7mi63cihi.eot?t=1545807318834#iefix') format('embedded-opentype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.woff?t=1545807318834') format('woff'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.ttf?t=1545807318834') format('truetype'), url('https://at.alicdn.com/t/font_985780_km7mi63cihi.svg?t=1545807318834#iconfont') format('svg');
}
.logo {
font-family: "iconfont logo";
font-size: 160px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* tabs */
.nav-tabs {
position: relative;
}
.nav-tabs .nav-more {
position: absolute;
right: 0;
bottom: 0;
height: 42px;
line-height: 42px;
color: #666;
}
#tabs {
border-bottom: 1px solid #eee;
}
#tabs li {
cursor: pointer;
width: 100px;
height: 40px;
line-height: 40px;
text-align: center;
font-size: 16px;
border-bottom: 2px solid transparent;
position: relative;
z-index: 1;
margin-bottom: -1px;
color: #666;
}
#tabs .active {
border-bottom-color: #f00;
color: #222;
}
.tab-container .content {
display: none;
}
/* 页面布局 */
.main {
padding: 30px 100px;
width: 960px;
margin: 0 auto;
}
.main .logo {
color: #333;
text-align: left;
margin-bottom: 30px;
line-height: 1;
height: 110px;
margin-top: -50px;
overflow: hidden;
*zoom: 1;
}
.main .logo a {
font-size: 160px;
color: #333;
}
.helps {
margin-top: 40px;
}
.helps pre {
padding: 20px;
margin: 10px 0;
border: solid 1px #e7e1cd;
background-color: #fffdef;
overflow: auto;
}
.icon_lists {
width: 100% !important;
overflow: hidden;
*zoom: 1;
}
.icon_lists li {
width: 100px;
margin-bottom: 10px;
margin-right: 20px;
text-align: center;
list-style: none !important;
cursor: default;
}
.icon_lists li .code-name {
line-height: 1.2;
}
.icon_lists .icon {
display: block;
height: 100px;
line-height: 100px;
font-size: 42px;
margin: 10px auto;
color: #333;
-webkit-transition: font-size 0.25s linear, width 0.25s linear;
-moz-transition: font-size 0.25s linear, width 0.25s linear;
transition: font-size 0.25s linear, width 0.25s linear;
}
.icon_lists .icon:hover {
font-size: 100px;
}
.icon_lists .svg-icon {
/* 通过设置 font-size 来改变图标大小 */
width: 1em;
/* 图标和文字相邻时,垂直对齐 */
vertical-align: -0.15em;
/* 通过设置 color 来改变 SVG 的颜色/fill */
fill: currentColor;
/* path 和 stroke 溢出 viewBox 部分在 IE 下会显示
normalize.css 中也包含这行 */
overflow: hidden;
}
.icon_lists li .name, .icon_lists li .code-name {
color: #666;
}
/* markdown 样式 */
.markdown {
color: #666;
font-size: 14px;
line-height: 1.8;
}
.highlight {
line-height: 1.5;
}
.markdown img {
vertical-align: middle;
max-width: 100%;
}
.markdown h1 {
color: #404040;
font-weight: 500;
line-height: 40px;
margin-bottom: 24px;
}
.markdown h2, .markdown h3, .markdown h4, .markdown h5, .markdown h6 {
color: #404040;
margin: 1.6em 0 0.6em 0;
font-weight: 500;
clear: both;
}
.markdown h1 {
font-size: 28px;
}
.markdown h2 {
font-size: 22px;
}
.markdown h3 {
font-size: 16px;
}
.markdown h4 {
font-size: 14px;
}
.markdown h5 {
font-size: 12px;
}
.markdown h6 {
font-size: 12px;
}
.markdown hr {
height: 1px;
border: 0;
background: #e9e9e9;
margin: 16px 0;
clear: both;
}
.markdown p {
margin: 1em 0;
}
.markdown>p, .markdown>blockquote, .markdown>.highlight, .markdown>ol, .markdown>ul {
width: 80%;
}
.markdown ul>li {
list-style: circle;
}
.markdown>ul li, .markdown blockquote ul>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown>ul li p, .markdown>ol li p {
margin: 0.6em 0;
}
.markdown ol>li {
list-style: decimal;
}
.markdown>ol li, .markdown blockquote ol>li {
margin-left: 20px;
padding-left: 4px;
}
.markdown code {
margin: 0 3px;
padding: 0 5px;
background: #eee;
border-radius: 3px;
}
.markdown strong, .markdown b {
font-weight: 600;
}
.markdown>table {
border-collapse: collapse;
border-spacing: 0px;
empty-cells: show;
border: 1px solid #e9e9e9;
width: 95%;
margin-bottom: 24px;
}
.markdown>table th {
white-space: nowrap;
color: #333;
font-weight: 600;
}
.markdown>table th, .markdown>table td {
border: 1px solid #e9e9e9;
padding: 8px 16px;
text-align: left;
}
.markdown>table th {
background: #F7F7F7;
}
.markdown blockquote {
font-size: 90%;
color: #999;
border-left: 4px solid #e9e9e9;
padding-left: 0.8em;
margin: 1em 0;
}
.markdown blockquote p {
margin: 0;
}
.markdown .anchor {
opacity: 0;
transition: opacity 0.3s ease;
margin-left: 8px;
}
.markdown .waiting {
color: #ccc;
}
.markdown h1:hover .anchor, .markdown h2:hover .anchor, .markdown h3:hover .anchor, .markdown h4:hover .anchor, .markdown h5:hover .anchor, .markdown h6:hover .anchor {
opacity: 1;
display: inline-block;
}
.markdown>br, .markdown>p>br {
clear: both;
}
.hljs {
display: block;
background: white;
padding: 0.5em;
color: #333333;
overflow-x: auto;
}
.hljs-comment, .hljs-meta {
color: #969896;
}
.hljs-string, .hljs-variable, .hljs-template-variable, .hljs-strong, .hljs-emphasis, .hljs-quote {
color: #df5000;
}
.hljs-keyword, .hljs-selector-tag, .hljs-type {
color: #a71d5d;
}
.hljs-literal, .hljs-symbol, .hljs-bullet, .hljs-attribute {
color: #0086b3;
}
.hljs-section, .hljs-name {
color: #63a35c;
}
.hljs-tag {
color: #333333;
}
.hljs-title, .hljs-attr, .hljs-selector-id, .hljs-selector-class, .hljs-selector-attr, .hljs-selector-pseudo {
color: #795da3;
}
.hljs-addition {
color: #55a532;
background-color: #eaffea;
}
.hljs-deletion {
color: #bd2c00;
background-color: #ffecec;
}
.hljs-link {
text-decoration: underline;
}
/* 代码高亮 */
/* PrismJS 1.15.0
https://prismjs.com/download.html#themes=prism&languages=markup+css+clike+javascript */
/**
* prism.js default theme for JavaScript, CSS and HTML
* Based on dabblet (http://dabblet.com)
* @author Lea Verou
*/
code[class*="language-"], pre[class*="language-"] {
color: black;
background: none;
text-shadow: 0 1px white;
font-family: Consolas, Monaco, 'Andale Mono', 'Ubuntu Mono', monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.5;
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
pre[class*="language-"]::-moz-selection, pre[class*="language-"] ::-moz-selection, code[class*="language-"]::-moz-selection, code[class*="language-"] ::-moz-selection {
text-shadow: none;
background: #b3d4fc;
}
pre[class*="language-"]::selection, pre[class*="language-"] ::selection, code[class*="language-"]::selection, code[class*="language-"] ::selection {
text-shadow: none;
background: #b3d4fc;
}
@media print {
code[class*="language-"], pre[class*="language-"] {
text-shadow: none;
}
}
/* Code blocks */
pre[class*="language-"] {
padding: 1em;
margin: .5em 0;
overflow: auto;
}
:not(pre)>code[class*="language-"], pre[class*="language-"] {
background: #f5f2f0;
}
/* Inline code */
:not(pre)>code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
}
.token.comment, .token.prolog, .token.doctype, .token.cdata {
color: slategray;
}
.token.punctuation {
color: #999;
}
.namespace {
opacity: .7;
}
.token.property, .token.tag, .token.boolean, .token.number, .token.constant, .token.symbol, .token.deleted {
color: #905;
}
.token.selector, .token.attr-name, .token.string, .token.char, .token.builtin, .token.inserted {
color: #690;
}
.token.operator, .token.entity, .token.url, .language-css .token.string, .style .token.string {
color: #9a6e3a;
background: hsla(0, 0%, 100%, .5);
}
.token.atrule, .token.attr-value, .token.keyword {
color: #07a;
}
.token.function, .token.class-name {
color: #DD4A68;
}
.token.regex, .token.important, .token.variable {
color: #e90;
}
.token.important, .token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
.token.entity {
cursor: help;
}
\ No newline at end of file
@font-face {
font-family: "iconfont";
/* Project id 1450452 */
src: url('iconfont.woff2?t=1620617459370') format('woff2'), url('iconfont.woff?t=1620617459370') format('woff'), url('iconfont.ttf?t=1620617459370') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
.icon-screen-exit:before {
content: "\ea1e";
}
.icon-screen-full:before {
content: "\ea1f";
}
.icon-shouqi:before {
content: "\e605";
}
.icon-zhankai:before {
content: "\e606";
}
.icon-menu1:before {
content: "\e616";
}
.icon-menu:before {
content: "\e7d3";
}
.icon-fanhui:before {
content: "\e641";
}
\ No newline at end of file
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-09 18:44:57
* @LastEditors: limin
* @LastEditTime: 2021-09-09 18:44:58
* @FilePath: \glsx-common\src\iconfont\iconfont.js
*/
!(function (c) {
var e,
t,
l,
n,
o,
i,
a =
'<svg><symbol id="icon-screen-exit" viewBox="0 0 1024 1024"><path d="M365.15043555 182.98538667c-0.97052445-8.00995555-10.80092445-11.40849778-16.50460444-5.70481778l-53.03637333 53.03637333L133.34755555 68.17564445c-3.76263111-3.76263111-9.95214222-3.76263111-13.71363555 0l-51.45827555 51.33653333c-3.76263111 3.76263111-3.76263111 9.95214222 0 13.71363555l162.26190222 162.26304-53.27758222 53.27758222c-5.70481778 5.70481778-2.30627555 15.53521778 5.70368 16.50574223L377.28711111 388.20977778c6.18951111 0.72817778 11.52910222-4.49080889 10.80092444-10.80092445l-22.9376-194.42346666z m12.25841778 452.92657778l-194.54520888 22.9376c-8.00995555 0.97052445-11.40849778 10.80092445-5.70368 16.50460444l53.27758222 53.27872L68.17564445 890.65244445c-3.76263111 3.76263111-3.76263111 9.95214222 0 13.71363555l51.45827555 51.33653333c3.76149333 3.76263111 9.95100445 3.76263111 13.71363555 0l162.26190223-162.14016 53.03637333 53.03523556c5.70368 5.70368 15.53408 2.30627555 16.50460444-5.70368l22.9376-194.30286222c0.72817778-6.18951111-4.48967111-11.40736-10.67918222-10.67918222z m269.18229334-247.8239289l194.54520888-22.9376c8.00995555-0.97052445 11.40849778-10.80092445 5.70368-16.50460444l-53.27758222-53.15697778L955.82435555 133.34755555c3.76263111-3.76263111 3.76263111-9.95214222 0-13.71363555l-51.45827555-51.33653333c-3.76149333-3.76263111-9.95100445-3.76263111-13.71363555 0l-162.26190223 162.01955555-53.03637333-53.03637333c-5.70368-5.70368-15.53408-2.30513778-16.50460444 5.70481778L635.91196445 377.28711111c-0.72817778 6.31125333 4.48967111 11.52910222 10.67918222 10.80092444z m146.97130666 340.42311112l53.27758222-53.27758222c5.70481778-5.70481778 2.30627555-15.53521778-5.70368-16.50574223L646.71288889 635.79022222c-6.18951111-0.72817778-11.52910222 4.49080889-10.80092444 10.80092445l22.9376 194.42346666c0.97052445 8.00995555 10.80092445 11.40849778 16.50460444 5.70481778l53.03637333-53.03637333L890.65244445 955.82435555c3.76263111 3.76263111 9.95214222 3.76263111 13.71363555 0l51.45827555-51.33653333c3.76263111-3.76263111 3.76263111-9.95214222 0-13.71363555L793.56245333 728.51114667z" ></path></symbol><symbol id="icon-screen-full" viewBox="0 0 1024 1024"><path d="M224.6125037 155.22565689l56.83063467-56.83063467c6.08392533-6.08392533 2.45881363-16.56968533-6.08513896-17.60612504l-207.38503111-24.46677333c-6.60214518-0.77672297-12.29770903 4.79019615-11.52098608 11.5221997l24.46677333 207.38503112c1.03522608 8.54395259 11.52098608 12.16785067 17.60612504 6.08392533l56.57091793-56.57091792 173.07936237 172.949504c4.01347318 4.01347318 10.61561837 4.01347318 14.62909156 0l54.88761363-54.7589689c4.01347318-4.01225955 4.01347318-10.61440475 0-14.62787793L224.6125037 155.22565689z m456.58324385 242.46620919c4.01347318 4.01347318 10.61561837 4.01347318 14.62909156 0L868.90420148 224.74236208l56.57091793 56.57091792c6.08513897 6.08392533 16.57089897 2.46002725 17.60612504-6.08392533l24.46677333-207.25638637c0.77672297-6.60214518-4.79019615-12.29770903-11.52098608-11.52098608l-207.38503111 24.46677333c-8.54395259 1.03522608-12.1690643 11.52098608-6.08513896 17.60612504l56.83063467 56.82942104-173.07936238 172.82085926c-4.01347318 4.01347318-4.01347318 10.61561837 0 14.62909156l54.88761363 54.88761363zM943.08124445 748.77064533c-1.03522608-8.54395259-11.52098608-12.16785067-17.60612504-6.08392533l-56.57091793 56.57091792-173.07936237-172.949504c-4.01347318-4.01347318-10.61561837-4.01347318-14.62909156 0l-54.88761363 54.7589689c-4.01347318 4.01225955-4.01347318 10.61440475 0 14.62787793L799.3874963 868.77434311 742.55686163 925.60497778c-6.08392533 6.08392533-2.45881363 16.56968533 6.08513896 17.60612504l207.38503111 24.46677333c6.60214518 0.77672297 12.29770903-4.79019615 11.52098608-11.5221997l-24.46677333-207.38503112zM342.80425245 626.30813392c-4.01347318-4.01347318-10.61561837-4.01347318-14.62909156 0L155.09579852 799.25763792l-56.57091793-56.57091792c-6.08513897-6.08392533-16.57089897-2.46002725-17.60612504 6.08392533l-24.46677333 207.25638637c-0.77672297 6.60214518 4.79019615 12.29770903 11.52098608 11.52098608l207.38503111-24.46677333c8.54395259-1.03522608 12.1690643-11.52098608 6.08513896-17.60612504l-56.83063467-56.7007763 173.07936238-172.949504c4.01347318-4.01347318 4.01347318-10.61561837 0-14.62909156l-54.88761363-54.88761363z" ></path></symbol><symbol id="icon-shouqi" viewBox="0 0 1117 1024"><path d="M703.769135 410.158545H33.514589a11.450182 11.450182 0 0 1-11.170909-11.636363v-81.454546c0-6.330182 5.026909-11.636364 11.170909-11.636363h670.254546c6.144 0 11.170909 5.306182 11.170909 11.636363v81.454546a11.450182 11.450182 0 0 1-11.170909 11.636363z m11.170909 296.773819a11.450182 11.450182 0 0 1-11.170909 11.636363H33.514589a11.450182 11.450182 0 0 1-11.170909-11.636363v-81.454546c0-6.423273 5.026909-11.636364 11.170909-11.636363h670.254546c6.144 0 11.170909 5.213091 11.170909 11.636363v81.454546zM11.172771 0h1094.749091c6.144 0 11.170909 5.213091 11.170909 11.636364V93.090909a11.450182 11.450182 0 0 1-11.170909 11.636364H11.172771A11.450182 11.450182 0 0 1 0.001862 93.090909V11.636364C0.001862 5.213091 5.028771 0 11.172771 0z m0 919.272727h1094.749091c6.144 0 11.170909 5.213091 11.170909 11.636364v81.454545a11.450182 11.450182 0 0 1-11.170909 11.636364H11.172771a11.450182 11.450182 0 0 1-11.170909-11.636364V930.909091c0-6.423273 5.026909-11.636364 11.170909-11.636364z m1063.470545-218.018909L856.345135 522.146909a13.218909 13.218909 0 0 1 0-20.200727l218.298181-179.2c8.098909-6.702545 20.107636-0.744727 20.107637 10.053818v358.213818c0 10.798545-11.915636 16.942545-20.107637 10.24z" ></path></symbol><symbol id="icon-zhankai" viewBox="0 0 1117 1024"><path d="M413.325498 410.158545h670.254546c6.144 0 11.170909-5.213091 11.170909-11.636363v-81.454546a11.450182 11.450182 0 0 0-11.170909-11.636363h-670.254546a11.450182 11.450182 0 0 0-11.170909 11.636363v81.454546c0 6.423273 5.026909 11.636364 11.170909 11.636363z m-11.170909 296.773819c0 6.330182 5.026909 11.636364 11.170909 11.636363h670.254546c6.144 0 11.170909-5.306182 11.170909-11.636363v-81.454546a11.450182 11.450182 0 0 0-11.170909-11.636363h-670.254546a11.450182 11.450182 0 0 0-11.170909 11.636363v81.454546zM1105.921862 0H11.172771A11.450182 11.450182 0 0 0 0.001862 11.636364V93.090909c0 6.423273 5.026909 11.636364 11.170909 11.636364h1094.749091c6.144 0 11.170909-5.213091 11.170909-11.636364V11.636364A11.450182 11.450182 0 0 0 1105.921862 0z m0 919.272727H11.172771A11.450182 11.450182 0 0 0 0.001862 930.909091v81.454545c0 6.423273 5.026909 11.636364 11.170909 11.636364h1094.749091c6.144 0 11.170909-5.213091 11.170909-11.636364V930.909091a11.450182 11.450182 0 0 0-11.170909-11.636364zM42.451316 701.253818L260.656407 522.146909a13.218909 13.218909 0 0 0 0-20.200727L42.451316 322.746182C34.352407 316.043636 22.34368 322.094545 22.34368 332.8v358.213818c0 10.798545 11.822545 16.942545 20.107636 10.24z" ></path></symbol><symbol id="icon-menu1" viewBox="0 0 1024 1024"><path d="M512 1024C229.241263 1024 0 794.758737 0 512S229.241263 0 512 0s512 229.241263 512 512-229.241263 512-512 512z m0-956.631579C266.428632 67.368421 67.368421 266.428632 67.368421 512S266.428632 956.631579 512 956.631579 956.631579 757.571368 956.631579 512 757.571368 67.368421 512 67.368421zM269.473684 673.684211h485.052632v53.894736H269.473684v-53.894736z m0-188.631579h485.052632v53.894736H269.473684v-53.894736z m0-188.631579h485.052632v53.894736H269.473684v-53.894736z" ></path></symbol><symbol id="icon-menu" viewBox="0 0 1024 1024"><path d="M832 384c70.692 0 128 57.308 128 128s-57.308 128-128 128c-70.692 0-128-57.308-128-128s57.308-128 128-128z m-320 0c70.692 0 128 57.308 128 128s-57.308 128-128 128c-70.692 0-128-57.308-128-128s57.308-128 128-128z m-320 0c70.692 0 128 57.308 128 128s-57.308 128-128 128c-70.692 0-128-57.308-128-128s57.308-128 128-128z" ></path></symbol><symbol id="icon-fanhui" viewBox="0 0 1024 1024"><path d="M398.848 512l271.36 271.36c16.896 16.896 16.896 43.52 0 60.416-16.896 16.896-43.52 16.896-60.416 0l-301.568-301.568c-16.896-16.896-16.896-43.52 0-60.416l301.568-301.568c16.896-16.896 43.52-16.896 60.416 0 16.896 16.896 16.896 43.52 0 60.416l-271.36 271.36z" fill="#333333" ></path></symbol></svg>',
s = (s = document.getElementsByTagName("script"))[s.length - 1].getAttribute("data-injectcss");
if (s && !c.__iconfont__svg__cssinject__) {
c.__iconfont__svg__cssinject__ = !0;
try {
document.write("<style>.svgfont {display: inline-block;width: 1em;height: 1em;fill: currentColor;vertical-align: -0.1em;font-size:16px;}</style>");
} catch (c) {
console && console.log(c);
}
}
function d() {
o || ((o = !0), l());
}
(e = function () {
var c, e, t, l;
((l = document.createElement("div")).innerHTML = a), (a = null), (t = l.getElementsByTagName("svg")[0]) && (t.setAttribute("aria-hidden", "true"), (t.style.position = "absolute"), (t.style.width = 0), (t.style.height = 0), (t.style.overflow = "hidden"), (c = t), (e = document.body).firstChild ? ((l = c), (t = e.firstChild).parentNode.insertBefore(l, t)) : e.appendChild(c));
}),
document.addEventListener
? ~["complete", "loaded", "interactive"].indexOf(document.readyState)
? setTimeout(e, 0)
: ((t = function () {
document.removeEventListener("DOMContentLoaded", t, !1), e();
}),
document.addEventListener("DOMContentLoaded", t, !1))
: document.attachEvent &&
((l = e),
(n = c.document),
(o = !1),
(i = function () {
try {
n.documentElement.doScroll("left");
} catch (c) {
return void setTimeout(i, 50);
}
d();
})(),
(n.onreadystatechange = function () {
"complete" == n.readyState && ((n.onreadystatechange = null), d());
}));
})(window);
{
"id": "1450452",
"name": "qiankun-vue",
"font_family": "iconfont",
"css_prefix_text": "icon-",
"description": "",
"glyphs": [
{
"icon_id": "19989302",
"name": "screen-exit",
"font_class": "screen-exit",
"unicode": "ea1e",
"unicode_decimal": 59934
},
{
"icon_id": "19989303",
"name": "screen-full",
"font_class": "screen-full",
"unicode": "ea1f",
"unicode_decimal": 59935
},
{
"icon_id": "15267568",
"name": "收起",
"font_class": "shouqi",
"unicode": "e605",
"unicode_decimal": 58885
},
{
"icon_id": "15267571",
"name": "展开",
"font_class": "zhankai",
"unicode": "e606",
"unicode_decimal": 58886
},
{
"icon_id": "1608363",
"name": "menu",
"font_class": "menu1",
"unicode": "e616",
"unicode_decimal": 58902
},
{
"icon_id": "2575093",
"name": "im-menu",
"font_class": "menu",
"unicode": "e7d3",
"unicode_decimal": 59347
},
{
"icon_id": "8575377",
"name": "返回",
"font_class": "fanhui",
"unicode": "e641",
"unicode_decimal": 58945
}
]
}
\ No newline at end of file
No preview for this file type
No preview for this file type
No preview for this file type
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-09 19:31:45
* @LastEditors: limin
* @LastEditTime: 2021-09-09 19:31:45
* @FilePath: \glsx-common\src\import\import-development.js
*/
module.exports = (file) => require("@/views" + file + "/index.vue").default;
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-09 19:31:38
* @LastEditors: limin
* @LastEditTime: 2021-09-09 19:31:38
* @FilePath: \glsx-common\src\import\import-production.js
*/
module.exports = (file) => () => import("@/views" + file + "/index.vue");
/*
* @Descripttion:
* @version: 1.0.0
* @Author: limin
* @Date: 2021-09-06 11:12:07
* @LastEditors: limin
* @LastEditTime: 2021-09-21 14:36:51
* @FilePath: \npm\glsx-common\src\index.js
*/
import Http from "./http";
import array from "./util.array";
import util from "./util";
// import qiankun from "./qiankun";
import storage from "./storage";
import Postmate from "./postmate";
const utils = { ...util, array, storage };
export { Http, utils, Postmate };
import "./iconfont/iconfont.css";
import "./style/index.scss";
const _import = require("./import/import-" + process.env.NODE_ENV);
// 为vuex添加global模块,存储全局下发的数据
function registerGlobalModule(store, props = {}) {
if (!store || !store.hasModule) return;
// 初始化数据
const initState = { ...props.globalState };
if (!store.hasModule("global")) {
const globalModule = {
namespaced: true,
state: initState,
actions: {
// 子应用改变state并通知父应用
setGlobalState({ commit }, payload) {
commit("setGlobalState", payload);
commit("emitGlobalState", payload);
},
// 初始化,只用于mount时同步父应用的数据
initGlobalState({ commit }, payload) {
commit("setGlobalState", payload);
},
},
mutations: {
setGlobalState(state, payload) {
state = Object.assign(state, payload);
},
emitGlobalState(state) {
if (props.setGlobalState) {
props.setGlobalState(state);
}
},
},
};
store.registerModule("global", globalModule);
} else {
// 每次mount时,都同步一次父应用数据
store.dispatch("global/initGlobalState", initState);
}
}
// 为vuex添加routes模块,存储及修改动态路由数据
function registerRoutesModule(store) {
if (!store || !store.hasModule) return;
if (!store.hasModule("routes")) {
const routesModule = {
namespaced: true,
state: {
routesData: [],
},
mutations: {
UPDATE_ROUTER_DATA(state, payload) {
state.routesData = payload;
},
},
};
store.registerModule("routes", routesModule);
}
}
// 封装路由数据
function getRoutes({ name, id, routesData }) {
const routes = [];
if (routesData && name && id) {
for (let i = 0, length = routesData.length; i < length; i += 1) {
const element = routesData[i];
if (element.path && element.path.includes(name) && element.meta && element.meta.id && element.meta.id.startsWith(id)) {
const path = element.path.slice(name.length + 1);
element.path = path;
element.component = _import(path);
routes.push(element);
}
}
}
return routes;
}
function initGlobalState(store, props) {
registerGlobalModule(store, props);
// registerRoutesModule(store);
// const routes = getRoutes(store, props);
// return routes;
}
export default {
initGlobalState,
getRoutes,
};
/*
* @Author: limin
* @Date: 2018-06-23 11:13:44
* @Last Modified by: limin
* @Last Modified time: 2018-08-31 18:28:26
*/
const TYPE = {
LOCAL: "localStorage",
SESSION: "sessionStorage",
};
function isObject(val) {
return val !== null && typeof val === "object";
}
function set(key, val, type = TYPE.LOCAL) {
if (isObject(val)) window[type].setItem(key, JSON.stringify(val));
else window[type].setItem(key, val);
}
function get(key, type = TYPE.LOCAL) {
var val = window[type].getItem(key);
try {
if (val && val.startsWith("#")) {
return val;
}
const value = JSON.parse(val);
return value;
} catch (e) {
throw e;
}
}
function remove(key, type = TYPE.LOCAL) {
window[type].removeItem(key);
}
function setSession(key, val, ex = 20) {
set(key, val, TYPE.SESSION);
}
function getSession(key) {
return get(key, TYPE.SESSION);
}
function removeSession(key) {
remove(key, TYPE.SESSION);
}
// 默认30minute
function setExpire(key, val, ex = 1.8e6) {
set(key, { v: val, t: Date.now() + ex });
}
function getExpire(key) {
var obj = get(key);
if (obj.t > Date.now()) return obj.v;
else return null;
}
export default {
set,
get,
remove,
setSession,
getSession,
removeSession,
setExpire,
getExpire,
};
@import "var";
$prefix: paas !default;
html {
margin: 0;
padding: 0;
font-size: 625%;
-webkit-text-size-adjust: 100%; // 4
-ms-text-size-adjust: 100%; // 4
-webkit-tap-highlight-color: rgba(0, 0, 0, 0); // 6
height: 100%;
max-height: 100%;
overflow-x: hidden;
overflow-y: auto;
}
body {
margin: 0;
padding: 0;
height: 100vh;
width: 100vw;
overflow: auto;
padding-left: calc(100vw - 100%);
font-size: 14px;
font-family: "Microsoft YaHei", "微软雅黑", "MicrosoftJhengHei", "STHeiti", "MingLiu";
color: #303133;
-ms-overflow-style: none;
scrollbar-width: none;
}
body::-webkit-scrollbar {
display: none;
}
a {
text-decoration: none;
color: #303133;
}
img {
display: block;
}
/* 宽度100% */
.width-abs {
width: 100% !important;
}
/* 高度100% */
.height-abs {
height: 100% !important;
}
@mixin flex-row {
display: -webkit-flex;
display: flex !important;
}
@mixin flex-col {
@include flex-row;
flex-direction: column;
}
/* flex布局 */
.flex-row {
@include flex-row;
}
.flex-col {
@include flex-row;
flex-direction: column;
}
// 分布两边
.flex-row-between {
@include flex-row;
justify-content: space-between;
}
// 居中
.flex-row-center {
@include flex-row;
justify-content: center;
}
// 左右等份
.flex-row-around {
@include flex-row;
justify-content: space-around;
}
// 上下两边分布
.flex-col-between {
@include flex-col;
justify-content: space-between;
}
// 上下等份
.flex-col-around {
@include flex-col;
justify-content: space-around;
}
// 元素上下居中
.flex-col-center {
@include flex-col;
justify-content: center;
}
/* flex布局子元素位置 */
.flex-items-start {
align-items: flex-start;
}
.flex-items-center {
align-items: center;
}
.flex-items-end {
align-items: flex-end;
}
/* 换行 || 等分 */
.flex-wrap {
flex-wrap: wrap;
}
.flex-1 {
flex: 1;
}
/* 定位布局 */
.position-relative {
position: relative;
}
.position-absolute {
position: absolute;
}
.position-fixed {
position: fixed;
}
/* 元素溢出处理 */
.overflow-hidden {
overflow: hidden;
}
.overflow-auto-x {
overflow-x: auto;
}
.overflow-auto-y {
overflow-y: auto;
}
/* 文本不换行 */
.overflow-nowrap {
white-space: nowrap;
}
/* 超出一行省略 */
.overflow-ellipsis {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
/* 元素转换处理 */
@each $var in (block, inline, inline-block) {
.box-#{$var} {
display: $var;
}
}
/* 鼠标点击效果 */
@each $var in (pointer, default, wait, no-drop) {
.cursor-#{$var} {
cursor: $var;
}
}
/* 文本对齐 */
@each $var in (left, center, right) {
.text-#{$var} {
text-align: $var;
}
}
/* 阴影处理 */
.shadow {
box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
}
.none-shadow {
box-shadow: none !important;
}
/* 边框 */
.border {
border: solid 1px $border;
}
.none-border {
border: none !important;
}
@each $var in (left, top, right, bottom) {
.border-#{$var} {
border-#{$var}: solid 1px $border;
}
}
/*! normalize.css v2.1.3 | MIT License | git.io/normalize */
/* ==========================================================================
HTML5 display definitions
========================================================================== */
/**
* Correct `block` display not defined in IE 8/9.
*/
article,
aside,
details,
figcaption,
figure,
footer,
header,
hgroup,
main,
nav,
section,
summary {
display: block;
}
/**
* Correct `inline-block` display not defined in IE 8/9.
*/
audio,
canvas,
video {
display: inline-block;
}
/**
* Prevent modern browsers from displaying `audio` without controls.
* Remove excess height in iOS 5 devices.
*/
audio:not([controls]) {
display: none;
height: 0;
}
/**
* Address `[hidden]` styling not present in IE 8/9.
* Hide the `template` element in IE, Safari, and Firefox < 22.
*/
[hidden],
template {
display: none;
}
/* ==========================================================================
Base
========================================================================== */
/**
* 1. Set default font family to sans-serif.
* 2. Prevent iOS text size adjust after orientation change, without disabling
* user zoom.
*/
html {
font-family: sans-serif; /* 1 */
-ms-text-size-adjust: 100%; /* 2 */
-webkit-text-size-adjust: 100%; /* 2 */
}
/**
* Remove default margin.
*/
body {
margin: 0;
}
/* ==========================================================================
Links
========================================================================== */
/**
* Remove the gray background color from active links in IE 10.
*/
a {
background: transparent;
}
/**
* Address `outline` inconsistency between Chrome and other browsers.
*/
a:focus {
outline: thin dotted;
}
/**
* Improve readability when focused and also mouse hovered in all browsers.
*/
a:active,
a:hover {
outline: 0;
}
/* ==========================================================================
Typography
========================================================================== */
/**
* Address variable `h1` font-size and margin within `section` and `article`
* contexts in Firefox 4+, Safari 5, and Chrome.
*/
h1 {
font-size: 2em;
margin: 0.67em 0;
}
/**
* Address styling not present in IE 8/9, Safari 5, and Chrome.
*/
abbr[title] {
border-bottom: 1px dotted;
}
/**
* Address style set to `bolder` in Firefox 4+, Safari 5, and Chrome.
*/
b,
strong {
font-weight: bold;
}
/**
* Address styling not present in Safari 5 and Chrome.
*/
dfn {
font-style: italic;
}
/**
* Address differences between Firefox and other browsers.
*/
hr {
-moz-box-sizing: content-box;
box-sizing: content-box;
height: 0;
}
/**
* Address styling not present in IE 8/9.
*/
mark {
background: #ff0;
color: #000;
}
/**
* Correct font family set oddly in Safari 5 and Chrome.
*/
code,
kbd,
pre,
samp {
font-family: monospace, serif;
font-size: 1em;
}
/**
* Improve readability of pre-formatted text in all browsers.
*/
pre {
white-space: pre-wrap;
}
/**
* Set consistent quote types.
*/
q {
quotes: "\201C""\201D""\2018""\2019";
}
/**
* Address inconsistent and variable font size in all browsers.
*/
small {
font-size: 80%;
}
/**
* Prevent `sub` and `sup` affecting `line-height` in all browsers.
*/
sub,
sup {
font-size: 75%;
line-height: 0;
position: relative;
vertical-align: baseline;
}
sup {
top: -0.5em;
}
sub {
bottom: -0.25em;
}
/* ==========================================================================
Embedded content
========================================================================== */
/**
* Remove border when inside `a` element in IE 8/9.
*/
img {
border: 0;
}
/**
* Correct overflow displayed oddly in IE 9.
*/
svg:not(:root) {
overflow: hidden;
}
/* ==========================================================================
Figures
========================================================================== */
/**
* Address margin not present in IE 8/9 and Safari 5.
*/
figure {
margin: 0;
}
/* ==========================================================================
Forms
========================================================================== */
/**
* Define consistent border, margin, and padding.
*/
fieldset {
border: 1px solid #c0c0c0;
margin: 0 2px;
padding: 0.35em 0.625em 0.75em;
}
/**
* 1. Correct `color` not being inherited in IE 8/9.
* 2. Remove padding so people aren't caught out if they zero out fieldsets.
*/
legend {
border: 0; /* 1 */
padding: 0; /* 2 */
}
/**
* 1. Correct font family not being inherited in all browsers.
* 2. Correct font size not being inherited in all browsers.
* 3. Address margins set differently in Firefox 4+, Safari 5, and Chrome.
*/
button,
input,
select,
textarea {
font-family: inherit; /* 1 */
font-size: 100%; /* 2 */
margin: 0; /* 3 */
}
/**
* Address Firefox 4+ setting `line-height` on `input` using `!important` in
* the UA stylesheet.
*/
button,
input {
line-height: normal;
}
/**
* Address inconsistent `text-transform` inheritance for `button` and `select`.
* All other form control elements do not inherit `text-transform` values.
* Correct `button` style inheritance in Chrome, Safari 5+, and IE 8+.
* Correct `select` style inheritance in Firefox 4+ and Opera.
*/
button,
select {
text-transform: none;
}
/**
* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`
* and `video` controls.
* 2. Correct inability to style clickable `input` types in iOS.
* 3. Improve usability and consistency of cursor style between image-type
* `input` and others.
*/
button,
html input[type="button"], /* 1 */
input[type="reset"],
input[type="submit"] {
-webkit-appearance: button; /* 2 */
cursor: pointer; /* 3 */
}
/**
* Re-set default cursor for disabled elements.
*/
button[disabled],
html input[disabled] {
cursor: default;
}
/**
* 1. Address box sizing set to `content-box` in IE 8/9/10.
* 2. Remove excess padding in IE 8/9/10.
*/
input[type="checkbox"],
input[type="radio"] {
box-sizing: border-box; /* 1 */
padding: 0; /* 2 */
}
/**
* 1. Address `appearance` set to `searchfield` in Safari 5 and Chrome.
* 2. Address `box-sizing` set to `border-box` in Safari 5 and Chrome
* (include `-moz` to future-proof).
*/
input[type="search"] {
-webkit-appearance: textfield; /* 1 */
-moz-box-sizing: content-box;
-webkit-box-sizing: content-box; /* 2 */
box-sizing: content-box;
}
/**
* Remove inner padding and search cancel button in Safari 5 and Chrome
* on OS X.
*/
input[type="search"]::-webkit-search-cancel-button,
input[type="search"]::-webkit-search-decoration {
-webkit-appearance: none;
}
/**
* Remove inner padding and border in Firefox 4+.
*/
button::-moz-focus-inner,
input::-moz-focus-inner {
border: 0;
padding: 0;
}
/**
* 1. Remove default vertical scrollbar in IE 8/9.
* 2. Improve readability and alignment in all browsers.
*/
textarea {
overflow: auto; /* 1 */
vertical-align: top; /* 2 */
}
/* ==========================================================================
Tables
========================================================================== */
/**
* Remove most spacing between table cells.
*/
table {
border-collapse: collapse;
border-spacing: 0;
}
@import "var";
// 表格样式重置
.el-table--mini,
.el-table--small,
.el-table__expand-icon {
font-size: 14px !important;
}
.el-table::before {
left: 0;
bottom: 0;
width: 100%;
height: 0px !important;
}
// 主题颜色
$primary: #23b7e5;
$auxiliary: #7266ba;
$success: #27c24c;
$warning: #fad733;
$error: #e83d2c;
// 文本颜色
$link: #23b7e5;
$white: #ffffff;
$black: #000000;
$title: #333333;
$text: #555555;
$icon: #b4b6bd;
$secondary: #777777;
$disabled: #999999;
$border: #cfdadd;
// 背景色
$titleBg: #ecf7fa;
$headerBg: #3a3f51;
$mainBg: #f2f3f8;
@import "normalize";
@import "base";
@import "reset";
@import "var";
/**
* 从树形数据中递归筛选目标值
* arr 数据源
* val 目标值
* id 需要判断相等的字段
* childs 子集
*/
function valInDeep(arr = [], val, id = "Id", childs = "Children") {
return arr.reduce((flat, item) => {
return flat.concat(
item[id] == val ? item : valInDeep(item[childs] || [], val, id, childs)
);
}, []);
}
/**
* 将树形数据向下递归为一维数组
* @param {*} arr 数据源
* @param {*} childs 子集key
*/
function flattenDeep(arr = [], childs = "children", pid = 0) {
return arr.reduce((flat, item) => {
item.pid = pid;
return flat.concat(
item,
item[childs] ? flattenDeep(item[childs], childs, item.id) : []
);
}, []);
}
/**
* 将树形数据向上将此支线递归为一维数组
* @param {*} arr 数据源
* @param {*} parent 父级
*/
function flattenDeepParents(arr, parent) {
return arr.reduce((flat, item) => {
return flat.concat(
item[parent] || [],
item[parent] ? flattenDeepParents([item[parent]], parent) : []
);
}, []);
}
/**
* 根据条件递归祖先元素
* @param {*} row 数据源
* @param {*} parent 父级数据
* @param {*} reg 回调
*/
function regDeepParents(row, parent, reg) {
if (row[parent]) {
reg && reg(row[parent]);
regDeepParents(row[parent], parent, reg);
}
}
/**
* 将数组转化成树结构 array to tree
* @param {*} array 数据源
* @param {*} options 字段名配置项
*/
function arrayToTree(
array = [],
options = { id: "id", pid: "pid", children: "children" }
) {
let array_ = []; // 创建储存剔除叶子节点后的骨架节点数组
let unique = {}; // 创建盒子辅助本轮children合并去重
let root_pid = [
0,
"0",
undefined,
"undefined",
null,
"null",
"00000000-0000-0000-0000-000000000000",
"",
]; // 可能存在的根节点pid形式
array.forEach((item) => {
// 筛选可以插入当前节点的所有子节点
let children_array = array.filter(
(it) => it[options.pid] === item[options.id]
);
if (
item[options.children] &&
item[options.children] instanceof Array &&
item[options.children].length > 0
) {
// 去重合并数组
item[options.children].map((i) => (unique[i[options.id]] = 1));
item[options.children].push(
...children_array.filter((i) => unique[i[options.id]] !== 1)
);
} else {
item[options.children] = children_array;
}
// 当children_array有数据时插入下一轮array_,当无数据时将最后留下来的根节点树形插入数组
let has_children = children_array.length > 0;
if (
has_children ||
(!has_children && root_pid.includes(item[options.pid]))
) {
array_.push(item);
}
});
// 当数组内仅有根节点时退出,否组继续处理 最终递归深度次
if (!array_.every((item) => root_pid.includes(item[options.pid]))) {
return arrayToTree(array_, options);
} else {
return array_;
}
}
/**
* 如果数据里缺少树枝节点,则根据parents和自增长id补全整条树链,输出数据调用上部arrToTree函数组装成完整的树
* @param {Array} data 当前选中的某些数据 [一维数组]
* @param {Array} sourceData 拥有完整数据的源数据 [一维数组]
* @param {Object} options 配置参数,包括id,pid,树链parents,组成树链的自增长IdentityId, 根节点的默认pid为空的guid
*/
function patchTreeChain(
data,
sourceData,
options = {
Id: "Id",
ParentId: "ParentId",
Parents: "Parents",
IdentityId: "IdentityId",
root: "00000000-0000-0000-0000-000000000000",
}
) {
let _out_put_data = [], // 声明一个导出数据盒子
_all_lack_data = []; // 声明一个全部需要补全的节点盒子
data.forEach((i) => {
// 当一个节点在整个已选节点里找不到父节点时,并且此节点不是根节点时,从源数据中补全
if (
!data.find((t) => t[options.Id] === i[options.ParentId]) &&
i[options.ParentId] !== options.root
) {
// 首先将记录在节点身上的父级树链拆分
let _parents = i[options.Parents]
.substring(1, i[options.Parents].length - 1)
.split(",")
.filter((item) => !!item);
// 然后查找父级树链中某一链条是否已在数据中存在,已存在的不需要补全,从树链中剔除
let _lack_parents = _parents.filter(
(e) => data.findIndex((m) => m[options.IdentityId] == e) === -1
);
// 合并全部需要补全的数据
_all_lack_data = _all_lack_data.concat(_lack_parents);
}
});
// 去重后根据IdentityId在源数据中找到完整的节点数据并组装
[...new Set(_all_lack_data)].forEach((item) => {
_out_put_data.push(sourceData.find((it) => it[options.IdentityId] == item));
});
// 最后返回当前数据和需要补全父级树链的数据
return _out_put_data.concat(data);
}
/**
* 数组删除后重新定位
* @param {Object} data 数组数据
* @param {String|Number} delId 要删除的数据id
* @param {string|number} actId 当前id
* @param {Boolean} useTree 是否使用树形算法
*/
function locationAfterDelete(data, delId, actId, useTree = false) {
if (data.length === 1) {
let _item = data.Parent
? data.Parent
: { Id: useTree ? data[0].ParentId : "" };
return { item: _item, after_data: [] };
}
let after_data = data.filter((item) => item.Id !== delId);
if (actId && delId !== actId) {
return { item: null, after_data };
}
let cur_i = data.findIndex((item) => item.Id === delId);
let prv_item = cur_i > 0 ? data[cur_i - 1] : null;
let next_item = cur_i !== data.length - 1 ? data[cur_i + 1] : null;
return { item: next_item || prv_item, after_data };
}
/**
* 从坐标值拼接指定字段到祖先元素
* @param {*} data 一维数据源
* @param {*} coordinate 坐标值数据
* @param {*} options 配置项
*/
function splicParentsUntil(
data,
coordinate,
options = {
Splic: "Name", // 所要拼接字段
Connector: "\\", // 连接符
Id: "Id", // 数据源匹配字段
CoordinateId: "id",
ParentId: "ParentId",
Parents: "Parents",
IdentityId: "IdentityId",
root: "00000000-0000-0000-0000-000000000000",
}
) {
let coordinate_item = data.find(
(i) => i[options.Id] === coordinate[options.CoordinateId]
);
if (!coordinate_item) return "";
if (!coordinate_item[options.Parents]) return coordinate_item[options.Splic];
let _parents = coordinate_item[options.Parents]
.substring(1, coordinate_item[options.Parents].length - 1)
.split(",")
.filter((i) => !!i);
let splic_parents = "";
_parents.forEach((i) => {
let _parent = data.find((t) => t[options.IdentityId] == i);
splic_parents += `${_parent[options.Splic]}${options.Connector}`;
});
return splic_parents + coordinate_item[options.Splic];
}
/**
* 根据数组2内的元素,通过match字段匹配数组1内的完整内容组成的数据
* @param {*} array1 带有完整item对象的源数组列表
* @param {*} array2 只带有match字段组成的简单数组
* @param {*} match 用于匹配数组1和数组2的字段
*/
function intersectionBy(array1 = [], array2 = [], match = "Id") {
if ([null, "null", undefined, "undefined"].includes(array2)) return;
let data = [];
array2.forEach((item) => {
let match_success = array1.find((it) => it[match] === item);
match_success && data.push(match_success);
});
return data;
}
export default {
valInDeep,
flattenDeep,
flattenDeepParents,
regDeepParents,
arrayToTree,
patchTreeChain,
locationAfterDelete,
splicParentsUntil,
intersectionBy,
};
import MD5 from "md5";
export const Util = {
/**
* 校验手机号码格式
*/
checkPhone: function (mobile) {
let myreg =
/^(13[0-9]|15[0-9]|16[0-9]|17[0-9]|18[0-9]|19[0-9]|14[0-9])[0-9]{8}$/;
return myreg.test(mobile);
},
/**
* 校验固定电话
*/
validationTel: function (tel) {
let reg = /^0[\d]{2,3}-[\d]{7,8}$/;
return reg.test(tel);
},
/**
* 是否特殊字符
*/
isSpecialLetter: function (str) {
let reg = new RegExp(
"[`~!@#$^&*=|{}':;',\\[\\]<>?~!@#¥……&*——|{}【】‘;:”“'。,、? ]"
);
return reg.test(str);
},
/**
* 获取当前时间
*/
getCurrentDate: function () {
let time = new Date();
let y = time.getFullYear();
let m = time.getMonth() + 1;
let d = time.getDate();
return {
date: y + "/" + m + "/" + d,
};
},
/**
* 获取浏览器参数
*/
getUrlParams: function (name) {
let vars = [],
hash;
let oParams = {};
let hashes = window.location.href
.slice(window.location.href.indexOf("?") + 1)
.split("&");
for (let i = 0; i < hashes.length; i++) {
hash = hashes[i].split("=");
vars.push(hash[0]);
oParams[hash[0]] = hash[1];
}
console.log(vars);
if (name) {
return oParams[name];
} else {
return oParams;
}
},
/**
* 根据当前时间,计算往后30天的日期
*/
getAfterDate: function (day) {
let date1 = new Date();
let date2 = new Date(date1);
let time = 30;
if (day) {
time = day;
}
date2.setDate(date1.getDate() + time);
let _date =
date2.getFullYear() +
"-" +
(date2.getMonth() + 1) +
"-" +
date2.getDate();
return {
date: _date,
year: date2.getFullYear(),
month: date2.getMonth() + 1,
day: date2.getDate(),
};
},
/**
* 字段截取
*/
cutStr: function (str, num) {
if (!str) {
return "";
}
let m = 10;
let n = str;
if (num) {
m = num;
}
if (str.length > m) {
n = str.slice(0, m) + "...";
}
return n;
},
/**
* 深克隆 所有原型链上的对象和属性
* 例: const bar=deepClone(foo)
* console.log(bar===foo) false
* @param {*} obj
*/
deepClone: function (obj) {
// Handle the 3 simple types, and null or undefined or function
if (obj == null || typeof obj !== "object") return obj;
// Handle Date
if (obj instanceof Date) {
const copy = new Date();
copy.setTime(obj.getTime());
return copy;
}
// Handle Array or Object
if ((obj instanceof Array) | (obj instanceof Object)) {
const copy = obj instanceof Array ? [] : {};
for (var attr in obj) {
if (obj.hasOwnProperty(attr)) {
copy[attr] = Util.deepClone(obj[attr]);
}
}
return copy;
}
throw new Error("Unable to clone obj! Its type isn't supported.");
},
genUrlParams: function (param, key, encode) {
// if (!param || layui.$.isEmptyObject(param)) return ''
var params = [];
var t = typeof param;
if (t == "string" || t == "number" || t == "boolean") {
params.push(
key +
"=" +
(encode == null || encode ? encodeURIComponent(param) : param)
);
} else {
for (var i in param) {
var k =
key == null
? i
: key + (param instanceof Array ? "[" + i + "]" : "." + i);
params.push(Util.genUrlParams(param[i], k, encode));
}
}
return params.join("&");
},
isEmptyObject: function (obj) {
return !obj || JSON.stringify(obj) == "{}";
},
// 创建签名
createSign: function (params, secret, noSignAttr = []) {
delete params.sign;
var keys = Object.keys(params).sort();
var str = [];
var obj = null;
for (const key in params) {
obj = params[key];
if (obj === null || obj === undefined) {
obj = "";
} else if (typeof obj === "object") {
obj = JSON.stringify(obj);
}
params[key] = obj;
}
keys.forEach((e) => {
!noSignAttr.includes(e) && str.push(e + params[e]);
});
var hash = MD5(secret + str.join("") + secret);
params.sign = hash;
return params;
},
};
export const createSign = Util.createSign;
export default Util;
const path = require("path");
module.exports = {
// webpack 设置,可覆盖默认配置
// mode: "development",
entry: "./src/index.js",
output: {
path: path.resolve(__dirname, "./dist"),
// publicPath: "/dist/",
filename: "glsx-common.js",
library: "glsx-common",
libraryTarget: "umd",
umdNamedDefine: true,
},
optimization: {
minimize: false,
},
};
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!