oipage 1.5.0-alpha.1 → 1.5.0-alpha.2
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/CHANGELOG +4 -1
- package/README.md +14 -0
- package/bin/serve.js +3 -3
- package/bin/tools/resolve404.js +2 -2
- package/bin/website-htmls/components/ui-select-file/index.html +8 -0
- package/bin/website-htmls/components/ui-select-file/index.js +38 -0
- package/bin/website-htmls/components/ui-select-file/index.scss +45 -0
- package/bin/website-htmls/images/addFile.svg +1 -0
- package/bin/website-htmls/images/img-to-pdf.svg +1 -0
- package/bin/website-htmls/main.js +2 -0
- package/bin/website-htmls/pages/appStore/index.html +6 -0
- package/bin/website-htmls/pages/img-to-pdf/index.html +4 -0
- package/bin/website-htmls/pages/img-to-pdf/index.js +45 -0
- package/bin/website-htmls/pages/img-to-pdf/index.scss +5 -0
- package/bin/website-htmls/router.config.js +3 -0
- package/bin/website-plugins/intercept/oipage-vislite-intercept.js +1 -1
- package/bin/website-plugins/intercept/oipage-zipaper-intercept.js +1 -1
- package/nodejs/animation/index.js +1 -1
- package/nodejs/cmdlog/index.js +1 -1
- package/nodejs/disk/index.js +1 -1
- package/nodejs/format/index.js +3 -3
- package/nodejs/json/index.js +1 -1
- package/nodejs/logform/index.js +1 -1
- package/nodejs/reader/index.js +1 -1
- package/nodejs/throttle/index.js +1 -1
- package/package.json +1 -1
- package/snipping/chart.png +0 -0
- package/snipping/image-editor.png +0 -0
- package/web/XMLHttpRequest/index.js +1 -1
- package/web/animation/index.js +1 -1
- package/web/format/index.js +3 -3
- package/web/json/index.js +1 -1
- package/web/onReady/index.js +1 -1
- package/web/performChunk/index.js +1 -1
- package/web/reader/index.js +1 -1
- package/web/style/index.js +1 -1
- package/web/throttle/index.js +1 -1
package/CHANGELOG
CHANGED
package/README.md
CHANGED
|
@@ -74,6 +74,20 @@ oipage-cli serve -p 8080
|
|
|
74
74
|
|
|
75
75
|
如果你需要在项目中使用,我们也提供了一些有用的API,具体可以访问[ 在线文档 ](https://oi-contrib.github.io/OIPage)进行了解。
|
|
76
76
|
|
|
77
|
+
## 应用市场
|
|
78
|
+
|
|
79
|
+
为了方便日常使用,内置了一个应用市场网站,比如有如下功能:
|
|
80
|
+
|
|
81
|
+
### 群聊贴
|
|
82
|
+
|
|
83
|
+
<img src="./snipping/chart.png" />
|
|
84
|
+
|
|
85
|
+
### 图片编辑器
|
|
86
|
+
|
|
87
|
+
<img src="./snipping/image-editor.png" />
|
|
88
|
+
|
|
89
|
+
已有功能或更多功能我们将根据实际情况逐步完善和维护,当然,你可以通过 [issue](https://github.com/oi-contrib/VISLite/issues) 给我们留言,告诉我们你的改进意见。
|
|
90
|
+
|
|
77
91
|
## 版权
|
|
78
92
|
|
|
79
93
|
MIT License
|
package/bin/serve.js
CHANGED
|
@@ -18,13 +18,13 @@ module.exports = function (config) {
|
|
|
18
18
|
let startTime = new Date().valueOf();
|
|
19
19
|
|
|
20
20
|
const cache = "cache" in config.devServer ? config.devServer.cache : true;
|
|
21
|
-
const port = config.devServer.port; // 端口号
|
|
21
|
+
const port = +config.devServer.port; // 端口号
|
|
22
22
|
const basePath = (/^\./.test(config.devServer.baseUrl)) ? join(process.cwd(), config.devServer.baseUrl) : config.devServer.baseUrl; // 服务器根路径
|
|
23
23
|
|
|
24
|
-
const name = (config.name || "OIPage") + "-
|
|
24
|
+
const name = (config.name || "OIPage") + "-http-server";
|
|
25
25
|
const version = config.version || packageValue.version;
|
|
26
26
|
|
|
27
|
-
const wsHandler = WebSocketClass(port + 1, (config.name || "OIPage") + "-
|
|
27
|
+
const wsHandler = WebSocketClass(port + 1, (config.name || "OIPage") + "-ws-server", version);
|
|
28
28
|
|
|
29
29
|
let Server = createServer(function (request, response) {
|
|
30
30
|
let headers = request.headers;
|
package/bin/tools/resolve404.js
CHANGED
|
@@ -18,9 +18,9 @@ module.exports = function (filePath, url) {
|
|
|
18
18
|
|
|
19
19
|
try {
|
|
20
20
|
subItems = readdirSync(filePath);
|
|
21
|
-
console.log("<i> \x1b[1m\x1b[32m[OIPage-
|
|
21
|
+
console.log("<i> \x1b[1m\x1b[32m[OIPage-http-server] Read Folder: " + url + '\x1b[0m ' + new Date().toLocaleString());
|
|
22
22
|
} catch (e) {
|
|
23
|
-
console.log("<i> \x1b[1m\x1b[32m[OIPage-
|
|
23
|
+
console.log("<i> \x1b[1m\x1b[32m[OIPage-http-server] Read " + (/\/$/.test(url) ? "Folder" : "File") + ": \x1b[35m" + url + ' 404 Not Found\x1b[0m ' + new Date().toLocaleString());
|
|
24
24
|
try {
|
|
25
25
|
if (!/\/$/.test(url) || url === "/") {
|
|
26
26
|
filePath = join(filePath, "../");
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<div class="ui-select-file-view">
|
|
2
|
+
<h2 class="title" z-bind="_props.title"></h2>
|
|
3
|
+
<div class="tips" z-bind="_props.tips"></div>
|
|
4
|
+
<div class="file">
|
|
5
|
+
<input type="file" multiple id="input" z-on:change.stop="doChange" z-bind:accept="accept" />
|
|
6
|
+
<label for="input" z-bind="'选择'+_props.type+'文件'"></label>
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineElement } from "zipaper";
|
|
2
|
+
import template from "./index.html";
|
|
3
|
+
import style from "./index.scss";
|
|
4
|
+
|
|
5
|
+
export default defineElement({
|
|
6
|
+
template,
|
|
7
|
+
emits: ["change"],
|
|
8
|
+
props: {
|
|
9
|
+
title: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: true,
|
|
12
|
+
},
|
|
13
|
+
tips: {
|
|
14
|
+
type: String,
|
|
15
|
+
required: true,
|
|
16
|
+
},
|
|
17
|
+
type: {
|
|
18
|
+
type: String,
|
|
19
|
+
required: true,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
data() {
|
|
23
|
+
return {
|
|
24
|
+
accept: {
|
|
25
|
+
pdf: "application/pdf",
|
|
26
|
+
image: "image/*"
|
|
27
|
+
}[this._props.type]
|
|
28
|
+
};
|
|
29
|
+
},
|
|
30
|
+
methods: {
|
|
31
|
+
doChange(event, target) {
|
|
32
|
+
this.$emit("change", target.files);
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
style: {
|
|
36
|
+
content: style
|
|
37
|
+
}
|
|
38
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.ui-select-file-view{
|
|
2
|
+
&>.title {
|
|
3
|
+
text-align: center;
|
|
4
|
+
font-weight: 700;
|
|
5
|
+
color: rgb(26, 26, 26);
|
|
6
|
+
font-size: 36px;
|
|
7
|
+
line-height: 48px;
|
|
8
|
+
padding-top: 30px;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&>.tips {
|
|
12
|
+
text-align: center;
|
|
13
|
+
line-height: 30px;
|
|
14
|
+
font-size: 22px;
|
|
15
|
+
color: rgb(26, 26, 26);
|
|
16
|
+
font-weight: 300;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&>.file {
|
|
20
|
+
text-align: center;
|
|
21
|
+
margin-top: 30px;
|
|
22
|
+
|
|
23
|
+
input {
|
|
24
|
+
display: none;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
label {
|
|
28
|
+
line-height: 50px;
|
|
29
|
+
display: inline-block;
|
|
30
|
+
border: 1px solid gray;
|
|
31
|
+
background-image: url("./images/addFile.svg");
|
|
32
|
+
background-repeat: no-repeat;
|
|
33
|
+
background-position: 5px center;
|
|
34
|
+
background-size: auto 70%;
|
|
35
|
+
padding-left: 40px;
|
|
36
|
+
padding-right: 10px;
|
|
37
|
+
border-radius: 5px;
|
|
38
|
+
|
|
39
|
+
&:hover {
|
|
40
|
+
text-decoration: underline;
|
|
41
|
+
cursor: pointer;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M13 12v-2h1v2h2v1h-2v2h-1v-2h-2v-1h2zm5 8H6V4H5v17h13v-1zm1 0v2H4V3h2V1h10l5 5v14h-2zM7 2v17h13V6l-4-4H7zm9 0l4 4h-4V2z"></path></svg>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path d="M0 4C0 1.79086 1.79086 0 4 0H20C22.2091 0 24 1.79086 24 4V20C24 22.2091 22.2091 24 20 24H4C1.79086 24 0 22.2091 0 20V4Z" fill="#FFB700"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M6.99992 8L13.9999 14.5625L16.9544 11.7927L24 17.5625V20L17.0455 14.3589L13.9999 17.2141L6.99992 10.6517L0 17.1875V14.5625L6.99992 8Z" fill="white"></path><circle cx="18" cy="6" r="3" fill="white"></circle></svg>
|
|
@@ -3,10 +3,12 @@ import { createApp } from "zipaper"
|
|
|
3
3
|
import App from "./pages/App/index.js"
|
|
4
4
|
import router from "./router.config.js"
|
|
5
5
|
import dialogs from "./dialogs/index.js"
|
|
6
|
+
import uiSelectFile from "./components/ui-select-file/index.js"
|
|
6
7
|
|
|
7
8
|
// https://oi-contrib.github.io/Zipaper/index.html
|
|
8
9
|
|
|
9
10
|
createApp(App)
|
|
10
11
|
.use(router) // 路由
|
|
11
12
|
.use(dialogs) // 弹框
|
|
13
|
+
.component("ui-select-file", uiSelectFile)
|
|
12
14
|
.mount(document.getElementById("root")) // 挂载到页面
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { defineElement, ref } from "zipaper"
|
|
2
|
+
import template from "./index.html"
|
|
3
|
+
import style from "./index.scss"
|
|
4
|
+
|
|
5
|
+
export default defineElement({
|
|
6
|
+
template,
|
|
7
|
+
methods: {
|
|
8
|
+
doChange(event) {
|
|
9
|
+
let files = event.data, promises = [], iframeEl = document.getElementById("iframe");
|
|
10
|
+
|
|
11
|
+
let template = "";
|
|
12
|
+
for (let index = 0; index < files.length; index++) {
|
|
13
|
+
let file = files[index];
|
|
14
|
+
|
|
15
|
+
promises.push(new Promise(function (resolve) {
|
|
16
|
+
|
|
17
|
+
let reader = new FileReader();
|
|
18
|
+
|
|
19
|
+
reader.onload = function () {
|
|
20
|
+
|
|
21
|
+
template += '<div style="display: flex;justify-content: center;align-items: center;height: 100vh;width: 100vw;"><img src="' + reader.result + '" style="max-width: 100vw;max-height: 100vh;"></img></div>';
|
|
22
|
+
resolve("");
|
|
23
|
+
}
|
|
24
|
+
reader.readAsDataURL(file);
|
|
25
|
+
}));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
Promise.all(promises).then(function () {
|
|
29
|
+
let iframeWindow = iframeEl.contentWindow;
|
|
30
|
+
let iframeDocument = iframeEl.contentWindow?.document;
|
|
31
|
+
|
|
32
|
+
iframeDocument.open();
|
|
33
|
+
iframeDocument.write(`<style>body{margin:0px;}</style>` + template);
|
|
34
|
+
iframeDocument.close();
|
|
35
|
+
|
|
36
|
+
setTimeout(function () {
|
|
37
|
+
iframeWindow.print();
|
|
38
|
+
}, 500);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
style: {
|
|
43
|
+
content: style
|
|
44
|
+
}
|
|
45
|
+
})
|
|
@@ -14,7 +14,7 @@ module.exports = {
|
|
|
14
14
|
if (request.headers["if-none-match"] === head["ETag"]) {
|
|
15
15
|
response.writeHead('304', head);
|
|
16
16
|
response.end();
|
|
17
|
-
console.log("<i> \x1b[1m\x1b[32m[OIPage-
|
|
17
|
+
console.log("<i> \x1b[1m\x1b[32m[OIPage-http-server] Cache File: VISLite\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304\x1b[0m");;
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
|
|
@@ -14,7 +14,7 @@ module.exports = {
|
|
|
14
14
|
if (request.headers["if-none-match"] === head["ETag"]) {
|
|
15
15
|
response.writeHead('304', head);
|
|
16
16
|
response.end();
|
|
17
|
-
console.log("<i> \x1b[1m\x1b[32m[OIPage-
|
|
17
|
+
console.log("<i> \x1b[1m\x1b[32m[OIPage-http-server] Cache File: Zipaper\x1b[0m " + new Date().toLocaleString() + "\x1b[33m\x1b[1m 304\x1b[0m");;
|
|
18
18
|
return;
|
|
19
19
|
}
|
|
20
20
|
|
package/nodejs/cmdlog/index.js
CHANGED
package/nodejs/disk/index.js
CHANGED
package/nodejs/format/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* format of OIPage v1.5.0-alpha.
|
|
2
|
+
* format of OIPage v1.5.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/OIPage.git
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -26,12 +26,12 @@ function numberFormat(input) {
|
|
|
26
26
|
integerArray.unshift(integerValue.substring(index > 2 ? index - 3 : 0, index));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return integerArray.join(",") + decimalValue;
|
|
29
|
+
return integerArray.join(",").replace(/^\-,/, "-") + decimalValue;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
function dateFormat(input, option) {
|
|
34
|
-
option = option ||
|
|
34
|
+
option = option || {};
|
|
35
35
|
var dateObj;
|
|
36
36
|
|
|
37
37
|
// 如果无值,就用当前日期
|
package/nodejs/json/index.js
CHANGED
package/nodejs/logform/index.js
CHANGED
package/nodejs/reader/index.js
CHANGED
package/nodejs/throttle/index.js
CHANGED
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
package/web/animation/index.js
CHANGED
package/web/format/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* format of OIPage v1.5.0-alpha.
|
|
2
|
+
* format of OIPage v1.5.0-alpha.2
|
|
3
3
|
* git+https://github.com/oi-contrib/OIPage.git
|
|
4
4
|
*/
|
|
5
5
|
|
|
@@ -26,12 +26,12 @@ export function numberFormat(input) {
|
|
|
26
26
|
integerArray.unshift(integerValue.substring(index > 2 ? index - 3 : 0, index));
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
return integerArray.join(",") + decimalValue;
|
|
29
|
+
return integerArray.join(",").replace(/^\-,/, "-") + decimalValue;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
export function dateFormat(input, option) {
|
|
34
|
-
option = option ||
|
|
34
|
+
option = option || {};
|
|
35
35
|
var dateObj;
|
|
36
36
|
|
|
37
37
|
// 如果无值,就用当前日期
|
package/web/json/index.js
CHANGED
package/web/onReady/index.js
CHANGED
package/web/reader/index.js
CHANGED
package/web/style/index.js
CHANGED
package/web/throttle/index.js
CHANGED