This commit is contained in:
fanxb 2023-12-20 22:04:06 +08:00
parent 9c001c5403
commit 0b87ecae94
7 changed files with 53 additions and 20 deletions

2
electron/.gitignore vendored
View File

@ -1,3 +1,5 @@
node_modules
dist
openRenamerBackend
build
.idea

View File

@ -1,8 +0,0 @@
<html>
<head>
<title>test</title>
</head>
<body>
你好
</body>
</html>

View File

@ -26,7 +26,7 @@ async function createWindow() {
let port = await startBackend()
// 并且为你的应用加载index.html
// win.loadFile('./dist/index.html')
win.loadURL(`file://${__dirname}/dist/index.html?port=` + port);
win.loadURL(`http://localhost:` + port);
win.webContents.openDevTools()
}

View File

@ -5,11 +5,48 @@
"main": "main.js",
"scripts": {
"start": "electron .",
"test": "echo \"Error: no test specified\" && exit 1"
"test": "echo \"Error: no test specified\" && exit 1",
"build": "electron-builder --win --x64"
},
"author": "",
"license": "ISC",
"devDependencies": {
"electron": "^28.0.0"
"electron": "^28.0.0",
"electron-builder": "^24.9.1"
},
"build": {
"productName": "openRenamer",
"appId": "electron.app",
"directories": {
"output": "build"
},
"copyright": "xxxx",
"nsis": {
"oneClick": false,
"allowElevation": true,
"allowToChangeInstallationDirectory": true,
"installerIcon": "./openRenamerBackend/static/favicon.ico",
"uninstallerIcon": "./openRenamerBackend/static/favicon.ico",
"installerHeaderIcon": "./openRenamerBackend/static/favicon.ico",
"createDesktopShortcut": true,
"createStartMenuShortcut": true,
"shortcutName": "openRenamer"
},
"win": {
"icon": "./openRenamerBackend/static/favicon.ico",
"target": [
"nsis",
"zip"
]
},
"mac": {
"target": [
"dmg",
"zip"
]
},
"linux": {
"icon": "build/icons"
}
}
}

View File

@ -1,9 +1,5 @@
lockfileVersion: '6.0'
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false
dependencies:
'@types/fs-extra':
specifier: 5.0.4
@ -1964,3 +1960,7 @@ packages:
resolution: {integrity: sha512-RXRJzMiK6U2ye0BlGGZnmpwJDPgakn6aNQ0A7gHRbD4I0uvK4TW6UqkK1V0pp9jskjJBAXd3dRrbzWkqJ+6cxA==}
engines: {node: '>= 4.0.0'}
dev: false
settings:
autoInstallPeers: true
excludeLinksFromLockfile: false

View File

@ -29,8 +29,8 @@
</el-tooltip>
&nbsp;&nbsp;
</template>
开源地址:<a href="https://github.com/FleyX/open-renamer">open-renamer</a>
&nbsp;&nbsp;<a href="https://github.com/FleyX/open-renamer/issues">反馈</a>
开源地址:<a href="https://github.com/FleyX/open-renamer" target="_blank">open-renamer</a>
&nbsp;&nbsp;<a href="https://github.com/FleyX/open-renamer/issues" target="_blank">反馈</a>
</div>
</div>
</template>
@ -56,7 +56,9 @@ export default {
queryMap[arr[0]] = arr[1];
})
if (queryMap.port) {
window.baseUrl =
window.baseUrl = "http://localhost:" + queryMap.port;
} else {
window.baseUrl = "";
}
window.token = localStorage.getItem("token");
window.isWindows = await httpUtil.get("/file/isWindows");

View File

@ -14,7 +14,7 @@ import router from '../router/index';
async function request(url, method, params, body, isForm) {
let options = {
url,
baseURL: '/openRenamer/api',
baseURL: window.baseUrl + '/openRenamer/api',
method,
params,
headers: {token: window.token}