图片设置权限功能

This commit is contained in:
Wisp X
2022-01-13 11:21:21 +08:00
parent 3e911db0ca
commit 81016e5643
5 changed files with 60 additions and 14 deletions

View File

@@ -2,15 +2,12 @@ window._ = require('lodash');
window.$ = window.jQuery = require('jquery');
window.toastr = require('toastr');
window.Swal = require('sweetalert2')
window.Swal.mixin({
customClass: {
confirmButton: 'btn btn-success',
cancelButton: 'btn btn-danger'
},
buttonsStyling: false
window.Swal = window.Swal.mixin({
showCancelButton: true,
confirmButtonText: '确认',
cancelButtonText: '取消',
})
toastr.options = {
"closeButton": true,
"debug": false,

View File

@@ -615,7 +615,42 @@
},
visibility: {
text: '设置可见性',
action: e => {},
action: e => {
Swal.fire({
title: '选择一个权限',
text: '选择公开将会出现在画廊中(若平台开启了画廊)',
input: 'select',
inputOptions: {
public: '公开',
private: '私有',
},
confirmButtonText: '确认设置',
inputPlaceholder: '请选择一个权限',
showCancelButton: true,
inputValidator: (value) => {
return new Promise((resolve) => {
if (value === '') {
resolve('请选择正确的权限')
} else {
resolve();
}
})
}
}).then(result => {
let selected = ds.getSelection().map(item => $(item).data('id'));
axios.put('{{ route('user.images.permission') }}', {
ids: selected,
permission: result.value,
}).then(response => {
if (response.data.status) {
ds.clearSelection();
toastr.success(response.data.message);
} else {
toastr.warning(response.data.message);
}
});
});
},
},
};
// 点击容器