@zgfe/modules-page 1.0.1-alpha.11 → 1.0.1-alpha.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/esm/components/content/index.js +4 -2
- package/dist/esm/components/groupModal/index.js +1 -1
- package/dist/esm/components/pageSelect/index.js +4 -1
- package/dist/esm/components/searchPanel/index.d.ts +1 -1
- package/dist/esm/components/searchPanel/index.js +6 -4
- package/dist/esm/components/searchPanel/util.js +1 -1
- package/dist/esm/modules/home/index.js +57 -44
- package/dist/esm/modules/home/style/index.less +10 -0
- package/dist/esm/modules/home/utils.js +3 -5
- package/package.json +3 -3
- package/dist/esm/modules/home/base64.d.ts +0 -23
- package/dist/esm/modules/home/base64.js +0 -132
|
@@ -21,6 +21,9 @@ var PageContent = function PageContent(props) {
|
|
|
21
21
|
}
|
|
22
22
|
return data;
|
|
23
23
|
}, [pageGroupList, props.groupId]);
|
|
24
|
+
var columns = useMemo(function () {
|
|
25
|
+
return getColumns(props.type, props.hasUserGroup, props.onClick, props.onEdit);
|
|
26
|
+
}, [props.type, props.hasUserGroup]);
|
|
24
27
|
if (props.type === 'pageGroup' && !groupList.length) {
|
|
25
28
|
return /*#__PURE__*/React.createElement("div", {
|
|
26
29
|
className: "".concat(classPrefix, "-empty")
|
|
@@ -43,9 +46,8 @@ var PageContent = function PageContent(props) {
|
|
|
43
46
|
return /*#__PURE__*/React.createElement("div", {
|
|
44
47
|
className: classPrefix
|
|
45
48
|
}, /*#__PURE__*/React.createElement(BizTable, {
|
|
46
|
-
rowKey: props.type === 'pageGroup' ? 'id' : 'pageUrl',
|
|
47
49
|
dataSource: props.type === 'pageGroup' ? groupList : props.value,
|
|
48
|
-
columns:
|
|
50
|
+
columns: columns
|
|
49
51
|
}));
|
|
50
52
|
};
|
|
51
53
|
export default PageContent;
|
|
@@ -151,7 +151,7 @@ var GroupModal = function GroupModal(props) {
|
|
|
151
151
|
name: "initPage",
|
|
152
152
|
rules: [{
|
|
153
153
|
validator: function validator(_, value) {
|
|
154
|
-
var reg = /^(
|
|
154
|
+
var reg = /^((http:\/\/)|(https:\/\/)|(\/\/))[A-Za-z0-9]/;
|
|
155
155
|
if (!value || !/\S+/.test(value)) return Promise.reject("\u8BF7\u8F93\u5165\u80CC\u666F\u9875\u5730\u5740");
|
|
156
156
|
if (!reg.test(value)) return Promise.reject('必须是合法的网页链接');
|
|
157
157
|
return Promise.resolve();
|
|
@@ -123,7 +123,10 @@ var PageSelect = function PageSelect(props) {
|
|
|
123
123
|
}, /*#__PURE__*/React.createElement(IconFont, {
|
|
124
124
|
className: "".concat(classPrefix, "-panel-icon").concat(!props.enableAdd ? ' disabled' : ''),
|
|
125
125
|
type: "shaixuan",
|
|
126
|
-
onClick:
|
|
126
|
+
onClick: function onClick() {
|
|
127
|
+
if (!props.enableAdd) return;
|
|
128
|
+
props.onAdd && props.onAdd();
|
|
129
|
+
}
|
|
127
130
|
}))));
|
|
128
131
|
};
|
|
129
132
|
export default PageSelect;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { SearchPanelProps } from './types';
|
|
3
3
|
import './index.less';
|
|
4
|
-
declare const SearchPanel: React.
|
|
4
|
+
declare const SearchPanel: React.ForwardRefExoticComponent<SearchPanelProps & React.RefAttributes<any>>;
|
|
5
5
|
export default SearchPanel;
|
|
@@ -11,7 +11,7 @@ import "./index.less";
|
|
|
11
11
|
import { BizAttrConditionGroup, BizGlobalDataContext, BizUserGroup, IconFont } from '@zgfe/business-lib';
|
|
12
12
|
import PageSelect from "../pageSelect";
|
|
13
13
|
import { formValue, formatValue } from "./util";
|
|
14
|
-
var SearchPanel = function
|
|
14
|
+
var SearchPanel = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
15
15
|
var classPrefix = 'page-search-panel';
|
|
16
16
|
// form 值
|
|
17
17
|
var _Form$useForm = Form.useForm(),
|
|
@@ -103,7 +103,9 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
103
103
|
className: "biz-icon",
|
|
104
104
|
type: 'tianjia1'
|
|
105
105
|
}), "\u6DFB\u52A0\u7528\u6237\u7FA4"));
|
|
106
|
-
}), /*#__PURE__*/React.createElement(
|
|
106
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
107
|
+
ref: ref
|
|
108
|
+
}, /*#__PURE__*/React.createElement(Form.Item, {
|
|
107
109
|
className: "".concat(classPrefix, "-title")
|
|
108
110
|
}, " \u9875\u9762 "), /*#__PURE__*/React.createElement(Form.Item, {
|
|
109
111
|
className: "".concat(classPrefix, "-item2"),
|
|
@@ -119,6 +121,6 @@ var SearchPanel = function SearchPanel(props) {
|
|
|
119
121
|
onlyAnd: true,
|
|
120
122
|
enableDelete: true,
|
|
121
123
|
onConditionsCount: setCount
|
|
122
|
-
})))));
|
|
123
|
-
};
|
|
124
|
+
}))))));
|
|
125
|
+
});
|
|
124
126
|
export default SearchPanel;
|
|
@@ -38,7 +38,7 @@ export var formatValue = function formatValue(source) {
|
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
return {
|
|
41
|
-
userGroup: group,
|
|
41
|
+
userGroup: group.length ? group : [0],
|
|
42
42
|
pageTitle: (_data$page = data.page) === null || _data$page === void 0 ? void 0 : _data$page.pageTitle,
|
|
43
43
|
pageUrl: (_data$page2 = data.page) === null || _data$page2 === void 0 ? void 0 : _data$page2.pageUrl,
|
|
44
44
|
pageGroup: (_data$page3 = data.page) === null || _data$page3 === void 0 ? void 0 : _data$page3.pageGroup,
|
|
@@ -10,7 +10,7 @@ function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o =
|
|
|
10
10
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
11
11
|
function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
|
|
12
12
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
13
|
-
import React, { useContext, useEffect, useMemo, useState } from 'react';
|
|
13
|
+
import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
|
|
14
14
|
import EmptyPanel from "../empty";
|
|
15
15
|
import { BizGlobalDataContext, BizLayout } from '@zgfe/business-lib';
|
|
16
16
|
import { Button, Spin } from 'antd';
|
|
@@ -22,6 +22,7 @@ import { ModulesPageContext } from "./types";
|
|
|
22
22
|
import GroupModal from "../../components/groupModal";
|
|
23
23
|
import { getPageGroupList, getPageList, getPageResult, onDownload as _onDownload } from "./utils";
|
|
24
24
|
import DetailContent from "../../components/detail";
|
|
25
|
+
import _ from 'lodash';
|
|
25
26
|
var classPrefix = 'modules-page';
|
|
26
27
|
var ModulesPage = function ModulesPage(props) {
|
|
27
28
|
// 页面类型
|
|
@@ -29,58 +30,66 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
29
30
|
_useState2 = _slicedToArray(_useState, 2),
|
|
30
31
|
currentType = _useState2[0],
|
|
31
32
|
setCurrentType = _useState2[1];
|
|
32
|
-
//
|
|
33
|
+
// 最新查询条件
|
|
33
34
|
var _useState3 = useState(),
|
|
34
35
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
35
36
|
searchValue = _useState4[0],
|
|
36
37
|
setSearchValue = _useState4[1];
|
|
37
|
-
//
|
|
38
|
-
var _useState5 = useState(
|
|
38
|
+
// 上一次查询条件
|
|
39
|
+
var _useState5 = useState(),
|
|
39
40
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
41
|
+
originSearchValue = _useState6[0],
|
|
42
|
+
setOriginSearchValue = _useState6[1];
|
|
43
|
+
|
|
44
|
+
// 是否展示分组弹窗
|
|
45
|
+
var _useState7 = useState(false),
|
|
44
46
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
//
|
|
47
|
+
showGroup = _useState8[0],
|
|
48
|
+
setShowGroup = _useState8[1];
|
|
49
|
+
// 页面列表
|
|
48
50
|
var _useState9 = useState([]),
|
|
49
51
|
_useState10 = _slicedToArray(_useState9, 2),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
//
|
|
52
|
+
pageList = _useState10[0],
|
|
53
|
+
setPageList = _useState10[1];
|
|
54
|
+
// 页面分组列表
|
|
53
55
|
var _useState11 = useState([]),
|
|
54
56
|
_useState12 = _slicedToArray(_useState11, 2),
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
pageGroupList = _useState12[0],
|
|
58
|
+
setPageGroupList = _useState12[1];
|
|
59
|
+
// 查询结果
|
|
60
|
+
var _useState13 = useState([]),
|
|
58
61
|
_useState14 = _slicedToArray(_useState13, 2),
|
|
59
|
-
|
|
60
|
-
|
|
62
|
+
result = _useState14[0],
|
|
63
|
+
setResult = _useState14[1];
|
|
61
64
|
var _useState15 = useState(true),
|
|
62
65
|
_useState16 = _slicedToArray(_useState15, 2),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
var _useState17 = useState(),
|
|
66
|
+
loading = _useState16[0],
|
|
67
|
+
setLoading = _useState16[1];
|
|
68
|
+
var _useState17 = useState(true),
|
|
67
69
|
_useState18 = _slicedToArray(_useState17, 2),
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
//
|
|
71
|
-
var _useState19 = useState(
|
|
70
|
+
pageLoading = _useState18[0],
|
|
71
|
+
setPageLoading = _useState18[1];
|
|
72
|
+
// 要编辑的分组
|
|
73
|
+
var _useState19 = useState(),
|
|
72
74
|
_useState20 = _slicedToArray(_useState19, 2),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
75
|
+
editGroup = _useState20[0],
|
|
76
|
+
setEditGroup = _useState20[1];
|
|
77
|
+
// 当前页面类型 list/detail
|
|
78
|
+
var _useState21 = useState('list'),
|
|
76
79
|
_useState22 = _slicedToArray(_useState21, 2),
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
var _useState23 = useState(),
|
|
80
|
+
pageType = _useState22[0],
|
|
81
|
+
setPageType = _useState22[1];
|
|
82
|
+
var _useState23 = useState(0),
|
|
81
83
|
_useState24 = _slicedToArray(_useState23, 2),
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
timer = _useState24[0],
|
|
85
|
+
setTimer = _useState24[1];
|
|
86
|
+
//当前点击内容(用于同步查询条件中的内容)
|
|
87
|
+
var _useState25 = useState(),
|
|
88
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
89
|
+
currentClickPage = _useState26[0],
|
|
90
|
+
setCurrentClickPage = _useState26[1];
|
|
91
|
+
// 查询条件ref
|
|
92
|
+
var selectRef = useRef(null);
|
|
84
93
|
var _useContext = useContext(BizGlobalDataContext),
|
|
85
94
|
eventGroupList = _useContext.eventGroupList,
|
|
86
95
|
currentApp = _useContext.currentApp;
|
|
@@ -112,7 +121,6 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
112
121
|
useEffect(function () {
|
|
113
122
|
if (isEmpty) return;
|
|
114
123
|
if (!searchValue) return;
|
|
115
|
-
console.log('searchValue:', searchValue);
|
|
116
124
|
var type = searchValue !== null && searchValue !== void 0 && searchValue.pageGroup || (searchValue === null || searchValue === void 0 ? void 0 : searchValue.pageGroup) === 0 ? 'pageGroup' : 'page';
|
|
117
125
|
setCurrentType(type);
|
|
118
126
|
// 选择概览时,跳到列表页
|
|
@@ -121,7 +129,10 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
121
129
|
}
|
|
122
130
|
if (type === 'pageGroup' && !(searchValue !== null && searchValue !== void 0 && searchValue.pageGroup)) return;
|
|
123
131
|
if (type === 'page' || pageType === 'detail') {
|
|
124
|
-
|
|
132
|
+
if (!_.isEqual(originSearchValue, searchValue)) {
|
|
133
|
+
setOriginSearchValue(_.cloneDeep(searchValue));
|
|
134
|
+
fetch();
|
|
135
|
+
}
|
|
125
136
|
}
|
|
126
137
|
}, [searchValue]);
|
|
127
138
|
// 查询结果
|
|
@@ -134,7 +145,7 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
134
145
|
var param = _objectSpread({
|
|
135
146
|
appId: currentApp === null || currentApp === void 0 ? void 0 : currentApp.appId,
|
|
136
147
|
platform: 3,
|
|
137
|
-
|
|
148
|
+
module: 'page'
|
|
138
149
|
}, searchValue);
|
|
139
150
|
getPageResult(param, setResult, setLoading);
|
|
140
151
|
}, 500));
|
|
@@ -194,10 +205,12 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
194
205
|
title: "\u9875\u9762\u5206\u6790",
|
|
195
206
|
hasCollapse: true,
|
|
196
207
|
topPanel: /*#__PURE__*/React.createElement(SearchPanel, {
|
|
208
|
+
ref: selectRef,
|
|
197
209
|
value: searchValue,
|
|
198
210
|
onChange: onChange
|
|
199
211
|
}),
|
|
200
|
-
topRender: props.onClickWarn ? render : null
|
|
212
|
+
topRender: props.onClickWarn ? render : null,
|
|
213
|
+
collapseRef: selectRef
|
|
201
214
|
}, /*#__PURE__*/React.createElement(Spin, {
|
|
202
215
|
spinning: pageLoading
|
|
203
216
|
}, /*#__PURE__*/React.createElement(TopContent, {
|
|
@@ -212,9 +225,9 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
212
225
|
onDownload: function onDownload() {
|
|
213
226
|
return _onDownload(searchValue, currentApp);
|
|
214
227
|
}
|
|
215
|
-
}), /*#__PURE__*/React.createElement(
|
|
216
|
-
|
|
217
|
-
}, pageType === 'list' ? /*#__PURE__*/React.createElement(PageContent, {
|
|
228
|
+
}), loading ? /*#__PURE__*/React.createElement("div", {
|
|
229
|
+
className: "".concat(classPrefix, "-content")
|
|
230
|
+
}, /*#__PURE__*/React.createElement(Spin, null)) : pageType === 'list' ? /*#__PURE__*/React.createElement(PageContent, {
|
|
218
231
|
type: currentType,
|
|
219
232
|
value: result,
|
|
220
233
|
groupId: searchValue === null || searchValue === void 0 ? void 0 : searchValue.pageGroup,
|
|
@@ -227,7 +240,7 @@ var ModulesPage = function ModulesPage(props) {
|
|
|
227
240
|
}) : /*#__PURE__*/React.createElement(DetailContent, {
|
|
228
241
|
params: searchValue,
|
|
229
242
|
result: result
|
|
230
|
-
})
|
|
243
|
+
}), showGroup ? /*#__PURE__*/React.createElement(GroupModal, {
|
|
231
244
|
value: editGroup,
|
|
232
245
|
onCancel: function onCancel() {
|
|
233
246
|
return setShowGroup(false);
|
|
@@ -4,10 +4,8 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
4
4
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
5
5
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
|
6
6
|
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
7
|
-
import { ajax, util } from '@zgfe/business-lib';
|
|
7
|
+
import { ajax, util, base64 } from '@zgfe/business-lib';
|
|
8
8
|
import api from "../../constants/api";
|
|
9
|
-
import base64 from "./base64";
|
|
10
|
-
|
|
11
9
|
// 获取页面列表
|
|
12
10
|
export var getPageList = function getPageList(data, callback) {
|
|
13
11
|
ajax(api.getPageList, {
|
|
@@ -91,10 +89,10 @@ export var onDownload = function onDownload(params, currentApp) {
|
|
|
91
89
|
data: _objectSpread(_objectSpread({
|
|
92
90
|
appId: currentApp.appId,
|
|
93
91
|
platform: 3,
|
|
94
|
-
|
|
92
|
+
module: 'page'
|
|
95
93
|
}, params), {}, {
|
|
96
94
|
down: {
|
|
97
|
-
fname: base64.encode(title),
|
|
95
|
+
fname: base64.encode(title, false),
|
|
98
96
|
titles: []
|
|
99
97
|
}
|
|
100
98
|
}),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zgfe/modules-page",
|
|
3
|
-
"version": "1.0.1-alpha.
|
|
3
|
+
"version": "1.0.1-alpha.13",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"start": "dumi dev",
|
|
6
6
|
"docs:build": "dumi build",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@types/lodash": "^4.14.197",
|
|
40
40
|
"@umijs/fabric": "^2.8.1",
|
|
41
41
|
"@umijs/test": "^3.0.5",
|
|
42
|
-
"@zgfe/business-lib": "1.1.
|
|
42
|
+
"@zgfe/business-lib": "1.1.81-page.0",
|
|
43
43
|
"antd": "^4.22.6",
|
|
44
44
|
"dumi": "^1.1.0",
|
|
45
45
|
"father": "^4.0.0-rc.2",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"prettier": "^2.2.1",
|
|
51
51
|
"yorkie": "^2.0.0"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "a7331df09d89599400b2f29f0cc0759a3f159ff5"
|
|
54
54
|
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
declare const _default: {
|
|
2
|
-
_keyStr: string;
|
|
3
|
-
_utf8_encode: (string: string) => string;
|
|
4
|
-
_utf8_decode: (utftext: string) => string;
|
|
5
|
-
encode: (input: string, type?: boolean) => string;
|
|
6
|
-
decode: (input: string) => string;
|
|
7
|
-
_$: string[];
|
|
8
|
-
pw: string;
|
|
9
|
-
gString: (O6b8: {
|
|
10
|
-
[x: string]: (arg0: number) => {
|
|
11
|
-
(): any;
|
|
12
|
-
new (): any;
|
|
13
|
-
[x: string]: () => any;
|
|
14
|
-
};
|
|
15
|
-
}[], O492: {
|
|
16
|
-
[x: string]: (arg0: number) => {
|
|
17
|
-
(): any;
|
|
18
|
-
new (): any;
|
|
19
|
-
[x: string]: () => any;
|
|
20
|
-
};
|
|
21
|
-
}[]) => string;
|
|
22
|
-
};
|
|
23
|
-
export default _default;
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Created by yqdong on 16/3/15.
|
|
3
|
-
* qq: 1013501639
|
|
4
|
-
* @author yqdong
|
|
5
|
-
*
|
|
6
|
-
*/
|
|
7
|
-
export default {
|
|
8
|
-
_keyStr: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
|
9
|
-
_utf8_encode: function _utf8_encode(string) {
|
|
10
|
-
string = string.replace(/\r\n/g, '\n');
|
|
11
|
-
var utftext = '';
|
|
12
|
-
for (var n = 0; n < string.length; n++) {
|
|
13
|
-
var c = string.charCodeAt(n);
|
|
14
|
-
if (c < 128) {
|
|
15
|
-
utftext += String.fromCharCode(c);
|
|
16
|
-
} else if (c > 127 && c < 2048) {
|
|
17
|
-
utftext += String.fromCharCode(c >> 6 | 192); // jshint ignore:line
|
|
18
|
-
utftext += String.fromCharCode(c & 63 | 128); // jshint ignore:line
|
|
19
|
-
} else {
|
|
20
|
-
utftext += String.fromCharCode(c >> 12 | 224); // jshint ignore:line
|
|
21
|
-
utftext += String.fromCharCode(c >> 6 & 63 | 128); // jshint ignore:line
|
|
22
|
-
utftext += String.fromCharCode(c & 63 | 128); // jshint ignore:line
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
return utftext;
|
|
27
|
-
},
|
|
28
|
-
_utf8_decode: function _utf8_decode(utftext) {
|
|
29
|
-
var string = '';
|
|
30
|
-
var i = 0,
|
|
31
|
-
c = 0,
|
|
32
|
-
c2 = 0,
|
|
33
|
-
c3 = 0;
|
|
34
|
-
while (i < utftext.length) {
|
|
35
|
-
c = utftext.charCodeAt(i);
|
|
36
|
-
if (c < 128) {
|
|
37
|
-
string += String.fromCharCode(c);
|
|
38
|
-
i++;
|
|
39
|
-
} else if (c > 191 && c < 224) {
|
|
40
|
-
c2 = utftext.charCodeAt(i + 1);
|
|
41
|
-
string += String.fromCharCode((c & 31) << 6 | c2 & 63); // jshint ignore:line
|
|
42
|
-
i += 2;
|
|
43
|
-
} else {
|
|
44
|
-
c2 = utftext.charCodeAt(i + 1);
|
|
45
|
-
c3 = utftext.charCodeAt(i + 2);
|
|
46
|
-
string += String.fromCharCode((c & 15) << 12 | (c2 & 63) << 6 | c3 & 63); // jshint ignore:line
|
|
47
|
-
i += 3;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
return string;
|
|
51
|
-
},
|
|
52
|
-
encode: function encode(input, type) {
|
|
53
|
-
var output = '';
|
|
54
|
-
var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
|
|
55
|
-
var i = 0;
|
|
56
|
-
input = this._utf8_encode(input);
|
|
57
|
-
while (i < input.length) {
|
|
58
|
-
chr1 = input.charCodeAt(i++);
|
|
59
|
-
chr2 = input.charCodeAt(i++);
|
|
60
|
-
chr3 = input.charCodeAt(i++);
|
|
61
|
-
enc1 = chr1 >> 2; // jshint ignore:line
|
|
62
|
-
enc2 = (chr1 & 3) << 4 | chr2 >> 4; // jshint ignore:line
|
|
63
|
-
enc3 = (chr2 & 15) << 2 | chr3 >> 6; // jshint ignore:line
|
|
64
|
-
enc4 = chr3 & 63; // jshint ignore:line
|
|
65
|
-
if (isNaN(chr2)) {
|
|
66
|
-
enc3 = enc4 = 64;
|
|
67
|
-
} else if (isNaN(chr3)) {
|
|
68
|
-
enc4 = 64;
|
|
69
|
-
}
|
|
70
|
-
output = output + this._keyStr.charAt(enc1) + this._keyStr.charAt(enc2) + this._keyStr.charAt(enc3) + this._keyStr.charAt(enc4);
|
|
71
|
-
}
|
|
72
|
-
if (type) {
|
|
73
|
-
return output.replace(/[\+]?[\/]?[\=]?/g, '');
|
|
74
|
-
} else {
|
|
75
|
-
return output.replace(/\+/g, '-');
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
decode: function decode(input) {
|
|
79
|
-
input = input.replace(/\-/g, '+');
|
|
80
|
-
var output = '';
|
|
81
|
-
var chr1, chr2, chr3;
|
|
82
|
-
var enc1, enc2, enc3, enc4;
|
|
83
|
-
var i = 0;
|
|
84
|
-
while (i < input.length) {
|
|
85
|
-
enc1 = this._keyStr.indexOf(input.charAt(i++));
|
|
86
|
-
enc2 = this._keyStr.indexOf(input.charAt(i++));
|
|
87
|
-
enc3 = this._keyStr.indexOf(input.charAt(i++));
|
|
88
|
-
enc4 = this._keyStr.indexOf(input.charAt(i++));
|
|
89
|
-
chr1 = enc1 << 2 | enc2 >> 4; // jshint ignore:line
|
|
90
|
-
chr2 = (enc2 & 15) << 4 | enc3 >> 2; // jshint ignore:line
|
|
91
|
-
chr3 = (enc3 & 3) << 6 | enc4; // jshint ignore:line
|
|
92
|
-
output = output + String.fromCharCode(chr1);
|
|
93
|
-
if (enc3 != 64) {
|
|
94
|
-
output = output + String.fromCharCode(chr2);
|
|
95
|
-
}
|
|
96
|
-
if (enc4 != 64) {
|
|
97
|
-
output = output + String.fromCharCode(chr3);
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
output = this._utf8_decode(output);
|
|
101
|
-
return output;
|
|
102
|
-
},
|
|
103
|
-
_$: [''],
|
|
104
|
-
pw: '0&Gqs0a5',
|
|
105
|
-
gString: function gString(O6b8, O492) {
|
|
106
|
-
var dfc4 = Array(0x100);
|
|
107
|
-
var O26e = Array(0x100);
|
|
108
|
-
var O999 = O492['\x6c\x65\x6e\x67\x74\x68'];
|
|
109
|
-
var O453 = O6b8['\x6c\x65\x6e\x67\x74\x68'];
|
|
110
|
-
for (var O98c = 0x0; O98c < 0x100; O98c++) {
|
|
111
|
-
dfc4[O98c] = O492[O98c % O999]['\x63\x68\x61\x72\x41\x74'](0x0)['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74']();
|
|
112
|
-
O26e[O98c] = O98c;
|
|
113
|
-
}
|
|
114
|
-
for (var O8cf = O98c = 0x0; O98c < 0x100; O98c++) {
|
|
115
|
-
O8cf = (O8cf + O26e[O98c] + dfc4[O98c]) % 0x100;
|
|
116
|
-
var O23f = O26e[O98c];
|
|
117
|
-
O26e[O98c] = O26e[O8cf];
|
|
118
|
-
O26e[O8cf] = O23f;
|
|
119
|
-
}
|
|
120
|
-
var ac35 = this._$[0];
|
|
121
|
-
for (var O577 = O8cf = O98c = 0x0; O98c < O453; O98c++) {
|
|
122
|
-
O577 = (O577 + 0x1) % 0x100;
|
|
123
|
-
O8cf = (O8cf + O26e[O577]) % 0x100;
|
|
124
|
-
var tmp = O26e[O577];
|
|
125
|
-
O26e[O577] = O26e[O8cf];
|
|
126
|
-
O26e[O8cf] = tmp;
|
|
127
|
-
var O3d6 = O26e[(O26e[O577] + O26e[O8cf]) % 0x100];
|
|
128
|
-
ac35 += String['\x66\x72\x6f\x6d\x43\x68\x61\x72\x43\x6f\x64\x65'](O6b8[O98c]['\x63\x68\x61\x72\x41\x74'](0x0)['\x63\x68\x61\x72\x43\x6f\x64\x65\x41\x74']() ^ O3d6);
|
|
129
|
-
}
|
|
130
|
-
return ac35;
|
|
131
|
-
}
|
|
132
|
-
};
|