fix: 客户端新窗口

This commit is contained in:
kuaifan 2021-12-25 15:19:03 +08:00
parent 5076374b5d
commit ffe62b8f8e
3 changed files with 8 additions and 59 deletions

8
electron/build.js vendored
View File

@ -106,6 +106,7 @@ const platform = ["build-mac", "build-mac-arm", "build-win"];
// 生成配置、编译应用
function step1(data, publish) {
// config.js
let systemInfo = {
title: data.name,
version: config.version,
@ -115,7 +116,12 @@ function step1(data, publish) {
fs.writeFileSync(electronDir + "/config.js", "window.systemInformation = " + JSON.stringify(systemInfo), 'utf8');
fs.writeFileSync(nativeCachePath, formatUrl(data.url));
fs.writeFileSync(devloadCachePath, "", 'utf8');
//
// index.html
let indexFile = path.resolve(electronDir, "index.html");
let indexString = fs.readFileSync(indexFile, 'utf8');
indexString = indexString.replace(`<title></title>`, `<title>${data.name}</title>`);
fs.writeFileSync(indexFile, indexString, 'utf8');
// package.json
let packageFile = path.resolve(__dirname, "package.json");
let packageString = fs.readFileSync(packageFile, 'utf8');
packageString = packageString.replace(/"name":\s*"(.*?)"/, `"name": "${data.name}"`);

View File

@ -1,4 +1,3 @@
<!DOCTYPE html>
<html lang="en">
<head>
@ -15,62 +14,6 @@
<script src="./js/language.all.js"></script>
<script src="./js/scroll-into-view.min.js"></script>
<script src="./config.js"></script>
<script>
window.$B = {
ishave: function (set) {
return !!(set !== null && set !== "null" && set !== undefined && set !== "undefined" && set);
},
strExists: function (string, find, lower = false) {
string += "";
find += "";
if (lower !== true) {
string = string.toLowerCase();
find = find.toLowerCase();
}
return (string.indexOf(find) !== -1);
},
getMiddle: function (string, start, end) {
string = string.toString();
if (this.ishave(start) && this.strExists(string, start)) {
string = string.substring(string.indexOf(start) + start.length);
}
if (this.ishave(end) && this.strExists(string, end)) {
string = string.substring(0, string.indexOf(end));
}
return string;
},
urlParameter: function(key) {
let params = this.urlParameterAll();
return typeof key === "undefined" ? params : params[key];
},
urlParameterAll: function() {
let search = window.location.search || window.location.hash;
let arr = [];
if (this.strExists(search, "?")) {
arr = this.getMiddle(search, "?").split("&");
}
let params = {};
for (let i = 0; i < arr.length; i++) {
let data = arr[i].split("=");
if (data.length === 2) {
params[data[0]] = data[1];
}
}
return params;
}
};
(function(){
let title = $B.urlParameter("title");
if (title) {
title = decodeURIComponent(title);
}
window.setTitle(title || window.systemInformation.title);
})();
</script>
</head>
<body>

View File

@ -654,7 +654,7 @@ export default {
},
openSingle(item) {
let url = $A.originUrl("index.html/#/single/file/" + item.id + "?title=" + encodeURIComponent(item.name)),
let url = $A.originUrl("index.html#/single/file/" + item.id),
name = 'file-' + item.id,
width = Math.min(window.screen.availWidth, 1280),
height = Math.min(window.screen.availHeight, 800);