From 5b7c867d5b72ecac43693c78556aa5f86f1caad5 Mon Sep 17 00:00:00 2001 From: zhoupzh Date: Sat, 2 Apr 2022 09:29:27 +0800 Subject: [PATCH] fix issue --- templates/explore/images.tmpl | 3 - templates/repo/cloudbrain/image/submit.tmpl | 16 ++++- web_src/js/components/Images.vue | 8 +-- web_src/js/features/images.js | 79 ++++++++++++++------- web_src/js/index.js | 24 +++---- 5 files changed, 82 insertions(+), 48 deletions(-) diff --git a/templates/explore/images.tmpl b/templates/explore/images.tmpl index 226a61168..4fcb67c7b 100644 --- a/templates/explore/images.tmpl +++ b/templates/explore/images.tmpl @@ -1,7 +1,4 @@ {{template "base/head" .}}
- -
- {{template "base/footer" .}} \ No newline at end of file diff --git a/templates/repo/cloudbrain/image/submit.tmpl b/templates/repo/cloudbrain/image/submit.tmpl index f77e3d14b..20a43de80 100644 --- a/templates/repo/cloudbrain/image/submit.tmpl +++ b/templates/repo/cloudbrain/image/submit.tmpl @@ -6,8 +6,18 @@ } {{template "base/head" .}} +
+
+
+
+
+
+
+
+
{{template "repo/header" .}} +

@@ -34,7 +44,7 @@

-
+
 
- - {{.i18n.Tr "repo.cloudbrain.cancel"}} + {{.i18n.Tr "repo.cloudbrain.cancel"}}
diff --git a/web_src/js/components/Images.vue b/web_src/js/components/Images.vue index a56d81e4c..d0e9febbc 100644 --- a/web_src/js/components/Images.vue +++ b/web_src/js/components/Images.vue @@ -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 diff --git a/web_src/js/features/images.js b/web_src/js/features/images.js index 3f806b622..302f16452 100644 --- a/web_src/js/features/images.js +++ b/web_src/js/features/images.js @@ -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() } \ No newline at end of file diff --git a/web_src/js/index.js b/web_src/js/index.js index 943a66318..035d9317a 100755 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -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');