增加js的事件处理;增加忘记密码的js替换事件;发布新版本;

This commit is contained in:
2023-09-23 11:47:18 +08:00
parent 94ab74892e
commit e176ed19e5
5 changed files with 32 additions and 11 deletions

View File

@@ -33,6 +33,7 @@
<span class="icon-nocheck"></span>
<span class="login-tip">保持登录</span>
{:event_view_replace('<a href="javascript:" class="forget-password">忘记密码?</a>','AdminLoginForget')}
{:event_view_replace_js('AdminLoginForget')}
</div>
<div class="layui-form-item" style="text-align:center; width:100%;height:100%;margin:0px;">

View File

@@ -38,8 +38,11 @@ $(function () {
});
});
$('.forget-password').click(function () {
layer.msg('可以使用重置密码命令设置:<br/>php think admin:reset:password<br><a target="_blank" href="http://doc.ulthon.com/home/read/ulthon_admin/reset_password/15/16.html"> 参考文档</a>');
ua.triggerEventReplaceJs('AdminLoginForget', () => {
$('.forget-password').click(function () {
layer.msg('可以使用重置密码命令设置:<br/>php think admin:reset:password<br><a target="_blank" href="http://doc.ulthon.com/home/read/ulthon_admin/reset_password/15/16.html"> 参考文档</a>');
});
}, (code) => {
eval(code);
});
});

View File

@@ -230,7 +230,7 @@ function build_upload_url($url, $upload_type = null)
return Filesystem::disk($upload_type)->url($url);
}
function event_handle_result($name, $key, $type = 'all')
function event_handle_result($name, $key, $type = 'all') : array
{
$list_result = Event::trigger($name);
@@ -246,9 +246,10 @@ function event_handle_result($name, $key, $type = 'all')
if ($type == 'all') {
$result[] = $value_event[$key];
} elseif ($type == 'last') {
$result = $value_event[$key];
$result = [];
$result[] = $value_event[$key];
} elseif ($type == 'first') {
$result = $value_event[$key];
$result[] = $value_event[$key];
break;
}
}
@@ -277,3 +278,12 @@ function event_view_replace($content, $name)
return $content_event;
}
function event_view_replace_js($name)
{
$list_result = event_handle_result($name, 'view_replace_js');
$content_event = implode('', $list_result);
return "<script id='event-replace-js-{$name}' type='text/plain'>{$content_event}</script>";
}

View File

@@ -14,14 +14,13 @@ use think\facade\App;
class Version extends Command
{
public const VERSION = 'v2.0.37';
public const VERSION = 'v2.0.38';
public const LAYUI_VERSION = '2.8.16';
public const COMMENT = [
'修改事件处理函数的逻辑',
'修改忘记密码提示',
'忘记密码增加view_replace事件',
'增加js的事件处理',
'增加忘记密码的js替换事件',
'发布新版本',
];

View File

@@ -2470,8 +2470,16 @@
return num + u;
}
return '0B';
}
},
triggerEventReplaceJs(name, defaultCallback, replaceCallback) {
var code = $('#event-replace-js-' + name).html();
if (admin.empty(code)) {
defaultCallback();
} else {
replaceCallback(code);
}
}
};
window.ulAdmin = window.ua = admin;