Browse Source

add bhouse_server into config, then change src=localhost to bhouse_server

weichen 3 years ago
parent
commit
bc45d95711

+ 2 - 1
backstage/editor/routes.py

@@ -1,4 +1,5 @@
 from flask import render_template, Blueprint, request
+from backstage.config import BHOUSE_SERVER
 
 editor_app = Blueprint('editor', __name__)
 
@@ -6,4 +7,4 @@ editor_app = Blueprint('editor', __name__)
 @editor_app.route('/backstage/editor')
 def editor():
     url = request.args.get('url', type=str)
-    return render_template('editor.html', title='Type Editor', url=url)
+    return render_template('editor.html', title='Type Editor', url=url, bhouse_server=BHOUSE_SERVER)

+ 3 - 2
backstage/home/routes.py

@@ -1,7 +1,7 @@
 from flask import render_template, Blueprint, request, redirect, url_for
 import requests
 from backstage.utils.routes import update_manage_table
-from backstage.config import PORTAL_SERVER
+from backstage.config import PORTAL_SERVER, BHOUSE_SERVER
 
 home_app = Blueprint('home', __name__)
 
@@ -14,7 +14,8 @@ def home():
                                title='首頁',
                                form_url='home.update',
                                page='home',
-                               contents=response.json())
+                               contents=response.json(),
+                               bhouse_server=BHOUSE_SERVER)
 
 
 @home_app.route('/backstage/home/update', methods=['POST'])

+ 3 - 2
backstage/room_planner/routes.py

@@ -1,7 +1,7 @@
 from flask import render_template, Blueprint, request, redirect, url_for
 import requests
 from backstage.utils.routes import update_manage_table
-from backstage.config import PORTAL_SERVER
+from backstage.config import PORTAL_SERVER, BHOUSE_SERVER
 
 room_planner_app = Blueprint('room_planner', __name__)
 
@@ -13,7 +13,8 @@ def main():
                            title='規劃師服務',
                            form_url='room_planner.update',
                            page='room_planner',
-                           contents=response.json())
+                           contents=response.json(),
+                           bhouse_server=BHOUSE_SERVER)
 
 
 @room_planner_app.route('/backstage/room_planner/update', methods=['POST'])

+ 1 - 1
backstage/static/js/utils.js

@@ -25,5 +25,5 @@ function removeDescData(blockArray, blockIndex, dataIndex) {
 }
 
 const contentUrl = () => {
-  return 'http://localhost:1313' + (JSON.parse(document.getElementById('url').textContent)).url + '/';
+  return BHOUSE_SERVER + (JSON.parse(document.getElementById('url').textContent)).url + '/';
 }

+ 3 - 1
backstage/store_locations/routes.py

@@ -5,6 +5,7 @@ from time import sleep
 from backstage.utils import translate
 from backstage.config import PORTAL_SERVER
 from backstage.utils.routes import remove_content
+from backstage.config import BHOUSE_SERVER
 
 store_locations_app = Blueprint('store_locations', __name__)
 
@@ -15,7 +16,8 @@ def main():
     return render_template('store_location.html',
                            title='門市據點',
                            page='store_location',
-                           stores_data=response.json())
+                           stores_data=response.json(),
+                           bhouse_server=BHOUSE_SERVER)
 
 
 @store_locations_app.route('/backstage/store_locations/create', methods=['POST'])

+ 1 - 1
backstage/templates/editor.html

@@ -19,7 +19,7 @@
       </div>
       <div class="column column__preview">
         <h3 class="h3 column__h3"><i class="fas fa-eye mr-2"></i>預覽頁面</h3>
-        <iframe src='http://localhost:1313{{ url }}/' width="100%" height="100%"></iframe>
+        <iframe src='{{ bhouse_server }}{{ url }}/' width="100%" height="100%"></iframe>
       </div>
     </div>
     </div>

+ 1 - 1
backstage/templates/store_location.html

@@ -44,7 +44,7 @@
             <td class="table__data">{{ store.parking }}</td>
             <td class="table__data">
               {% for img_src in store.imgs %}
-                <img src="http://127.0.0.1:1313/{{ img_src }}" width="80px" height="50px">
+                <img src="{{ bhouse_server }}/{{ img_src }}" width="80px" height="50px">
                 <input name="img-{{ store_idx }}" type='hidden' value="{{ img_src }}">
                 <a class="btn btn-secondary btn-sm m-1" href="{{ url_for('store_locations.remove_img', type=store.type, src=img_src) }}">
                   移除

+ 2 - 2
backstage/templates/tables/manage_table.html

@@ -26,7 +26,7 @@
                   {% if key == "img" %}
                     <td class="table__data"><span class="badge badge-pill badge__img">圖片</span></td>
                     <td class="table__data" style="display:flex;justify-content:center">
-                      <div class="img__table"><img src="http://127.0.0.1:1313/{{ data['src'] }}" width="100%" height="100%"></div>
+                      <div class="img__table"><img src="{{ bhouse_server }}/{{ data['src'] }}" width="100%" height="100%"></div>
                     </td>
                     <td class="table__data">
                       <div class="d-flex justify-content-center">
@@ -47,7 +47,7 @@
                               <div class="modal-body">
                                 <input id="image" name="image" type="file" value="{{ data['src'] }}">
                                 <input name="data" type="hidden" value="{{ data }}">
-                                <div class="modal__img"><img src="http://127.0.0.1:1313/{{ data['src'] }}"></div>
+                                <div class="modal__img"><img src="{{ bhouse_server }}/{{ data['src'] }}"></div>
                                 <div class="modal-footer pb-0 border-0">
                                   <button type="button" class="btn btn__cancel" data-dismiss="modal">取消</button>
                                   <input class="btn btn__submitadd" type="submit" value="完成">