Browse Source

fix further

SyuanYu 2 years ago
parent
commit
69ba5e4036
2 changed files with 19 additions and 14 deletions
  1. 1 1
      backstage/blogs/routes.py
  2. 18 13
      backstage/templates/further.html

+ 1 - 1
backstage/blogs/routes.py

@@ -334,7 +334,7 @@ def edit_blog_getfurther():
             data.append([item.get('href'), item.text])
 
     #sortedData = sorted(sortedData, key=lambda x: x['type'])
-    return data
+    return {"data": data}
 
 @blogs_app.route('/backstage/edit_blog_editfurther', methods=['GET'])
 def edit_blog_editfurther():

+ 18 - 13
backstage/templates/further.html

@@ -4,12 +4,17 @@
 <script src="https://cdn.jsdelivr.net/npm/@editorjs/editorjs@latest"></script>
 <script src="https://cdn.jsdelivr.net/npm/@editorjs/image@latest"></script><!-- Image -->
 <script type="text/javascript" src="/static/js/yo.js"></script>
+<style>
+    .table__data {
+        padding: 5px;
+    }
+</style>
 <table>
     <tbody id='contactData'>
         <h1 class="h3"><i class="fas fa-pen mr-3 mb-3"></i>{{ title }}</h1>
         <tr>
-            <td>延伸閱讀文章名稱 <span class="text-danger">(請務必填寫文章名稱,否則此項文章不予載入)</span></td>
-            <td>延伸閱讀文章連結</td>
+            <td>文章名稱 <span class="text-danger">(請務必填寫文章名稱,否則此項文章不予載入)</span></td>
+            <td>文章連結</td>
         </tr>
         <tr>
             <td class="table__data"><input class="form-control" id="data01" type="text" style="width: 600px;" placeholder="文章內容" /></td>
@@ -33,7 +38,7 @@
         </tr>
         <tr>
             <td>
-                <div class="d-flex justify-content-center">
+                <div class="d-flex justify-content-center mt-3" style="width: 200%;">
                     <button class="btn btn_light mr-1" onclick="changeArticles();"><b>儲存</b> <i
                             class="fas fa-pencil-alt"></i></button>
                 </div>
@@ -45,16 +50,16 @@
 <script>
     $(function(){
         axios.get('/backstage/edit_blog_getfurther').then(({ data }) => {
-            $('#data00').val(data[0][0]);
-            $('#data01').val(data[0][1]);
-            $('#data10').val(data[1][0]);
-            $('#data11').val(data[1][1]);
-            $('#data20').val(data[2][0]);
-            $('#data21').val(data[2][1]);
-            $('#data30').val(data[3][0]);
-            $('#data31').val(data[3][1]);
-            $('#data40').val(data[4][0]);
-            $('#data41').val(data[4][1]);
+            $('#data00').val(data.data[0][0]);
+            $('#data01').val(data.data[0][1]);
+            $('#data10').val(data.data[1][0]);
+            $('#data11').val(data.data[1][1]);
+            $('#data20').val(data.data[2][0]);
+            $('#data21').val(data.data[2][1]);
+            $('#data30').val(data.data[3][0]);
+            $('#data31').val(data.data[3][1]);
+            $('#data40').val(data.data[4][0]);
+            $('#data41').val(data.data[4][1]);
         });
         
     });