Compare commits
2 Commits
6444d9a612
...
922a74be41
Author | SHA1 | Date | |
---|---|---|---|
922a74be41 | |||
|
1ebd7acf5a |
@ -8,4 +8,5 @@ rm -rf ./static/js
|
|||||||
rm -rf ./static/css
|
rm -rf ./static/css
|
||||||
cp -r ../openRenamerFront/dist/* ./static
|
cp -r ../openRenamerFront/dist/* ./static
|
||||||
cd ../electron
|
cd ../electron
|
||||||
|
mkdir -p dist
|
||||||
npm run build
|
npm run build
|
70
electron/index.html
Normal file
70
electron/index.html
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
<html lang="">
|
||||||
|
<head>
|
||||||
|
<title>open-renamer</title>
|
||||||
|
</head>
|
||||||
|
<body class="center">
|
||||||
|
<div class="center" style="flex-direction: column">
|
||||||
|
<div class="loading"></div>
|
||||||
|
<div id="text" style="font: 1.2em">loading...</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.center {
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
display: -webkit-flex;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading {
|
||||||
|
position: relative;
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
animation: satellite 3s infinite linear;
|
||||||
|
border: 1px solid #000;
|
||||||
|
border-radius: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading:before,
|
||||||
|
.loading:after {
|
||||||
|
position: absolute;
|
||||||
|
left: 1px;
|
||||||
|
top: 1px;
|
||||||
|
width: 12px;
|
||||||
|
height: 12px;
|
||||||
|
content: "";
|
||||||
|
border-radius: 100%;
|
||||||
|
background-color: #000;
|
||||||
|
box-shadow: 0 0 10px #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
.loading:after {
|
||||||
|
right: 0;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
margin: 13px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@keyframes satellite {
|
||||||
|
from {
|
||||||
|
transform: rotate(0) translateZ(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
to {
|
||||||
|
transform: rotate(360deg) translateZ(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
<script>
|
||||||
|
let text = document.getElementById("text");
|
||||||
|
let count = 1;
|
||||||
|
setInterval(() => {
|
||||||
|
if (count > 3) {
|
||||||
|
count = 1;
|
||||||
|
}
|
||||||
|
text.innerText = "Loading" + (count == 3 ? '...' : count == 2 ? '..' : '.');
|
||||||
|
count++;
|
||||||
|
}, 500);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -26,15 +26,25 @@ async function createWindow() {
|
|||||||
nodeIntegration: true, // 是否完整支持node。默认为 true
|
nodeIntegration: true, // 是否完整支持node。默认为 true
|
||||||
preload: path.join(__dirname, 'preload.js') //界面的其它脚本运行之前预先加载一个指定脚本。
|
preload: path.join(__dirname, 'preload.js') //界面的其它脚本运行之前预先加载一个指定脚本。
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
//打开调试
|
||||||
|
// win.webContents.openDevTools();
|
||||||
|
|
||||||
|
win.loadFile('./index.html');
|
||||||
|
let startTime = Date.now();
|
||||||
|
|
||||||
// 下面这两行代码配合上面 new BrowserWindow 里面的 show: false,可以实现打开时窗口最大化
|
// 下面这两行代码配合上面 new BrowserWindow 里面的 show: false,可以实现打开时窗口最大化
|
||||||
win.maximize()
|
win.maximize()
|
||||||
win.show()
|
win.show()
|
||||||
log.info(__dirname);
|
log.info(__dirname);
|
||||||
let port = await startBackend()
|
let port = await startBackend()
|
||||||
// 并且为你的应用加载index.html
|
|
||||||
// win.loadFile('./dist/index.html')
|
|
||||||
log.info("backend service started")
|
log.info("backend service started")
|
||||||
|
|
||||||
|
let diff = Date.now() - startTime;
|
||||||
|
let time = 2000;
|
||||||
|
if (diff < time) {
|
||||||
|
await sleep(time - diff);
|
||||||
|
}
|
||||||
win.loadURL(`http://localhost:` + port);
|
win.loadURL(`http://localhost:` + port);
|
||||||
// win.webContents.openDevTools()
|
// win.webContents.openDevTools()
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "electron",
|
"name": "electron",
|
||||||
"version": "1.0.0",
|
"version": "1.1.0",
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "main.js",
|
"main": "main.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
@ -22,7 +22,8 @@
|
|||||||
},
|
},
|
||||||
"files": [
|
"files": [
|
||||||
"main.js",
|
"main.js",
|
||||||
"preload.js"
|
"preload.js",
|
||||||
|
"index.html"
|
||||||
],
|
],
|
||||||
"extraFiles": [
|
"extraFiles": [
|
||||||
{
|
{
|
||||||
|
@ -90,7 +90,7 @@ export default {
|
|||||||
} else {
|
} else {
|
||||||
this.chosedTemplate = await HttpUtil.get("/applicationRule/default");
|
this.chosedTemplate = await HttpUtil.get("/applicationRule/default");
|
||||||
this.ruleList = JSON.parse(this.chosedTemplate.content);
|
this.ruleList = JSON.parse(this.chosedTemplate.content);
|
||||||
await this.ruleUpdate();
|
await this.ruleUpdate(false);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
@ -101,9 +101,14 @@ export default {
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
//规则更新
|
//规则更新
|
||||||
ruleUpdate() {
|
ruleUpdate(preview) {
|
||||||
|
if (preview !== undefined && preview === false) {
|
||||||
|
preview = false;
|
||||||
|
} else {
|
||||||
|
preview = true;
|
||||||
|
}
|
||||||
let temp = this.ruleList.filter((item) => !item.blocked);
|
let temp = this.ruleList.filter((item) => !item.blocked);
|
||||||
this.$emit("ruleUpdate", temp);
|
this.$emit("ruleUpdate", temp, preview);
|
||||||
},
|
},
|
||||||
//模板内容提交
|
//模板内容提交
|
||||||
async templateSubmit() {
|
async templateSubmit() {
|
||||||
|
@ -155,9 +155,12 @@ export default {
|
|||||||
this.dialogVisible = false;
|
this.dialogVisible = false;
|
||||||
await this.showResult();
|
await this.showResult();
|
||||||
},
|
},
|
||||||
async ruleUpdate(rules) {
|
async ruleUpdate(rules, preview) {
|
||||||
|
console.log(rules, preview);
|
||||||
this.ruleList = rules;
|
this.ruleList = rules;
|
||||||
await this.showResult();
|
if (preview) {
|
||||||
|
await this.showResult();
|
||||||
|
}
|
||||||
},
|
},
|
||||||
//预览结果
|
//预览结果
|
||||||
async showResult() {
|
async showResult() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user