Merge branch 'topic_bank' of https://bdgit.educoder.net/Hjqreturn/educoder into topic_bank

topic_bank
hjm 5 years ago
commit aab9d30a29

1
.gitignore vendored

@ -37,6 +37,7 @@
/public/react/node_modules/ /public/react/node_modules/
/public/react/config/stats.json /public/react/config/stats.json
/public/react/stats.json /public/react/stats.json
/public/react/.idea/*
/public/npm-debug.log /public/npm-debug.log

@ -303,7 +303,7 @@ class CoursesController < ApplicationController
def destroy def destroy
if @course.is_delete == 0 if @course.is_delete == 0
@course.delete! @course.delete!
Tiding.create!(user_id: @course.tea_id, trigger_user_id: 1, container_id: @course.id, Tiding.create!(user_id: @course.tea_id, trigger_user_id: 0, container_id: @course.id,
container_type: 'Course', tiding_type: 'Delete', extra: @course.name) container_type: 'Course', tiding_type: 'Delete', extra: @course.name)
normal_status(0, "成功") normal_status(0, "成功")
else else

@ -82,7 +82,9 @@ class HomeworkCommonsController < ApplicationController
end end
@task_count = @homework_commons.size @task_count = @homework_commons.size
@homework_commons = @homework_commons.order("position DESC").page(page).per(15) order_str = @homework_type == 4 ? "position DESC" : "IF(ISNULL(homework_commons.publish_time),0,1), homework_commons.publish_time DESC,
homework_commons.created_at DESC"
@homework_commons = @homework_commons.order(order_str).page(page).per(15)
if @homework_type == 4 if @homework_type == 4
@homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns) @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :shixuns)

@ -55,7 +55,7 @@ class ProjectPackagesController < ApplicationController
package.destroy! package.destroy!
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, container_id: package.id, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0, container_id: package.id,
container_type: 'ProjectPackage', tiding_type: 'Destroyed', extra: package.title) container_type: 'ProjectPackage', tiding_type: 'Destroyed', extra: package.title)
render_ok render_ok

@ -1,6 +1,6 @@
class Wechats::JsSdkSignaturesController < ApplicationController class Wechats::JsSdkSignaturesController < ApplicationController
def create def create
timestamp = (Time.now.to_f * 1000).to_i timestamp = Time.now.to_i
noncestr = ('A'..'z').to_a.sample(8).join noncestr = ('A'..'z').to_a.sample(8).join
signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp) signature = Util::Wechat.js_sdk_signature(params[:url], noncestr, timestamp)

@ -7,7 +7,8 @@ module Util::Wechat
attr_accessor :appid, :secret attr_accessor :appid, :secret
def js_sdk_signature(url, noncestr, timestamp) def js_sdk_signature(url, noncestr, timestamp)
str = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }.to_query data = { jsapi_ticket: jsapi_ticket, noncestr: noncestr, timestamp: timestamp, url: url }
str = data.map { |k, v| "#{k}=#{v}" }.join('&')
Digest::SHA1.hexdigest(str) Digest::SHA1.hexdigest(str)
end end

@ -337,7 +337,7 @@ class Course < ApplicationRecord
#创建课程后,给该用户发送消息 #创建课程后,给该用户发送消息
def send_tiding def send_tiding
self.tidings << Tiding.new(user_id: tea_id, trigger_user_id: 1, belong_container_id: id, self.tidings << Tiding.new(user_id: tea_id, trigger_user_id: 0, belong_container_id: id,
belong_container_type: 'Course', tiding_type: 'System') belong_container_type: 'Course', tiding_type: 'System')
end end

@ -28,7 +28,7 @@ class CourseMessage < ApplicationRecord
def send_deal_tiding deal_status def send_deal_tiding deal_status
# 发送申请处理结果消息 # 发送申请处理结果消息
Tiding.create!( Tiding.create!(
user_id: course_message_id, trigger_user_id: 1, container_id: course_id, container_type: 'DealCourse', user_id: course_message_id, trigger_user_id: 0, container_id: course_id, container_type: 'DealCourse',
belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: deal_status belong_container: course, extra: content.to_i == 2 ? '9' : '7', tiding_type: 'System', status: deal_status
) )
# 将申请消息置为已处理 # 将申请消息置为已处理

@ -25,7 +25,7 @@ class Libraries::AgreeApplyService < ApplicationService
private private
def notify_library_author! def notify_library_author!
Tiding.create!(user_id: library.user_id, trigger_user_id: 1, Tiding.create!(user_id: library.user_id, trigger_user_id: 0,
container_id: library.id, container_type: 'Library', container_id: library.id, container_type: 'Library',
tiding_type: 'System', status: 1) tiding_type: 'System', status: 1)
end end

@ -32,7 +32,7 @@ class Libraries::RefuseApplyService < ApplicationService
private private
def notify_library_author! def notify_library_author!
Tiding.create!(user_id: library.user_id, trigger_user_id: 1, Tiding.create!(user_id: library.user_id, trigger_user_id: 0,
container_id: library.id, container_type: 'Library', container_id: library.id, container_type: 'Library',
tiding_type: 'System', status: 2, extra: library_apply.reason) tiding_type: 'System', status: 2, extra: library_apply.reason)
end end

@ -29,7 +29,7 @@ class ProjectPackages::AgreeApplyService < ApplicationService
Tiding.where(container_id: package.id, container_type: 'ProjectPackage', Tiding.where(container_id: package.id, container_type: 'ProjectPackage',
tiding_type: 'Apply', status: 0).update_all(status: 1) tiding_type: 'Apply', status: 0).update_all(status: 1)
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0,
container_id: package.id, container_type: 'ProjectPackage', container_id: package.id, container_type: 'ProjectPackage',
tiding_type: 'System', status: 1) tiding_type: 'System', status: 1)
end end

@ -16,7 +16,7 @@ class ProjectPackages::EndBiddingService < ApplicationService
private private
def send_bidding_end_notify! def send_bidding_end_notify!
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0,
container_id: package.id, container_type: 'ProjectPackage', tiding_type: 'BiddingEnd') container_id: package.id, container_type: 'ProjectPackage', tiding_type: 'BiddingEnd')
end end

@ -31,7 +31,7 @@ class ProjectPackages::RefuseApplyService < ApplicationService
Tiding.where(container_id: package.id, container_type: 'ProjectPackage', Tiding.where(container_id: package.id, container_type: 'ProjectPackage',
tiding_type: 'Apply', status: 0).update_all(status: 1) tiding_type: 'Apply', status: 0).update_all(status: 1)
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0,
container_id: package.id, container_type: 'ProjectPackage', container_id: package.id, container_type: 'ProjectPackage',
tiding_type: 'System', status: 2, extra: apply.reason) tiding_type: 'System', status: 2, extra: apply.reason)
end end

@ -71,7 +71,7 @@ class ProjectPackages::SaveService < ApplicationService
end end
def send_create_notify! def send_create_notify!
Tiding.create!(user_id: package.creator_id, trigger_user_id: 1, Tiding.create!(user_id: package.creator_id, trigger_user_id: 0,
container_id: package.id, container_type: 'ProjectPackage', tiding_type: 'Created') container_id: package.id, container_type: 'ProjectPackage', tiding_type: 'Created')
end end

@ -28,7 +28,7 @@ class Videos::AgreeApplyService < ApplicationService
private private
def notify_video_author! def notify_video_author!
Tiding.create!(user_id: video.user_id, trigger_user_id: 1, Tiding.create!(user_id: video.user_id, trigger_user_id: 0,
container_id: video.id, container_type: 'Video', container_id: video.id, container_type: 'Video',
tiding_type: 'System', status: 1) tiding_type: 'System', status: 1)
end end

@ -31,7 +31,7 @@ class Videos::RefuseApplyService < ApplicationService
private private
def notify_video_author! def notify_video_author!
Tiding.create!(user_id: video.user_id, trigger_user_id: 1, Tiding.create!(user_id: video.user_id, trigger_user_id: 0,
container_id: video.id, container_type: 'Video', container_id: video.id, container_type: 'Video',
tiding_type: 'System', status: 2, extra: video_apply.reason) tiding_type: 'System', status: 2, extra: video_apply.reason)
end end

@ -18,7 +18,7 @@ json.time tiding.how_long_time
json.new_tiding tiding.unread?(@onclick_time) json.new_tiding tiding.unread?(@onclick_time)
json.trigger_user do json.trigger_user do
if tiding.trigger_user_id.zero? if tiding.trigger_user_id.zero? || (tiding.trigger_user_id == 1 && tiding.tiding_type == 'System')
json.id 0 json.id 0
json.name "系统" json.name "系统"
json.login "" json.login ""

@ -298,7 +298,7 @@ class App extends Component {
const url = '/wechats/js_sdk_signature.json' const url = '/wechats/js_sdk_signature.json'
const currentUrl = window.location.href.split('#')[0] const currentUrl = window.location.href.split('#')[0]
axios.post(url, { axios.post(url, {
url: currentUrl, url: window.__testUrl || window.encodeURIComponent(currentUrl),
}).then((response) => { }).then((response) => {
console.log('got res') console.log('got res')
const data = response.data; const data = response.data;

@ -67,11 +67,10 @@ class Groupjobbandetails extends Component {
<div className="yslquestionbank1"> <div className="yslquestionbank1">
{ {
datas&&(datas.description===null||datas.description==="null"||datas.description===""? datas.description===null||datas.description==="null"||datas.description===""?
"" ""
: :
<MarkdownToHtml content={datas.description} selector="work_content" className="mb10 yslquesHeigth"></MarkdownToHtml> <MarkdownToHtml content={datas.description} selector="work_content" className="mb10 yslquesHeigth"></MarkdownToHtml>
)
} }
<div className="mt24"> <div className="mt24">
{datas.attachments === undefined || datas.attachments === null || datas.attachments === ""? "" : {datas.attachments === undefined || datas.attachments === null || datas.attachments === ""? "" :

@ -64,7 +64,7 @@ class Completetopicdetails extends Component {
<div className="bor-bottom-greyE"> <div className="bor-bottom-greyE">
<div className="yslquestionbank1"> <div className="yslquestionbank1">
{ {
datas&&(datas.description===null? datas.description===null?
"" ""
:datas.description==="null"? :datas.description==="null"?
"" ""
@ -73,25 +73,24 @@ class Completetopicdetails extends Component {
"" ""
: :
<MarkdownToHtml content={datas.description} selector="work_content" className="mb10 yslquesHeigth"></MarkdownToHtml> <MarkdownToHtml content={datas.description} selector="work_content" className="mb10 yslquesHeigth"></MarkdownToHtml>
)
} }
{datas.attachment_list === undefined ? {datas.attachment_list === undefined ?
(datas.description===undefined || datas.description===null? (datas.description===undefined || datas.description===null||datas.description===""?
<NoneData></NoneData> <NoneData></NoneData>
: :
"" ""
) )
: :
datas.attachment_list === null ? datas.attachment_list === null ?
(datas.description===undefined || datas.description===null? (datas.description===undefined || datas.description===null||datas.description===""?
<NoneData></NoneData> <NoneData></NoneData>
: :
"" ""
) )
: :
datas.attachment_list.length === 0 ? datas.attachment_list.length === 0 ?
(datas.description===undefined || datas.description===null? (datas.description===undefined || datas.description===null||datas.description===""?
<NoneData></NoneData> <NoneData></NoneData>
: :
"" ""

@ -68,12 +68,12 @@ class Groupjobbandetails extends Component {
<div className="yslquestionbank1"> <div className="yslquestionbank1">
{ {
ddatas.description===null? ddatas.description===null?
<NoneData></NoneData> ""
:datas.description==="null"? :datas.description==="null"?
<NoneData></NoneData> ""
: :
datas.description===""? datas.description===""?
<NoneData></NoneData> ""
: :
<MarkdownToHtml content={datas.description} selector="work_content" className="mb10 yslquesHeigth"></MarkdownToHtml> <MarkdownToHtml content={datas.description} selector="work_content" className="mb10 yslquesHeigth"></MarkdownToHtml>
// <div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/> // <div id="MakedownHTML"className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/>
@ -84,13 +84,38 @@ class Groupjobbandetails extends Component {
{/* <GroupPackage key={key} attachments={item}></GroupPackage>*/} {/* <GroupPackage key={key} attachments={item}></GroupPackage>*/}
{/* )*/} {/* )*/}
{/*})}*/} {/*})}*/}
{datas.attachments === undefined ?
(datas.description === undefined || datas.description === undefined || datas.description === "" ?
<NoneData></NoneData>
:
""
)
:
datas.attachments=== "" ?
(datas.description === undefined || datas.description === undefined || datas.description === "" ?
<NoneData></NoneData>
:
""
)
:
datas.attachments=== null ?
(datas.description === undefined || datas.description === undefined || datas.description === "" ?
<NoneData></NoneData>
:
""
)
:
datas.attachments.length === 0 ?
(datas.description === undefined || datas.description === undefined || datas.description === "" ?
<NoneData></NoneData>
:
""
)
:
<div className="mt24"> <div className="mt24">
{datas.attachments === undefined ? "" : <AttachmentsList {...this.state} {...this.props} attachments={datas.attachments} ></AttachmentsList>
<AttachmentsList {...this.state} {...this.props} attachments={datas.attachments} ></AttachmentsList>}
</div> </div>
}
<GroupPackage2 datas={datas} bool={true}></GroupPackage2> <GroupPackage2 datas={datas} bool={true}></GroupPackage2>
</div> </div>

@ -62,20 +62,49 @@ class Generaljobdetails extends Component {
<div className=" clearfix edu-back-white " ref='targetElementTrainingjobsetting' style={{margin: "auto", minWidth:"1200px"}}> <div className=" clearfix edu-back-white " ref='targetElementTrainingjobsetting' style={{margin: "auto", minWidth:"1200px"}}>
<div className="yslquestionbank1"> <div className="yslquestionbank1">
{ {
datas&&(datas.description===null? datas.description===null?
<NoneData></NoneData> ""
:datas.description==="null"? :datas.description==="null"?
<NoneData></NoneData> ""
:datas&&datas.description===""? :datas&&datas.description===""?
<NoneData></NoneData>: ""
:
<MarkdownToHtml content={datas.description} selector="work_content" className="mb10 yslquesHeigth"></MarkdownToHtml> <MarkdownToHtml content={datas.description} selector="work_content" className="mb10 yslquesHeigth"></MarkdownToHtml>
// <div id="MakedownHTML "className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/> // <div id="MakedownHTML "className="markdown-body yslquesHeigth yslquesmarkdowntext" dangerouslySetInnerHTML={{__html: markdownToHTML(datas.description).replace(/▁/g, "▁▁▁")}}/>
}
{datas.attachments === undefined ?
(datas.description === undefined || datas.description === undefined || datas.description === "" ?
<NoneData></NoneData>
:
""
)
:
datas.attachments=== "" ?
(datas.description === undefined || datas.description === undefined || datas.description === "" ?
<NoneData></NoneData>
:
""
) )
:
datas.attachments=== null ?
(datas.description === undefined || datas.description === undefined || datas.description === "" ?
<NoneData></NoneData>
:
""
)
:
datas.attachments.length === 0 ?
(datas.description === undefined || datas.description === undefined || datas.description === "" ?
<NoneData></NoneData>
:
""
)
:
<div className="mt16px">
<AttachmentsList {...this.state} {...this.props}
attachments={datas.attachments}></AttachmentsList>
</div>
} }
<div className="mt16px">
{datas.attachments === undefined ? "" :
<AttachmentsList {...this.state} {...this.props} attachments={datas.attachments} ></AttachmentsList>}
</div>
</div> </div>
</div> </div>

@ -408,10 +408,11 @@ class InfosTopics extends Component{
} }
.gongkais{ .gongkais{
min-width: 50px; min-width: 50px;
height: 22px !important; height: 22px !important;
line-height: 22px !important; line-height: 22px !important;
color: #fff !important; color: #fff !important;
margin-top: 4px;
} }
` `
} }
@ -428,7 +429,7 @@ class InfosTopics extends Component{
<div className={types==="personal"?"topicstopfont fl ":"topicstopfont fl topcsactive"} <div className={types==="personal"?"topicstopfont fl ":"topicstopfont fl topcsactive"}
>我的题库</div> >我的题库</div>
<a className={types==="publicly"?"topicstopfont fr ":"topicstopfont fr topcsactive"} <a className={types==="publicly"?"topicstopfont fr ":"topicstopfont fr topcsactive"}
href={`/topicbank/${username}/publicly`} href={`/topicbank/${this.props.current_user&&this.props.current_user.login}/publicly`}
>公共题库</a> >公共题库</a>
</div>} </div>}
@ -530,7 +531,7 @@ class InfosTopics extends Component{
{item.name} {item.name}
</a> </a>
{item.is_public===true?types==="publicly"?"":<span className="edu-filter-btn edu-filter-btn-4CACFF ml15 fl gongkais mt3">公开</span>:""} {item.is_public===true?types==="publicly"?"":<span className="edu-filter-btn edu-filter-btn-4CACFF ml15 fl gongkais">公开</span>:""}

Loading…
Cancel
Save