@tuya-sat/micro-dev-loader 0.0.1-beta.2 → 0.0.3
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/.swcrc +11 -0
- package/dist/index.js +32 -19
- package/dist/manifestDom.js +7 -10
- package/dist/plugins/layoutMock/index.js +150 -38
- package/dist/plugins/layoutMock/layout-static/index.html +174 -180
- package/dist/transform.js +111 -111
- package/dist/utils/parseManifest.js +14 -10
- package/package.json +15 -5
- package/dist/index.d.ts +0 -4
- package/dist/manifestDom.d.ts +0 -2
- package/dist/plugins/layoutMock/index.d.ts +0 -4
- package/dist/plugins/layoutMock/layout-static/2.c7981cdc.chunk.css +0 -10
- package/dist/plugins/layoutMock/layout-static/main.efdba179.chunk.css +0 -2
- package/dist/transform.d.ts +0 -23
- package/dist/utils/parseManifest.d.ts +0 -22
package/.swcrc
ADDED
package/dist/index.js
CHANGED
|
@@ -1,23 +1,36 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "LayoutMockPlugin", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _layoutMock.default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
exports.default = void 0;
|
|
12
|
+
var _loaderUtils = require("loader-utils");
|
|
13
|
+
var _transform = _interopRequireDefault(require("./transform"));
|
|
14
|
+
var _parseManifest = _interopRequireDefault(require("./utils/parseManifest"));
|
|
15
|
+
var _manifestDom = _interopRequireDefault(require("./manifestDom"));
|
|
16
|
+
var _layoutMock = _interopRequireDefault(require("./plugins/layoutMock"));
|
|
17
|
+
function _interopRequireDefault(obj) {
|
|
18
|
+
return obj && obj.__esModule ? obj : {
|
|
19
|
+
default: obj
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
var addjsLoader = function addjsLoader(sourceCode) {
|
|
23
|
+
var ref = (0, _loaderUtils).getOptions(this), _authedCode = ref.authedCode, authedCode = _authedCode === void 0 ? [] : _authedCode, microFramework = ref.microFramework;
|
|
24
|
+
var privileges = (0, _parseManifest).default().privileges;
|
|
25
|
+
var codeMaker = new _transform.default({
|
|
26
|
+
sourceCode: sourceCode,
|
|
27
|
+
microFramework: microFramework
|
|
28
|
+
});
|
|
17
29
|
codeMaker.changeAst({
|
|
18
|
-
privileges,
|
|
19
|
-
authedCode
|
|
30
|
+
privileges: privileges,
|
|
31
|
+
authedCode: authedCode
|
|
20
32
|
});
|
|
21
|
-
return codeMaker.gtAst() +
|
|
33
|
+
return codeMaker.gtAst() + _manifestDom.default;
|
|
22
34
|
};
|
|
23
|
-
|
|
35
|
+
var _default = addjsLoader;
|
|
36
|
+
exports.default = _default;
|
package/dist/manifestDom.js
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const { insertDom } = require("@tuya-sat/micro-dev-component");
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})();
|
|
10
|
-
`;
|
|
11
|
-
exports.default = manifestDom;
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var manifestDom = "\n(function ExternalRender() {\n const div = document.createElement('div');\n const { insertDom } = require(\"@tuya-sat/micro-dev-component\");\n insertDom(div)\n document.body.appendChild(div);\n})();\n";
|
|
7
|
+
var _default = manifestDom;
|
|
8
|
+
exports.default = _default;
|
|
@@ -1,46 +1,158 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
const fs_extra_1 = __importDefault(require("fs-extra"));
|
|
7
|
-
const path_1 = __importDefault(require("path"));
|
|
8
|
-
const ejs_1 = __importDefault(require("ejs"));
|
|
9
|
-
const cheerio_1 = __importDefault(require("cheerio"));
|
|
10
|
-
const html_webpack_plugin_1 = __importDefault(require("html-webpack-plugin"));
|
|
11
|
-
const parseManifest_1 = __importDefault(require("../../utils/parseManifest"));
|
|
12
|
-
const manifest = (0, parseManifest_1.default)();
|
|
13
|
-
const lang = fs_extra_1.default.readJSONSync(path_1.default.resolve(process.cwd(), "_locales/zh-CN.json"));
|
|
14
|
-
const layoutMockTpl = fs_extra_1.default.readFileSync(path_1.default.resolve(__dirname, "./layout-static/index.html"), {
|
|
15
|
-
encoding: "utf-8",
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
16
4
|
});
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
5
|
+
exports.default = void 0;
|
|
6
|
+
var _fsExtra = _interopRequireDefault(require("fs-extra"));
|
|
7
|
+
var _path = _interopRequireDefault(require("path"));
|
|
8
|
+
var _ejs = _interopRequireDefault(require("ejs"));
|
|
9
|
+
var _cheerio = _interopRequireDefault(require("cheerio"));
|
|
10
|
+
var _htmlWebpackPlugin = _interopRequireDefault(require("html-webpack-plugin"));
|
|
11
|
+
var _parseManifest = _interopRequireDefault(require("../../utils/parseManifest"));
|
|
12
|
+
function _arrayWithHoles(arr) {
|
|
13
|
+
if (Array.isArray(arr)) return arr;
|
|
14
|
+
}
|
|
15
|
+
function _classCallCheck(instance, Constructor) {
|
|
16
|
+
if (!(instance instanceof Constructor)) {
|
|
17
|
+
throw new TypeError("Cannot call a class as a function");
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
function _defineProperties(target, props) {
|
|
21
|
+
for(var i = 0; i < props.length; i++){
|
|
22
|
+
var descriptor = props[i];
|
|
23
|
+
descriptor.enumerable = descriptor.enumerable || false;
|
|
24
|
+
descriptor.configurable = true;
|
|
25
|
+
if ("value" in descriptor) descriptor.writable = true;
|
|
26
|
+
Object.defineProperty(target, descriptor.key, descriptor);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function _createClass(Constructor, protoProps, staticProps) {
|
|
30
|
+
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
31
|
+
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
32
|
+
return Constructor;
|
|
33
|
+
}
|
|
34
|
+
function _defineProperty(obj, key, value) {
|
|
35
|
+
if (key in obj) {
|
|
36
|
+
Object.defineProperty(obj, key, {
|
|
37
|
+
value: value,
|
|
38
|
+
enumerable: true,
|
|
39
|
+
configurable: true,
|
|
40
|
+
writable: true
|
|
21
41
|
});
|
|
42
|
+
} else {
|
|
43
|
+
obj[key] = value;
|
|
22
44
|
}
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
45
|
+
return obj;
|
|
46
|
+
}
|
|
47
|
+
function _interopRequireDefault(obj) {
|
|
48
|
+
return obj && obj.__esModule ? obj : {
|
|
49
|
+
default: obj
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function _iterableToArrayLimit(arr, i) {
|
|
53
|
+
var _arr = [];
|
|
54
|
+
var _n = true;
|
|
55
|
+
var _d = false;
|
|
56
|
+
var _e = undefined;
|
|
57
|
+
try {
|
|
58
|
+
for(var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true){
|
|
59
|
+
_arr.push(_s.value);
|
|
60
|
+
if (i && _arr.length === i) break;
|
|
61
|
+
}
|
|
62
|
+
} catch (err) {
|
|
63
|
+
_d = true;
|
|
64
|
+
_e = err;
|
|
65
|
+
} finally{
|
|
66
|
+
try {
|
|
67
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
68
|
+
} finally{
|
|
69
|
+
if (_d) throw _e;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return _arr;
|
|
73
|
+
}
|
|
74
|
+
function _nonIterableRest() {
|
|
75
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
|
76
|
+
}
|
|
77
|
+
function _objectSpread(target) {
|
|
78
|
+
for(var i = 1; i < arguments.length; i++){
|
|
79
|
+
var source = arguments[i] != null ? arguments[i] : {
|
|
80
|
+
};
|
|
81
|
+
var ownKeys = Object.keys(source);
|
|
82
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
83
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
84
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
85
|
+
}));
|
|
86
|
+
}
|
|
87
|
+
ownKeys.forEach(function(key) {
|
|
88
|
+
_defineProperty(target, key, source[key]);
|
|
43
89
|
});
|
|
44
90
|
}
|
|
91
|
+
return target;
|
|
92
|
+
}
|
|
93
|
+
function _slicedToArray(arr, i) {
|
|
94
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
|
45
95
|
}
|
|
96
|
+
var manifest = (0, _parseManifest).default();
|
|
97
|
+
var lang = _fsExtra.default.readJSONSync(_path.default.resolve(process.cwd(), "_locales/zh-CN.json"));
|
|
98
|
+
var layoutMockTpl = _fsExtra.default.readFileSync(_path.default.resolve(__dirname, "./layout-static/index.html"), {
|
|
99
|
+
encoding: "utf-8"
|
|
100
|
+
});
|
|
101
|
+
var LayoutMockPlugin = /*#__PURE__*/ function() {
|
|
102
|
+
"use strict";
|
|
103
|
+
function LayoutMockPlugin() {
|
|
104
|
+
_classCallCheck(this, LayoutMockPlugin);
|
|
105
|
+
}
|
|
106
|
+
_createClass(LayoutMockPlugin, [
|
|
107
|
+
{
|
|
108
|
+
key: "apply",
|
|
109
|
+
value: function apply(compiler) {
|
|
110
|
+
compiler.hooks.compilation.tap("MyPlugin", function(compilation) {
|
|
111
|
+
_htmlWebpackPlugin.default.getHooks(compilation).beforeEmit.tapAsync("LayoutMockPlugin", function(data, cb) {
|
|
112
|
+
var $ = _cheerio.default.load(data.html);
|
|
113
|
+
var name1 = manifest.name, defaultMenuIcon = manifest.defaultMenuIcon, entries = manifest.entries;
|
|
114
|
+
var nameProcesser = function(name) {
|
|
115
|
+
var ref = _slicedToArray(name.split("."), 2), _ = ref[0], key = ref[1];
|
|
116
|
+
return lang[key] || name;
|
|
117
|
+
};
|
|
118
|
+
data.html = _ejs.default.render(layoutMockTpl, {
|
|
119
|
+
appName: nameProcesser(name1),
|
|
120
|
+
appIcon: defaultMenuIcon.url,
|
|
121
|
+
menus: function() {
|
|
122
|
+
var processer = function(item) {
|
|
123
|
+
return _objectSpread({
|
|
124
|
+
}, item, {
|
|
125
|
+
langName: nameProcesser(item.name)
|
|
126
|
+
});
|
|
127
|
+
};
|
|
128
|
+
var entries$ = entries.length ? entries : [
|
|
129
|
+
{
|
|
130
|
+
name: name1,
|
|
131
|
+
path: "/"
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
return entries$.map(processer);
|
|
135
|
+
}(),
|
|
136
|
+
appHtml: [
|
|
137
|
+
$("head").html(),
|
|
138
|
+
$("body").html()
|
|
139
|
+
].join("")
|
|
140
|
+
});
|
|
141
|
+
cb(null, data);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
], [
|
|
147
|
+
{
|
|
148
|
+
key: "useLayoutStatic",
|
|
149
|
+
value: function useLayoutStatic(app) {
|
|
150
|
+
app.get("/layout-static/*", function(req, res) {
|
|
151
|
+
res.sendFile(_path.default.join(__dirname, req.path));
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
]);
|
|
156
|
+
return LayoutMockPlugin;
|
|
157
|
+
}();
|
|
46
158
|
exports.default = LayoutMockPlugin;
|
|
@@ -1,187 +1,181 @@
|
|
|
1
1
|
<!DOCTYPE html>
|
|
2
|
-
<html lang="en" style="margin: 0; padding: 0
|
|
3
|
-
<head>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
2
|
+
<html lang="en" style="margin: 0; padding: 0">
|
|
3
|
+
<head>
|
|
4
|
+
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
|
5
|
+
<meta charset="utf-8" />
|
|
6
|
+
<link rel="icon" href="favicon.ico" />
|
|
7
|
+
<meta name="viewport" content="width=device-width,initial-scale=1" />
|
|
8
|
+
<meta name="theme-color" content="#000000" />
|
|
9
|
+
<meta name="description" content="Tuya General Management Portal" />
|
|
10
|
+
<title><%= appName %></title>
|
|
11
|
+
<style>
|
|
12
|
+
.c-debugger-container {
|
|
13
|
+
width: 100vw;
|
|
14
|
+
height: 100vh;
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
}
|
|
18
|
+
.c-debugger-header {
|
|
19
|
+
flex: 0 0 auto;
|
|
20
|
+
display: flex;
|
|
21
|
+
align-items: center;
|
|
22
|
+
justify-content: space-between;
|
|
23
|
+
height: 55px;
|
|
24
|
+
padding: 0 16px;
|
|
25
|
+
border-bottom: 1px solid #eee;
|
|
26
|
+
color: rgba(0, 0, 0, 0.85);
|
|
27
|
+
}
|
|
28
|
+
.c-debugger-logo {
|
|
29
|
+
position: relative;
|
|
30
|
+
overflow: hidden;
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
}
|
|
34
|
+
.c-debugger-title {
|
|
35
|
+
color: #000;
|
|
36
|
+
font-size: 14px;
|
|
37
|
+
font-weight: 700;
|
|
38
|
+
height: 32px;
|
|
39
|
+
line-height: 32px;
|
|
40
|
+
margin: 0 0 0 12px;
|
|
41
|
+
}
|
|
42
|
+
.c-debugger-main {
|
|
43
|
+
display: flex;
|
|
44
|
+
flex: 1 1 auto;
|
|
45
|
+
}
|
|
46
|
+
.c-debugger-side {
|
|
47
|
+
flex: 0 0 auto;
|
|
48
|
+
width: 208px;
|
|
49
|
+
height: 100%;
|
|
50
|
+
border-right: 1px solid #f0f2f5;
|
|
51
|
+
}
|
|
52
|
+
.c-debugger-content {
|
|
53
|
+
flex: 1 1 auto;
|
|
54
|
+
height: 100%;
|
|
55
|
+
background-color: #f0f2f5;
|
|
56
|
+
}
|
|
57
|
+
#root {
|
|
58
|
+
width: 100%;
|
|
59
|
+
height: 100%;
|
|
60
|
+
}
|
|
61
|
+
.c-debugger-lang-trigger {
|
|
62
|
+
position: relative;
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
white-space: nowrap;
|
|
66
|
+
cursor: pointer;
|
|
67
|
+
font-size: 14px;
|
|
68
|
+
font-weight: normal;
|
|
69
|
+
height: 100%;
|
|
70
|
+
}
|
|
71
|
+
.c-debugger-lang-trigger:hover .c-debugger-lang-list {
|
|
72
|
+
display: block;
|
|
73
|
+
line-height: 1.5;
|
|
74
|
+
}
|
|
75
|
+
.c-debugger-lang-trigger .c-debugger-lang-list {
|
|
76
|
+
position: absolute;
|
|
77
|
+
top: 42px;
|
|
78
|
+
right: -5px;
|
|
79
|
+
display: none;
|
|
80
|
+
background: #ffffff;
|
|
81
|
+
border-radius: 2px;
|
|
82
|
+
outline: none;
|
|
83
|
+
box-shadow: 0 3px 6px -4px rgb(0 0 0 / 12%),
|
|
84
|
+
0 6px 16px 0 rgb(0 0 0 / 8%), 0 9px 28px 8px rgb(0 0 0 / 5%);
|
|
85
|
+
z-index: 100;
|
|
86
|
+
}
|
|
87
|
+
.c-debugger-lang-trigger .c-debugger-lang-list span {
|
|
88
|
+
display: block;
|
|
89
|
+
padding: 5px 12px;
|
|
90
|
+
}
|
|
91
|
+
.c-debugger-lang-trigger .c-debugger-lang-list span:hover {
|
|
92
|
+
background-color: #f5f5f5;
|
|
93
|
+
}
|
|
94
|
+
.c-debugger-menu {
|
|
95
|
+
display: flex;
|
|
96
|
+
justify-content: flex-start;
|
|
97
|
+
align-items: center;
|
|
98
|
+
height: 40px;
|
|
99
|
+
padding: 0 0 0 17px;
|
|
100
|
+
margin: 4px 0 8px;
|
|
101
|
+
cursor: pointer;
|
|
102
|
+
font-size: 14px;
|
|
103
|
+
color: rgba(0, 0, 0, 0.85);
|
|
104
|
+
}
|
|
105
|
+
.c-debugger-menu-name {
|
|
106
|
+
margin-left: 10px;
|
|
107
|
+
}
|
|
108
|
+
.c-debugger-menu:hover {
|
|
109
|
+
color: #1890ff;
|
|
110
|
+
}
|
|
111
|
+
</style>
|
|
112
|
+
</head>
|
|
113
|
+
<body style="margin: 0; padding: 0">
|
|
114
|
+
<div class="c-debugger-container">
|
|
115
|
+
<div class="c-debugger-header">
|
|
116
|
+
<div class="c-debugger-logo">
|
|
117
|
+
<img
|
|
118
|
+
src="https://promotion-static.tuyacn.com/static/242969466160533504.png"
|
|
119
|
+
alt=""
|
|
120
|
+
style="height: 28px"
|
|
121
|
+
/>
|
|
122
|
+
<div class="c-debugger-title"><%= appName %></div>
|
|
123
|
+
</div>
|
|
15
124
|
|
|
16
|
-
<div
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<aside
|
|
22
|
-
id="J_sider"
|
|
23
|
-
class="ant-layout-sider ant-layout-sider-light ant-pro-sider ant-pro-sider-fixed ant-pro-sider-layout-mix ant-pro-sider-light"
|
|
24
|
-
style="overflow: hidden; padding-top: 48px; flex: 0 0 208px; max-width: 208px; min-width: 208px; width: 208px;"
|
|
25
|
-
>
|
|
26
|
-
<div class="ant-layout-sider-children">
|
|
27
|
-
<div style="flex: 1 1 0%; overflow: hidden auto;">
|
|
28
|
-
<% if (menus.length>0) { %>
|
|
29
|
-
<ul class="ant-menu ant-menu-light ant-pro-sider-menu ant-menu-root ant-menu-inline" role="menu" style="width: 100%;">
|
|
30
|
-
<li class="ant-menu-submenu ant-menu-submenu-inline ant-menu-submenu-open" role="menuitem">
|
|
31
|
-
<div class="ant-menu-submenu-title" role="button" aria-expanded="true" aria-haspopup="true" aria-owns="/apps/1440611125199634515$Menu" style="padding-left: 16px;">
|
|
32
|
-
<span class="ant-pro-menu-item" title="工单管理">
|
|
33
|
-
<span class="ant-menu-item-icon">
|
|
34
|
-
<img src="<%= appIcon %>" alt="" style="width: 16px; height: 16px; margin-top: -2px; margin-right: 10px;">
|
|
35
|
-
</span>
|
|
36
|
-
<span class="ant-pro-menu-item-title"><%= appName %></span>
|
|
37
|
-
</span>
|
|
38
|
-
<i class="ant-menu-submenu-arrow"></i>
|
|
39
|
-
</div>
|
|
40
|
-
<ul id="/apps/1440611125199634515$Menu" class="ant-menu ant-menu-sub ant-menu-inline" role="menu" style="">
|
|
41
|
-
<% menus.forEach(function(menu){%>
|
|
42
|
-
<li class="ant-menu-item ant-menu-item-only-child" role="menuitem" style="padding-left: 32px;">
|
|
43
|
-
<a onclick="toPage('<%=menu.path %>')" style="height: 40px;">
|
|
44
|
-
<span class="ant-pro-menu-item">
|
|
45
|
-
<span class="ant-pro-menu-item-title"><%=menu.langName %></span>
|
|
46
|
-
</span>
|
|
47
|
-
</a>
|
|
48
|
-
</li>
|
|
49
|
-
<% }) %>
|
|
50
|
-
</ul>
|
|
51
|
-
</li>
|
|
52
|
-
</ul>
|
|
53
|
-
<%} else { %>
|
|
54
|
-
<ul style="width: 100%;" class="ant-menu ant-menu-light ant-pro-sider-menu ant-menu-root ant-menu-inline" role="menu">
|
|
55
|
-
<li class="ant-menu-item ant-menu-item-only-child" role="menuitem" style="padding-left: 16px;">
|
|
56
|
-
<a style="height: 40px;" href="/">
|
|
57
|
-
<span class="ant-pro-menu-item">
|
|
58
|
-
<span class="ant-menu-item-icon">
|
|
59
|
-
<img src="<%= appIcon %>" alt='' style="width: 16px; height: 16px; margin-top: -2px; margin-right: 10px;">
|
|
60
|
-
</span>
|
|
61
|
-
<span class="ant-pro-menu-item-title"><%= appName %></span>
|
|
62
|
-
</span>
|
|
63
|
-
</a>
|
|
64
|
-
</li>
|
|
65
|
-
</ul>
|
|
66
|
-
<% } %>
|
|
67
|
-
</div>
|
|
68
|
-
<div class="ant-pro-sider-links">
|
|
69
|
-
<ul class="ant-menu ant-menu-light ant-pro-sider-link-menu ant-menu-root ant-menu-inline" role="menu">
|
|
70
|
-
<li
|
|
71
|
-
id="J_sider-trigger"
|
|
72
|
-
class="ant-menu-item ant-menu-item-only-child ant-pro-sider-collapsed-button"
|
|
73
|
-
role="menuitem"
|
|
74
|
-
style="padding-left: 16px;"
|
|
75
|
-
>
|
|
76
|
-
<span role="img" aria-label="menu-fold" class="anticon anticon-menu-fold">
|
|
77
|
-
<svg viewBox="64 64 896 896" focusable="false" data-icon="menu-fold" width="1em" height="1em" fill="currentColor" aria-hidden="true">
|
|
78
|
-
<path
|
|
79
|
-
d="M408 442h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8zm-8 204c0 4.4 3.6 8 8 8h480c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8H408c-4.4 0-8 3.6-8 8v56zm504-486H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zm0 632H120c-4.4 0-8 3.6-8 8v56c0 4.4 3.6 8 8 8h784c4.4 0 8-3.6 8-8v-56c0-4.4-3.6-8-8-8zM115.4 518.9L271.7 642c5.8 4.6 14.4.5 14.4-6.9V388.9c0-7.4-8.5-11.5-14.4-6.9L115.4 505.1a8.74 8.74 0 000 13.8z"></path>
|
|
80
|
-
</svg>
|
|
81
|
-
</span>
|
|
82
|
-
</li>
|
|
83
|
-
</ul>
|
|
84
|
-
</div>
|
|
125
|
+
<div class="c-debugger-lang-trigger">
|
|
126
|
+
<span id="c-debugger-lang-name"></span>
|
|
127
|
+
<div class="c-debugger-lang-list">
|
|
128
|
+
<span onclick="changeLng('en-US')">English</span>
|
|
129
|
+
<span onclick="changeLng('zh-CN')">简体中文</span>
|
|
85
130
|
</div>
|
|
86
|
-
</aside>
|
|
87
|
-
|
|
88
|
-
<div style="position: relative;" class="ant-layout">
|
|
89
|
-
<header class="ant-layout-header" style="height: 48px;"></header>
|
|
90
|
-
<header class="ant-layout-header ant-pro-fixed-header ant-pro-fixed-header-action" style="padding: 0px; height: 48px; line-height: 48px; width: 100%; z-index: 100; right: 0px;">
|
|
91
|
-
<div class="ant-pro-global-header">
|
|
92
|
-
<div class="ant-pro-global-header-logo" style="flex: 1;">
|
|
93
|
-
<a>
|
|
94
|
-
<img src="https://images.tuyacn.com/rms-static/3bb090e0-d7e2-11eb-815d-e39234ce96ff-1624865222894.png" alt='' style="height: 28px;">
|
|
95
|
-
<h1>IoT SaaS App Demo</h1>
|
|
96
|
-
</a>
|
|
97
|
-
</div>
|
|
98
|
-
<style>
|
|
99
|
-
.lang-trigger {
|
|
100
|
-
position: relative;
|
|
101
|
-
white-space: nowrap;
|
|
102
|
-
cursor: pointer;
|
|
103
|
-
}
|
|
104
|
-
.lang-trigger:hover .lang-list {
|
|
105
|
-
display: block;
|
|
106
|
-
line-height: 1.5;
|
|
107
|
-
}
|
|
108
|
-
.lang-trigger .lang-list {
|
|
109
|
-
position: absolute;
|
|
110
|
-
top: 40px;
|
|
111
|
-
right: 0;
|
|
112
|
-
display: none;
|
|
113
|
-
background: #ffffff;
|
|
114
|
-
border-radius: 2px;
|
|
115
|
-
outline: none;
|
|
116
|
-
box-shadow: 0 3px 6px -4px rgb(0 0 0 / 12%), 0 6px 16px 0 rgb(0 0 0 / 8%), 0 9px 28px 8px rgb(0 0 0 / 5%);
|
|
117
|
-
}
|
|
118
|
-
.lang-trigger .lang-list span {
|
|
119
|
-
display: block;
|
|
120
|
-
padding: 5px 12px;
|
|
121
|
-
}
|
|
122
|
-
.lang-trigger .lang-list span:hover {
|
|
123
|
-
background-color: #f5f5f5;
|
|
124
|
-
}
|
|
125
|
-
</style>
|
|
126
|
-
<span class="lang-trigger">
|
|
127
|
-
<span id="J_lng-name"></span>
|
|
128
|
-
<div class="lang-list">
|
|
129
|
-
<span onclick="changeLng('en-US')">English</span>
|
|
130
|
-
<span onclick="changeLng('zh-CN')">简体中文</span>
|
|
131
|
-
</div>
|
|
132
|
-
</span>
|
|
133
|
-
<script>
|
|
134
|
-
;(() => {
|
|
135
|
-
const lngMap = {
|
|
136
|
-
'en-US': 'English',
|
|
137
|
-
'zh-CN': '简体中文',
|
|
138
|
-
};
|
|
139
|
-
const lng = localStorage.getItem('i18nextLng') || 'zh-CN';
|
|
140
|
-
document.querySelector('#J_lng-name').innerHTML = lngMap[lng];
|
|
141
|
-
})();
|
|
142
|
-
|
|
143
|
-
function changeLng(lng, name) {
|
|
144
|
-
localStorage.setItem('i18nextLng', lng);
|
|
145
|
-
location.reload();
|
|
146
|
-
}
|
|
147
|
-
function toPage(path){
|
|
148
|
-
mhistory && mhistory.push(path);
|
|
149
|
-
}
|
|
150
|
-
</script>
|
|
151
|
-
</div>
|
|
152
|
-
</header>
|
|
153
|
-
<main
|
|
154
|
-
class="ant-layout-content ant-pro-basicLayout-content ant-pro-basicLayout-has-header"
|
|
155
|
-
style="margin: 0;"
|
|
156
|
-
>
|
|
157
|
-
<div id="container" style="height: calc(-56px + 100vh);"><div id="__qiankun_microapp_wrapper_for_demo" style="height: 100%">
|
|
158
|
-
|
|
159
|
-
<%- appHtml %>
|
|
160
|
-
|
|
161
|
-
</div></div>
|
|
162
|
-
</main>
|
|
163
131
|
</div>
|
|
164
|
-
</
|
|
132
|
+
</div>
|
|
133
|
+
<div class="c-debugger-main">
|
|
134
|
+
<div class="c-debugger-side">
|
|
135
|
+
<% menus.forEach(function(menu){ %>
|
|
136
|
+
<div class="c-debugger-menu" onclick="toPage('<%= menu.path %>')">
|
|
137
|
+
<svg
|
|
138
|
+
viewBox="0 0 1024 1024"
|
|
139
|
+
version="1.1"
|
|
140
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
141
|
+
p-id="2323"
|
|
142
|
+
width="14"
|
|
143
|
+
height="14"
|
|
144
|
+
>
|
|
145
|
+
<path
|
|
146
|
+
d="M192.037 287.953h640.124c17.673 0 32-14.327 32-32s-14.327-32-32-32H192.037c-17.673 0-32 14.327-32 32s14.327 32 32 32zM192.028 543.17h638.608c17.673 0 32-14.327 32-32s-14.327-32-32-32H192.028c-17.673 0-32 14.327-32 32s14.327 32 32 32zM832.161 735.802H192.037c-17.673 0-32 14.327-32 32s14.327 32 32 32h640.124c17.673 0 32-14.327 32-32s-14.327-32-32-32z"
|
|
147
|
+
fill=""
|
|
148
|
+
p-id="2324"
|
|
149
|
+
></path>
|
|
150
|
+
</svg>
|
|
151
|
+
<div class="c-debugger-menu-name"><%= menu.langName %></div>
|
|
152
|
+
</div>
|
|
153
|
+
<% }); %>
|
|
154
|
+
</div>
|
|
155
|
+
<div class="c-debugger-content"><%- appHtml %></div>
|
|
156
|
+
</div>
|
|
165
157
|
</div>
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
158
|
+
<script>
|
|
159
|
+
(() => {
|
|
160
|
+
const lngMap = {
|
|
161
|
+
"en-US": "English",
|
|
162
|
+
"zh-CN": "简体中文",
|
|
163
|
+
};
|
|
164
|
+
const localLng = localStorage.getItem("i18nextLng");
|
|
165
|
+
const lng = lngMap[localLng] ? localLng : "zh-CN";
|
|
166
|
+
console.log(lng);
|
|
167
|
+
document.querySelector("#c-debugger-lang-name").textContent =
|
|
168
|
+
lngMap[lng];
|
|
169
|
+
})();
|
|
170
|
+
|
|
171
|
+
function toPage(path) {
|
|
172
|
+
window.location.href = new URL(path, window.location.origin);
|
|
173
|
+
}
|
|
175
174
|
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
unfold = !unfold;
|
|
183
|
-
});
|
|
184
|
-
}());
|
|
185
|
-
</script>
|
|
186
|
-
</body>
|
|
175
|
+
function changeLng(lng, name) {
|
|
176
|
+
localStorage.setItem("i18nextLng", lng);
|
|
177
|
+
location.reload();
|
|
178
|
+
}
|
|
179
|
+
</script>
|
|
180
|
+
</body>
|
|
187
181
|
</html>
|