diff --git a/app/admin/view/login/index.html b/app/admin/view/login/index.html
index 2287833..1a19096 100644
--- a/app/admin/view/login/index.html
+++ b/app/admin/view/login/index.html
@@ -33,6 +33,7 @@
保持登录
{:event_view_replace('忘记密码?','AdminLoginForget')}
+ {:event_view_replace_js('AdminLoginForget')}
diff --git a/app/admin/view/login/index.js b/app/admin/view/login/index.js
index 1c7a4fe..b9e1e4a 100644
--- a/app/admin/view/login/index.js
+++ b/app/admin/view/login/index.js
@@ -38,8 +38,11 @@ $(function () {
});
});
-
- $('.forget-password').click(function () {
- layer.msg('可以使用重置密码命令设置:
php think admin:reset:password
参考文档');
+ ua.triggerEventReplaceJs('AdminLoginForget', () => {
+ $('.forget-password').click(function () {
+ layer.msg('可以使用重置密码命令设置:
php think admin:reset:password
参考文档');
+ });
+ }, (code) => {
+ eval(code);
});
});
\ No newline at end of file
diff --git a/app/common.php b/app/common.php
index db61ced..4f772b5 100644
--- a/app/common.php
+++ b/app/common.php
@@ -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 "";
+}
diff --git a/app/common/command/admin/Version.php b/app/common/command/admin/Version.php
index d351e3a..3c81bd9 100644
--- a/app/common/command/admin/Version.php
+++ b/app/common/command/admin/Version.php
@@ -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替换事件',
'发布新版本',
];
diff --git a/public/static/plugs/ulthon-admin/ulthon-admin.js b/public/static/plugs/ulthon-admin/ulthon-admin.js
index 6607300..de91253 100644
--- a/public/static/plugs/ulthon-admin/ulthon-admin.js
+++ b/public/static/plugs/ulthon-admin/ulthon-admin.js
@@ -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;