no message

This commit is contained in:
kuaifan 2021-07-08 19:26:40 +08:00
parent 279384bddf
commit 0cda0a7427
12 changed files with 82 additions and 33 deletions

View File

@ -28,7 +28,7 @@ server {
allow all; allow all;
} }
location =/ws { location =/api/ws {
proxy_http_version 1.1; proxy_http_version 1.1;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Real-PORT $remote_port; proxy_set_header X-Real-PORT $remote_port;

51
electron/index.html Normal file
View File

@ -0,0 +1,51 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">
<meta name="renderer" content="webkit">
<meta name="format-detection" content="telephone=no" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<title>Dootask</title>
<link rel="stylesheet" type="text/css" href="./public/css/app.css">
<link rel="stylesheet" type="text/css" href="./public/css/iview.css">
<script src="./public/js/jquery.min.js"></script>
<script src="./public/js/bootstrap.min.js"></script>
<script src="./public/js/language.all.js"></script>
<script src="./public/js/scroll-into-view.min.js"></script>
<script>
window.systemInformation = {
version: "0.2.63",
origin: window.location.origin + "/",
apiUrl: null
};
</script>
</head>
<body>
<div id="app">
<div class="app-view-loading">
<div>
<div>PAGE LOADING</div>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
<span></span>
</div>
</div>
</div>
<script type="text/javascript">
document.writeln("<script src=\'./public/js/app.js?v=" + window.systemInformation.version + "\'><\/script>");
</script>
</body>
</html>

2
electron/main.js vendored
View File

@ -15,7 +15,7 @@ function createWindow () {
}) })
// and load the index.html of the app. // and load the index.html of the app.
mainWindow.loadFile('../public/index_electron.html').then(r => { mainWindow.loadFile('./index.html').then(r => {
}) })

View File

@ -114,7 +114,7 @@
language = 'zh' language = 'zh'
break; break;
} }
this.url = './js/grapheditor/' + (this.readOnly ? 'viewer' : 'index') + '.html?lang=' + language; this.url = $A.originUrl('js/grapheditor/' + (this.readOnly ? 'viewer' : 'index') + '.html?lang=' + language);
}, },
mounted() { mounted() {
window.addEventListener('message', this.handleMessage) window.addEventListener('message', this.handleMessage)

View File

@ -51,13 +51,13 @@ export default {
}, },
mounted() { mounted() {
$A.loadScriptS([ $A.loadScriptS([
'./js/luckysheet/plugins/css/pluginsCss.css', 'js/luckysheet/plugins/css/pluginsCss.css',
'./js/luckysheet/plugins/plugins.css', 'js/js/luckysheet/plugins/plugins.css',
'./js/luckysheet/css/luckysheet.css', 'js/js/luckysheet/css/luckysheet.css',
'./js/luckysheet/assets/iconfont/iconfont.css', 'js/js/luckysheet/assets/iconfont/iconfont.css',
// //
'./js/luckysheet/plugins/js/plugin.js', 'js/js/luckysheet/plugins/js/plugin.js',
'./js/luckysheet/luckysheet.umd.js', 'js/js/luckysheet/luckysheet.umd.js',
], () => { ], () => {
this.loadIng = false; this.loadIng = false;
this.bakValue = JSON.stringify(this.value); this.bakValue = JSON.stringify(this.value);

View File

@ -227,7 +227,7 @@
} }
}, },
htmlOk() { htmlOk() {
$A.loadScript(window.location.origin + '/js/html2md.js', () => { $A.loadScript('js/html2md.js', () => {
if (typeof toMarkdown !== 'function') { if (typeof toMarkdown !== 'function') {
$A.modalAlert("组件加载失败!"); $A.modalAlert("组件加载失败!");
return; return;

View File

@ -212,7 +212,7 @@
return { return {
inline: isFull ? false : this.inline, inline: isFull ? false : this.inline,
selector: (isFull ? '#T_' : '#') + this.id, selector: (isFull ? '#T_' : '#') + this.id,
base_url: './js/tinymce', base_url: $A.originUrl('js/tinymce'),
language: "zh_CN", language: "zh_CN",
toolbar: this.toolbar, toolbar: this.toolbar,
plugins: this.plugin(isFull), plugins: this.plugin(isFull),

View File

@ -3,8 +3,6 @@
*/ */
(function (window, $, undefined) { (function (window, $, undefined) {
let serverUrl = window.location.origin + '/';
/** /**
* ============================================================================= * =============================================================================
* ************************** 基础函数类 ************************** * ************************** 基础函数类 **************************
@ -209,7 +207,7 @@
* @param str * @param str
* @returns {string} * @returns {string}
*/ */
serverUrl: function (str) { originUrl: function (str) {
if (str.substring(0, 2) === "//" || if (str.substring(0, 2) === "//" ||
str.substring(0, 7) === "http://" || str.substring(0, 7) === "http://" ||
str.substring(0, 8) === "https://" || str.substring(0, 8) === "https://" ||
@ -217,7 +215,11 @@
str.substring(0, 1) === "/") { str.substring(0, 1) === "/") {
return str; return str;
} }
return serverUrl + str; if (window.systemInformation && typeof window.systemInformation.origin === "string") {
return window.systemInformation.origin + str;
} else {
return window.location.origin + "/" + str;
}
}, },
/** /**
@ -878,6 +880,7 @@
* @param callback * @param callback
*/ */
loadScript(url, callback) { loadScript(url, callback) {
url = $A.originUrl(url);
if (this.rightExists(url, '.css')) { if (this.rightExists(url, '.css')) {
this.loadCss(url, callback) this.loadCss(url, callback)
return; return;
@ -928,6 +931,7 @@
* @param callback * @param callback
*/ */
loadCss(url, callback) { loadCss(url, callback) {
url = $A.originUrl(url);
if (this.rightExists(url, '.js')) { if (this.rightExists(url, '.js')) {
this.loadScript(url, callback) this.loadScript(url, callback)
return; return;
@ -936,7 +940,7 @@
typeof callback === "function" && callback(); typeof callback === "function" && callback();
return; return;
} }
var script = document.createElement('link'); let script = document.createElement('link');
if (script.readyState) { if (script.readyState) {
script.onreadystatechange = () => { script.onreadystatechange = () => {
if (script.readyState == 'loaded' || script.readyState == 'complete') { if (script.readyState == 'loaded' || script.readyState == 'complete') {

View File

@ -296,7 +296,7 @@ export default {
} }
this._notificationId = id; this._notificationId = id;
this.notificationClass.replaceOptions({ this.notificationClass.replaceOptions({
icon: './images/logo.png', icon: $A.originUrl('images/logo.png'),
body: body, body: body,
data: data, data: data,
tag: "dialog", tag: "dialog",

View File

@ -1422,12 +1422,10 @@ export default {
} }
return; return;
} }
let url = window.webSocketConfig.URL; //
if (!url) { let url = state.method.apiUrl('ws');
url = state.method.apiUrl('/ws');
url = url.replace("https://", "wss://"); url = url.replace("https://", "wss://");
url = url.replace("http://", "ws://"); url = url.replace("http://", "ws://");
}
url += "?action=web&token=" + state.userToken; url += "?action=web&token=" + state.userToken;
// //
state.ws = new WebSocket(url); state.ws = new WebSocket(url);

View File

@ -1,19 +1,16 @@
const method = { const method = {
apiUrl(str) { apiUrl(str) {
let origin;
origin = window.location.origin;
origin = 'http://127.0.0.1:2222';
//
if (str.substring(0, 2) === "//" || if (str.substring(0, 2) === "//" ||
str.substring(0, 7) === "http://" || str.substring(0, 7) === "http://" ||
str.substring(0, 8) === "https://" || str.substring(0, 8) === "https://" ||
str.substring(0, 6) === "ftp://") { str.substring(0, 6) === "ftp://" ||
str.substring(0, 1) === "/") {
return str; return str;
} }
if (str.substring(0, 1) == "/") { if (window.systemInformation && typeof window.systemInformation.apiUrl === "string") {
return origin + str; return window.systemInformation.apiUrl + str;
} else { } else {
return origin + "/api/" + str; return window.location.origin + "/api/" + str;
} }
}, },

View File

@ -19,8 +19,7 @@
<script src="{{ asset_main('js/scroll-into-view.min.js') }}"></script> <script src="{{ asset_main('js/scroll-into-view.min.js') }}"></script>
<script> <script>
window.csrfToken = { csrfToken : "{{ csrf_token() }}" }; window.csrfToken = { csrfToken : "{{ csrf_token() }}" };
window.webSocketConfig = { URL: "{{ env('LARAVELS_PROXY_URL') }}", DEBUG: {{ env('APP_DEBUG') ? "true" : "false" }}, LISTENER: {} }; window.systemInformation = { version : "{{ $version }}", origin: window.location.origin + "/", apiUrl: null };
window.systemInformation = { version : "{{ $version }}" };
</script> </script>
</head> </head>
<body> <body>