Browse Source

fix issue

tags/v1.22.4.1^2
zhoupzh 4 years ago
parent
commit
193f78a61b
2 changed files with 80 additions and 32 deletions
  1. +1
    -0
      templates/repo/cloudbrain/image/edit.tmpl
  2. +79
    -32
      web_src/js/components/Images.vue

+ 1
- 0
templates/repo/cloudbrain/image/edit.tmpl View File

@@ -27,6 +27,7 @@
<div class="ui attached segment" style="padding: 2em 3em;padding-bottom: 7rem;">
<form class="ui form" id="form_image">
{{.CsrfTokenHtml}}
<input type="hidden" name="id" value="{{.Image.ID}}">
<div class="inline field">
<label class="label_color" for="">{{$.i18n.Tr "dataset.dataset_available_clusters"}}</label>
<div class="ui basic label" style="border: none !important;color:#3291f8;">


+ 79
- 32
web_src/js/components/Images.vue View File

@@ -83,7 +83,7 @@
align="center"
>
<template slot-scope="scope">
<a :href="scope.row.userName" :title="scope.row.userName">
<a :href="'/' + scope.row.userName" :title="scope.row.userName">
<img :src="scope.row.relAvatarLink" class="ui avatar image">
</a>
</template>
@@ -105,8 +105,8 @@
>
<template slot-scope="scope">
<div style="display: flex;justify-content: flex-end;align-items: center;">
<div style="display: flex;align-items: center;cursor:pointer;padding: 0 1rem;" @click="imageStar(scope.row.id)">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke"><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg>
<div style="display: flex;align-items: center;cursor:pointer;padding: 0 1rem;" @click="imageStar(scope.$index,scope.row.id,scope.row.isStar)">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke" :class='{stars_active:scope.row.isStar}'><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg>
<span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
</div>
<span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" @click="copyUrl(scope.row.place)">复制地址</span>
@@ -212,7 +212,7 @@
>
<template slot-scope="scope">
<div style="display: flex;justify-content: flex-end;align-items: center;">
<div style="display: flex;align-items: center;cursor:pointer;padding: 0 1rem;" @click="imageStar(scope.$index,scope.row.id)">
<div style="display: flex;align-items: center;cursor: default;;padding: 0 1rem;">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke"><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg>
<span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
</div>
@@ -260,50 +260,84 @@
</div>
</div>
<el-row style="margin-top:15px;">
<el-table
:data="tableDataStar"

<el-table
:data="tableDataPublic"
style="width: 100%"
:header-cell-style="tableHeaderStyle"
:default-sort="{prop:'createtime',order:'descending'}">
>
<el-table-column
label="镜像名称"
width="350"
min-width="19%"
align="left"
prop="name"
sortable
prop="tag"
>
<template slot-scope="scope">
<a class="text-over" :title="scope.row.name" style="cursor:default;color:#426290">{{ scope.row.name }}</a>
<div style="display: flex;align-items: center;">
<a class="text-over image_title" :title="scope.row.tag">{{ scope.row.tag }}</a>
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="scope.row.isPrivate"></i>
</div>
</template>
</el-table-column>
<el-table-column
label="文件路径/镜像描述"
width="450"
label="镜像描述"
min-width="28%"
align="left"
prop="description"
>
<template slot-scope="scope">
<el-tooltip class="item" effect="dark" content="点击复制文件路径" placement="top">
<a class="text-over" style="display:block;" @click="copyUrl(scope.row.place)">{{ scope.row.place }}</a>
</el-tooltip>
<div class="image_desc" :title="scope.row.description">{{ scope.row.description}}</div>
<div v-if="!!scope.row.topics">
<span v-for="(topic,index) in scope.row.topics" class="ui repo-topic label topic">{{topic}}</span>
</div>
<span class="text-over" :title="scope.row.description | clearP">{{ scope.row.description | clearP }}</span>
</template>
</el-table-column>
<el-table-column
prop="provider"
label="提供者"
width="120"
align="left"
sortable>
prop="type"
label="可用集群"
min-width="10%"
align="center"
>
<template slot-scope="scope">
{{scope.row.type | transformType}}
</template>
</el-table-column>
<el-table-column
prop="creator"
label="创建者"
min-width="8%"
align="center"
>
<template slot-scope="scope">
<a :href="'/' + scope.row.userName" :title="scope.row.userName">
<img :src="scope.row.relAvatarLink" class="ui avatar image">
</a>
</template>
</el-table-column>
<el-table-column
prop="createtime"
prop="createdUnix"
label="创建时间"
align="center"
sortable>
min-width="14%"
>
<template slot-scope="scope">
{{scope.row.createdUnix | transformTimestamp}}
</template>
</el-table-column>
<el-table-column
align="center"
min-width="21%"
label="操作"
>
<template slot-scope="scope">
{{scope.row.createtime | transformTimestamp}}
<div style="display: flex;justify-content: flex-end;align-items: center;">
<div style="display: flex;align-items: center;cursor:default;padding: 0 1rem;">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke stars_active"><path d="M4.4 6.54c-1.761 1.643-2.6 3.793-2.36 6.056.24 2.263 1.507 4.521 3.663 6.534a29110.9 29110.9 0 0010.296 9.633l10.297-9.633c2.157-2.013 3.424-4.273 3.664-6.536.24-2.264-.599-4.412-2.36-6.056-1.73-1.613-3.84-2.29-6.097-1.955-1.689.25-3.454 1.078-5.105 2.394l-.4.319-.398-.319c-1.649-1.316-3.414-2.143-5.105-2.394a7.612 7.612 0 00-1.113-.081c-1.838 0-3.541.694-4.983 2.038z"></path></svg>
<span style="line-height: 2;margin-left:0.3rem;">{{scope.row.numStars}}</span>
</div>
<span style="padding: 0 1rem;color:#0366d6;cursor:pointer;" @click="copyUrl(scope.row.place)">复制地址</span>
</div>
</template>
</el-table-column>
</el-table>
@@ -471,12 +505,21 @@ export default {
eidtImage(id){
location.href = `/image/${id}/imageSquare`
},
imageStar(index,id){
console.log("===index",index,this.tableDataCustom[index])
this.$axios.put(`/image/${id}/action/star`).then((res)=>{
console.log(res)
this.tableDataCustom[index].numStars = this.tableDataCustom[index].numStars + 1
})
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
})
}
},
copyUrl(url){
const cInput = document.createElement('input')
@@ -661,4 +704,8 @@ export default {
stroke-width: 2;
fill: #fff
}
.stars_active{
fill: #FA8C16 !important;
stroke:#FA8C16 !important
}
</style>

Loading…
Cancel
Save