From 38608263d3fe3bc131f76f37076a5c972ca5a610 Mon Sep 17 00:00:00 2001 From: Yagami <976204163@qq.com> Date: Fri, 21 Jun 2019 15:52:34 +0800 Subject: [PATCH] * Add entry edit.js. --- module/entry/js/edit.js | 12 ++++++++++++ module/entry/model.php | 2 ++ module/entry/view/create.html.php | 2 +- module/entry/view/edit.html.php | 7 ++++++- 4 files changed, 21 insertions(+), 2 deletions(-) diff --git a/module/entry/js/edit.js b/module/entry/js/edit.js index be33903126..c252a6b5c7 100644 --- a/module/entry/js/edit.js +++ b/module/entry/js/edit.js @@ -31,4 +31,16 @@ $(function() }) $('#name').focus(); + + $("input[id^=freePasswd]").change(function() + { + if($(this).val() == 1) + { + $('#account').closest('tr').addClass('hidden'); + } + else + { + $('#account').closest('tr').removeClass('hidden'); + } + }) }); diff --git a/module/entry/model.php b/module/entry/model.php index 6adf038125..e93e11f5cb 100644 --- a/module/entry/model.php +++ b/module/entry/model.php @@ -115,6 +115,8 @@ class entryModel extends model ->remove('allIP') ->get(); + if($this->post->freePasswd == 1) $this->config->entry->edit->requiredFields = 'name, code, key'; + $this->dao->update(TABLE_ENTRY)->data($entry) ->batchCheck($this->config->entry->edit->requiredFields, 'notempty') ->check('code', 'code') diff --git a/module/entry/view/create.html.php b/module/entry/view/create.html.php index 8ce7b7ba15..11832ef65f 100644 --- a/module/entry/view/create.html.php +++ b/module/entry/view/create.html.php @@ -34,7 +34,7 @@ entry->freePasswd;?> - entry->freePasswdList, "class='form-control'");?> + entry->freePasswdList, '');?> diff --git a/module/entry/view/edit.html.php b/module/entry/view/edit.html.php index 4f31b337b4..abd4f0d5ec 100644 --- a/module/entry/view/edit.html.php +++ b/module/entry/view/edit.html.php @@ -20,7 +20,7 @@ arrow . ' ' . $lang->entry->edit;?> -
+ @@ -32,7 +32,12 @@ + + + + +
entry->name;?>code, "class='form-control' title='{$lang->entry->note->code}' placeholder='{$lang->entry->note->code}'");?>
entry->freePasswd;?>entry->freePasswdList, $entry->freePasswd);?>
entry->account;?> account, "class='form-control chosen'");?>