From 836a0bacd6426b844d020342b989a015ba117eda Mon Sep 17 00:00:00 2001 From: holan20180123 Date: Mon, 16 Aug 2021 10:30:10 +0800 Subject: [PATCH] * Finish task #41437. --- module/my/js/profile.js | 16 ++++++++++------ module/my/view/profile.html.php | 2 ++ module/user/control.php | 1 + 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/module/my/js/profile.js b/module/my/js/profile.js index e36ebbf5e6..b5ec8a420b 100644 --- a/module/my/js/profile.js +++ b/module/my/js/profile.js @@ -3,21 +3,25 @@ $(document).ready(function() $('#files').change(function(){$('#avatarForm').submit();}); $.setAjaxForm('#avatarForm', function(response) - { + { if(response.result == 'success') - { + { setTimeout(function() - { + { $('#avatarUploadBtn').popover('destroy'); $('#ajaxModal').load(response.locate); }, 800); - } - }); + } + }); $('#avatarUploadBtn').on('click', function() - { + { $('#files').click(); }); + + window.parent.$('#main-avatar, #menu-avatar').html(''); + window.parent.$('#mainContent>.cell>.main-header>.avatar').html(''); + window.parent.$('#mainContent .avatar-' + account).html(''); }); function uploadAvatar() diff --git a/module/my/view/profile.html.php b/module/my/view/profile.html.php index 4807c5c7de..e4c3e8a5c7 100644 --- a/module/my/view/profile.html.php +++ b/module/my/view/profile.html.php @@ -11,6 +11,8 @@ */ ?> +app->user->avatar);?> +app->user->account);?>
diff --git a/module/user/control.php b/module/user/control.php index a955e34843..1211e8a348 100644 --- a/module/user/control.php +++ b/module/user/control.php @@ -1141,6 +1141,7 @@ class user extends control $this->app->user->avatar = $image->webPath; $this->session->set('user', $this->app->user); + $this->dao->update(TABLE_USER)->set('avatar')->eq($image->webPath)->where('account')->eq($this->app->user->account)->exec(); exit('success'); }