Browse Source

fix issue

tags/v1.22.3.2^2
zhoupzh 3 years ago
parent
commit
ec8df448ce
6 changed files with 466 additions and 45 deletions
  1. +51
    -0
      templates/explore/dataset_left.tmpl
  2. +163
    -9
      templates/explore/datasets.tmpl
  3. +98
    -0
      templates/repo/attachment/edit.tmpl
  4. +10
    -6
      templates/repo/datasets/create.tmpl
  5. +28
    -18
      templates/repo/datasets/index.tmpl
  6. +116
    -12
      web_src/js/index.js

+ 51
- 0
templates/explore/dataset_left.tmpl View File

@@ -0,0 +1,51 @@
<div class="computer only four wide computer column">
<div class="ui grid">
<div class="ui sixteen wide column">
<h2 class="ui medium header" style="margin-top: 0;visibility: hidden;" >
{{.i18n.Tr "datasets"}}
</h2>
<div id="task-square-range-value" style="display: none;">
{{range $task := tasks}}
<div class="item" data-task='{{$.i18n.Tr (printf "dataset.task.%s" $task)}}'></div>
{{end}}
</div>
<div id="licenses-square-range-value" style="display: none;">
{{range $license := licenses}}
<div class="item" data-license="{{$license}}"></div>
{{end}}
</div>
<div class="mg-b-2">
<div class="flex mg-b-1">
<h3 class="font-medium">{{.i18n.Tr "dataset.category"}}</h3>
</div>
<div class="flex flex-wrap">
{{range $category := categories}}
<a class="tag tag-red"><span>{{$.i18n.Tr (printf "dataset.category.%s" $category)}}</span></a>
{{end}}
</div>
</div>
<div class="mg-b-2">
<div class="flex mg-b-1">
<h3 class="font-medium">{{.i18n.Tr "dataset.task"}}</h3>
</div>
<div class="flex flex-wrap history-content">
{{range $task := tasks}}
<a class="tag tag-purple"><span>{{$.i18n.Tr (printf "dataset.task.%s" $task)}}</span></a>
{{end}}
</div>
</div>
<div class="mg-b-2">
<div class="flex mg-b-1">
<h3 class="font-medium">{{.i18n.Tr "dataset.license"}}</h3>
</div>
<div class="flex flex-wrap">
{{range $license := licenses}}
<a class="tag tag-red"><span>{{$license}}</span></a>
{{end}}
</div>
</div>

</div>
</div>
</div>

+ 163
- 9
templates/explore/datasets.tmpl View File

@@ -1,17 +1,171 @@
{{template "base/head" .}}
<style>
.mg-b-1{
margin-bottom: 1rem;
}
.mg-b-2{
margin-bottom: 2rem;
}

.flex{
display: flex;
}
.font-medium{
font-weight: 500;
}
.flex-wrap{
flex-wrap: wrap;
}
.tag {
background-image: linear-gradient(to bottom,var(--tw-gradient-stops));
border-color: transparent;
border-radius: 0.5rem;
border-width: 1px;
font-size: .875rem;
line-height: 1.25rem;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.tag-red {
--tw-gradient-from: #fef2f2;
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,hsla(0,86%,97%,0));
--tw-gradient-to: #fef2f2;
--tw-text-opacity: 1;
color: rgba(153,27,27,var(--tw-text-opacity));
}
.tag-purple {
--tw-gradient-from: #f5f3ff;
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,rgba(245,243,255,0));
--tw-gradient-to: #f5f3ff;
--tw-text-opacity: 1;
color: rgba(91,33,182,var(--tw-text-opacity));
}
.tag-blue {
--tw-gradient-from: #eff6ff;
--tw-gradient-stops: var(--tw-gradient-from),var(--tw-gradient-to,rgba(239,246,255,0));
--tw-gradient-to: #eff6ff;
--tw-text-opacity: 1;
color: rgba(30,64,175,var(--tw-text-opacity));
}
.tag {
align-items: center;
display: inline-flex;
flex: none;
height: 2rem;
margin-bottom: 0.35rem;
margin-right: 0.35rem;
max-width: 100%;
}
.tag>span {
padding: 0.75rem;
font-size: 14px;
}
.repo_dataset_header{
font-size: 12px;
color: #3291F8;
}
.heart-stroke{
stroke: #666;
stroke-width: 2;
fill: #fff
}
.stars_active{
fill: #FA8C16 !important;
stroke:#FA8C16 !important
}
</style>
<div class="explore repositories">
{{template "explore/dataset_search" .}}
<div class="ui container">
<div class="ui grid">
{{template "explore/navbar" .}}
<div class="ui sixteen wide mobile ten wide tablet ten wide computer column">
{{template "explore/dataset_list" .}}
{{template "base/paginate" .}}
</div>
<div class="ui sixteen wide mobile six wide tablet three wide computer column">
{{template "explore/repo_right" .}}
<div id="dataset-base">
<div class="ui container">
<div class="ui grid">
{{template "explore/dataset_left" .}}
<div class="ui sixteen wide mobile sixteen wide tablet twelve wide computer column">
<div class="ui row">
<h2 class="ui left floated medium header">
{{.i18n.Tr "datasets"}}
</h2>
<div class="ui right floated secondary filter menu">
<!-- Sort -->
<div class="ui right dropdown type jump item">
<span class="text">
{{.i18n.Tr "repo.issues.filter_sort"}}
<i class="dropdown icon"></i>
</span>
<div class="menu">
<a class="{{if eq .SortType "newest"}}active{{end}} item" href="{{$.Link}}?sort=newest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.latest"}}</a>
<a class="{{if eq .SortType "oldest"}}active{{end}} item" href="{{$.Link}}?sort=oldest&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.oldest"}}</a>
<a class="{{if eq .SortType "recentupdate"}}active{{end}} item" href="{{$.Link}}?sort=recentupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.recentupdate"}}</a>
<a class="{{if eq .SortType "leastupdate"}}active{{end}} item" href="{{$.Link}}?sort=leastupdate&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.leastupdate"}}</a>
<a class="{{if eq .SortType "downloadtimes"}}active{{end}} item" href="{{$.Link}}?sort=downloadtimes&q={{$.Keyword}}&tab={{$.TabName}}">{{.i18n.Tr "repo.issues.filter_sort.downloadtimes"}}</a>
</div>
</div>
</div>
</div>
{{if .Datasets}}
<div id="datasets-square-range-value" style="display: none;">
{{range .Datasets}}
<div class="item" data-num-stars="{{.NumStars}}" data-star-active="{{.IsStaring}}"></div>
{{end}}
</div>
{{end}}

<div class="ui row" style="clear: both;">
<div class="ui two cards">
{{range $k, $v :=.Datasets}}
<div class="ui card" @click="gotoDataset('{{.Repo.Link}}/datasets')" style="cursor: pointer;">
<div class="content">
<div class="repo_dataset_header" style="display: flex;align-items: center;justify-content: space-between;">
<a href="{{.Repo.Link}}/datasets" style="font-size: 12px;color: #3291F8;height: 24px;">{{.Repo.OwnerName}} / {{.Repo.Alias}}</a>
<span style="display: flex;align-items: center;justify-content: flex-end;cursor: pointer;" @click.stop="postSquareStar({{.ID}},'{{.Repo.Link}}/datasets',{{$k}})">
<div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke" :class='{stars_active:starActives[{{$k}}]}'><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>
<span style="line-height: 1;color: #101010;">${starItems[{{$k}}]}</span>
</span>
</div>
<div style="font-size: 16px;color:#0366D6;font-family: SourceHanSansSC-medium;height: 27px;">{{.Title}}</div>
<div style="font-size: 12px;margin-top: 5px;height: 24px;">
{{if .Task}}
<span class="ui repo-topic label topic" href="{{AppSubUrl}}/explore/repos?q={{.Task}}&topic=">{{.Task}}</span>
{{end}}
{{if .Category}}
<span class="ui repo-topic label topic" href="{{AppSubUrl}}/explore/repos?q={{.Category}}&topic=">{{.Category}}</span>
{{end}}
{{if .License}}
<span class="ui repo-topic label topic" href="{{AppSubUrl}}/explore/repos?q={{.License}}&topic=">{{.License}}</span>
{{end}}
</div>
<div class="description" style="-webkit-box-orient: vertical;-webkit-line-clamp: 2;display: -webkit-box;overflow: hidden;color:#999999;font-size: 14px;margin-top: 10px;">
<p>{{.Description}}</p>
</div>
</div>
<div class="extra content">
<div style="display: flex;align-items: center;">
<a href="{{.Repo.OwnerName}}" title="{{.Repo.OwnerName}}">
<img class="ui avatar image" style="width: 22px;height:22px;" src="/user/avatar/{{.Repo.OwnerName}}/-1">
</a>
<span style="color: #999999;font-size: 14px;;">创建于:{{TimeSinceUnix1 .CreatedUnix}}</span>
</div>
</div>
</div>
{{end}}

</div>
</div>
</div>
</div>
</div>
</div>
</div>
{{template "base/footer" .}}
<script>

console.log({{.Datasets}});
</script>

+ 98
- 0
templates/repo/attachment/edit.tmpl View File

@@ -0,0 +1,98 @@
<style>
.active{
color: #0087f5!important;
border: 1px solid #0087f5!important;
/* margin: -1px!important; */
background: #fff!important;
}
</style>
{{template "base/head" .}}
<div class="repository">
{{template "repo/header" .}}
<div class="ui container">
<input type="hidden" id="postPath" value="{{.Link}}">
<div style="width: 80%;margin: auto;">
<h4 class="ui top attached header">
上传数据集文件
</h4>
<div class="ui attached segment" style="padding: 2em 3em;">
<div class="ui form" id="dataset-base">
<el-form label-width="140px">
{{.CsrfTokenHtml}}
<el-form-item label="存储位置:" prop="title">
<el-button :class="{active:type==0}" size="small" style="margin: 0;border-radius: 0.28571429rem 0 0 0.28571429rem;" @click="uploadGpu">CPU/GPU</el-button>
<el-button :class="{active:type==1}" size="small" style="margin: 0 0 0 -4px;border-radius: 0 0.28571429rem 0.28571429rem 0;" @click="uploadNpu">NPU</el-button>
<!-- <span>请输入字母、数字、_和-,最长64个字符,且不能以中划线(-)结尾。</span> -->
</el-form-item>
<el-form-item label="文件描述:" prop="description">
<el-input type="textarea" :rows="3" maxlength="255" v-model="desc"></el-input>
</el-form-item>
<el-form-item label="数据上传:" prop="category">
<minio-uploader :uploadtype="type" :desc="desc"></minio-uploader>
<!-- <obs-uploader v-if="type==1"></obs-uploader> -->
</el-form-item>
<!-- <el-form-item label="研究方向/应用领域" prop="task">
<el-select v-model="ruleForm.task" placeholder="请选择活动区域" style="width: 60%;">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
</el-select>
</el-form-item> -->
<!-- <el-form-item>
<el-button style="background-color: #21ba45;" type="success" @click="createDataset('ruleForm')">确定</el-button>
<el-button type="info" @click="cancelDataset">取消</el-button>
</el-form-item> -->
<div style='display:none;'
id="minioUploader-params"
data-uuid="{{.uuid}}"
data-add-url="{{.Repo.OwnerName}}/attachments/add"
data-accepts="{{.AttachmentAllowedTypes}}"
data-remove-url="{{AppSubUrl}}/attachments/delete"
data-csrf="{{.CsrfToken}}"
dataset-id={{.dataset.ID}}
data-max-file="100"
data-dataset-id="{{.dataset.ID}}"
data-max-size="{{.AttachmentMaxSize}}"
data-default-message="{{.i18n.Tr "dropzone.default_message"}}"
data-invalid-input-type="{{.i18n.Tr "dropzone.invalid_input_type"}}"
data-file-too-big="{{.i18n.Tr "dropzone.file_too_big"}}"
data-remove-file="{{.i18n.Tr "dropzone.remove_file"}}"
data-file-status='{{.i18n.Tr "dropzone.file_status"}}'
data-file-init-status='{{.i18n.Tr "dropzone.file_init_status"}}'
data-waitting-uploading='{{.i18n.Tr "dropzone.waitting_uploading"}}'
data-md5-computing='{{.i18n.Tr "dropzone.md5_computing"}}'
data-obs-connecting='{{.i18n.Tr "dropzone.obs-connecting"}}'
data-loading-file='{{.i18n.Tr "dropzone.loading_file"}}'
data-upload-complete='{{.i18n.Tr "dropzone.upload_complete"}}'
data-uploading='{{.i18n.Tr "dropzone.uploading"}}'
data-failed='{{.i18n.Tr "dropzone.failed"}}'
data-repopath='{{AppSubUrl}}/{{.Repo.OwnerName}}/{{.Repo.Name}}/datasets'
>
</div>
<div id="datasetId" datasetId="{{.datasetId}}"></div>
</el-form>
</div>
</div>
</div>
<div style="width: 80%;margin: auto;padding-top: 2em;">
<!-- <p>说明:<br>
- 只有<span class="text blue">zip格式</span>zip格式的数据集才能发起云脑任务;<br>
- 云脑1提供 <span class="text blue">CPU / GPU</span> 资源,云脑2提供 <span class="text blue">Ascend NPU</span> 资源;调试使用的数据集也需要上传到对应的环境。
</p> -->
<p style="color: 505559;">说明:</p>
<p style="line-height: 1.5;color: #101010;">只有<span class="text red">zip格式</span>的数据集才能发起云脑任务;</br>
云脑1提供CPU / GPU资源,云脑2提供Ascend NPU资源;调试使用的数据集也需要上传到对应的环境;</p>
</div>
</div>
</div>
{{template "base/footer" .}}
<script>
console.log({{.datasetId}})
console.log({{.Repo}})
</script>

+ 10
- 6
templates/repo/datasets/create.tmpl View File

@@ -36,20 +36,24 @@
</el-form-item>
<el-form-item label="分类" prop="category">
<el-select v-model="ruleForm.category" placeholder="请选择活动区域" style="width: 60%;">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
{{range $category := categories}}
<el-option label='{{$.i18n.Tr (printf "dataset.category.%s" $category)}}' value='{{$.i18n.Tr (printf "dataset.category.%s" $category)}}'></el-option>
{{end}}
</el-select>
</el-form-item>
<el-form-item label="研究方向/应用领域" prop="task">
<el-select v-model="ruleForm.task" placeholder="请选择活动区域" style="width: 60%;">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
{{range $task := tasks}}
<el-option label='{{$.i18n.Tr (printf "dataset.task.%s" $task)}}' value='{{$.i18n.Tr (printf "dataset.task.%s" $task)}}'></el-option>
{{end}}
</el-select>
</el-form-item>
<el-form-item label="授权许可" prop="license">
<el-select v-model="ruleForm.license" placeholder="请选择活动区域" style="width: 60%;">
<el-option label="区域一" value="shanghai"></el-option>
<el-option label="区域二" value="beijing"></el-option>
{{range $license := licenses}}
<el-option label='{{$license}}' value='{{$license}}'></el-option>
{{end}}
</el-select>
</el-form-item>
<el-form-item>


+ 28
- 18
templates/repo/datasets/index.tmpl View File

@@ -112,7 +112,7 @@
<div class="column thirteen wide"><h2>{{.dataset.Title}}</h2></div>
<div class="column three wide right aligned">
<span style="display: flex;align-items: center;justify-content: flex-end;height: 36px;">
<div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;padding: 0 10px;" @click="postStar({{.dataset.ID}},'{{.Link}}',{{$.IsStaringDataset}})">
<div style="line-height: 1;margin-right: 4px;margin-bottom: -2px;padding: 0 10px;" @click="postStar({{.dataset.ID}},'{{.Link}}')">
<svg width="1.4em" height="1.4em" viewBox="0 0 32 32" class="heart-stroke" :class='{stars_active:star_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>
</div>
@@ -147,11 +147,11 @@
<div class="row">
<div class="column ten wide"></div>
<div class="column six wide right aligned">
<el-select v-model="datasetType" style="width: 40%;" size="small">
<el-select v-model="datasetType" style="width: 40%;" size="small" @change="changeDatasetType">
<i slot="prefix" style="display: inline-block;color: #101010;" class="el-input__icon ri-archive-drawer-line"></i>
<el-option label="全部" value="all"></el-option>
<el-option label="CPU/GPU" value="CPU/GPU"></el-option>
<el-option label="NPU" value="NPU"></el-option>
<el-option label="全部" value="-1"></el-option>
<el-option label="CPU/GPU" value="0"></el-option>
<el-option label="NPU" value="1"></el-option>
</el-select>
<el-button icon="el-icon-upload" type="primary" size="small" @click="gotoUpload({{.dataset.ID}})">上传</el-button>
</div>
@@ -184,13 +184,13 @@
</div>
</div>
</div>
{{range $k, $v :=.dataset.Attachments}}
{{range $k, $v :=.Attachments}}
<div class="ui grid stackable item" id="{{.FileChunk.UUID}}">
<div class="row">
<!-- 数据集名称 -->

<div class="four wide column" style="display: flex;align-items: center;">
<a class="dataset_title title" href="javascript:void(0)" title="{{.Name}}">
<a class="dataset_title title" href="{{.DownloadURL}}" title="{{.Name}}">
{{.Name}}
</a>
<i class="ri-lock-2-line" style="color: #fa8c16;" v-if="privates[{{$k}}]"></i>
@@ -199,13 +199,20 @@
{{.Size | FileSize}}
</div>
<div class="two wide column text center">
{{.Type}}
{{.Type | AttachmentResourceType}}
</div>
<div class="one wide column text center">
{{.IsPrivate}}
{{$x:=.IsPrivate | AttachmentStatus}}
<span style="color: #fa8c16;" v-if="privates[{{$k}}]">{{$.i18n.Tr "home.show_private"}}</span>
<span style="color: #13c28d;" v-else="privates[{{$k}}]">{{$.i18n.Tr "org.settings.visibility.public"}}</span>
</div>
<div class="one wide column text center">
创建者
{{if .Uploader.Name}}
<a href="{{AppSubUrl}}/{{.Uploader.Name}}" title="{{.Uploader.Name}}"><img class="ui avatar image" src="{{AppSubUrl}}/user/avatar/{{.Uploader.Name}}/-1"></a>
{{else}}
<a title="Ghost"><img class="ui avatar image" src="{{AppSubUrl}}/user/avatar/Ghost/-1"></a>
{{end}}
</div>
<div class="three wide column text center">
{{.CreatedUnix | TimeSinceUnix1}}
@@ -224,9 +231,13 @@
</el-popover>
</el-button> -->
<div class="ui compact buttons">
<a class="ui basic blue button">下载</a>
<a class="ui basic blue button">预览</a>
<a class="ui basic blue button">标注</a>
<a class="ui basic blue button" href="{{.DownloadURL}}">下载</a>
{{if eq .DecompressState 1}}
<a class="ui basic blue button" href="datasets/dirs/{{.UUID}}?type={{$.Type}}" data-tooltip='{{$.i18n.Tr "dataset.directory"}}'>预览</a>
{{end}}
{{if $.IsSigned}}
<a class="ui basic blue button" href="datasets/label/{{.UUID}}?type={{$.Type}}" data-tooltip='{{$.i18n.Tr "dataset.create_label_task"}}'>标注</a>
{{end}}
<a class="ui basic blue button">
<el-dropdown size="medium">
<span class="el-dropdown-link">
@@ -235,18 +246,16 @@
<el-dropdown-menu slot="dropdown">
<el-dropdown-item class="clipboard" data-clipboard-text="{{.DownloadURL}}" data-clipboard-action="copy">复制下载链接</el-dropdown-item>
<el-dropdown-item class="clipboard" data-clipboard-text="{{.FileChunk.Md5}}" data-clipboard-action="copy">复制文件MD5</el-dropdown-item>
{{if .CanDel}}
<el-dropdown-item style="color: #13c28d;" @click.native="setPrivate('{{.FileChunk.UUID}}',false,{{$k}})" v-if="privates[{{$k}}]">设为公有</el-dropdown-item>
<el-dropdown-item style="color: #fa8c16;" @click.native="setPrivate('{{.FileChunk.UUID}}',true,{{$k}})" v-else="privates[{{$k}}]">设为私有</el-dropdown-item>
<el-dropdown-item>修改描述</el-dropdown-item>
<el-dropdown-item @click.native="gotoDatasetEidt({{.ID}})">修改描述</el-dropdown-item>
<el-dropdown-item style="color: red;" @click.native="delDataset('{{.FileChunk.UUID}}')">删除</el-dropdown-item>
{{end}}
</el-dropdown-menu>
</el-dropdown>
</a>

</div>
</div>
</div>
</div>
@@ -306,4 +315,5 @@ $('#dataset-range-value').find('.item').each(function(){
})
console.log(items)
console.log({{$.IsStaringDataset}})
console.log({{.Attachments}})
</script>

+ 116
- 12
web_src/js/index.js View File

@@ -3682,6 +3682,22 @@ function initVueDataset() {
ruleForm._csrf = csrf
}
console.log(ruleForm)
const starItems = []
const starActives = []
$('#datasets-square-range-value').find('.item').each(function(){
starItems.push($(this).data('num-stars'))
starActives.push($(this).data('star-active'))
})
const taskLists = []
const licenseLists = []
$('#task-square-range-value').find('.item').each(function(){
taskLists.push($(this).data('task'))
})
$('#task-square-range-value').find('.item').each(function(){
licenseLists.push($(this).data('license'))
})


// getEditInit(){
// if($('#dataset-edit-value')){
// $this = $('#dataset-edit-value')
@@ -3701,8 +3717,16 @@ function initVueDataset() {
url:'',
type:0,
desc:'',
datasetType:'全部',
datasetType:'',
privates:[],
starItems:[],
starActives:[],
taskLists:[],
taskShow:[],
licenseLists:[],
licenseShow:[],
hasMoreBthHis: false,
showMoreHis:false,
star_active:false,
num_stars:0,
ruleForm:{
@@ -3755,6 +3779,19 @@ function initVueDataset() {
ObsUploader
},
mounted(){
// if(document.getElementById('postPath')){
// this.url = document.getElementById('postPath').value
// }
// this.privates = items
// this.num_stars = num_stars
// this.star_active = star_active
// this.ruleForm1 = ruleForm
// // this.getEditInit()
// this.getTypeList()
this.toggleHistoryData() //数据处理
},
created(){
if(document.getElementById('postPath')){
this.url = document.getElementById('postPath').value
}
@@ -3762,9 +3799,12 @@ function initVueDataset() {
this.num_stars = num_stars
this.star_active = star_active
this.ruleForm1 = ruleForm
// this.getEditInit()

this.getTypeList()
this.starItems = starItems
this.starActives = starActives
this.taskLists = taskLists
this.licenseLists = licenseLists
},
methods:{
createDataset(formName){
@@ -3802,6 +3842,10 @@ function initVueDataset() {
gotoUpload(datsetId){
location.href = `${AppSubUrl}/attachments/upload?datasetId=${datsetId}`
},
gotoDataset(datsetUrl){
console.log(datsetUrl)
location.href = datsetUrl
},
uploadGpu(){
this.type=0
},
@@ -3871,31 +3915,91 @@ function initVueDataset() {
})

},
postStar(id,link,IsStaringDataset){
console.log(id,link,IsStaringDataset)
if(IsStaringDataset){
postStar(id,link){
console.log(id,link)
if(this.star_active){
let url = link+'/'+ id + '/unstar'
this.$axios.put(url).then((res)=>{
console.log(res)
if(res.Code===0){
this.num_stars = this.num_stars + 1
if(res.data.Code===0){
this.star_active = false
this.num_stars = this.num_stars -1
}
})
}else{
let url = link+'/'+ id + '/star'
this.$axios.put(url).then((res)=>{
console.log(res)
this.star_active = true
if(res.Code===0){
if(res.data.Code===0){
this.star_active = true
this.num_stars = this.num_stars + 1
}
})
}
},
postSquareStar(id,link,index){
console.log(id,link,index)
if(this.starItems[index]){
let url = link+'/'+ id + '/unstar'
this.$axios.put(url).then((res)=>{
console.log(res)
if(res.data.Code===0){
this.$set(this.starActives,index,false)
this.$set(this.starItems,index,this.starItems[index]-1)
}
})
}else{
let url = link+'/'+ id + '/star'
this.$axios.put(url).then((res)=>{
console.log(res)
if(res.data.Code===0){
this.$set(this.starActives,index,true)
this.$set(this.starItems,index,this.starItems[index]+1)
}
})
}
},
getTypeList(){
const params = new URLSearchParams(window.location.search)
console.log("init---",window.location.search && params.has('type'))
if( window.location.search && params.has('type')){
if(params.get('type')==0){
this.datasetType = '0'
} else if(params.get('type')==1){
this.datasetType = '1'
}else{
this.datasetType = '-1'
}
}else {
this.datasetType = '-1'
}
},
changeDatasetType(val){
console.log("---change",val)
const searchParams = new URLSearchParams(window.location.search)
console.log("-----change--",window.location.search,)
if (!window.location.search) {
window.location.href = window.location.href + '?type='+val
} else if (searchParams.has('type')) {
window.location.href = window.location.href.replace(/type=[0-9]/g,'type='+val)
} else {
window.location.href=window.location.href+'&type='+val
}

},
gotoDatasetEidt(id){
location.href = `/attachments/edit/${id}`

}


}
},

});

}


Loading…
Cancel
Save