From b95c8c4f2e9d2fce676574813faafe77164992be Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 6 Sep 2019 13:59:22 +0800
Subject: [PATCH 1/6] href
---
public/react/src/App.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/public/react/src/App.js b/public/react/src/App.js
index 00f07ecbc..087323521 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -286,7 +286,7 @@ class App extends Component {
const wx = window.wx
const url = '/wechats/js_sdk_signature.json'
axios.post(url, {
- url: 'http://pre-newweb.educoder.net',
+ url: window.location.href.split('#')[0],
}).then((response) => {
console.log('got res')
const data = response.data;
From 0170247b4a85705e0d744ef7401e1d86a9f2a866 Mon Sep 17 00:00:00 2001
From: hjm <63528605@qq.com>
Date: Fri, 6 Sep 2019 14:09:23 +0800
Subject: [PATCH 2/6] currentUrl
---
public/react/src/App.js | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/public/react/src/App.js b/public/react/src/App.js
index 087323521..3013eca7b 100644
--- a/public/react/src/App.js
+++ b/public/react/src/App.js
@@ -285,8 +285,9 @@ class App extends Component {
if (window.wx) {
const wx = window.wx
const url = '/wechats/js_sdk_signature.json'
+ const currentUrl = window.location.href.split('#')[0]
axios.post(url, {
- url: window.location.href.split('#')[0],
+ url: currentUrl,
}).then((response) => {
console.log('got res')
const data = response.data;
@@ -308,10 +309,10 @@ class App extends Component {
wx.ready(function () {
console.log('wx is ready')
var shareData = {
- title: '这是是分享标题',
- desc: '这是是摘要',
- link: 'http://pre-newweb.educoder.net',
- imgUrl: 'http://pre-newweb.educoder.net/images/educoder/index/subject/subject15.jpg'
+ title: 'EduCoder',
+ desc: '创新源于实践',
+ link: currentUrl,
+ imgUrl: currentUrl + '/images/educoder/index/subject/subject15.jpg'
};
wx.onMenuShareAppMessage(shareData);//分享给好友
From 73ce37baeee76ec565444598dd5b32a5e1c2c50c Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 6 Sep 2019 14:14:59 +0800
Subject: [PATCH 3/6] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E5=AD=A6=E7=94=9F?=
=?UTF-8?q?=E8=BF=9B=E4=BD=9C=E5=93=81=E5=88=97=E8=A1=A8=E6=8A=A5=E9=94=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/graduation_task.rb | 2 +-
app/models/homework_common.rb | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/app/models/graduation_task.rb b/app/models/graduation_task.rb
index e247f2b6e..17309101d 100644
--- a/app/models/graduation_task.rb
+++ b/app/models/graduation_task.rb
@@ -37,7 +37,7 @@ class GraduationTask < ApplicationRecord
def user_work user_id
- work = self.graduation_works.find_by(user_id: user_id)
+ work = self.graduation_works.find_by(user_id: user_id) || GraduationWork.create!(graduation_task_id: id, user_id: user_id)
end
def task_type_name
diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb
index c33bbca0d..4c8f94a42 100644
--- a/app/models/homework_common.rb
+++ b/app/models/homework_common.rb
@@ -102,7 +102,7 @@ class HomeworkCommon < ApplicationRecord
end
def user_work user_id
- work = self.student_works.find_by_user_id(user_id)
+ work = self.student_works.find_by_user_id(user_id) || StudentWork.create!(homework_common_id: id, user_id: user_id)
end
# 是否在补交阶段内
From f7167b69fb8ceefb452f8227898265672bceb7db Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Fri, 6 Sep 2019 14:49:05 +0800
Subject: [PATCH 4/6] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/application_controller.rb | 7 +++++++
app/controllers/exercise_banks_controller.rb | 2 --
app/controllers/gtopic_banks_controller.rb | 2 --
app/controllers/homework_banks_controller.rb | 2 --
app/controllers/task_banks_controller.rb | 3 +--
app/helpers/courses_helper.rb | 2 +-
6 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6046be5af..86d6312ab 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -45,6 +45,13 @@ class ApplicationController < ActionController::Base
uid_logger("###############user_course_identity:#{@user_course_identity}")
end
+ # 题库的访问权限
+ def bank_visit_auth
+ tip_exception("未通过职业认证") if current_user.is_teacher? && !current_user.certification_teacher? && !current_user.admin? && @bank.user_id != current_user.id && @bank.is_public
+ tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? ||
+ (current_user.certification_teacher? && @bank.is_public)
+ end
+
# 判断用户的邮箱或者手机是否可用
# params[:type] 1: 注册;2:忘记密码
diff --git a/app/controllers/exercise_banks_controller.rb b/app/controllers/exercise_banks_controller.rb
index ce6259c19..160393e0c 100644
--- a/app/controllers/exercise_banks_controller.rb
+++ b/app/controllers/exercise_banks_controller.rb
@@ -64,8 +64,6 @@ class ExerciseBanksController < ApplicationController
def find_bank
@bank = ExerciseBank.find_by!(id: params[:id])
- tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? ||
- (current_user.certification_teacher? && @bank.is_public)
end
def bank_admin
diff --git a/app/controllers/gtopic_banks_controller.rb b/app/controllers/gtopic_banks_controller.rb
index 291302bc2..e0382b21a 100644
--- a/app/controllers/gtopic_banks_controller.rb
+++ b/app/controllers/gtopic_banks_controller.rb
@@ -23,8 +23,6 @@ class GtopicBanksController < ApplicationController
def find_bank
@bank = GtopicBank.find_by!(id: params[:id])
- tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? ||
- (current_user.certification_teacher? && @bank.is_public)
end
def bank_admin
diff --git a/app/controllers/homework_banks_controller.rb b/app/controllers/homework_banks_controller.rb
index 7bdf425bf..31e733245 100644
--- a/app/controllers/homework_banks_controller.rb
+++ b/app/controllers/homework_banks_controller.rb
@@ -44,8 +44,6 @@ class HomeworkBanksController < ApplicationController
def find_bank
@bank = HomeworkBank.find_by!(id: params[:id])
- tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? ||
- (current_user.certification_teacher? && @bank.is_public)
end
def bank_admin
diff --git a/app/controllers/task_banks_controller.rb b/app/controllers/task_banks_controller.rb
index e2e7f0a1a..1d3aca955 100644
--- a/app/controllers/task_banks_controller.rb
+++ b/app/controllers/task_banks_controller.rb
@@ -1,6 +1,7 @@
class TaskBanksController < ApplicationController
before_action :require_login
before_action :find_bank
+ before_action :bank_visit_auth
before_action :bank_admin, only: [:update]
def show
@@ -25,8 +26,6 @@ class TaskBanksController < ApplicationController
def find_bank
@bank = GtaskBank.find_by!(id: params[:id])
- tip_exception(403, "无权限") unless @bank.user_id == current_user.id || current_user.admin? ||
- (current_user.certification_teacher? && @bank.is_public)
end
def bank_admin
diff --git a/app/helpers/courses_helper.rb b/app/helpers/courses_helper.rb
index b98073d7c..cdb3225d6 100644
--- a/app/helpers/courses_helper.rb
+++ b/app/helpers/courses_helper.rb
@@ -111,7 +111,7 @@ module CoursesHelper
when "announcement"
course.informs.count
when "online_learning"
- course.subject.stage_shixuns_count
+ course.subject&.shixuns_count
end
end
From 7c13d9a4d83f3ed92a96c8325e828f495cd14aef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Fri, 6 Sep 2019 15:01:01 +0800
Subject: [PATCH 5/6] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E5=A0=82?=
=?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=AD=A6=E6=A0=A1=E5=A2=9E=E5=8A=A0=E5=8A=A0?=
=?UTF-8?q?=E8=BD=BD=E6=95=88=E6=9E=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/modules/courses/new/CoursesNew.js | 38 +++++++++++++------
.../src/modules/courses/new/Goldsubject.js | 19 ++++++++--
2 files changed, 42 insertions(+), 15 deletions(-)
diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js
index a2cc45916..c15a6e9a0 100644
--- a/public/react/src/modules/courses/new/CoursesNew.js
+++ b/public/react/src/modules/courses/new/CoursesNew.js
@@ -48,6 +48,7 @@ class CoursesNew extends Component {
addonAfteronelenone:0,
addonAfteronelentwo:0,
bordebool:false,
+ smallspinning:false
}
}
componentDidMount() {
@@ -450,8 +451,10 @@ class CoursesNew extends Component {
// });
this.setState({
fetching: true,
- school: value
+ school: value,
+ smallspinning:true
})
+
this.getschool(value)
}
};
@@ -478,6 +481,7 @@ class CoursesNew extends Component {
};
getschool=(value)=>{
+
// this.props.form.setFieldsValue({
// school: value
// })
@@ -488,20 +492,27 @@ class CoursesNew extends Component {
}
}).then((result)=>{
if(result){
- if (result.data.status===0) {
- this.setState({
- searchlistscholl: result.data.school_names,
-
- })
- if(result.data.school_names.length!=0){
- this.setState({
- fetching: false
- })
- }
- }
+ if (result.data.status===0) {
+ this.setState({
+ searchlistscholl: result.data.school_names,
+ smallspinning:false
+ })
+ if(result.data.school_names.length!=0){
+ this.setState({
+ fetching: false,
+ })
+ }
+ }else{
+ this.setState({
+ smallspinning:false
+ })
+ }
}
}).catch((error)=>{
console.log(error)
+ this.setState({
+ smallspinning:false
+ })
})
}
showApplyForAddOrgModal = () => {
@@ -895,6 +906,9 @@ class CoursesNew extends Component {
>
)}
+
+