优化 ui

This commit is contained in:
pushuo 2022-06-30 18:18:44 +08:00
parent 160840a214
commit 3f3e2affa6
3 changed files with 32 additions and 2 deletions

View File

@ -11282,3 +11282,11 @@ textarea.form-control-lg {
.btn-primary {
color: #fff;
}
.form-switch {
margin-bottom: 0;
}
.form-switch .form-check-input {
width: 3em;
height: 1.6em;
}

View File

@ -25,3 +25,12 @@ $link-color: #1890ff;
.btn-primary {
color: #fff;
}
.form-switch {
margin-bottom: 0;
.form-check-input {
width: 3em;
height: 1.6em;
}
}

View File

@ -34,7 +34,7 @@
<td>
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" role="switch" id="switch-1"
{{ $plugin->enabled ? 'checked' : '' }}>
{{ $plugin->enabled ? 'checked' : '' }} data-code="{{ $plugin->code }}">
<label class="form-check-label" for="switch-1"></label>
</div>
</td>
@ -53,7 +53,20 @@
@push('footer')
<script>
$('.form-switch input[type="checkbox"]').change(function(event) {
console.log($(this).prop('checked'))
const $input = $(this);
const checked = $(this).prop('checked') ? 1 : 0;
const code = $(this).data('code')
$.ajax({
url: `/admin/plugins/${code}/status`,
type: 'PUT',
data: {status: checked},
success: function(res) {
layer.msg(res.message)
$input.removeAttr('checked')
},
error: function() {
}
})
});
</script>
@endpush