|
|
@@ -41,7 +41,7 @@ |
|
|
|
</div> --> |
|
|
|
<div class="inline required field"> |
|
|
|
<label for="Alias">项目名称</label> |
|
|
|
<input id="Alias" name="Alias" value="" autofocus required> |
|
|
|
<input id="alias" name="alias" value="" oninput="throttle()" autofocus required> |
|
|
|
<!-- <span class="help"></span> --> |
|
|
|
</div> |
|
|
|
|
|
|
@@ -78,12 +78,16 @@ |
|
|
|
<div class="required field {{if .Err_RepoName}}error{{end}}"> |
|
|
|
<!-- <label for="repo_name">{{.i18n.Tr "repo.repo_name"}}</label> --> |
|
|
|
<input style="width: 100% !important;" id="repo_name" name="repo_name" value="{{.repo_name}}" autofocus required> |
|
|
|
<!-- <span class="help"></span> --> |
|
|
|
|
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
<div class="inline field"> |
|
|
|
<label for=""></label> |
|
|
|
<span id="repoAdress" style="display: none;margin-bottom: 1rem;"></span> |
|
|
|
|
|
|
|
|
|
|
|
</div> |
|
|
|
<!-- <div class="js-project-full-path" id="repoAdress" ></div> --> |
|
|
|
<div class="inline field"> |
|
|
|
<label>{{.i18n.Tr "repo.visibility"}}</label> |
|
|
|
<div class="ui checkbox"> |
|
|
@@ -228,3 +232,45 @@ |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
{{template "base/footer" .}} |
|
|
|
<script> |
|
|
|
$('#alias').bind('input propertychange', function (event) { |
|
|
|
|
|
|
|
}); |
|
|
|
console.log() |
|
|
|
let timeout; |
|
|
|
let keydown_flag = false |
|
|
|
$('#repo_name').keyup(function(){ |
|
|
|
keydown_flag = $('#repo_name').val() ? true : false |
|
|
|
if(keydown_flag){ |
|
|
|
$('#repoAdress').css("display","block") |
|
|
|
$('#repoAdress').text("{{.i18n.Tr "repo.template.topics"}}:"+$('#repo_name').val()) |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
function throttle(){ |
|
|
|
//先清理 |
|
|
|
clearTimeout(timeout) |
|
|
|
timeout = setTimeout(() => { |
|
|
|
//在此处写调用的方法,可以实现仅最后一次操作生效 |
|
|
|
const aliasValue = $('#alias').val() |
|
|
|
const ownerValue = $('#uid').val() |
|
|
|
if(keydown_flag){ |
|
|
|
$('#repo_name').attr("placeholder","") |
|
|
|
} |
|
|
|
else if(aliasValue){ |
|
|
|
$('#repo_name').attr("placeholder","正在获取路径...") |
|
|
|
$.get(`${window.config.AppSubUrl}/repo/check_name?q=${aliasValue}&owner=${ownerValue }`,(data)=>{ |
|
|
|
const repo_name = data.name |
|
|
|
$('#repo_name').val(repo_name) |
|
|
|
$('#repoAdress').css("display","block") |
|
|
|
$('#repoAdress').text("{{.i18n.Tr "repo.template.topics"}}:"+$('#repo_name').val()) |
|
|
|
}) |
|
|
|
}else{ |
|
|
|
$('#repo_name').val('') |
|
|
|
$('#repo_name').attr("placeholder","") |
|
|
|
} |
|
|
|
}, 500) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
</script> |