fix: 客户端新窗口
This commit is contained in:
parent
5076374b5d
commit
ffe62b8f8e
8
electron/build.js
vendored
8
electron/build.js
vendored
@ -106,6 +106,7 @@ const platform = ["build-mac", "build-mac-arm", "build-win"];
|
|||||||
|
|
||||||
// 生成配置、编译应用
|
// 生成配置、编译应用
|
||||||
function step1(data, publish) {
|
function step1(data, publish) {
|
||||||
|
// config.js
|
||||||
let systemInfo = {
|
let systemInfo = {
|
||||||
title: data.name,
|
title: data.name,
|
||||||
version: config.version,
|
version: config.version,
|
||||||
@ -115,7 +116,12 @@ function step1(data, publish) {
|
|||||||
fs.writeFileSync(electronDir + "/config.js", "window.systemInformation = " + JSON.stringify(systemInfo), 'utf8');
|
fs.writeFileSync(electronDir + "/config.js", "window.systemInformation = " + JSON.stringify(systemInfo), 'utf8');
|
||||||
fs.writeFileSync(nativeCachePath, formatUrl(data.url));
|
fs.writeFileSync(nativeCachePath, formatUrl(data.url));
|
||||||
fs.writeFileSync(devloadCachePath, "", 'utf8');
|
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 packageFile = path.resolve(__dirname, "package.json");
|
||||||
let packageString = fs.readFileSync(packageFile, 'utf8');
|
let packageString = fs.readFileSync(packageFile, 'utf8');
|
||||||
packageString = packageString.replace(/"name":\s*"(.*?)"/, `"name": "${data.name}"`);
|
packageString = packageString.replace(/"name":\s*"(.*?)"/, `"name": "${data.name}"`);
|
||||||
|
@ -1,4 +1,3 @@
|
|||||||
|
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html lang="en">
|
<html lang="en">
|
||||||
<head>
|
<head>
|
||||||
@ -15,62 +14,6 @@
|
|||||||
<script src="./js/language.all.js"></script>
|
<script src="./js/language.all.js"></script>
|
||||||
<script src="./js/scroll-into-view.min.js"></script>
|
<script src="./js/scroll-into-view.min.js"></script>
|
||||||
<script src="./config.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>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
openSingle(item) {
|
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,
|
name = 'file-' + item.id,
|
||||||
width = Math.min(window.screen.availWidth, 1280),
|
width = Math.min(window.screen.availWidth, 1280),
|
||||||
height = Math.min(window.screen.availHeight, 800);
|
height = Math.min(window.screen.availHeight, 800);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user