Skip to content

Commit

Permalink
add i18n base js
Browse files Browse the repository at this point in the history
  • Loading branch information
finovy committed Oct 14, 2023
1 parent 815cbd5 commit e1e4c07
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 8 deletions.
Empty file.
1 change: 1 addition & 0 deletions common/static/i18n/i18n.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions common/static/i18n/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
console.log("index.js-------------------")
console.log(i18n.get("footer.about"))
7 changes: 7 additions & 0 deletions common/static/i18n/lang/i18n_cn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"footer.about": "关于",
"footer.contact": "联系我们",
"footer.title": "联系我们",
"this is button 1":"这是中文按钮",
"this is button 2":"这是英文按钮"
}
5 changes: 5 additions & 0 deletions common/static/i18n/lang/i18n_en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"footer.about": "About",
"footer.contact": "Contact us",
"footer.title": "Contact us"
}
14 changes: 7 additions & 7 deletions common/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
<link href="{% static 'bootstrap-select/css/bootstrap-select.min.css' %}" rel="stylesheet">
<link href="{% static 'bootstrap-table/css/bootstrap-table.min.css' %}" rel="stylesheet">
<link href="{% static 'bootstrap-switch/css/bootstrap-switch.min.css' %}" rel="stylesheet">
<link href="{% static 'dist/css/style.css' %}" rel="stylesheet">
<style type="text/css">
table{
max-width: none !important; /*解决 ios 横向滚动失效*/
Expand Down Expand Up @@ -410,15 +411,15 @@ <h4 class="modal-title" id="myModalLabel2">扫码绑定</h4>
<script src="{% static 'dist/js/utils.js' %}"></script>
<script src="{% static 'watermark/shuiyin.js' %}"></script>
<script type="text/javascript">
var now = getNow();
var user = '{{ user }}';
var watermark_enabled = '{{ watermark_enabled }}';
if(watermark_enabled == 'True'){
let now = getNow();
let user = '{{ user }}';
let watermark_enabled = '{{ watermark_enabled }}';
if(watermark_enabled === 'True'){
watermark.init({ watermark_txt: user + " " + now })
window.onscroll = function(){
watermark.load({ watermark_txt: user + " " + now })
}
};
}
</script>
<script>
function twofa(enable, auth_type) {
Expand Down Expand Up @@ -682,8 +683,7 @@ <h4 class="modal-title" id="myModalLabel2">扫码绑定</h4>

$('input[name="2fa"]').on('switchChange.bootstrapSwitch', function(event, state) {
if ($("#state").val() !== 'initial') {
$("#auth_type").val($(this).attr('auth_type'));
$("#auth_type").trigger('change');
$("#auth_type").val($(this).attr('auth_type')).trigger('change');
$("#enable").val(state);
$("#2fa").modal("hide");
$("#passwd-auth").modal("show");
Expand Down
2 changes: 1 addition & 1 deletion common/templates/login.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- 引入 Bootstrap -->
<link href="{% static 'bootstrap/css/bootstrap.min.css' %}" rel="stylesheet">
<link href="{% static 'dist/css/style.css' %}" rel="stylesheet">
<link href="{% static 'dist/css/login.css' %}" rel="stylesheet">
<!-- HTML5 Shim Respond.js 用于让 IE8 支持 HTML5元素和媒体查询 -->
<!-- 注意如果通过 file:// 引入 Respond.js 文件则该文件无法起效果 -->
Expand Down Expand Up @@ -160,7 +161,6 @@ <h4 class="modal-title" id="myModalLabel">
$(document).ready(function () {
$(document).keydown(function (event) {
//keycode==13为回车键
console.log($("#sign-up").css("display"))
if (event.keyCode === 13 && $("#sign-up").css("display") === 'none') {
$('#btnLogin').addClass('disabled');
$('#btnLogin').prop('disabled', true);
Expand Down

0 comments on commit e1e4c07

Please sign in to comment.