ソースを参照

增加代理的配置。尝试使用远程调试。

YangZhiJie 2 年 前
コミット
34f1422e95

+ 1 - 0
.eslintrc.js

@@ -96,5 +96,6 @@ module.exports = {
     'Vue': true,
     'Handsontable': true,
     'X6': true,
+    'REMOTE_DEV_PORT': true
   },
 };

+ 1 - 1
.vscode/settings.json

@@ -12,7 +12,7 @@
       },
       // 保存后自动修复格式  
       "editor.codeActionsOnSave": {
-            "source.fixAll.eslint": true
+            "source.fixAll.eslint": "explicit"
       },
       // 添加vue支持  
       "eslint.validate": [

ファイルの差分が大きいため隠しています
+ 359 - 131
package-lock.json


+ 6 - 2
package.json

@@ -5,6 +5,7 @@
   "author": "yangzhijie1488 <yangzhijie1488@163.com>",
   "scripts": {
     "dev": "cross-env webpack serve --config ./webpack.dev.js",
+    "remotedev": "cross-env remoteDevPort=8081 node server.js",
     "build-lib": "cross-env NODE_ENV=production webpack --progress --config ./webpack.lib.js",
     "build": "cross-env NODE_ENV=production webpack --mode=production --config ./webpack.prod.js --progress"
   },
@@ -21,12 +22,12 @@
     "dingtalk-jsapi": "^2.10.3",
     "moment": "^2.29.4",
     "pc-component-v3": "1.0.74",
+    "qrcode": "^1.5.3",
     "uuid": "^8.3.2",
     "v-tooltip": "^4.0.0-beta.17",
     "vue-request": "^1.2.4",
     "vue-select": "^4.0.0-beta.6",
-    "vuedraggable": "^4.1.0",
-    "qrcode": "^1.5.3"
+    "vuedraggable": "^4.1.0"
   },
   "devDependencies": {
     "@babel/core": "^7.17.5",
@@ -44,8 +45,10 @@
     "eslint": "^8.10.0",
     "eslint-plugin-vue": "^8.5.0",
     "eslint-webpack-plugin": "^3.1.1",
+    "express": "^4.19.2",
     "file-loader": "^6.2.0",
     "html-webpack-plugin": "^5.5.0",
+    "http-proxy": "^1.18.1",
     "mini-css-extract-plugin": "^2.6.0",
     "style-loader": "^3.3.1",
     "terser-webpack-plugin": "^5.3.6",
@@ -53,6 +56,7 @@
     "webpack": "^5.70.0",
     "webpack-bundle-analyzer": "^4.7.0",
     "webpack-cli": "^4.9.2",
+    "webpack-dev-middleware": "^7.1.1",
     "webpack-dev-server": "^4.7.4",
     "webpack-merge": "^5.8.0"
   },

+ 37 - 37
public/index-debug.html

@@ -13,61 +13,61 @@
 	<meta http-equiv="Content-Security-Policy" content="upgrade-insecure-requests">-->
 	<title>prodog</title>
 
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/font-awesome/css/font-awesome.min.css">
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap/dist/css/bootstrap.css">
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap/dist/css/bootstrap-theme.min.css">
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/bootstrap3-dialog/dist/css/bootstrap-dialog.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/font-awesome/css/font-awesome.min.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/bootstrap/dist/css/bootstrap.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/bootstrap/dist/css/bootstrap-theme.min.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/bootstrap3-dialog/dist/css/bootstrap-dialog.css">
 	
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/layui/dist/css/layui.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/layui/dist/css/layui.css">
 
 
 
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/cropper/dist/cropper.css">
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/animate.css/animate.css">
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/colResizable/colResizable-1.6.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/cropper/dist/cropper.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/animate.css/animate.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/colResizable/colResizable-1.6.css">
 
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/jQuery-ResizableColumns/jQuery.resizableColumns.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/jQuery-ResizableColumns/jQuery.resizableColumns.css">
 
-	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="/static/summernote/dist/summernote.min.css">
+	<link nonce="*NONCE_TOKEN_CSS*" rel="stylesheet" type="text/css" href="./static/summernote/dist/summernote.min.css">
 
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/jquery/dist/jquery.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/jquery/dist/jquery.js"></script>
 
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/jquery.cookie/jquery.cookie.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/table-fixer.jquery/table-fixer.jquery.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/jquery.cookie/jquery.cookie.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/table-fixer.jquery/table-fixer.jquery.js"></script>
 
 	
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/cropper/dist/cropper.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/bootstrap/dist/js/bootstrap.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/bootstrap3-dialog/dist/js/bootstrap-dialog.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/colResizable/colResizable-1.6.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/cropper/dist/cropper.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/bootstrap/dist/js/bootstrap.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/bootstrap3-dialog/dist/js/bootstrap-dialog.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/colResizable/colResizable-1.6.js"></script>
 
 	
 
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/jQuery-ResizableColumns/jQuery.resizableColumns.js"></script>
-	<!-- <script src="../static/js/api.js"></script> -->
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/jQuery-ResizableColumns/jQuery.resizableColumns.js"></script>
+	<!-- <script src=".../static/js/api.js"></script> -->
 
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/summernote/dist/summernote.min.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/summernote/dist/lang/summernote-zh-CN.min.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/summernote/dist/summernote.min.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/summernote/dist/lang/summernote-zh-CN.min.js"></script>
 
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/moment/moment.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/moment/locale/zh-cn.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/moment/moment.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/moment/locale/zh-cn.js"></script>
 
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/reconnecting-websocket/reconnecting-websocket.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/reconnecting-websocket/reconnecting-websocket.js"></script>
 	
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/layui/dist/layui.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/layui/dist/layui.js"></script>
 
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="../static/plugin/dingtalk-jsapi/2.10.3/dingtalk.open.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/plugin/dingtalk-jsapi/2.10.3/dingtalk.open.js"></script>
 
 	<!--VueJS has 2 different versions: the full version and the runtime version. 'unsafe-eval' is only needed for the full version of VueJS; the runtime version doesn't need it. 
 	The runtime-only build is fully CSP-compliant. When using the runtime-only build with Webpack + vue-loader or Browserify + vueify, your templates will be precompiled into render functions which work perfectly in CSP environments. -->
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue/dist/vue.global.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue-i18n/dist/vue-i18n.global.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vuex/dist/vuex.global.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/vue-router/dist/vue-router.global.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/dayjs/dayjs.min.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/axios/dist/axios.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/sortablejs/Sortable.js"></script>
-	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="/static/antv/x6/dist/x6.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/vue/dist/vue.global.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/vue-i18n/dist/vue-i18n.global.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/vuex/dist/vuex.global.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/vue-router/dist/vue-router.global.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/dayjs/dayjs.min.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/axios/dist/axios.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/sortablejs/Sortable.js"></script>
+	<script nonce="*NONCE_TOKEN*" type="text/javascript" src="./static/antv/x6/dist/x6.js"></script>
 
 
 	
@@ -83,9 +83,9 @@
 	</div>
 	<div id="refreshCount"></div>
 
-	<script defer="defer" nonce="*NONCE_TOKEN*"  src="/static/echarts/dist/echarts.min.js"></script>
-	<!-- <script src="../static/js/fullscreen-api.js"></script> -->
-	<!-- <script src="../static/js/problem-feedback-api.js"></script> -->
+	<script defer="defer" nonce="*NONCE_TOKEN*"  src="./static/echarts/dist/echarts.min.js"></script>
+	<!-- <script src=".../static/js/fullscreen-api.js"></script> -->
+	<!-- <script src=".../static/js/problem-feedback-api.js"></script> -->
 
 </body>
 

+ 39 - 0
server.js

@@ -0,0 +1,39 @@
+const express = require('express');
+const webpack = require('webpack');
+const webpackDevMiddleware = require('webpack-dev-middleware');
+const httpProxy = require("http-proxy");
+
+const app = express();
+const config = require('./webpack.remote.dev.js');
+const compiler = webpack(config);
+const port = process.env.remoteDevPort;
+
+var apiProxy = httpProxy.createProxyServer();
+
+// Tell express to use the webpack-dev-middleware and use the webpack.config.js
+// configuration file as a base.
+app.use(
+    webpackDevMiddleware(compiler, {
+        publicPath: '/',
+    })
+);
+
+
+const proxyUrls = ['/api', '/static', '/content', '/dashboard', '/assets', '/authApi', '/Dictionary', '/Files', '/WebSocket', '/TrainVideo'];
+proxyUrls.forEach(proxyUrl => {
+    // Proxy api requests
+    app.use(proxyUrl + "/*", function (req, res) {
+        req.url = req.baseUrl; // Janky hack...
+        apiProxy.web(req, res, {
+            target: {
+                port: 10022,
+                host: "localhost"
+            }
+        });
+    });
+})
+
+// Serve the files on port 8081.
+app.listen(port, function () {
+    console.log('Example app listening on port ' + port + '!\n');
+});

+ 1 - 1
src/client/Archive.vue

@@ -235,7 +235,7 @@ export default {
      * 下载文件
      */
     download: function (item, type) {
-      var url = Common.getFileServerUrl() + item.reportUrl + type;
+      var url = Common.getHostPageBaseURL() + item.reportUrl + type;
       window.open(url);
     },
 

+ 1 - 2
src/client/DingTalkLogin.vue

@@ -77,8 +77,7 @@ export default {
       var _self = this;
       $.ajax({
         url:
-          Common.getHostPageBaseURL() +
-          'authApi/LoginResource/dingTalkAutoLogin',
+          Common.getApiUrl2('authApi/LoginResource/dingTalkAutoLogin'),
         data: {
           code: _self.code,
           clientId: _self.clientId,

+ 5 - 5
src/client/Login.vue

@@ -318,7 +318,7 @@ export default {
     unqiueAccountManagementDto: function () {
       var _self = this;
       $.ajax({
-        url: '/api/AccountManagementResource/unqiueAccountManagementDto',
+        url: Common.getApiURL('AccountManagementResource/unqiueAccountManagementDto'),
         type: 'get',
         async: true,
         success: function (response) {
@@ -337,7 +337,7 @@ export default {
     // 判断SAML服务器是否存在
     existsSAML: function (id) {
       $.ajax({
-        url: '/api/SamlLogin/samlServiceProviderCheck?authSettingId=' + id,
+        url: Common.getApiURL('SamlLogin/samlServiceProviderCheck?authSettingId=' + id),
         type: 'get',
         contentType: 'application/json',
         dataType: 'json',
@@ -375,7 +375,7 @@ export default {
         return;
       }
       $.ajax({
-        url: '/authApi/UserVerificationCodeResource/sendUserVerificationCode',
+        url: Common.getApiUrl2('authApi/UserVerificationCodeResource/sendUserVerificationCode'),
         async: true,
         type: 'post',
         data: loginData,
@@ -451,7 +451,7 @@ export default {
         return;
       }
       $.ajax({
-        url: '/authApi/LoginResource/login',
+        url: Common.getApiUrl2('authApi/LoginResource/login'),
         async: true,
         type: 'post',
         data: loginData,
@@ -528,7 +528,7 @@ export default {
     getCurrentDate: function () {
       var _self = this;
       $.ajax({
-        url: '/authApi/LoginResource/getCurrentDate',
+        url: Common.getApiUrl2('authApi/LoginResource/getCurrentDate'),
         type: 'get',
         timeout: 2000,
         success: function (data) {

+ 1 - 1
src/client/ProfileLogin.vue

@@ -49,7 +49,7 @@ export default {
       };
       var _self = this;
       $.ajax({
-        url: Common.getHostPageBaseURL() + 'authApi/LoginResource/profileLogin',
+        url: Common.getApiUrl2('authApi/LoginResource/profileLogin'),
         async: true,
         type: 'post',
         data: loginData,

+ 2 - 2
src/client/SamlLogin.vue

@@ -50,7 +50,7 @@ export default {
         languageId: _self.languageSelected,
       };
       $.ajax({
-        url: '/api/SamlLogin/login',
+        url: Common.getApiURL('SamlLogin/login'),
         type: 'post',
         async: true,
         data: params,
@@ -126,7 +126,7 @@ export default {
     setTokenClient: function () {
       const _self = this;
       $.ajax({
-        url: '/api/TokenClientResource/saveTokenClient',
+        url: Common.getApiURL('TokenClientResource/saveTokenClient'),
         type: 'post',
         dataType: 'json',
         contentType: 'application/json',

+ 20 - 93
src/common/Common.js

@@ -60,68 +60,35 @@ export default {
   },
 
   getHostPageBaseURL: function () {
-    return this.getRootPath() + '/';
+    if(typeof REMOTE_DEV_PORT !== 'undefined' && REMOTE_DEV_PORT != null){
+      return this.getRootPath() + '/proxy/' + REMOTE_DEV_PORT + '/';
+    }else{
+      return this.getRootPath() + '/';
+    }
   },
 
-  // 获取图片路径url
-  getFileServerUrl: function () {
-    return this.getRootPath() + '/';
-  },
 
   // 获取API的地址
   getApiURL: function (apiName) {
     return this.getHostPageBaseURL() + 'api/' + apiName;
   },
 
-  // 获取测试API的地址
-  getTestApiURL: function (apiName) {
-    return 'http://xxx/' + 'api/' + apiName;
-  },
-
-  // 获取中间件API的地址
-  getMidURL: function (apiName) {
-    var that = this;
-    if (window.middlewareUrl == undefined) {
-      $.ajax({
-        url: that.getApiURL('MiddleareResource/getApiUrl'),
-        type: 'GET',
-        dataType: 'text',
-        async: false,
-        beforeSend: function (request) {
-          that.addTokenToRequest(request);
-        },
-        success: function (data) {
-          if (data.indexOf('http') == 0) {
-            window.middlewareUrl = data;
-          } else {
-            window.middlewareUrl = that.getHostPageBaseURL() + 'mid';
-          }
-          if (window.middlewareUrl.indexOf(window.middlewareUrl.length() - 1) == '/') {
-            window.middlewareUrl = window.middlewareUrl.substring(0, window.middlewareUrl.length() - 2);
-          }
-        },
-        error: function (XMLHttpRequest, textStatus, errorThrown) {
-          window.middlewareUrl = that.getHostPageBaseURL() + 'mid';
-        },
-      });
-    }
-    if (apiName.indexOf(0) == '/') {
-      apiName = apiName.substring(1, apiName.length() - 2);
-    }
-    return window.middlewareUrl + apiName;
+  /**
+   * 获取API的地址 直接拼接
+   * @param {*} apiName 
+   * @returns 
+   */
+  getApiUrl2: function (apiName) {
+    return this.getHostPageBaseURL() + apiName;
   },
 
-  // 获取微信测试api地址
-  getWeixinApiURL: function (apiName) {
-    return this.getHostPageBaseURL() + '/api/' + apiName;
-  },
 
   // 获取图片路径
   getImageUrl: function (imageName) {
     if (imageName == null || imageName == '') {
-      return this.getFileServerUrl() + 'notFound.png';
+      return this.getHostPageBaseURL() + 'notFound.png';
     } else {
-      return this.getFileServerUrl() + imageName;
+      return this.getHostPageBaseURL() + imageName;
     }
   },
 
@@ -130,7 +97,7 @@ export default {
     if (imageName == null) {
       return null;
     }
-    return '/api/file/imageDownload?className=' + className + '&fileName=' + imageName;
+    return this.getHostPageBaseURL() + '/api/file/imageDownload?className=' + className + '&fileName=' + imageName;
   },
 
 
@@ -151,7 +118,7 @@ export default {
    */
   getAttachmentsSrc: function (className, imageName) {
     var accountId = localStorage.getItem('#accountId');
-    return this.getFileServerUrl() + 'Files/' + accountId + '/Attachments/' + className + '/' + imageName;
+    return this.getHostPageBaseURL() + 'Files/' + accountId + '/Attachments/' + className + '/' + imageName;
   },
 
   // 获取图片路径
@@ -161,7 +128,7 @@ export default {
       return this.getHostPageBaseURL() + 'static/image/noImage.jpg';
     }
 
-    return this.getFileServerUrl() + 'Files/' + accountId + '/Video/' + className + '/' + imageName;
+    return this.getHostPageBaseURL() + 'Files/' + accountId + '/Video/' + className + '/' + imageName;
   },
 
 
@@ -172,58 +139,18 @@ export default {
       return;
     }
     if (type == 'image') {
-      return this.getFileServerUrl() + 'Files/' + accountId + '/Images/' + className + '/' + resourceName;
+      return this.getHostPageBaseURL() + 'Files/' + accountId + '/Images/' + className + '/' + resourceName;
     }
     if (type == 'video') {
-      return this.getFileServerUrl() + 'Files/' + accountId + '/Video/' + className + '/' + resourceName;
+      return this.getHostPageBaseURL() + 'Files/' + accountId + '/Video/' + className + '/' + resourceName;
     }
     if (type == 'file') {
-      return this.getFileServerUrl() + 'Files/' + accountId + '/Files/' + className + '/' + resourceName;
+      return this.getHostPageBaseURL() + 'Files/' + accountId + '/Files/' + className + '/' + resourceName;
     }
 
   },
 
-  getApsURL: function (apiName) {
-    var apsBaseUrl = localStorage.getItem('apsBaseUrl');
-    if (apsBaseUrl == undefined) {
-      Notify.error('错误', '系统参数"apsBaseUrl"未设置,请联系系统管理员设置参数', false);
-      return;
-    }
-    return apsBaseUrl + apiName;
-  },
 
-  getActivitiURL: function (apiName) {
-    var apsBaseUrl = localStorage.getItem('activitiUrl');
-    if (apsBaseUrl == undefined) {
-      Notify.error('错误', '系统参数"activitiUrl"未设置,请联系系统管理员设置参数', false);
-      return;
-    }
-    return apsBaseUrl + apiName;
-  },
-
-  getSchedulingURL: function (apiName) {
-    var _self = this;
-    var apsBaseUrl = localStorage.getItem('schedulingUrl');
-    if (apsBaseUrl == undefined) {
-      _self.loadSystemParam('schedulingUrl', function () {
-        apsBaseUrl = localStorage.getItem('schedulingUrl');
-        if (apsBaseUrl == undefined) {
-          Notify.error('错误', '系统参数"schedulingUrl"未设置,请联系系统管理员设置参数', false);
-          return;
-        }
-      });
-    }
-    return apsBaseUrl + apiName;
-  },
-
-  getCameraURL: function (apiName) {
-    var apsBaseUrl = localStorage.getItem('cameraBaseURL');
-    if (apsBaseUrl == undefined) {
-      Notify.error('错误', '系统参数"cameraBaseURL"未设置,请联系系统管理员设置参数', false);
-      return;
-    }
-    return apsBaseUrl + apiName;
-  },
 
   //设置路径到localStorage
   setHref: function () {

+ 12 - 10
src/common/image-src.js

@@ -1,30 +1,32 @@
+import Common from './Common';
 
 // 获取图片路径
 export function getImageSrc(className, imageName) {
-  var protocol = window.location.protocol;
+  // var protocol = window.location.protocol;
   // console.log('protocol:' + protocol);
-  var host = window.location.host;
+  // var host = window.location.host;
   // console.log('host:' + host);
-  var localhostPath = protocol + '//' + host;
+  var localhostPath = Common.getHostPageBaseURL();
   var accountId = localStorage.getItem('#accountId') || 0;
   if (imageName == null) {
     return null;
   }
   if (imageName != null && imageName[0] == '/') {
-    return localhostPath + '/Files/' + accountId + '/Images/' + className + imageName;
+    return localhostPath + 'Files/' + accountId + '/Images/' + className + imageName;
   } else {
-    return localhostPath + '/Files/' + accountId + '/Images/' + className + '/' + imageName;
+    return localhostPath + 'Files/' + accountId + '/Images/' + className + '/' + imageName;
   }
 }
   
   
 // 获取略缩图图片路径
 export function getThumbnailImageSrc(className, imageName) {
-  var protocol = window.location.protocol;
+  // var protocol = window.location.protocol;
   // console.log('protocol:' + protocol);
-  var host = window.location.host;
+  // var host = window.location.host;
   // console.log('host:' + host);
-  var localhostPath = protocol + '//' + host;
+  // var localhostPath = protocol + '//' + host;
+  var localhostPath = Common.getHostPageBaseURL();
   //测试用
   //var localhostPath = 'http://127.0.0.1:83';
   console.log('localhostPath:' + localhostPath);
@@ -33,8 +35,8 @@ export function getThumbnailImageSrc(className, imageName) {
     return null;
   }
   if (imageName != null && imageName[0] == '/') {
-    return localhostPath + '/Files/' + accountId + '/Images/' + className + '/thumbnail' + imageName;
+    return localhostPath + 'Files/' + accountId + '/Images/' + className + '/thumbnail' + imageName;
   } else {
-    return localhostPath + '/Files/' + accountId + '/Images/' + className + '/thumbnail/' + imageName;
+    return localhostPath + 'Files/' + accountId + '/Images/' + className + '/thumbnail/' + imageName;
   }
 }

+ 1 - 1
src/customer/printTemp/step2.vue

@@ -313,7 +313,7 @@ const handleOk = () => {
   let json = graph.toJSON();
   // console.log(json.cells);
   $.ajax({
-    url: '/api/printPageResource/uploadCustomerPrintTemplateX6',
+    url: Common.getApiURL('printPageResource/uploadCustomerPrintTemplateX6'),
     type: 'post',
     // contentType: 'application/json',
     dataType: 'json',

+ 0 - 81
src/widget/Middleware.js

@@ -1,81 +0,0 @@
-var webSocket = undefined
-import Common from "../common/Common.js";
-import Notify from "pc-component-v3").Notify;
-export default {
-
-    //打开websocket
-    open: function (readerEnvent) {
-        if (this.webSocket == null) {
-            //webSocket的URL            
-			var url = Common.getMidURL("/ws/ReaderEventWebSocket");
-            url = websocketUrl.replace("https","wss").replace("http", "ws");
-            
-            //创建新的webSocket
-            this.webSocket = new WebSocket(url);
-        }else{
-            Notify.info("提示", "webSocket已经连接", false);
-        }
-        this.webSocket.onmessage = function (evt) {
-            var datas = JSON.parse(evt.data);
-            if (datas != null) {
-                readerEnvent(datas);
-            }
-        };
-        this.webSocket.onopen = function () {
-            Notify.success("提示", "webSocket已连接",1500);
-        }
-        this.webSocket.onerror = function (evt) {
-            Notify.error("提示", "webSocket出错", false);
-        };
-        this.webSocket.onclose = function (evt) {
-            //Notify.info("提示", "webSocket已断开", false);
-        };
-    },
-    //关闭websocket
-    close: function () {
-        if (this.webSocket) {
-            this.webSocket.close()
-            this.webSocket = null;
-        };
-    },
-    //订阅读写器
-    subscribe: function (readerId) {
-        this.webSocket.send("Subscribe " + readerId);
-    },
-    //取消订阅
-    unSubscribe: function (readerId) {
-        this.webSocket.send("UnSubscribe " + readerId);
-
-    },
-    //启动盘点
-    start: function (readerId) {
-        $.ajax({
-            type: "GET",
-            url: Common.getMidURL("/api/ReaderResource/startInventory/" + readerId),
-            dataType: "json",
-            contentType: "application/json",
-            success: function (result) {
-                Notify.info("提示", "开启盘点成功", false);
-            },
-            error: function (XMLHttpRequest, textStatus, errorThrown) {
-                Common.processException(XMLHttpRequest, textStatus, errorThrown);
-            }
-        });
-    },
-    //关闭盘点
-    stop: function (readerId) {
-        $.ajax({
-            type: "GET",
-            url: Common.getMidURL("/api/ReaderResource/stopInventory/" + readerId),
-            dataType: "json",
-            contentType: "application/json",
-            success: function (statusConfigs) {
-                Notify.info("提示", "关闭盘点成功", false);
-            },
-            error: function (XMLHttpRequest, textStatus, errorThrown) {
-                Common.processException(XMLHttpRequest, textStatus, errorThrown);
-            }
-        });
-    }
-
-}

+ 3 - 1
webpack.dev.js

@@ -32,7 +32,9 @@ module.exports = WebpackMerge.merge(baseConfig, {
 
     port: 8081,
     compress: false,
-
+    
+    // 修复BUG:Invalid Host header
+    allowedHosts: 'all',
 
     static: [
       {

+ 56 - 0
webpack.remote.dev.js

@@ -0,0 +1,56 @@
+const path = require('path');
+const HtmlWebpackPlugin = require('html-webpack-plugin');
+const WebpackMerge = require('webpack-merge');
+const baseConfig = require('./webpack.base.js');
+const Webpack = require('webpack');
+
+const port = process.env.remoteDevPort;
+module.exports = WebpackMerge.merge(baseConfig, {
+  mode: 'development',
+  //开发环境下默认启用cache,在内存中对已经构建的部分进行缓存
+  //避免其他模块修改,但是该模块未修改时候,重新构建,能够更快的进行增量构建
+  //属于空间换时间的做法
+  cache: true,
+  
+  // 代码入口
+  entry: {
+    // 注册界面
+    main: './src/main.js',
+  },
+
+  output: {
+    path: path.resolve(__dirname, 'dist'),
+    publicPath: '/proxy/8081/',
+    filename: 'app-client-[name].js',
+    chunkFilename: 'app-client-chunk-[name].js',
+  },
+
+  watchOptions: {
+    ignored: ['**/node_modules', '/bat/', '/dist/', '/public/', '/static/', '/test/'],
+    poll: 2000,
+  },
+
+  watch: true,
+
+
+  devtool: 'source-map',
+
+
+  plugins: (module.exports.plugins || []).concat([
+
+    new Webpack.DefinePlugin({
+      'REMOTE_DEV_PORT': JSON.stringify(port)
+    }),
+
+    
+    new HtmlWebpackPlugin({
+      title: 'Prodog',
+      template: './public/index-debug.html',   // 源模板文件
+      filename: './index.html',                   // 输出文件【注意:这里的根路径是module.exports.output.path】
+      chunks: ['main'],
+    }),
+
+  ]),
+});
+
+

この差分においてかなりの量のファイルが変更されているため、一部のファイルを表示していません