Преглед изворни кода

语种文件下载新增flutter文件类型

peng пре 2 година
родитељ
комит
8d7ebd5f6d
2 измењених фајлова са 9 додато и 4 уклоњено
  1. 5 3
      controller/LangArea.py
  2. 4 1
      web/langTab.html

+ 5 - 3
controller/LangArea.py

@@ -132,7 +132,7 @@ class LangAreaView(TemplateView):
             en_kv[e['word_key']] = e['langvalmodel__word_val']
 
         content = ''
-        if type == 'ios' or type == 'link_ios':
+        if type == 'ios' or type == 'link_ios' or type == 'flutter':
             res_qs = LangKeyModel.objects.filter(langvalmodel__la__id=id, type__in=langType). \
                 values('word_key', 'langvalmodel__word_val')
             res = {}
@@ -144,7 +144,10 @@ class LangAreaView(TemplateView):
                     res[r['word_key']] = en_kv[r['word_key']]
             for l in res:
                 content_val = res[l].replace('"', '\'')
-                content = content + '"' + l + '"="' + content_val + '";\n'
+                if type == 'ios' or type == 'link_ios':
+                    content = content + '"' + l + '"="' + content_val + '";\n'
+                else:
+                    content = content + '"' + l + '":"' + content_val + '";\n'
         elif type == 'android' or type == 'link_android':
             res_qs = LangKeyModel.objects.filter(langvalmodel__la__id=id, type__in=langType). \
                 values('word_key', 'langvalmodel__word_val').order_by('addTime')
@@ -196,7 +199,6 @@ class LangAreaView(TemplateView):
         response['Content-Type'] = 'application/octet-stream'
         response['Content-Disposition'] = 'attachment;filename="lang.txt"'
         return response
-        return response.json(0, res)
 
     def do_download_avss(self, id):
         content = ''

+ 4 - 1
web/langTab.html

@@ -210,9 +210,10 @@
             let link_android_btn = 'Link 安卓:<a href="#" title="zosi_link_android" onclick="dlFunc(\'' + obj['id'] + '\',5)"><i class="fa fa-download"></i></a>';
             let new_searchTool_btn = 'New Search Tool:<a href="#" title="new_searchTool" onclick="dlFunc(\'' + obj['id'] + '\',6)"><i class="fa fa-download"></i></a>';
             let old_searchTool_btn = 'Old Search Tool:<a href="#" title="new_searchTool" onclick="dlFunc(\'' + obj['id'] + '\',7)"><i class="fa fa-download"></i></a>';
+            let flutter_btn = 'flutter:<a href="#" title="flutter" onclick="dlFunc(\'' + obj['id'] + '\',8)"><i class="fa fa-download"></i></a>';
             let np = '&nbsp;&nbsp;&nbsp;'
             body_html += '<tr><td>' + obj['id'] + '</td><td>' + obj['lang'] + '</td><td>' + edit_btn + np + del_btn
-                + np + idw_btn + np + adw_btn + np + avssw_btn + np + link_ios_tbn + np + link_android_btn + np + new_searchTool_btn + np + old_searchTool_btn +'</td></tr>'
+                + np + idw_btn + np + adw_btn + np + avssw_btn + np + link_ios_tbn + np + link_android_btn + np + new_searchTool_btn + np + old_searchTool_btn + np + flutter_btn + '</td></tr>'
         })
         $('#tabLangBody').html(body_html)
     }
@@ -326,6 +327,8 @@
             post_type = 'new_searchTool'
         }else if(type == 7){
             post_type = 'old_searchTool'
+        }else if(type == 8){
+            post_type = 'flutter'
         }
         let post_data = {
             'token': $.cookie('access_token'),