From a88f91046c05b2c101697421dd05f66766fe1566 Mon Sep 17 00:00:00 2001 From: Karson Date: Tue, 2 Jun 2026 10:56:33 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E8=AF=AD=E8=A8=80=E5=8C=85?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 优化退出逻辑 --- application/index/lang/zh-cn/user.php | 2 ++ public/assets/js/frontend.js | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+) diff --git a/application/index/lang/zh-cn/user.php b/application/index/lang/zh-cn/user.php index b471c8f4..de121cef 100755 --- a/application/index/lang/zh-cn/user.php +++ b/application/index/lang/zh-cn/user.php @@ -66,6 +66,8 @@ return [ 'Operation failed' => '操作失败', 'Invalid parameters' => '参数不正确', 'Change password failure' => '修改密码失败', + 'Are you sure you want to sign out?' => '确定要退出登录吗?', + 'Confirm sign out' => '确定退出', 'All' => '全部', 'Url' => '物理路径', 'Imagewidth' => '宽度', diff --git a/public/assets/js/frontend.js b/public/assets/js/frontend.js index 0bd60fd0..45842d71 100644 --- a/public/assets/js/frontend.js +++ b/public/assets/js/frontend.js @@ -100,6 +100,24 @@ define(['fast', 'template', 'moment'], function (Fast, Template, Moment) { $(document).on("click", ".sidebar-toggle", function () { $("body").toggleClass("sidebar-open"); }); + + $(document).on("click", "a[href*='user/logout']", function () { + var that = this; + $.ajax({ + type: 'GET', dataType: 'html', url: $(that).attr("href"), + success: function (data, status, xhr) { + Fast.api.ajax({url: $(that).attr("href"), loading:false, data: {__token__: xhr.getResponseHeader('__token__')}}, function (data, ret) { + Layer.msg(ret.msg, {icon: 1}, function () { + location.reload(); + }); + return false; + }); + }, error: function (xhr, type) { + Layer.msg(__('Network error'), {icon: 2}); + } + }); + return false; + }); } }; Frontend.api = $.extend(Fast.api, Frontend.api);