diff --git a/templates/repo/cloudbrain/image/edit.tmpl b/templates/repo/cloudbrain/image/edit.tmpl
new file mode 100644
index 000000000..345627061
--- /dev/null
+++ b/templates/repo/cloudbrain/image/edit.tmpl
@@ -0,0 +1,112 @@
+
+ {{template "base/head" .}}
+
+
+ {{template "repo/header" .}}
+
+
+
+ {{template "base/footer" .}}
+
\ No newline at end of file
diff --git a/web_src/js/components/Images.vue b/web_src/js/components/Images.vue
index d0e9febbc..d27a12c1f 100644
--- a/web_src/js/components/Images.vue
+++ b/web_src/js/components/Images.vue
@@ -9,7 +9,8 @@
-
-
+ >
- {{ scope.row.name }}
+
-
- {{ scope.row.place }}
-
+ {{ scope.row.description}}
+
+ {{topic}}
+
- {{ scope.row.description | clearP }}
+ prop="type"
+ label="可用集群"
+ min-width="10%"
+ align="center"
+ >
+
+ {{scope.row.type | transformType}}
+
+
+ {{scope.row.isPrivate | transformPravite}}
+
+
+
+ min-width="14%"
+ >
- {{scope.row.createtime | transformTimestamp}}
+ {{scope.row.createdUnix | transformTimestamp}}
+
+
+
+
+
+
+
复制地址
+
+
+
+ 更多
+
+
+ 编辑
+ 删除
+
+
+
+
@@ -178,76 +190,93 @@
+ :total="totalNumCustom">
-
-
+
+
-
-
-
-
-
-
-
-
-
-
-
@@ -271,28 +300,38 @@ export default {
return {
activeName: 'first',
search:'',
- currentPage:1,
- pageSize:10,
- totalNum:0,
- params:{page:1,size:10,name:''},
- tableData: [],
- loading:false,
-
- currentPage1:1,
- pageSize1:10,
- totalNum1:0,
- params1:{page:1,size:10,name:''},
- tableData1: [],
- loading1:false
+ currentPagePublic:1,
+ pageSizePublic:15,
+ totalNumPublic:0,
+ paramsPublic:{page:1,pageSize:15,q:'',recommend:false},
+ tableDataPublic: [],
+ loadingPublic:false,
+
+ currentPageCustom:1,
+ pageSizeCustom:15,
+ totalNumCustom:0,
+ paramsCustom:{page:1,pageSize:15,q:''},
+ tableDataCustom: [],
+ loadingCustom:false,
+
+ currentPageStar:1,
+ pageSizeStar:15,
+ totalNumStar:0,
+ paramsStar:{page:1,pageSize:15,q:''},
+ tableDataStar: [],
+ loadingStar:false
};
},
methods: {
handleClick(tab, event) {
if(tab.name=="first"){
- this.getImageList()
+ this.getImageListPublic()
}
if(tab.name=="second"){
- this.getImageList1()
+ this.getImageListCustom()
+ }
+ if(tab.name=="third"){
+ this.getImageListStar()
}
},
@@ -303,51 +342,84 @@ export default {
}
},
- handleSizeChange(val){
- this.params.size = val
- this.getImageList()
+ handleSizeChangePublic(val){
+ this.paramsPublic.pageSize = val
+ this.getImageListPublic()
+
+
+ },
+ handleCurrentChangePublic(val){
+ this.paramsPublic.page = val
+ this.getImageListPublic()
+
+ },
+ handleSizeChangeCustom(val){
+ this.paramsCustom.pageSize = val
+ this.getImageListCustom()
},
- handleCurrentChange(val){
- this.params.page = val
- this.getImageList()
+ handleCurrentChangeCustom(val){
+ this.paramsCustom.page = val
+ this.getImageListCustom()
},
- handleSizeChange1(val){
- this.params1.size = val
- this.getImageList1()
+ handleSizeChangeStar(val){
+ this.paramsStar.pageSize = val
+ this.getImageListStar()
},
- handleCurrentChange1(val){
- this.params1.page = val
- this.getImageList1()
+ handleCurrentChangeStar(val){
+ this.paramsStar.page = val
+ this.getImageListStar()
},
- getImageList(){
- this.loading = true
- this.$axios.get('/images/public',{
- params:this.params
+ getImageListPublic(){
+ this.loadingPublic = true
+ 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
+ })
+ },
+
+ getImageListCustom(){
+ this.loadingCustom = true
+ this.$axios.get('/explore/images/custom',{
+ params:this.paramsCustom
}).then((res)=>{
console.log("res",res)
- this.totalNum = res.data.count
- this.tableData = res.data.rows
- this.loading = false
+ this.totalNumCustom = res.data.count
+ this.tableDataCustom = res.data.images
+ this.loadingCustom = false
})
},
- getImageList1(){
- this.loading1 = true
- this.$axios.get('/images/custom',{
- params:this.params1
+ getImageListStar(){
+ this.loadingStar = true
+ this.$axios.get('/explore/images/star',{
+ params:this.paramsStar
}).then((res)=>{
console.log("res",res)
- this.totalNum1 = res.data.count
- this.tableData1 = res.data.rows
- this.loading1 = false
+ this.totalNumStar = res.data.count
+ this.tableDataStar = res.data.images
+ this.loadingStar = false
+ })
+ },
+
+ deleteImage(id){
+ this.$axios.delete('/image/'+id).then((res)=>{
+ console.log(res)
+ this.getImageListCustom()
})
},
+ eidtImage(id){
+ location.href = `/image/${id}/imageSquare`
+ },
copyUrl(url){
const cInput = document.createElement('input')
cInput.value = url
@@ -355,38 +427,49 @@ export default {
cInput.select()
document.execCommand('Copy')
cInput.remove()
-
},
searchName(){
if(this.activeName=='first'){
- this.params.name = this.search
- this.params.page = 1
- this.getImageList()
+ this.paramsPublic.q = this.search
+ this.paramsPublic.page = 1
+ this.getImageListPublic()
}
if(this.activeName=='second'){
- this.params1.name = this.search
- this.params1.page = 1
- this.getImageList1()
+ this.paramsCustom.q = this.search
+ this.paramsCustom.page = 1
+ this.getImageListCustom()
+ }
+ if(this.activeName=='third'){
+ this.paramsStar.q = this.search
+ this.paramsStar.page = 1
+ this.getImageListStar()
}
}
},
filters:{
-
-
-
-
clearP(value){
if(!value) return ''
const reg = /\<\/?p\>/g;
value = value.replace(reg,'')
return value
-
+ },
+ transformType(val){
+ if(val==0){
+ return "GPU"
+ }
+ },
+ transformPravite(val){
+ if(val){
+ return "私有"
+ }else{
+ return "公开"
+ }
},
transformTimestamp(timestamp){
- let a = new Date(timestamp).getTime();
- const date = new Date(a);
+ // 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) + '-';
const D = (date.getDate() < 10 ? '0'+date.getDate() : date.getDate()) + ' ';
@@ -397,24 +480,26 @@ export default {
// console.log('dateString', dateString); // > dateString 2021-07-06 14:23
return dateString;
},
-
-
},
watch:{
search(val){
if(!val && this.activeName=='first'){
- this.params.name = val
- this.getImageList()
+ this.paramsPublic.q = val
+ this.getImageListPublic()
}
if(!val && this.activeName=='second'){
- this.params1.name = val
- this.getImageList1()
+ this.paramsCustom.q = val
+ this.getImageListCustom()
+ }
+ if(!val && this.activeName=='third'){
+ this.paramsStar.q = val
+ this.getImageListStar()
}
}
},
mounted() {
- this.getImageList()
+ this.getImageListPublic()
},
created() {
@@ -500,4 +585,22 @@ export default {
vertical-align: middle;
white-space: nowrap;
}
+.image_title{
+ display: inline-block;
+ width: 80%;
+ cursor: default;
+ color: rgb(66, 98, 144);
+}
+.image_desc{
+ -webkit-line-clamp: 2;
+ -webkit-box-orient: vertical;
+ display: -webkit-box;
+ text-overflow: ellipsis;
+ overflow: hidden;
+}
+.heart-stroke{
+ stroke: #666;
+ stroke-width: 2;
+ fill: #fff
+}