zhangweicheng 4 роки тому
батько
коміт
f41e37d201

+ 1 - 0
modules/main/routes/main_route.js

@@ -53,6 +53,7 @@ module.exports =function (app) {
                         projectReadOnly: projectReadOnly,
                         projectCooperate: projectCooperate,
                         allowCopy: allowCopy||false,
+                        socketPort:config[process.env.NODE_ENV].socketPort?config[process.env.NODE_ENV].socketPort:3300,
                         LicenseKey:config.getLicenseKey(process.env.NODE_ENV),
                         overWriteUrl:req.session.sessionCompilation.overWriteUrl,
                         fileKind: fileKind,

+ 1 - 0
modules/pm/controllers/pm_controller.js

@@ -373,6 +373,7 @@ module.exports = {
             engineeringList: JSON.stringify(engineering.List),
             compilationName: sessionCompilation.name,
             versionName: request.session.compilationVersion,
+            socketPort:config[process.env.NODE_ENV].socketPort?config[process.env.NODE_ENV].socketPort:3300,
             LicenseKey: config.getLicenseKey(process.env.NODE_ENV)
         };
 

+ 1 - 0
modules/unit_price_file/controllers/unit_price_controller.js

@@ -49,6 +49,7 @@ module.exports={
           unitpriceList:JSON.stringify(unitpriceList),
           gljTypeMap:JSON.stringify(gljTypeMap),
           mixRatioMap:JSON.stringify(mixRatioMap),
+          socketPort:config[process.env.NODE_ENV].socketPort?config[process.env.NODE_ENV].socketPort:3300,
           LicenseKey:config.getLicenseKey(process.env.NODE_ENV)
         });
     },

+ 3 - 1
public/web/socket/connection.js

@@ -8,7 +8,9 @@ socketObject = {
         // 连接socket服务器
         var hostName = window.location.hostname;
         let me = this;
-        let port = window.location.protocol === 'http:' ? 3300 : 3301;
+        let socketPort = parseInt($("#socketPort").val());
+        if(!socketPort) socketPort= 3300;
+        let port = window.location.protocol === 'http:' ? socketPort : socketPort+1;
         socket = io(window.location.protocol + '//' + hostName + ':' + port);
         socket.on('connect', function () {
             if (from == 'pm') {

+ 3 - 0
web/building_saas/unit_price_file/index.html

@@ -61,6 +61,9 @@
                 </button>
                 <strong id="message"></strong>-
             </div>
+            <% if(typeof socketPort != 'undefined'){ %>
+                <input id="socketPort" value="<%= socketPort %>" type="hidden">
+            <% } %>
         </div>
         <nav class="navbar navbar-expand-lg p-0 d-flex <%= versionName.includes('免费') ? 'free-version' : 'pro-version' %>">
           <div class="unit_price_header header-logo ">

+ 3 - 0
web/common/html/header.html

@@ -1,4 +1,7 @@
 <img id="f_btn" src="/web/dest/css/img/feeRate_btn.jpg" alt="" style="display: none" />
+<% if(typeof socketPort != 'undefined'){ %>
+    <input id="socketPort" value="<%= socketPort %>" type="hidden">
+<% } %>
 <!-- <nav class="navbar p-0 "> -->
 <div class="top-msg clearfix">
     <div class="alert alert-warning alert-dismissible" role="alert" id="notify" style="display: none">