mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-27 06:29:19 +08:00
Update storage display when checking in
This commit is contained in:
parent
e3e70a59e6
commit
3e27625064
@ -73,6 +73,7 @@ class UserController extends Controller
|
||||
'errno' => 0,
|
||||
'msg' => trans('user.sign-in-success', ['score' => $acuiredScore]),
|
||||
'score' => $this->user->getScore(),
|
||||
'storage' => $this->calculatePercentageUsed($this->user->getStorageUsed(), option('score_per_storage')),
|
||||
'remaining_time' => round($this->user->getSignInRemainingTime() / 3600)
|
||||
]);
|
||||
} else {
|
||||
|
@ -554,6 +554,14 @@ function signIn() {
|
||||
var dom = '<i class="fa fa-calendar-check-o"></i> ' + trans('user.signInRemainingTime', { time: String(json.remaining_time) });
|
||||
$('#sign-in-button').attr('disabled', 'disabled').html(dom);
|
||||
|
||||
if (json.storage.used > 1024) {
|
||||
$('#user-storage').html(`<b>${Math.round(json.storage.used)}</b>/ ${Math.round(json.storage.total)} MB`);
|
||||
} else {
|
||||
$('#user-storage').html(`<b>${Math.round(json.storage.used)}</b>/ ${Math.round(json.storage.total)} KB`);
|
||||
}
|
||||
|
||||
$('#user-storage-bar').css('width', `${json.storage.percentage}%`)
|
||||
|
||||
swal({
|
||||
type: 'success',
|
||||
html: json.msg
|
||||
|
@ -44,18 +44,16 @@
|
||||
$total = $statistics['storage']['total'];
|
||||
?>
|
||||
|
||||
@if ($used > 1024)
|
||||
<span class="progress-number">
|
||||
<b>{{ round($used / 1024, 1) }}</b>/ {{ is_string($total) ? $total : round($total / 1024, 1) }} MB
|
||||
<span class="progress-number" id="user-storage">
|
||||
@if ($used > 1024)
|
||||
<b>{{ round($used / 1024, 1) }}</b>/ {{ is_string($total) ? $total : round($total / 1024, 1) }} MB
|
||||
@else
|
||||
<b>{{ $used }}</b>/ {{ $total }} KB
|
||||
@endif
|
||||
</span>
|
||||
@else
|
||||
<span class="progress-number">
|
||||
<b>{{ $used }}</b>/ {{ $total }} KB
|
||||
</span>
|
||||
@endif
|
||||
|
||||
<div class="progress sm">
|
||||
<div class="progress-bar progress-bar-yellow" style="width: {{ $statistics['storage']['percentage'] }}%"></div>
|
||||
<div class="progress-bar progress-bar-yellow" id="user-storage-bar" style="width: {{ $statistics['storage']['percentage'] }}%"></div>
|
||||
</div>
|
||||
</div><!-- /.progress-group -->
|
||||
</div><!-- /.col -->
|
||||
|
Loading…
Reference in New Issue
Block a user