mirror of
https://github.com/lsky-org/lsky-pro.git
synced 2025-01-09 04:19:32 +08:00
🐛 修复 BUG
This commit is contained in:
parent
844d768fd3
commit
e0b68d5470
6
public/js/app.js
vendored
6
public/js/app.js
vendored
@ -5475,6 +5475,7 @@ window.utils = {
|
||||
},
|
||||
infiniteScroll: function infiniteScroll(selector, options) {
|
||||
if ($(selector).length > 0) {
|
||||
var classes = options.classes || {};
|
||||
var loadingText = options.loadingText || '加载中...';
|
||||
var finishedText = options.finishedText || '我也是有底线的~';
|
||||
var errorText = options.errorText || '加载失败';
|
||||
@ -5484,6 +5485,11 @@ window.utils = {
|
||||
finished: false
|
||||
};
|
||||
$(selector).append("<div class=\"infinite-scroll\"><span>".concat(loadingText, "</span></div>"));
|
||||
|
||||
for (var classesKey in classes) {
|
||||
$(selector).find('.infinite-scroll').addClass(classes[classesKey]);
|
||||
}
|
||||
|
||||
var $btn = $(selector + ' .infinite-scroll span');
|
||||
var opts = {
|
||||
url: options.url || '',
|
||||
|
4
resources/js/app.js
vendored
4
resources/js/app.js
vendored
@ -36,6 +36,7 @@ window.utils = {
|
||||
},
|
||||
infiniteScroll(selector, options) {
|
||||
if ($(selector).length > 0) {
|
||||
let classes = options.classes || {};
|
||||
let loadingText = options.loadingText || '加载中...';
|
||||
let finishedText = options.finishedText || '我也是有底线的~';
|
||||
let errorText = options.errorText || '加载失败';
|
||||
@ -45,6 +46,9 @@ window.utils = {
|
||||
finished: false,
|
||||
};
|
||||
$(selector).append(`<div class="infinite-scroll"><span>${loadingText}</span></div>`);
|
||||
for (const classesKey in classes) {
|
||||
$(selector).find('.infinite-scroll').addClass(classes[classesKey]);
|
||||
}
|
||||
let $btn = $(selector + ' .infinite-scroll span');
|
||||
|
||||
let opts = {
|
||||
|
@ -48,10 +48,10 @@
|
||||
</x-dropdown>
|
||||
</div>
|
||||
</div>
|
||||
<div class="relative inset-0 h-full overflow-hidden">
|
||||
<div class="relative inset-0 h-full overflow-hidden select-none">
|
||||
<!-- content -->
|
||||
<div id="photos-scroll" class="absolute inset-0 overflow-y-scroll select-none">
|
||||
<div id="photos-grid"></div>
|
||||
<div id="photos-scroll" class="absolute inset-0 overflow-y-scroll dragselect">
|
||||
<div id="photos-grid" class="dragselect"></div>
|
||||
</div>
|
||||
<!-- right drawer -->
|
||||
<div id="drawer-mask" class="absolute hidden inset-0 bg-gray-500 bg-opacity-50 z-[2]" onclick="drawer.close()"></div>
|
||||
@ -134,6 +134,7 @@
|
||||
|
||||
let selectedAlbum = 0; // 选择的相册
|
||||
|
||||
const PHOTOS_SCROLL = '#photos-scroll';
|
||||
const PHOTOS_GRID = '#photos-grid';
|
||||
const PHOTOS_ITEM = '.photos-item';
|
||||
|
||||
@ -165,8 +166,9 @@
|
||||
|
||||
$photos.justifiedGallery(gridConfigs);
|
||||
|
||||
const imagesInfinite = utils.infiniteScroll('#photos-scroll', {
|
||||
const imagesInfinite = utils.infiniteScroll(PHOTOS_SCROLL, {
|
||||
url: '{{ route('user.images') }}',
|
||||
classes: ['dragselect'],
|
||||
success: function (response) {
|
||||
if (!response.status) {
|
||||
return toastr.error(response.message);
|
||||
@ -192,6 +194,7 @@
|
||||
|
||||
$photos.append(html);
|
||||
ds.setSelectables($photos.find(PHOTOS_ITEM));
|
||||
$(PHOTOS_SCROLL).trigger('click');
|
||||
},
|
||||
complete: function () {
|
||||
if ($photos.html() !== '') {
|
||||
@ -341,17 +344,25 @@
|
||||
resetImages({page: 1, keyword: $(this).val()});
|
||||
}
|
||||
});
|
||||
|
||||
$(document).keydown(e => {
|
||||
e.preventDefault();
|
||||
if (e.keyCode === 65 && (e.altKey || e.metaKey)) {
|
||||
ds.setSelection($(PHOTOS_ITEM));
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
const ds = new DragSelect({
|
||||
area: $photos.get(0),
|
||||
area: $(PHOTOS_SCROLL).get(0),
|
||||
keyboardDrag: false,
|
||||
});
|
||||
ds.subscribe('predragstart', ({ event }) => {
|
||||
if (utils.isMobile()) {
|
||||
ds.stop();
|
||||
}
|
||||
if (event.target.id !== 'photos-grid') {
|
||||
|
||||
if (! $(event.target).hasClass('dragselect')) {
|
||||
ds.break();
|
||||
}
|
||||
});
|
||||
@ -449,7 +460,7 @@
|
||||
},
|
||||
},
|
||||
remove: {
|
||||
text: '移出所在相册',
|
||||
text: '移出当前相册',
|
||||
action: _ => {
|
||||
axios.put('{{ route('user.images.movement') }}', {
|
||||
selected: ds.getSelection().map(item => $(item).data('id')),
|
||||
@ -470,7 +481,7 @@
|
||||
delete: {text: '删除', action: e => {}},
|
||||
};
|
||||
// 点击容器
|
||||
context.attach('#photos-scroll', [
|
||||
context.attach(PHOTOS_SCROLL, [
|
||||
methods.refresh,
|
||||
], _ => ds.clearSelection());
|
||||
// 点击图片
|
||||
|
Loading…
Reference in New Issue
Block a user