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