| @@ -193,13 +193,10 @@ export default { | |||
| handleSizeChangeCustom(val){ | |||
| this.paramsCustom.pageSize = val | |||
| this.getImageListCustom() | |||
| }, | |||
| handleCurrentChangeCustom(val){ | |||
| this.paramsCustom.page = val | |||
| this.getImageListCustom() | |||
| }, | |||
| getImageListCustom(){ | |||
| @@ -207,7 +204,6 @@ export default { | |||
| this.$axios.get('/admin/images/data',{ | |||
| params:this.paramsCustom | |||
| }).then((res)=>{ | |||
| console.log("res",res) | |||
| this.totalNumCustom = res.data.count | |||
| this.tableDataCustom = res.data.images | |||
| this.tableDataCustom.forEach(element => { | |||
| @@ -218,7 +214,6 @@ export default { | |||
| }) | |||
| }, | |||
| deleteImage(id){ | |||
| console.log("deleteImage") | |||
| let flag=1 | |||
| let _this = this | |||
| $('.ui.basic.modal.images') | |||
| @@ -228,7 +223,6 @@ export default { | |||
| }, | |||
| onApprove: function() { | |||
| _this.$axios.delete('/image/'+id).then((res)=>{ | |||
| console.log(res) | |||
| _this.getImageListCustom() | |||
| }) | |||
| flag = true | |||
| @@ -249,13 +243,11 @@ export default { | |||
| imageStar(index,id,isStar){ | |||
| if(isStar){ | |||
| this.$axios.put(`/image/${id}/action/unstar`).then((res)=>{ | |||
| console.log(res) | |||
| this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars - 1 | |||
| this.tableDataPublic[index].isStar = false | |||
| }) | |||
| }else{ | |||
| this.$axios.put(`/image/${id}/action/star`).then((res)=>{ | |||
| console.log(res) | |||
| this.tableDataPublic[index].numStars = this.tableDataPublic[index].numStars + 1 | |||
| this.tableDataPublic[index].isStar = true | |||
| }) | |||
| @@ -278,25 +270,20 @@ export default { | |||
| }, | |||
| setRecommend(index,id){ | |||
| this.$axios.put(`/admin/image/${id}/action/recommend`).then((res)=>{ | |||
| console.log(res) | |||
| this.tableDataCustom[index].type = 5 | |||
| }) | |||
| }, | |||
| unSetRecommend(index,id){ | |||
| this.$axios.put(`/admin/image/${id}/action/unrecommend`).then((res)=>{ | |||
| console.log(res) | |||
| this.tableDataCustom[index].type = 0 | |||
| }) | |||
| }, | |||
| handleCommand(command){ | |||
| console.log(command) | |||
| this.dropdownPrivate = command.label | |||
| this.paramsCustom.private = command.private | |||
| this.getImageListCustom() | |||
| } | |||
| }, | |||
| filters:{ | |||
| transformType(val){ | |||
| @@ -312,7 +299,6 @@ export default { | |||
| } | |||
| }, | |||
| transformTimestamp(timestamp){ | |||
| // let a = new Date(timestamp).getTime(); | |||
| const date = new Date(parseInt(timestamp) * 1000); | |||
| const Y = date.getFullYear() + '-'; | |||
| const M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-'; | |||
| @@ -321,7 +307,6 @@ export default { | |||
| const m = (date.getMinutes() <10 ? '0'+date.getMinutes() : date.getMinutes()) + ':' ; | |||
| const s = (date.getSeconds() <10 ? '0'+date.getSeconds() : date.getSeconds()) ; // 秒 | |||
| const dateString = Y + M + D + h + m + s; | |||
| // console.log('dateString', dateString); // > dateString 2021-07-06 14:23 | |||
| return dateString; | |||
| }, | |||
| }, | |||
| @@ -225,7 +225,6 @@ export default { | |||
| this.$axios.get('/explore/images/public',{ | |||
| params:this.paramsPublic | |||
| }).then((res)=>{ | |||
| console.log("res",res.data) | |||
| this.totalNumPublic = res.data.count | |||
| this.tableDataPublic = res.data.images | |||
| this.loadingPublic = false | |||
| @@ -237,7 +236,6 @@ export default { | |||
| this.$axios.get('/explore/images/custom',{ | |||
| params:this.paramsCustom | |||
| }).then((res)=>{ | |||
| console.log("res",res) | |||
| this.totalNumCustom = res.data.count | |||
| this.tableDataCustom = res.data.images | |||
| this.tableDataCustom.forEach(element => { | |||
| @@ -253,7 +251,6 @@ export default { | |||
| this.$axios.get('/explore/images/star',{ | |||
| params:this.paramsStar | |||
| }).then((res)=>{ | |||
| console.log("res",res) | |||
| this.totalNumStar = res.data.count | |||
| this.tableDataStar = res.data.images | |||
| this.loadingStar = false | |||
| @@ -75,16 +75,9 @@ export default async function initImage(){ | |||
| type:'POST', | |||
| data:formData, | |||
| success:function(res){ | |||
| console.log("res",res) | |||
| if(res.Code===1){ | |||
| $('.ui.info.message').text(res.Message).show().delay(1500).fadeOut(); | |||
| }else if(res.Code==0){ | |||
| // if(link.indexOf('commit_image')===1){ | |||
| // $('.ui.positive.message').text('保存镜像成功').show().delay(1500).fadeOut(); | |||
| // }else{ | |||
| // $('.ui.positive.message').text('提交镜像成功').show().delay(1500).fadeOut(); | |||
| // } | |||
| }else if(res.Code==0){ | |||
| if(location.href.indexOf('imageAdmin')!==-1){ | |||
| location.href = `${window.config.AppSubUrl}/admin/images` | |||
| }else{ | |||
| @@ -95,8 +88,6 @@ export default async function initImage(){ | |||
| error: function(xhr){ | |||
| // 隐藏 loading | |||
| // 只有请求不正常(状态码不为200)才会执行 | |||
| // $('.ui.error.message').text(xhr.responseText) | |||
| // $('.ui.error.message').css('display','block') | |||
| $('.ui.negative.message').html(xhr.responseText).show().delay(1500).fadeOut(); | |||
| }, | |||
| complete:function(xhr){ | |||
| @@ -124,11 +115,7 @@ export default async function initImage(){ | |||
| topics:$("input[name='topics']").val(), | |||
| id:$("input[name='id']").val() | |||
| } | |||
| console.log(postData) | |||
| let formData = $params(postData) | |||
| console.log(formData) | |||
| console.log() | |||
| if($("input[name='edit']").val()=="edit"){ | |||
| postImage(formData) | |||
| } | |||
| @@ -138,7 +125,6 @@ export default async function initImage(){ | |||
| type:'POST', | |||
| data:formData, | |||
| success:function(res){ | |||
| console.log("res",res) | |||
| if(res.Code===1){ | |||
| $('.ui.modal.image_confirm_submit') | |||
| .modal({ | |||
| @@ -169,12 +155,9 @@ export default async function initImage(){ | |||
| location.href = `${window.config.AppSubUrl}/admin/images` | |||
| } | |||
| }) | |||
| console.log("initImage") | |||
| function initVueImages() { | |||
| const el = document.getElementById('images'); | |||
| console.log(el) | |||
| if (!el) { | |||
| return; | |||
| } | |||
| @@ -186,8 +169,6 @@ export default async function initImage(){ | |||
| } | |||
| function initVueAdminImages() { | |||
| const el = document.getElementById('images-admin'); | |||
| console.log(el) | |||
| if (!el) { | |||
| return; | |||
| } | |||
| @@ -199,8 +180,6 @@ export default async function initImage(){ | |||
| } | |||
| function initVueselectImages() { | |||
| const el = document.getElementById('images-new-cb'); | |||
| console.log(el) | |||
| if (!el) { | |||
| return; | |||
| } | |||