Browse Source

fix issue

tags/v1.22.4.1^2
zhoupzh 4 years ago
parent
commit
5b7c867d5b
5 changed files with 82 additions and 48 deletions
  1. +0
    -3
      templates/explore/images.tmpl
  2. +13
    -3
      templates/repo/cloudbrain/image/submit.tmpl
  3. +4
    -4
      web_src/js/components/Images.vue
  4. +53
    -26
      web_src/js/features/images.js
  5. +12
    -12
      web_src/js/index.js

+ 0
- 3
templates/explore/images.tmpl View File

@@ -1,7 +1,4 @@
{{template "base/head" .}}
<div id="images">

</div>

{{template "base/footer" .}}

+ 13
- 3
templates/repo/cloudbrain/image/submit.tmpl View File

@@ -6,8 +6,18 @@
}
</style>
{{template "base/head" .}}
<div id="mask">
<div id="loadingPage">
<div class="rect1"></div>
<div class="rect2"></div>
<div class="rect3"></div>
<div class="rect4"></div>
<div class="rect5"></div>
</div>
</div>
<div class="repository">
{{template "repo/header" .}}
<div class="alert"></div>
<div class="ui container">
<div>
<h4 class="ui top attached header">
@@ -34,7 +44,7 @@
<label class="label_color" for="">{{$.i18n.Tr "dataset.description"}}</label>
<textarea style="width: 80%;" required id="description" name="description" rows="3" maxlength="255" placeholder={{.i18n.Tr "repo.modelarts.train_job.new_place"}} onchange="this.value=this.value.substring(0, 255)" onkeydown="this.value=this.value.substring(0, 255)" onkeyup="this.value=this.value.substring(0, 255)"></textarea>
</div>
<div class="inline required field" style="display: flex;align-items: center;">
<div class="inline field" style="display: flex;align-items: center;">
<label class="label_color" for="">{{$.i18n.Tr "repo.model.manage.label"}}</label>&nbsp;
<div class="ui multiple search selection dropdown" id="dropdown_image" style="width: 80%;">
<input type="hidden" name="topics" value="" required>
@@ -63,10 +73,10 @@
</div>
<div class="inline required field" style="padding-top: 2rem;">
<label class="label_color" for="" style="visibility: hidden;"></label>
<button class="ui create_image green button">
<button class="ui create_image green button" type="button">
{{.i18n.Tr "repo.cloudbrain.commit_image"}}
</button>
<a class="ui button" href="/">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
<a class="ui button" id="cancel_submit_image">{{.i18n.Tr "repo.cloudbrain.cancel"}}</a>
</div>
</form>
</div>


+ 4
- 4
web_src/js/components/Images.vue View File

@@ -327,10 +327,10 @@ export default {
},
getImageList(){
this.loading = true
this.$axios.get('/explore/images/public',{
this.$axios.get('/images/public',{
params:this.params
}).then((res)=>{
console.log("res",res)
this.totalNum = res.data.count
this.tableData = res.data.rows
this.loading = false
@@ -339,10 +339,10 @@ export default {

getImageList1(){
this.loading1 = true
this.$axios.get('/explore/images/custom',{
this.$axios.get('/images/custom',{
params:this.params1
}).then((res)=>{
console.log("res",res)
this.totalNum1 = res.data.count
this.tableData1 = res.data.rows
this.loading1 = false


+ 53
- 26
web_src/js/features/images.js View File

@@ -1,6 +1,32 @@
import Images from '../components/Images.vue';
import Vue from 'vue';
export default async function initImage(){
function validate() {
$("#form_image")
.form({
on: 'blur',
// inline:true,
fields: {
tag: {
identifier : 'tag',
rules: [
{
type: 'regExp[/^[A-Za-z0-9_.-]{1,100}[A-Za-z0-9_.]$/]',
}
]
},
description:{
identifier : 'description',
rules: [
{
type: 'empty',
}
]
},
}
})
}
function initDropdown(){
$('#dropdown_image')
.dropdown({
@@ -27,7 +53,9 @@ export default async function initImage(){
})
}
});
}
validate()
initDropdown()
let link = $('.submit-image-tmplvalue').data('link')
$('.ui.create_image.green.button').click(()=>{
@@ -38,43 +66,42 @@ export default async function initImage(){
data:$('#form_image').serialize(),
success:function(res){
console.log("res",res)
if(res.Code===1){
$('.alert').html(res.Message).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
}
},
error: function(xhr){
// 隐藏 loading
// 只有请求不正常(状态码不为200)才会执行
// $('.ui.error.message').text(xhr.responseText)
// $('.ui.error.message').css('display','block')
$('.alert').html(xhr.responseText).removeClass('alert-success').addClass('alert-danger').show().delay(1500).fadeOut();
},
complete:function(xhr){
// $("#mask").css({"display":"none","z-index":"1"})
$("#mask").css({"display":"none","z-index":"1"})
}
})
})
$('#cancel_submit_image').click(()=>{
if(link.includes('cloudbrain')){
let repoLink = link.split('cloudbrain')[0]
location.href = `${window.config.AppSubUrl}${repoLink}debugjob?debugListType=all`
}
})
console.log("initImage")
const el = document.getElementById('image-base');
if (!el) {
return;
}
// let defaultText = document.getElementById("default_text").offsetHeight
// defaultText = defaultText>40 ? defaultText+12 :defaultText
// $("#dropdown_container").css("height",defaultText)
new Vue({
delimiters: ['${', '}'],
el,
data() {
return{

}
},
components: {
Images
},
mounted(){
},
methods:{
function initVueImages() {
const el = document.getElementById('images');
console.log(el)
if (!el) {
return;
}
});

new Vue({
el:el,
render: h => h(Images)
});
}
initVueImages()
}

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

@@ -36,7 +36,7 @@ import {createCodeEditor} from './features/codeeditor.js';
import MinioUploader from './components/MinioUploader.vue';
import ObsUploader from './components/ObsUploader.vue';
import EditAboutInfo from './components/EditAboutInfo.vue';
import Images from './components/Images.vue';
// import Images from './components/Images.vue';
import EditTopics from './components/EditTopics.vue';
import DataAnalysis from './components/DataAnalysis.vue'
import Contributors from './components/Contributors.vue'
@@ -2923,7 +2923,7 @@ $(document).ready(async () => {
initVueEditAbout();
initVueEditTopic();
initVueContributors();
initVueImages();
// initVueImages();
initVueModel();
initVueDataAnalysis();
initVueWxAutorize();
@@ -4277,20 +4277,20 @@ function initVueContributors() {
}


function initVueImages() {
const el = document.getElementById('images');
// function initVueImages() {
// const el = document.getElementById('images');
if (!el) {
return;
}
// if (!el) {
// return;
// }

new Vue({
el: '#images',
// new Vue({
// el: '#images',
render: h => h(Images)
});
}
// render: h => h(Images)
// });
// }
function initVueModel() {
const el = document.getElementById('model_list');


Loading…
Cancel
Save