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

dev_admin
jingquan huang 6 years ago
commit c9ee929361

@ -38,7 +38,7 @@ class LibrariesController < ApplicationController
def create def create
library = current_user.libraries.new library = current_user.libraries.new
Libraries::SaveService.call(library, current_user, save_params) Libraries::SaveService.call(library, current_user, save_params)
render_ok render_ok({id: library})
rescue Libraries::SaveService::Error => ex rescue Libraries::SaveService::Error => ex
render_error(ex.message) render_error(ex.message)
end end
@ -47,7 +47,7 @@ class LibrariesController < ApplicationController
return render_forbidden unless library_manageable?(current_library) return render_forbidden unless library_manageable?(current_library)
Libraries::SaveService.call(current_library, current_user, save_params) Libraries::SaveService.call(current_library, current_user, save_params)
render_ok render_ok({id: current_library.id})
rescue Libraries::SaveService::Error => ex rescue Libraries::SaveService::Error => ex
render_error(ex.message) render_error(ex.message)
end end

@ -782,8 +782,8 @@ class ShixunsController < ApplicationController
school_name = "%#{params[:school_name].to_s.strip}%" school_name = "%#{params[:school_name].to_s.strip}%"
if user_name.present? || school_name.present? if user_name.present? || school_name.present?
@users = User.joins(user_extension: :school).where("users.id not in #{member_ids} AND users.status = 1 AND @users = User.joins(user_extension: :school).where("users.id not in #{member_ids} AND users.status = 1 AND
(LOWER(users.lastname) LIKE ? or users.phone like ?) AND LOWER(schools.name) LIKE (LOWER(concat(users.lastname, users.firstname)) LIKE ? or users.phone like ?)
?", user_name, user_name, school_name) AND LOWER(schools.name) LIKE ?", user_name, user_name, school_name)
else else
@users = User.none @users = User.none
end end

@ -360,7 +360,7 @@ class StudentWorksController < ApplicationController
Tiding.create(user_id: @work.user_id, trigger_user_id: User.current.id, container_id: new_score.id, Tiding.create(user_id: @work.user_id, trigger_user_id: User.current.id, container_id: new_score.id,
container_type: "StudentWorksScore", parent_container_id: @work.id, container_type: "StudentWorksScore", parent_container_id: @work.id,
parent_container_type: "HomeworkCommon", belong_container_id: @homework.course_id, parent_container_type: "HomeworkCommon", belong_container_id: @homework.course_id,
belong_container_type: "Course", viewed: 0, tiding_type: "HomeworkCommon", extra: new_score.reviewer_role) belong_container_type: "Course", viewed: 0, tiding_type: new_score.reviewer_role == 3 ? "System" : "HomeworkCommon", extra: new_score.reviewer_role)
case new_score.reviewer_role case new_score.reviewer_role
when 1 #教师评分:最后一个教师评分为最终评分 when 1 #教师评分:最后一个教师评分为最终评分

@ -19,11 +19,20 @@ class StudentWorkScoreAppealNotifyJob < ApplicationJob
belong_container_id: course.id, belong_container_type: 'Course', belong_container_id: course.id, belong_container_type: 'Course',
tiding_type: 'HomeworkCommon', viewed: 0, status: 0 tiding_type: 'HomeworkCommon', viewed: 0, status: 0
} }
student_same_attrs = {
trigger_user_id: 0,
container_id: appeal.id, container_type: 'StudentWorksScoresAppeal',
parent_container_id: score.student_work_id, parent_container_type: 'StudentWork',
belong_container_id: course.id, belong_container_type: 'Course',
tiding_type: 'System', viewed: 0, status: 0
}
Tiding.bulk_insert(*attrs) do |worker| Tiding.bulk_insert(*attrs) do |worker|
course.course_member(user).member_teachers.each do |teacher| course.course_member(user).member_teachers.each do |teacher|
worker.add same_attrs.merge(user_id: teacher.user_id) worker.add same_attrs.merge(user_id: teacher.user_id)
end end
worker.add same_attrs.merge(user_id: score.user_id) worker.add student_same_attrs.merge(user_id: score.user_id)
end end
end end
end end

@ -43,7 +43,8 @@ module Searchable::Subject
author_school_name: user.school_name, author_school_name: user.school_name,
visits_count: visits, visits_count: visits,
stage_count: stages_count, stage_count: stages_count,
stage_shixuns_count: stage_shixuns_count stage_shixuns_count: stage_shixuns_count,
shixuns_count: shixuns_count
} }
end end

@ -56,7 +56,7 @@ class Libraries::SaveService < ApplicationService
destroy_ids = old_attachment_id - attachment_ids destroy_ids = old_attachment_id - attachment_ids
library.attachments.where(id: destroy_ids).delete_all library.attachments.where(id: destroy_ids).delete_all
Attachment.where(id: attachment_ids, author_id: user.id).update_all(container: library) Attachment.where(id: attachment_ids, author_id: user.id).update_all(container_type: library)
end end
def library_params def library_params

@ -1,4 +1,4 @@
json.(@subject, :id, :name, :description, :learning_notes, :stages_count, :stage_shixuns_count) json.(@subject, :id, :name, :description, :learning_notes, :stages_count, :stage_shixuns_count, :shixuns_count)
json.challenge_choose_count @subject.subject_challenge_choose_count json.challenge_choose_count @subject.subject_challenge_choose_count
json.challenges_count @subject.subject_challenge_count json.challenges_count @subject.subject_challenge_count

@ -18,7 +18,14 @@ 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
json.partial! 'users/user_simple', user: tiding.trigger_user_id.zero? ? User.find(1) : tiding.trigger_user if tiding.trigger_user_id.zero?
json.id 0
json.name "系统"
json.login ""
json.image_url "educoder/systemLogo.png"
else
json.partial! 'users/user_simple', user: tiding.trigger_user
end
end end
json.attachments tiding.attachments, partial: 'attachments/attachment_small', as: :attachment json.attachments tiding.attachments, partial: 'attachments/attachment_small', as: :attachment

@ -202,7 +202,7 @@
2_end: "别人对你的匿评发起的申诉申请:%s审核未通过" 2_end: "别人对你的匿评发起的申诉申请:%s审核未通过"
StudentWork: StudentWork:
Apply_end: "发起了匿评申诉申请:%s" Apply_end: "发起了匿评申诉申请:%s"
HomeworkCommon_end: "有人对你的匿评发起了申诉:%s" System_end: "有人对你的匿评发起了申诉:%s"
Department_end: "你选填的二级单位:%s%s因不符合规范,已被系统删除.请重新选择" Department_end: "你选填的二级单位:%s%s因不符合规范,已被系统删除.请重新选择"
Library: Library:
Apply_end: "申请发布教学案例:%s" Apply_end: "申请发布教学案例:%s"

@ -0,0 +1,18 @@
class ModifyKeContentsForMarkdown < ActiveRecord::Migration[5.2]
# include ActionView::Helpers::SanitizeHelper
def change
# def ke_transform_to_md content
# sanitize(content, tags: %w(img a span), attributes: %w(src href target style))
# .gsub(/^(\n)/, "").gsub(/(\n)+/, "<br />").gsub(/$(\n)/, "")
# .gsub(/(\n)+/, "<br />").gsub("\t", "&nbsp;&nbsp;&nbsp;&nbsp;")
# end
#
# MessageDetail.find_each do |m|
# content = ke_transform_to_md m.content
# puts("content:#{content}")
# m.update_column(:content, content)
# end
end
end

@ -0,0 +1,6 @@
class MigrateAnonymousTidingType < ActiveRecord::Migration[5.2]
def change
Tiding.where(container_type: "StudentWorksScore", extra: "3").update_all(tiding_type: "System", trigger_user_id: 0)
Tiding.where(container_type: "StudentWorksScoresAppeal", parent_container_type: "StudentWork", tiding_type: "HomeworkCommon").update_all(tiding_type: "System", trigger_user_id: 0)
end
end

@ -54,5 +54,8 @@ html, body {
/* md多空格 */ /* md多空格 */
.markdown-body p { .markdown-body p {
white-space: pre-wrap; white-space: pre-wrap;
margin-bottom: 0px !important; }
/* resize */
.editormd .CodeMirror {
border-right: none !important;
} }

@ -9,6 +9,7 @@ import Dialog, {
import Button from 'material-ui/Button'; import Button from 'material-ui/Button';
import { FormControl, FormHelperText } from 'material-ui/Form'; import { FormControl, FormHelperText } from 'material-ui/Form';
import Input, { InputLabel } from 'material-ui/Input'; import Input, { InputLabel } from 'material-ui/Input';
import { InputNumber } from 'antd'
@ -38,8 +39,9 @@ class RewardDialog extends Component {
onGoldRewardDialogOkBtnClick() { onGoldRewardDialogOkBtnClick() {
console.log('onGoldRewardDialogOkBtnClick') console.log('onGoldRewardDialogOkBtnClick')
const { goldRewardInput } = this.state; const { goldRewardInput } = this.state;
if (!goldRewardInput || goldRewardInput === '0' || goldRewardInput.indexOf('-') !== -1) { if (!goldRewardInput || goldRewardInput === '0' || goldRewardInput < 0) {
this.setState({ goldRewardInputError: true}) this.props.showNotification('奖励金币不能为空或负数')
// this.setState({ goldRewardInputError: true})
return; return;
} else { } else {
this.props.setRewardDialogVisible( false ) this.props.setRewardDialogVisible( false )
@ -47,7 +49,8 @@ class RewardDialog extends Component {
} }
} }
onGoldRewardInputChange(event) { onGoldRewardInputChange(event) {
this.setState({ goldRewardInput: event.target.value, goldRewardInputError: false }); // || event.target.value
this.setState({ goldRewardInput: event , goldRewardInputError: false });
} }
render() { render() {
@ -60,15 +63,24 @@ class RewardDialog extends Component {
open={goldRewardDialogOpen} open={goldRewardDialogOpen}
disableEscapeKeyDown={true} disableEscapeKeyDown={true}
onClose={this.handleGoldRewardDialogClose} onClose={this.handleGoldRewardDialogClose}
className={'rewardDialog'}
> >
<style>{`
.rewardDialog>div:last-child {
width: 280px;
}
`}</style>
<DialogTitle id="alert-dialog-title">{"奖励设置"}</DialogTitle> <DialogTitle id="alert-dialog-title">{"奖励设置"}</DialogTitle>
<DialogContent> <DialogContent>
<FormControl { ...goldRewardInputErrorObj } aria-describedby="name-error-text"> {/* <FormControl { ...goldRewardInputErrorObj } aria-describedby="name-error-text"> */}
<InputLabel htmlFor="goldReward">请输入奖励的金币数量</InputLabel> {/* <InputLabel htmlFor="goldReward"></InputLabel>
<Input id="goldReward" type="number" value={this.state.goldRewardInput} onChange={(e) => this.onGoldRewardInputChange(e)} /> <Input id="goldReward" type="number" value={this.state.goldRewardInput} onChange={(e) => this.onGoldRewardInputChange(e)} />
{ goldRewardInputError ? <FormHelperText id="name-error-text">奖励金币不能为空或负数</FormHelperText> : ''} { goldRewardInputError ? <FormHelperText id="name-error-text">奖励金币不能为空或负数</FormHelperText> : ''} */}
</FormControl>
<InputNumber placeholder="请输入奖励的金币数量" id="goldReward" type="number" value={this.state.goldRewardInput}
onChange={(e) => this.onGoldRewardInputChange(e)} width={228} style={{ width: '228px'}} />
{/* </FormControl> */}
{/*<DialogContentText id="alert-dialog-description" style={{textAlign: 'center'}}> </DialogContentText>*/} {/*<DialogContentText id="alert-dialog-description" style={{textAlign: 'center'}}> </DialogContentText>*/}
</DialogContent> </DialogContent>

@ -41,7 +41,7 @@
} }
.stu_table table{ .stu_table table{
line-height: 1; line-height: 1.2;
} }
.stu_table .classesName{ .stu_table .classesName{
display: block; display: block;

@ -154,6 +154,9 @@ class Exercisetablesmubus extends Component {
} }
.Exermubu .ant-table-tbody > tr:nth-last-child(1) > td{ .Exermubu .ant-table-tbody > tr:nth-last-child(1) > td{
border:1px solid transparent; border:1px solid transparent;
}
.Exermubu .editormd-html-preview, .Exermubu .editormd-preview-container {
background: transparent;
} }
`} `}
</style> </style>

@ -105,7 +105,7 @@ class ForumsIndex extends Component {
componentDidMount() { componentDidMount() {
window.document.title = '讨论区' window.document.title = '交流问答'
} }

@ -685,6 +685,7 @@ class MemoDetail extends Component {
<RewardDialog goldRewardDialogOpen={goldRewardDialogOpen} <RewardDialog goldRewardDialogOpen={goldRewardDialogOpen}
setRewardDialogVisible={this.setRewardDialogVisible} setRewardDialogVisible={this.setRewardDialogVisible}
rewardCode={this.rewardCodeMemo} rewardCode={this.rewardCodeMemo}
{...this.props}
></RewardDialog> ></RewardDialog>
<div className="clearfix"> <div className="clearfix">
<div id="forum_list" className="forum_table mh650"> <div id="forum_list" className="forum_table mh650">
@ -694,7 +695,8 @@ class MemoDetail extends Component {
{ memo.sticky && <span className="btn-cir btn-cir-red ml10 " style={{ height: '20px' }}>置顶</span>} { memo.sticky && <span className="btn-cir btn-cir-red ml10 " style={{ height: '20px' }}>置顶</span>}
{ !!memo.reward && <span className="color-orange font-14 ml15" { !!memo.reward && <span className="color-orange font-14 ml15"
data-tip-down={`获得平台奖励金币:${memo.reward}`} > data-tip-down={`获得平台奖励金币:${memo.reward}`} >
<i className="iconfont icon-gift mr5"></i>{memo.reward} <i className="iconfont icon-gift mr5"></i>
<span style={{ 'vertical-align': 'sub' }}>{memo.reward}</span>
</span> } </span> }
<div style={{ flex: 1 }}> <div style={{ flex: 1 }}>

@ -323,7 +323,7 @@ class Challenges extends Component {
</Tooltip> </Tooltip>
</p> </p>
<div className="justify break_full_word new_li markdown-body" <div className="justify break_full_word new_li "
id="challenge_editorMd_description"> id="challenge_editorMd_description">
<p id="ReactMarkdown" style={{overflow:'hidden'}}> <p id="ReactMarkdown" style={{overflow:'hidden'}}>
{ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"": {ChallengesDataList === undefined ? "" :ChallengesDataList&&ChallengesDataList.description===null?"":

@ -126,7 +126,7 @@ class AccountBasic extends Component {
// 输入昵称时change剩余的字数 // 输入昵称时change剩余的字数
changeNickName=(e)=>{ changeNickName=(e)=>{
let num= 10 - parseInt(e.target.value.length); let num= 20 - parseInt(e.target.value.length);
this.setState({ this.setState({
nameLength:num < 0 ? 0 : num nameLength:num < 0 ? 0 : num
}) })
@ -393,6 +393,13 @@ class AccountBasic extends Component {
this.props.showNotification("请先选择正确的单位或者学校!"); this.props.showNotification("请先选择正确的单位或者学校!");
} }
} }
checkNameLength = (rule, value, callback) => {
if (value && value.length <= 10) {
callback();
return;
}
callback('请输入您的姓名最大限制10个字符');
}
render() { render() {
let{ let{
@ -491,8 +498,8 @@ class AccountBasic extends Component {
message: '请输入您的昵称', message: '请输入您的昵称',
}], }],
})( })(
<Input placeholder="请输入您的昵称,10个字以内" onInput={this.changeNickName} maxLength="10" suffix ={ <Input placeholder="请输入您的昵称,最大限制20个字符" onInput={this.changeNickName} maxLength="20" suffix ={
<span className="color-grey-6 font-13">{String(nameLength)}/10</span> <span className="color-grey-6 font-13">{String(nameLength)}/20</span>
}></Input> }></Input>
)} )}
</Form.Item> </Form.Item>
@ -505,10 +512,11 @@ class AccountBasic extends Component {
rules: [{ rules: [{
// initialValue: this.state.cityDefaultValue, // initialValue: this.state.cityDefaultValue,
required: true, required: true,
message: '请输入您的姓名', message: '请输入您的姓名最大限制10个字符',
validator: this.checkNameLength
}], }],
})( })(
<Input placeholder="请输入您的姓名" disabled={!showRealName && this.state.forDisable == true } suffix={ <Input placeholder="请输入您的姓名最大限制10个字符" disabled={!showRealName && this.state.forDisable == true } suffix={
<i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"} <i className={showRealName?"iconfont icon-xianshi font-18 color-blue":"iconfont icon-yincang font-18 color-blue"}
onClick={()=>this.showOrHide(showRealName)}></i> onClick={()=>this.showOrHide(showRealName)}></i>
}></Input> }></Input>

@ -13,7 +13,7 @@ class AccountNav extends Component {
this.props.history.push(`/account/secure`) this.props.history.push(`/account/secure`)
} }
render() { render() {
let { basicInfo } = this.props let { basicInfo, current_user } = this.props
// console.log(this.props); // console.log(this.props);
const path = window.location.pathname const path = window.location.pathname
const isBasic = path.indexOf('profile') != -1 || path == "/account" const isBasic = path.indexOf('profile') != -1 || path == "/account"
@ -78,7 +78,7 @@ class AccountNav extends Component {
<React.Fragment> <React.Fragment>
<div className="accountInfo"> <div className="accountInfo">
<AccountImg src={basicInfo.avatar_url} {...this.props}></AccountImg> <AccountImg src={basicInfo.avatar_url} {...this.props}></AccountImg>
<span className="name">{basicInfo.name}</span> <span className="name">{basicInfo.name || (current_user ? current_user.login : '')}</span>
<span className="role">{basicInfo.technical_title}</span> <span className="role">{basicInfo.technical_title}</span>
</div> </div>

Loading…
Cancel
Save