!function(){var e=require("nw.gui").Window.get(),t=localStorage.getItem("token"),s=localStorage.getItem("sys_user_id");const a=axios.create();a.interceptors.request.use(e=>(e.headers.x_platform="PC_HELPER",e.params.platform="PC_HELPER",e));var o=new Vue({el:"#root",data:{albums:[],currentSelectAlbum:"",searchCode:"",currentPage:1,totalAlbumsCount:0,choosedAlbums:[],loading:!1},watch:{currentPage:e=>{o.loadAlbums()}},methods:{closeWindow:function(){e.close()},minifyWindow:function(){e.minimize()},loadAlbums:()=>{6==o.searchCode.length?o.search():(o.choosedAlbums.splice(0),o.currentSelectAlbum="",o.loading=!0,console.log("加载相册列表"),a.get("https://int.xxpie.com/api/pm/queryAlbumsPg",{params:{page_no:o.currentPage,page_size:5e4,token:t,type:"PHOTO_ALBUM"}}).then(e=>{200===e.status&&(data=e.data,o.totalAlbumsCount=data.result.count,allIds=global.albums.map(e=>e.id),1===o.currentPage?(o.albums=[],data.result.albums.sort((e,t)=>e.create_time<t.create_time?1:-1).forEach(e=>{if(!allIds.includes(e.shoot_task_id)){var t={create_by:s,date_time:e.create_time,id:e.shoot_task_id,invitation_code:e.invitation_code,name:e.task_name,choosen:!1,noPermission:0===e.access_album_permission};o.albums.push(t)}})):o.albums=o.albums.concat(data.result)),o.loading=!1}).catch(t=>{o.loading=!1,t.response&&403===t.response.status&&(global.emitter.emit("tokenInvalid"),e.close())}))},maxifyWindow:function(){},refresh:()=>{o.albums.splice(0),o.loadAlbums()},select:(e,t)=>{t.noPermission?alert(t.name+": 主账号会员已过期, 无权限处理此相册"):t.choosen?(console.log("取消选中"+t.name),o.choosedAlbums.includes(t)&&(i=o.choosedAlbums.indexOf(t),o.choosedAlbums.splice(i,1),0===o.choosedAlbums.length&&(o.currentSelectAlbum=""))):(console.log("选中了"+t.name),o.choosedAlbums.includes(t)||(o.choosedAlbums.push(t),o.currentSelectAlbum=t))},search:()=>{0!==o.searchCode.length?(o.albums.splice(0),o.choosedAlbums.splice(0),o.currentSelectAlbum="",o.loading=!0,a.get("https://int.xxpie.com/api/pm/queryAlbumByRetouchCode",{params:{retouch_code:o.searchCode,token:t}}).then(e=>{200===e.status&&e.data.result.shoot_task_id?o.albums=[{id:e.data.result.shoot_task_id,name:e.data.result.task_name,date_time:e.data.result.create_time?e.data.result.create_time:e.data.result.plan_shoot_time,invitation_code:e.data.result.invitation_code,create_by:e.data.result.create_by}]:o.albums=[],o.loading=!1}).catch(t=>{o.loading=!1,t.response&&403===t.response.status&&(global.emitter.emit("tokenInvalid"),e.close())})):o.refresh()},cancel:()=>{e.close()},confirm:()=>{global.emitter.emit("choosedAlbum",o.choosedAlbums),e.close()},formatDtt:(e,t)=>{var s={"M+":t.getMonth()+1,"d+":t.getDate(),"h+":t.getHours(),"m+":t.getMinutes(),"s+":t.getSeconds(),"q+":Math.floor((t.getMonth()+3)/3),S:t.getMilliseconds()};for(var a in/(y+)/.test(e)&&(e=e.replace(RegExp.$1,(t.getFullYear()+"").substr(4-RegExp.$1.length))),s)new RegExp("("+a+")").test(e)&&(e=e.replace(RegExp.$1,1==RegExp.$1.length?s[a]:("00"+s[a]).substr((""+s[a]).length)));return e}}});o.loadAlbums()}();