💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
:-: 图片空间 文件路径:shop/controllers/Seller/AlbumCtl.php; 初始化: function initPage() { _page.$imageList.empty(), _page.$pagination.empty(); $.post(SITE_URL + '?ctl=Seller_Album&met=listImage&typ=json&firstRow=' + _page.firstRow + '&totalRows=' + _page.totalRows, { page: _page.page, rows: _page.rows, param: _page.param, firstRow: _page.firstRow, totalRows: _page.totalRows, }, function (data) {console.info(123); if (data.status == 200) { var data = data.data, itmes = data.items; if (itmes.length > 0) { _page.$pagination.parent().show(), loadingPagination(data), loadingImageList(itmes); } else { _page.$imageList.append('<div class="no_account"><img src="' + BASE_URL + '/shop/static/default/images/ico_none.png"><p>暂无符合条件的数据记录</p></div>'); } } else { alert('读取数据失败'); } if(_page.firstPreview) { initCategory(); } }) } 生成图片列表: $imageItem = $('<div class="image-item" data-album_id="' + itmes[i].album_id + '" data-upload_id="' + itmes[i].upload_id + '">' + '<div class="image-box" style="background-image:url(' + itmes[i].upload_path + ');"></div>' + '</div>'); $imageTitle = $('<div class="image-title"><label><input name="image-box" type="checkbox"><span>' + itmes[i].upload_name + '</span></label></div>'); $imageOpt = $('<div class="image-opt"></div>'); $rename = $('<a href="javascript:;">改名</a>'); $link = $('<a href="javascript:;" name="imageUrl" data-imageurl="' + itmes[i].upload_path + '">链接</a>'); $assignGroup = $('<a href="javascript:;">分组</a>'); $delete = $('<a href="javascript:;">删除</a>'); 改名: $rename.on('click', function() { $.dialog({ content: '<div class="ui-popover-inner" style="min-width: auto; width: 180px;">' + '<div style="margin-bottom: 6px;">修改名称</div>' + '<div style="margin-bottom: 6px;">' + '<input class="js-name-input" type="text" value="' + $(this).parent().prev().find('span').html() + '" placeholder="" style=" width: 166px;">' + '</div>' + '</div>', title: '改名', width: 250, cancel: true, data: { upload_id: $(this).parent().parent().data('upload_id'), upload_name: $(this).parent().prev().find('span').html(), _thisSpan: $(this).parent().prev().find('span') }, ok: function () { var _thisSpan = this.data._thisSpan, upload_id = this.data.upload_id, upload_name = this.DOM.wrap.find('.js-name-input').val(); if (upload_name && upload_name != this.data.upload_name) { $.post(SITE_URL + '?ctl=Seller_Album&met=edit&typ=json', { upload_id: upload_id, upload_name: upload_name }, function (data) { if (data.status == 200) { _thisSpan.html(data.data.upload_name); } }) } else { alert('请输入名称'); return false; } } }) }); 分组: $assignGroup.on('click', function () { var thisImageItem = $(this).parent().parent(), upload_id = $(this).parent().parent().data('upload_id'); assignGroup({ thisImageItem: thisImageItem, upload_id: upload_id }); }); 删除: $delete.on('click', function () { var thisImageItem = $(this).parent().parent(), upload_id = $(this).parent().parent().data('upload_id'); deleteImage({ thisImageItem: thisImageItem, upload_id: upload_id }); }); 获取分组数据: function initCategory() { $.post(SITE_URL + '?ctl=Seller_Album&met=getAlbumList&typ=json', {}, function (data) { if (data.status == 200) { var items = data.data.items; for (var i = 0; i < items.length; i++) { _page.$categoryList.append(' <li class="ui-tooltip ' + ( i == 0 ? 'active' : '') + '" data-album-id="' + items[i].album_id + '" data-tooltip-title="' + items[i].album_desc + '" data-tooltip-placement="left">' + '<span class="category-name">' + items[i].album_desc + '</span>' + '<span class="category-num">' + items[i].image_num + '</span>' + '</li>') } } else { alert('服务器响应失败'); } if(_page.firstPreview) { _page.firstPreview = false; initEvent(); } }) } 新增分组: _page.$addAlbum.on('click', function (e) { $.dialog({ title: '新增分组', content: '<div class="ui-popover-inner" style="min-width: auto; width: 180px;">' + '<div style="margin-bottom: 6px;">新增分组</div>' + '<div style="margin-bottom: 6px;">' + '<input class="js-name-input" type="text" value="" placeholder="" style=" width: 166px;">' + '</div>' + '</div>', width: 250, cancel: true, lock: true, ok: function () { var group_name = $(this.DOM.content).find('input').val(); if ( group_name == '' ) { Public.tips({ content: '请输入分组名称', type: 1}); return false; } else { $.post(SITE_URL + '?ctl=Seller_Album&met=addAlbum&typ=json', {album_desc: group_name}, function(data) { if ( data.status == 200 ) { Public.tips({content: data.msg, type: 3}); var $li = $('<li class="ui-tooltip" data-album-id="' + data.data.album_id + '" data-tooltip-title="' + data.data.album_desc + '" data-tooltip-placement="left">' + '<span class="category-name">' + data.data.album_desc + '</span>' + '<span class="category-num">0</span>' + '</li>'); $li.on('click', function(){ readAlbumImages({ album_id: $(this).data('album-id'), album_name: $(this).data('tooltip-title') }); }); _page.$categoryList.append($li); return false; } else { Public.tips({content: data.msg, type: 1}); } }) } } }) }); 删除图片: _page.$bulkRemove.on('click', function () { var flag = $(this).hasClass('c-gray'); if (!flag) { var upload_id = 0, upload_ids = [], imageItems = [], album_id = _page.$categoryList.find('.active').data('album-id'), imageList = $('input[name="image-box"]:checked'); for (var i = 0; i < imageList.length; i++) { upload_id = $(imageList[i]).parent().parent().parent().data('upload_id'); imageItems.push($(imageList[i]).parent().parent().parent()); upload_ids.push(upload_id); } deleteImage({ upload_id: upload_ids, thisImageItem: imageItems }); } }) 上传图片: _page.$uploadImage.on('click', function() { //获取当前相册id var album_id = _page.$categoryList.find('.active').data('album-id'); window.aloneImage = $.dialog({ title: '图片管理', content: 'url: ' + SITE_URL + '?ctl=Upload&met=image&typ=e', data: { callback: getImageList, album_id: album_id }, // height: 585, width: 900, max: !1, min: !1, cache: !1, lock: !0 }) });