From e2f1590eb6501aff3b5d10e9b052036ad5ce37e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Thu, 18 Jul 2019 15:02:33 +0800
Subject: [PATCH] =?UTF-8?q?=E6=A1=88=E4=BE=8B=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/libraries/_form.html.erb | 36 +++++++++++++----------
public/react/src/modules/tpm/NewHeader.js | 7 ++++-
2 files changed, 27 insertions(+), 16 deletions(-)
diff --git a/app/views/libraries/_form.html.erb b/app/views/libraries/_form.html.erb
index a2f6e564..c71bc7c1 100644
--- a/app/views/libraries/_form.html.erb
+++ b/app/views/libraries/_form.html.erb
@@ -140,13 +140,14 @@
var submitForm = function(){
var title = $("input[name='library[title]']").val();
var content = $("textarea[name='library[content]']").val();
- var author_name = $("input[name='library[author_name]']").val();
- var author_school_name = $("input[name='library[author_school_name]']").val();
- var cover_file = $("input[name='cover_file").val();
+ var author_name = $("input[name='library[author_name]']").val();
+ var author_school_name = $("input[name='library[author_school_name]']").val();
+ var cover_file = $("input[name='cover_file").val();
if (!title || title.length == 0) {
$("#title_notice").removeClass("none");
$("#title_notice").html("请输入标题");
+ $(document).scrollTop(parseInt($("#title_notice").offset().top)-150);
return
}else{
$("#title_notice").addClass("none");
@@ -163,29 +164,33 @@
if (!content || content.length == 0) {
$("#des_notice").removeClass("none");
+ $(document).scrollTop(parseInt($("#des_notice").offset().top)-150);
return
}else{
$("#des_notice").addClass("none");
}
- if (!author_name || author_name.length == 0) {
- $("#author_name_notice").removeClass("none");
- return
- }else{
- $("#author_name_notice").addClass("none");
- }
-
- if (!author_name || author_name.length >10) {
- $("#title_author_name").removeClass("none");
+ if (!author_name || author_name.length == 0) {
+ $("#author_name_notice").removeClass("none");
+ $(document).scrollTop(parseInt($("#author_name_notice").offset().top)-150);
return
- }else{
- $("#title_author_name").addClass("none");
- }
+ }else{
+ $("#author_name_notice").addClass("none");
+ }
+
+ if (!author_name || author_name.length >10) {
+ $("#title_author_name").removeClass("none");
+ $(document).scrollTop(parseInt($("#title_author_name").offset().top)-150);
+ return
+ }else{
+ $("#title_author_name").addClass("none");
+ }
if (!author_school_name || author_school_name.length == 0) {
$("#author_school_name_notice").removeClass("none");
+ $(document).scrollTop(parseInt($("#author_school_name_notice").offset().top)-150);
return
}else{
$("#author_school_name_notice").addClass("none");
@@ -201,6 +206,7 @@
if($('.attachments_fields .attachment').length == 0){
$("#file_notice").removeClass("none");
+ $(document).scrollTop(parseInt($("#file_notice").offset().top)-150);
return
}else{
$("#file_notice").addClass("none");
diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js
index 7c9e78e1..00e00b37 100644
--- a/public/react/src/modules/tpm/NewHeader.js
+++ b/public/react/src/modules/tpm/NewHeader.js
@@ -270,6 +270,7 @@ class NewHeader extends Component {
let activeCareers = false;
let activeCourses = false;
let competitions = false;
+ let crowdsourcing=false;
if (match.path === '/forums') {
activeForums = true;
} else if (match.path.startsWith('/shixuns')) {
@@ -282,6 +283,8 @@ class NewHeader extends Component {
activeCourses=true;
}else if(match.path.startsWith('/competitions')){
competitions=true;
+ }else if(match.path.startsWith('/crowdsourcing')){
+ crowdsourcing=true
}else{
activeIndex = true;
}
@@ -367,8 +370,10 @@ class NewHeader extends Component {
在线竞赛
+