diff --git a/app/controllers/admins/base_controller.rb b/app/controllers/admins/base_controller.rb index f90c8a1ed..9a4a25013 100644 --- a/app/controllers/admins/base_controller.rb +++ b/app/controllers/admins/base_controller.rb @@ -10,6 +10,7 @@ class Admins::BaseController < ApplicationController before_action :require_login, :require_admin! after_action :rebind_event_if_ajax_render_partial + skip_before_action :check_sign private diff --git a/app/controllers/admins/users_controller.rb b/app/controllers/admins/users_controller.rb index 9630394b4..b9a07ba1e 100644 --- a/app/controllers/admins/users_controller.rb +++ b/app/controllers/admins/users_controller.rb @@ -61,7 +61,7 @@ class Admins::UsersController < Admins::BaseController private def update_params - params.require(:user).permit(%i[lastname nickname gender identity technical_title student_id + params.require(:user).permit(%i[lastname nickname gender identity technical_title student_id is_shixun_marker mail phone location location_city school_id department_id admin business is_test password professional_certification authentication]) end diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 634209570..ac53343b5 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -24,15 +24,19 @@ class ApplicationController < ActionController::Base # 所有请求必须合法签名 def check_sign Rails.logger.info("66666 #{params}") - if params[:client_key].present? - Rails.logger.info("111111 #{params[:client_key]}") - Rails.logger.info("00000 #{params[:timestamp]}") - timestamp = params[:timestamp] - sign = Digest::MD5.hexdigest("#{OPENKEY}#{timestamp}") - Rails.logger.info("2222 #{sign}") - tip_exception(501, "请求不合理") if sign != params[:client_key] - else - tip_exception(501, "请求不合理") + suffix = request.url.split(".").last + suffix_arr = ["xls", "xlsx"] # excel文件先注释 + unless suffix_arr.include?(suffix) + if params[:client_key].present? + randomcode = params[:randomcode] + tip_exception(501, "请求不合理") unless (Time.now.to_i - randomcode.to_i).between?(0,5) + + sign = Digest::MD5.hexdigest("#{OPENKEY}#{randomcode}") + Rails.logger.info("2222 #{sign}") + tip_exception(501, "请求不合理") if sign != params[:client_key] + else + tip_exception(501, "请求不合理") + end end end @@ -42,6 +46,12 @@ class ApplicationController < ActionController::Base EduSetting.get(name) end + def shixun_marker + unless current_user.is_shixun_marker? || current_user.admin_or_business? + tip_exception(403, "..") + end + end + # 实训的访问权限 def shixun_access_allowed if !current_user.shixun_permission(@shixun) diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb index 5fc81c5d5..e0dd71467 100644 --- a/app/controllers/attachments_controller.rb +++ b/app/controllers/attachments_controller.rb @@ -5,6 +5,7 @@ class AttachmentsController < ApplicationController before_action :require_login, :check_auth, except: [:show] before_action :find_file, only: %i[show destroy] before_action :attachment_candown, only: [:show] + skip_before_action :check_sign, only: [:show, :create] include ApplicationHelper diff --git a/app/controllers/departments_controller.rb b/app/controllers/departments_controller.rb index 5e82b2c51..73cb19156 100644 --- a/app/controllers/departments_controller.rb +++ b/app/controllers/departments_controller.rb @@ -1,4 +1,6 @@ class DepartmentsController < ApplicationController + skip_before_action :check_sign + def for_option render_ok(departments: current_school.departments.without_deleted.select(:id, :name).as_json) end diff --git a/app/controllers/hacks_controller.rb b/app/controllers/hacks_controller.rb index e5ca0dc1d..3eaac0648 100644 --- a/app/controllers/hacks_controller.rb +++ b/app/controllers/hacks_controller.rb @@ -44,12 +44,13 @@ class HacksController < ApplicationController begin logger.info("##########{hack_params}") hack = Hack.new(hack_params) + hack.user_id = current_user.id + hack.identifier = generate_identifier Hack, 8 ActiveRecord::Base.transaction do - hack.user_id = current_user.id - hack.identifier = generate_identifier Hack, 8 hack.save! # 创建测试集与代码 hack.hack_sets.create!(hack_sets_params) + # 新建知识点 hack_codes = hack.hack_codes.new(hack_code_params) hack_codes.modify_time = Time.now hack_codes.save! diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 395e536f4..e8554300c 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -1,6 +1,10 @@ class MainController < ApplicationController skip_before_action :check_sign + def first_stamp + render :json => { status: 0, message: Time.now.to_i } + end + def index render file: 'public/react/build/index.html', :layout => false end diff --git a/app/controllers/schools_controller.rb b/app/controllers/schools_controller.rb index 99ca62b4c..dc9f6c091 100644 --- a/app/controllers/schools_controller.rb +++ b/app/controllers/schools_controller.rb @@ -1,4 +1,5 @@ class SchoolsController < ApplicationController + skip_before_action :check_sign def school_list schools = School.all diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 8a752106c..4f2a19536 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -24,6 +24,7 @@ class ShixunsController < ApplicationController before_action :portion_allowed, only: [:copy] before_action :special_allowed, only: [:send_to_course, :search_user_courses] + before_action :shixun_marker, only: [:new, :create] ## 获取课程列表 def index @@ -1151,4 +1152,5 @@ private end md5.hexdigest end + end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 2c1b5a810..7df9aae89 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -7,6 +7,8 @@ class SubjectsController < ApplicationController :search_members, :add_subject_members, :statistics, :shixun_report, :school_report, :up_member_position, :down_member_position, :update_team_title] before_action :require_admin, only: [:copy_subject] + before_action :shixun_marker, only: [:new, :create, :add_shixun_to_stage] + include ApplicationHelper include SubjectsHelper diff --git a/app/services/admins/identity_auths/agree_apply_service.rb b/app/services/admins/identity_auths/agree_apply_service.rb index d75a6d7db..4528debb4 100644 --- a/app/services/admins/identity_auths/agree_apply_service.rb +++ b/app/services/admins/identity_auths/agree_apply_service.rb @@ -10,7 +10,6 @@ class Admins::IdentityAuths::AgreeApplyService < ApplicationService ActiveRecord::Base.transaction do apply.update!(status: 1) user.update!(authentication: true) - RewardGradeService.call(user, container_id: user.id, container_type: 'Authentication', score: 500) deal_tiding! diff --git a/app/services/admins/professional_auths/agree_apply_service.rb b/app/services/admins/professional_auths/agree_apply_service.rb index 1ca2da2fc..3d723412b 100644 --- a/app/services/admins/professional_auths/agree_apply_service.rb +++ b/app/services/admins/professional_auths/agree_apply_service.rb @@ -10,7 +10,7 @@ class Admins::ProfessionalAuths::AgreeApplyService < ApplicationService ActiveRecord::Base.transaction do apply.update!(status: 1) user.update!(professional_certification: true) - + user.update!(is_shixun_marker: true) if user.is_teacher? RewardGradeService.call(user, container_id: user.id, container_type: 'Professional', score: 500) deal_tiding! diff --git a/app/services/admins/update_user_service.rb b/app/services/admins/update_user_service.rb index 41b5065d0..6b1c0c857 100644 --- a/app/services/admins/update_user_service.rb +++ b/app/services/admins/update_user_service.rb @@ -25,6 +25,7 @@ class Admins::UpdateUserService < ApplicationService ActiveRecord::Base.transaction do user.save! user.user_extension.save! + user.update!(is_shixun_marker: true) if user.is_certification_teacher update_gitlab_password if params[:password].present? end @@ -36,7 +37,7 @@ class Admins::UpdateUserService < ApplicationService def user_attributes params.slice(*%i[lastname nickname mail phone admin business is_test - professional_certification authentication]) + professional_certification authentication is_shixun_marker]) end def user_extension_attributes diff --git a/app/views/admins/users/edit.html.erb b/app/views/admins/users/edit.html.erb index abb003cbc..b1a8cbba1 100644 --- a/app/views/admins/users/edit.html.erb +++ b/app/views/admins/users/edit.html.erb @@ -120,6 +120,7 @@
<%= f.input :professional_certification, as: :boolean, label: '职业认证', checked_value: 1, unchecked_value: 0 %> <%= f.input :authentication, as: :boolean, label: '实名认证', wrapper_html: { class: 'ml-3' }, checked_value: 1, unchecked_value: 0 %> + <%= f.input :is_shixun_marker, as: :boolean, label: '实训制作', wrapper_html: { class: 'ml-3' }, checked_value: 1, unchecked_value: 0 %>
diff --git a/app/views/users/get_user_info.json.jbuilder b/app/views/users/get_user_info.json.jbuilder index e80c8c215..eeb66f6eb 100644 --- a/app/views/users/get_user_info.json.jbuilder +++ b/app/views/users/get_user_info.json.jbuilder @@ -14,6 +14,7 @@ json.email @user.mail json.profile_completed @user.profile_completed? json.professional_certification @user.professional_certification json.main_site current_laboratory.main_site? +json.is_shixun_marker current_user.is_shixun_marker? || current_user.admin_or_business? if @course json.course_identity @course_identity json.course_name @course.name diff --git a/config/routes.rb b/config/routes.rb index f9ed12dbe..c9da309d2 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -15,6 +15,7 @@ Rails.application.routes.draw do scope '/api' do get 'home/index' get 'home/search' + get 'main/first_stamp' get 'search', to: 'searchs#index' @@ -1336,6 +1337,7 @@ Rails.application.routes.draw do root 'main#index' + ## react用 get '*path', to: 'main#index', constraints: ReactConstraint.new end diff --git a/db/migrate/20191230094544_add_is_shixun_marker_for_users.rb b/db/migrate/20191230094544_add_is_shixun_marker_for_users.rb new file mode 100644 index 000000000..5a1eee4b1 --- /dev/null +++ b/db/migrate/20191230094544_add_is_shixun_marker_for_users.rb @@ -0,0 +1,9 @@ +class AddIsShixunMarkerForUsers < ActiveRecord::Migration[5.2] + def change + add_column :users, :is_shixun_marker, :boolean, :default => false + + User.joins(:user_extension) + .where(users: {professional_certification: 1}, user_extensions: {identity: 0}) + .update_all(is_shixun_marker: 1) + end +end diff --git a/public/images/educoder/qqqun20191230.png b/public/images/educoder/qqqun20191230.png new file mode 100644 index 000000000..e831b7d7b Binary files /dev/null and b/public/images/educoder/qqqun20191230.png differ diff --git a/public/react/src/AppConfig.js b/public/react/src/AppConfig.js index 29e7461ec..24493dd13 100644 --- a/public/react/src/AppConfig.js +++ b/public/react/src/AppConfig.js @@ -6,9 +6,10 @@ import { requestProxy } from "./indexEduplus2RequestProxy"; import { broadcastChannelOnmessage ,SetAppModel, isDev, queryString } from 'educoder'; import { notification } from 'antd'; import './index.css'; +const $ = window.$; const opens ="79e33abd4b6588941ab7622aed1e67e8"; -let timestamp = Date.parse(new Date()); -const newopens=md5(opens+timestamp) +let timestamp; +let checkSubmitFlg = false; broadcastChannelOnmessage('refreshPage', () => { window.location.reload() }) @@ -20,7 +21,7 @@ function locationurl(list){ window.location.href=list } } -let hashTimeout + // TODO 开发期多个身份切换 let debugType ="" @@ -40,7 +41,29 @@ if (isDev) { //ebugType="teacher"; // 学生 //debugType="student"; - + function railsgettimes(proxy) { + if(timestamp&&checkSubmitFlg===false){ + $.ajax({url:proxy,async:false,success:function(data){ + if(data.status===0){ + timestamp=data.message; + } + }}) + checkSubmitFlg=true + window.setTimeout(function () { + checkSubmitFlg=false; + }, 2500); + }else if(checkSubmitFlg===false){ + $.ajax({url:proxy,async:false,success:function(data){ + if(data.status===0){ + timestamp=data.message; + } + }}) + checkSubmitFlg=true + window.setTimeout(function () { + checkSubmitFlg=false; + }, 2500); + } +} window._debugType = debugType; export function initAxiosInterceptors(props) { initOnlineOfflineListener() @@ -66,6 +89,7 @@ export function initAxiosInterceptors(props) { window.setfalseInRequestMap = function(keyName) { requestMap[keyName] = false; } + axios.interceptors.request.use( config => { @@ -95,19 +119,23 @@ export function initAxiosInterceptors(props) { } if(`${config[0]}`!=`true`){ if (window.location.port === "3007") { + railsgettimes(`${proxy}/api/main/first_stamp.json`); + let newopens=md5(opens+timestamp) config.url = `${proxy}${url}`; if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?debug=${debugType}×tamp=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}?debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; } else { - config.url = `${config.url}&debug=${debugType}×tamp=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}&debug=${debugType}&randomcode=${timestamp}&client_key=${newopens}`; } } else { // 加api前缀 + railsgettimes(`/api/main/first_stamp.json`); + let newopens=md5(opens+timestamp) config.url = url; if (config.url.indexOf('?') == -1) { - config.url = `${config.url}?×tamp=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}?&randomcode=${timestamp}&client_key=${newopens}`; } else { - config.url = `${config.url}×tamp=${timestamp}&client_key=${newopens}`; + config.url = `${config.url}&randomcode=${timestamp}&client_key=${newopens}`; } } } diff --git a/public/react/src/common/UrlTool.js b/public/react/src/common/UrlTool.js index d7a49ea63..33a84dc55 100644 --- a/public/react/src/common/UrlTool.js +++ b/public/react/src/common/UrlTool.js @@ -1,3 +1,5 @@ +import md5 from 'md5'; +const $ = window.$; const isDev = window.location.port == 3007; export const TEST_HOST = "https://test-newweb.educoder.net" export function getImageUrl(path) { @@ -68,19 +70,46 @@ export function getUrl2(path, goTest) { } return `${path ? path: ''}`; } +const newopens ="79e33abd4b6588941ab7622aed1e67e8"; +let newtimestamp; +let checkSubmitFlgs = false; +function railsgettimess(proxy) { + if(checkSubmitFlgs===false){ + $.ajax({url:proxy,async:false,success:function(data){ + if(data.status===0){ + newtimestamp=data.message; + } + }}) + checkSubmitFlgs=true + window.setTimeout(function () { + checkSubmitFlgs=false; + }, 2500); + } +} + +export function Railsgettimes() { + railsgettimess(`${getUrl()}/api/main/first_stamp.json`); +} + export function getUploadActionUrl(path, goTest) { - return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}` + Railsgettimes() + let anewopens=md5(newopens+newtimestamp); + return `${getUrl()}/api/attachments.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}`; } export function getUploadActionUrltwo(id) { - - return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}` + Railsgettimes() + let anewopens=md5(newopens+newtimestamp); + return `${getUrlmys()}/api/shixuns/${id}/upload_data_sets.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` } export function getUploadActionUrlthree() { - - return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}` + Railsgettimes() + let anewopens=md5(newopens+newtimestamp); + return `${getUrlmys()}/api/jupyters/import_with_tpm.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` } export function getUploadActionUrlOfAuth(id) { - return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}` : ''}` + Railsgettimes() + let anewopens=md5(newopens+newtimestamp); + return `${getUrl()}/api/users/accounts/${id}/auth_attachment.json${isDev ? `?debug=${window._debugType || 'admin'}&randomcode=${newtimestamp}&client_key=${anewopens}` : `?randomcode=${newtimestamp}&client_key=${anewopens}`}` } export function test(path) { @@ -96,6 +125,11 @@ export function getTaskUrlById(id) { return `/tasks/${id}` } +export function getRandomcode(url) { + Railsgettimes() + let anewopens=md5(newopens+newtimestamp); + return `${url}?&randomcode=${newtimestamp}&client_key=${anewopens}` +} export function htmlEncode(str) { var s = ""; diff --git a/public/react/src/common/educoder.js b/public/react/src/common/educoder.js index 3d11ee3cb..126a42e87 100644 --- a/public/react/src/common/educoder.js +++ b/public/react/src/common/educoder.js @@ -2,7 +2,7 @@ // export { default as OrderStateUtil } from '../routes/Order/components/OrderStateUtil'; -export { getImageUrl as getImageUrl, getUrl as getUrl, getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl +export { getImageUrl as getImageUrl, getUrl as getUrl, getRandomcode as getRandomcode,getUrlmys as getUrlmys, getUrl2 as getUrl2, setImagesUrl as setImagesUrl , getUploadActionUrl as getUploadActionUrl,getUploadActionUrltwo as getUploadActionUrltwo ,getUploadActionUrlthree as getUploadActionUrlthree, getUploadActionUrlOfAuth as getUploadActionUrlOfAuth , getTaskUrlById as getTaskUrlById, TEST_HOST ,htmlEncode as htmlEncode } from './UrlTool'; export { default as queryString } from './UrlTool2'; diff --git a/public/react/src/modal/GotoQQgroup.js b/public/react/src/modal/GotoQQgroup.js new file mode 100644 index 000000000..0ac34da65 --- /dev/null +++ b/public/react/src/modal/GotoQQgroup.js @@ -0,0 +1,62 @@ +import React, { Component } from 'react'; +import {getImageUrl} from 'educoder'; +import { Modal} from 'antd'; +import axios from 'axios'; +import '../modules/user/account/common.css'; +import './gotoqqgroup.css' +class GotoQQgroup extends Component { + + constructor(props) { + super(props); + this.state={ + + } + } + + modalCancel=()=>{ + try { + this.props.setgoshowqqgtounp(false); + }catch (e) { + + } + } + + setDownload=()=>{ + //立即联系 + try { + this.props.setgoshowqqgtounp(false); + }catch (e) { + + } + } + + + render() { + + return( + +
+

您可以在QQ服务群向管理员申请,获得继续操作的权限

+ + +

群号:612934990

+
+ this.modalCancel()}>取消 + 立即联系 +
+
+
+ ) + } +} + +export default GotoQQgroup; diff --git a/public/react/src/modal/gotoqqgroup.css b/public/react/src/modal/gotoqqgroup.css new file mode 100644 index 000000000..777b7992f --- /dev/null +++ b/public/react/src/modal/gotoqqgroup.css @@ -0,0 +1,61 @@ +/* 中间居中 */ +.intermediatecenter{ + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; +} +/* 简单居中 */ +.intermediatecenterysls{ + display: flex; + align-items: center; +} +.spacearound{ + display: flex; + justify-content: space-around; + +} +.spacebetween{ + display: flex; + justify-content: space-between; +} +/* 头顶部居中 */ +.topcenter{ + display: -webkit-flex; + flex-direction: column; + align-items: center; + +} + + +/* x轴正方向排序 */ +/* 一 二 三 四 五 六 七 八 */ +.sortinxdirection{ + display: flex; + flex-direction:row; +} +/* x轴反方向排序 */ +/* 八 七 六 五 四 三 二 一 */ +.xaxisreverseorder{ + display: flex; + flex-direction:row-reverse; +} +/* 垂直布局 正方向*/ +/* 一 + 二 + 三 + 四 + 五 + 六 + 七 + 八 */ +.verticallayout{ + display: flex; + flex-direction:column; +} +/* 垂直布局 反方向*/ +.reversedirection{ + display: flex; + flex-direction:column-reverse; +} + diff --git a/public/react/src/modules/comment/CommentItemMDEditor.js b/public/react/src/modules/comment/CommentItemMDEditor.js index 8c49d356f..0bde1c6a7 100644 --- a/public/react/src/modules/comment/CommentItemMDEditor.js +++ b/public/react/src/modules/comment/CommentItemMDEditor.js @@ -6,7 +6,7 @@ import { BrowserRouter as Router, Route, Link, Switch } from "react-router-dom"; import PropTypes from 'prop-types'; import classNames from 'classnames' - +import { getImageUrl, toPath, getUrl,getUploadActionUrl } from 'educoder'; import './CommentItemMDEditor.css' const $ = window.$; @@ -36,7 +36,7 @@ class CommentItemMDEditor extends Component { if( $(`#${initMD_ID} textarea`).length === 1 ) { // 没有初始化 const placeholder = '我要回复...' // const imageUrl = `/upload_with_markdown?container_id=${commentId}&container_type=Memo`; - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; const otherOptions = { watch: false, diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js index 049f2bab1..9ea972177 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import {Button, Card, Row, Col ,Upload,Icon,message,Tabs} from 'antd'; import axios from 'axios'; -import {getImageUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; +import {getUploadActionUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; const { TabPane } = Tabs; class CompetitionContentsMd extends Component{ @@ -184,7 +184,7 @@ class CompetitionContentsMd extends Component{ // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleContentUploadChange, onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), beforeUpload: (file) => { diff --git a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js index eb304e007..360d65937 100644 --- a/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js +++ b/public/react/src/modules/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import {Button,Layout,Row, Col,Divider,Table} from 'antd'; import axios from 'axios'; -import {getImageUrl} from 'educoder'; +import {getImageUrl,getRandomcode} from 'educoder'; import './CompetitionContentspdfdownload.css'; // import NoneData from "../../../courses/shixunHomework/shixunHomework"; @@ -158,7 +158,7 @@ class CompetitionContentspdfdownload extends Component{ return( - 立即下载 ) @@ -172,7 +172,7 @@ class CompetitionContentspdfdownload extends Component{ return( - 立即下载 ) diff --git a/public/react/src/modules/courses/busyWork/NewWorkForm.js b/public/react/src/modules/courses/busyWork/NewWorkForm.js index 81851d2f2..6740f7579 100644 --- a/public/react/src/modules/courses/busyWork/NewWorkForm.js +++ b/public/react/src/modules/courses/busyWork/NewWorkForm.js @@ -3,7 +3,7 @@ import { Input, InputNumber, Form, Button, Checkbox, Upload, Icon, message, Moda import axios from 'axios' import '../css/busyWork.css' import '../css/Courses.css' -import { WordsBtn, getUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder' +import {getUploadActionUrl, ConditionToolTip, appendFileSizeToUploadFile, appendFileSizeToUploadFileAll } from 'educoder' import TPMMDEditor from '../../tpm/challengesnew/TPMMDEditor'; import CBreadcrumb from '../common/CBreadcrumb' @@ -333,7 +333,7 @@ class NewWorkForm extends Component{ // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleContentUploadChange, onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), beforeUpload: (file) => { @@ -352,7 +352,7 @@ class NewWorkForm extends Component{ // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleAnswerUploadChange, onRemove: (file) => this.onAttachmentRemove(file, 'answerFileList'), beforeUpload: (file) => { diff --git a/public/react/src/modules/courses/busyWork/common/TabRightComponents.js b/public/react/src/modules/courses/busyWork/common/TabRightComponents.js index 9c8f96cc2..41e03d176 100644 --- a/public/react/src/modules/courses/busyWork/common/TabRightComponents.js +++ b/public/react/src/modules/courses/busyWork/common/TabRightComponents.js @@ -150,8 +150,8 @@ class TabRightComponents extends Component{ {this.props.isAdmin()?
  • 导出
  • :""} diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js index 049f2bab1..9ea972177 100644 --- a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentsMd.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import {Button, Card, Row, Col ,Upload,Icon,message,Tabs} from 'antd'; import axios from 'axios'; -import {getImageUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; +import {getUploadActionUrl,getUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; const { TabPane } = Tabs; class CompetitionContentsMd extends Component{ @@ -184,7 +184,7 @@ class CompetitionContentsMd extends Component{ // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleContentUploadChange, onRemove: (file) => this.onAttachmentRemove(file, 'contentFileList'), beforeUpload: (file) => { diff --git a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js index eb304e007..360d65937 100644 --- a/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js +++ b/public/react/src/modules/courses/competitions/Competitioncommon/CompetitionCommonChild/CompetitionContentspdfChild/CompetitionContentspdfdownload.js @@ -1,7 +1,7 @@ import React, { Component } from 'react'; import {Button,Layout,Row, Col,Divider,Table} from 'antd'; import axios from 'axios'; -import {getImageUrl} from 'educoder'; +import {getImageUrl,getRandomcode} from 'educoder'; import './CompetitionContentspdfdownload.css'; // import NoneData from "../../../courses/shixunHomework/shixunHomework"; @@ -158,7 +158,7 @@ class CompetitionContentspdfdownload extends Component{ return( - 立即下载 ) @@ -172,7 +172,7 @@ class CompetitionContentspdfdownload extends Component{ return( - 立即下载 ) diff --git a/public/react/src/modules/courses/coursesPublic/CoursesMarkdown.js b/public/react/src/modules/courses/coursesPublic/CoursesMarkdown.js index fea6c79be..7b996480c 100644 --- a/public/react/src/modules/courses/coursesPublic/CoursesMarkdown.js +++ b/public/react/src/modules/courses/coursesPublic/CoursesMarkdown.js @@ -6,7 +6,7 @@ import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; // import "antd/dist/antd.css"; -import { getImageUrl, toPath, getUrl } from 'educoder'; +import { getImageUrl, toPath, getUrl,getUploadActionUrl } from 'educoder'; import axios from 'axios'; @@ -171,7 +171,7 @@ export default class CoursesMarkdown extends Component { // const placeholder = ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 创建editorMd const answers_editormd = create_editorMD(_id, '100%', 400, placeholder, imageUrl, () => { diff --git a/public/react/src/modules/courses/coursesPublic/SelectSetting.js b/public/react/src/modules/courses/coursesPublic/SelectSetting.js index ea87e8bb2..337b4d2e8 100644 --- a/public/react/src/modules/courses/coursesPublic/SelectSetting.js +++ b/public/react/src/modules/courses/coursesPublic/SelectSetting.js @@ -1,7 +1,7 @@ import React,{ Component } from "react"; import { Modal,Checkbox,Select,Input,Upload,Button,Icon,message,DatePicker,Tooltip,Radio} from "antd"; import axios from'axios'; -import {getUrl,handleDateString,appendFileSizeToUploadFileAll} from 'educoder'; +import {getUrl,handleDateString,appendFileSizeToUploadFileAll,getUploadActionUrl} from 'educoder'; import locale from 'antd/lib/date-picker/locale/zh_CN'; import moment from 'moment'; import Modals from '../../modals/Modals'; @@ -264,7 +264,7 @@ class Selectsetting extends Component{ const uploadProps = { width: 600, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file) => { diff --git a/public/react/src/modules/courses/coursesPublic/sendResource.js b/public/react/src/modules/courses/coursesPublic/sendResource.js index 73a0f6630..0f4e3cfbe 100644 --- a/public/react/src/modules/courses/coursesPublic/sendResource.js +++ b/public/react/src/modules/courses/coursesPublic/sendResource.js @@ -2,7 +2,7 @@ import React,{ Component } from "react"; import { Modal,Checkbox,Upload,Button,Icon,message,DatePicker,Select,Tooltip,Radio} from "antd"; import axios from 'axios'; import Modals from '../../modals/Modals'; -import {getUrl,handleDateString,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder'; +import {getUploadActionUrl,handleDateString,appendFileSizeToUploadFileAll} from 'educoder'; import locale from 'antd/lib/date-picker/locale/zh_CN'; import moment from 'moment'; const CheckboxGroup = Checkbox.Group; @@ -246,7 +246,7 @@ class Sendresource extends Component{ const uploadProps = { width: 600, // showUploadList:false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file) => { diff --git a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js index ab662555d..ca4a0758a 100644 --- a/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js +++ b/public/react/src/modules/courses/exercise/Testpapersettinghomepage.js @@ -1,7 +1,7 @@ import React,{ Component } from "react"; import {Checkbox,Input,Table, Pagination,Menu,Spin} from "antd"; import {Link,NavLink} from 'react-router-dom'; -import { WordsBtn ,ActionBtn,queryString,downloadFile} from 'educoder'; +import { WordsBtn ,ActionBtn,queryString,getRandomcode} from 'educoder'; import CoursesListType from '../coursesPublic/CoursesListType'; import '../css/members.css'; import '../css/busyWork.css'; @@ -404,7 +404,7 @@ class Testpapersettinghomepage extends Component{ :""} diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js index 7ac909958..f535c01bb 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitedit.js @@ -2,7 +2,7 @@ import React,{Component} from "react"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Spin,Tooltip} from "antd"; import {Link} from 'react-router-dom'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { WordsBtn,getUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; +import { WordsBtn,getUploadActionUrl ,bytesToSize,getImageUrl,appendFileSizeToUploadFileAll,appendFileSizeToUploadFile} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; const Search = Input.Search; @@ -512,7 +512,7 @@ class GraduationTasksSubmitedit extends Component{ // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file) => { diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js index d505ba15d..4918c1f6e 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksSubmitnew.js @@ -3,7 +3,7 @@ import React,{Component} from "react"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal,Tooltip,Spin} from "antd"; import {Link} from 'react-router-dom'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { WordsBtn,getUrl,getImageUrl,bytesToSize,appendFileSizeToUploadFileAll} from 'educoder'; +import { WordsBtn,getUrl,getImageUrl,getUploadActionUrl,appendFileSizeToUploadFileAll} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; const Search = Input.Search; @@ -536,7 +536,7 @@ render(){ // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file) => { diff --git a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js index b530a4de6..1a9c1490e 100644 --- a/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js +++ b/public/react/src/modules/courses/graduation/tasks/GraduationTasksedit.js @@ -2,7 +2,7 @@ import React,{Component} from "react"; import { Form, Select, Input, Button,Checkbox,Upload,Icon,message,Modal} from "antd"; import {Link} from 'react-router-dom'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; -import { WordsBtn,getUrl ,bytesToSize,appendFileSizeToUploadFileAll,AttachmentList,appendFileSizeToUploadFile} from 'educoder'; +import { WordsBtn,getUrl ,getUploadActionUrl,appendFileSizeToUploadFileAll,AttachmentList,appendFileSizeToUploadFile} from 'educoder'; import axios from 'axios'; import Modals from '../../../modals/Modals'; import '../../css/Courses.css'; @@ -314,7 +314,7 @@ class GraduationTasksedit extends Component{ // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file) => { diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js index 38e68ad32..6d4d08743 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicPostWorksNew.js @@ -7,7 +7,7 @@ import { } from 'antd'; import TPMMDEditor from '../../../tpm/challengesnew/TPMMDEditor'; import axios from 'axios' -import {getUrl} from 'educoder'; +import {getUrl,getUploadActionUrl} from 'educoder'; import "../../common/formCommon.css" // import './board.css' @@ -248,7 +248,7 @@ class GraduateTopicPostWorksNew extends Component{ // https://github.com/ant-design/ant-design/issues/15505 // showUploadList={false},然后外部拿到 fileList 数组自行渲染列表。 // showUploadList: false, - action: `${getUrl()}/api/attachments.json`, + action: `${getUploadActionUrl()}`, onChange: this.handleChange, onRemove: this.onAttachmentRemove, beforeUpload: (file) => { diff --git a/public/react/src/modules/courses/statistics/Statistics.js b/public/react/src/modules/courses/statistics/Statistics.js index 281052426..d0f47e21a 100644 --- a/public/react/src/modules/courses/statistics/Statistics.js +++ b/public/react/src/modules/courses/statistics/Statistics.js @@ -1,6 +1,6 @@ import React,{ Component } from "react"; import {Table, Pagination,Popover,Spin, Row, Col ,Tabs, Icon} from "antd"; -import { WordsBtn,on, off, trigger ,getImageUrl,sortDirections} from 'educoder'; +import { WordsBtn,on, off, getRandomcode ,getImageUrl,sortDirections} from 'educoder'; import axios from'axios'; import Dropdownbox from './Dropdownbox'; import Dynamiclist from './Dynamiclist'; @@ -172,7 +172,7 @@ class Statistics extends Component{ } }) - this.props.slowDownload(`${url}?${urllist}`); + this.props.slowDownload(getRandomcode(`${url}?${urllist}`)); } diff --git a/public/react/src/modules/forums/MemoDetailMDEditor.js b/public/react/src/modules/forums/MemoDetailMDEditor.js index 6e2563b9b..57a48fe91 100644 --- a/public/react/src/modules/forums/MemoDetailMDEditor.js +++ b/public/react/src/modules/forums/MemoDetailMDEditor.js @@ -7,7 +7,7 @@ import PropTypes from 'prop-types'; import classNames from 'classnames' -import { isDev } from 'educoder' +import { getUploadActionUrl } from 'educoder' import './MemoDetailEditor.css' @@ -36,7 +36,7 @@ class MemoDetailMDEditor extends Component { // 因为props.memo不存在时,本组件不会被加载,这里直接在didMount里初始化即可 const placeholder = '我要回复...' // const imageUrl = `/upload_with_markdown?container_id=${this.props.memo.id}&container_type=Memo`; - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; if (this.isMDInited) { return; } diff --git a/public/react/src/modules/forums/MemoDetailMDEditortwo.js b/public/react/src/modules/forums/MemoDetailMDEditortwo.js index cc3a2b1af..eafc1451f 100644 --- a/public/react/src/modules/forums/MemoDetailMDEditortwo.js +++ b/public/react/src/modules/forums/MemoDetailMDEditortwo.js @@ -7,7 +7,7 @@ import PropTypes from 'prop-types'; import classNames from 'classnames' -import { isDev } from 'educoder' +import { getUploadActionUrl } from 'educoder' import './MemoDetailEditor.css' @@ -35,7 +35,7 @@ class MemoDetailMDEditortwo extends Component { // 因为props.memo不存在时,本组件不会被加载,这里直接在didMount里初始化即可 const placeholder = '我要回复...' // const imageUrl = `/upload_with_markdown?container_id=${this.props.memo.id}&container_type=Memo`; - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 执行太快了,样式不正常 window.__tt = 400; diff --git a/public/react/src/modules/forums/MemoNew.js b/public/react/src/modules/forums/MemoNew.js index fbbd88044..a9e7d6668 100644 --- a/public/react/src/modules/forums/MemoNew.js +++ b/public/react/src/modules/forums/MemoNew.js @@ -441,7 +441,7 @@ class MemoNew extends Component { // amp; // 编辑时要传memoId // const imageUrl = `/upload_with_markdown?container_id=&container_type=Memo`; - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 创建editorMd diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index a495a97c3..3e295344c 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -31,13 +31,15 @@ class ShixunsHome extends Component { } } componentDidMount(){ - configShareForIndex() + configShareForIndex() const upsystem=`/users/system_update.json`; axios.get(upsystem).then((response)=>{ - let updata=response.data; - this.setState({ - updata:updata - }) + if(response.data){ + let updata=response.data; + this.setState({ + updata:updata + }) + } }).catch((error)=>{ console.log(error); }) @@ -50,7 +52,7 @@ class ShixunsHome extends Component { }) } }).catch((error)=>{ - console.log(error) + // console.log(error) }); } diff --git a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js index c296899f2..cd78ceaa2 100644 --- a/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js +++ b/public/react/src/modules/paths/PathDetail/DetailCardsEditAndAdd.js @@ -7,6 +7,8 @@ import Addshixuns from './Addshixuns'; import '../ShixunPaths.css'; import axios from 'axios'; import NewShixunModel from '../../courses/coursesPublic/NewShixunModel'; +import GotoQQgroup from "../../../modal/GotoQQgroup"; + const $ = window.$; const Search = Input.Search; @@ -54,8 +56,10 @@ class DetailCardsEditAndAdd extends Component{ ChooseShixunListshixun_list:undefined, stage_nametype:false, descriptiontype:false, - Addshixunstype:false - } + Addshixunstype:false, + goshowqqgtounp:false, + + } this.onDragEnd = this.onDragEnd.bind(this); } //选择实训弹框 @@ -315,6 +319,12 @@ class DetailCardsEditAndAdd extends Component{ } Addshixuns=()=>{ + // debugger + // console.log("点击了新建实训Addshixuns"); + if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){ + this.setgoshowqqgtounp(true); + return; + } this.setState({ Addshixunstype:true, }) @@ -349,7 +359,12 @@ class DetailCardsEditAndAdd extends Component{ console.log(error) }); } - + // 处理弹框 + setgoshowqqgtounp=(bool)=>{ + this.setState({ + goshowqqgtounp:bool + }) + } render(){ let {selectShixun, @@ -368,11 +383,19 @@ class DetailCardsEditAndAdd extends Component{ Modalsbottomval, ChooseShixunListshixun_list, stage_nametype, - descriptiontype} = this.state + descriptiontype, + goshowqqgtounp + } = this.state return(
    + { + goshowqqgtounp===true? + this.setgoshowqqgtounp(bool)}> + : + "" + } { + if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){ + this.setgoshowqqgtounp(true); + return; + } this.setState({ Addshixunstype:true, }) @@ -349,7 +356,12 @@ class DetailCardsEditAndEdit extends Component{ console.log(error) }); } - + // 处理弹框 + setgoshowqqgtounp=(bool)=>{ + this.setState({ + goshowqqgtounp:bool + }) + } render(){ let {selectShixun, @@ -369,11 +381,18 @@ class DetailCardsEditAndEdit extends Component{ delectfunvalue, ChooseShixunListshixun_list, stage_nametype, - descriptiontype + descriptiontype, + goshowqqgtounp } = this.state return(
    + { + goshowqqgtounp===true? + this.setgoshowqqgtounp(bool)}> + : + "" + }
    ", - testIcon1: "
    " - }, - //这个配置在simple.html中并没有,但是为了能够提交表单,使用这个配置可以让构造出来的HTML代码直接在第二个隐藏的textarea域中,方便post提交表单。 - saveHTMLToTextarea: true, - // 用于增加自定义工具栏的功能,可以直接插入HTML标签,不使用默认的元素创建图标 - dialogMaskOpacity: 0.6, - imageUpload: true, - imageFormats: ["jpg", "jpeg", "gif", "png", "bmp", "webp", "JPG", "JPEG", "GIF", "PNG", "BMP", "WEBP"], - imageUploadURL: imageUrl,//url - onload: function () { - // this.previewing(); - var id = this.id; - var editorName = this; - $("#" + id + " [type=\"latex\"]").bind("click", function () { - editorName.cm.replaceSelection("```latex"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("\n"); - editorName.cm.replaceSelection("```"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line - 1, 0); - }); - - $("#" + id + " [type=\"inline\"]").bind("click", function () { - editorName.cm.replaceSelection("`$$$$`"); - var __Cursor = editorName.cm.getDoc().getCursor(); - editorName.cm.setCursor(__Cursor.line, __Cursor.ch - 3); - editorName.cm.focus(); - }); - $("[type=\"inline\"]").attr("title", "行内公式"); - $("[type=\"latex\"]").attr("title", "多行公式"); - - - callback && callback() - } - }); - // 一个页面有多个md时,onload方法只执行了一次 - // window.md_elocalStorage(editorName, `MemoQuestion_${id}`, `${id}`); - - return editorName; -} - - - - class PathNew extends Component{ constructor(props){ super(props); + this.contentMdRef = React.createRef(); + this.Point_editMD = React.createRef(); this.state={ pathName:"", description:"", @@ -104,7 +37,7 @@ class PathNew extends Component{ }) return; } - let des=this.Des_editMD.getValue(); + let des= this.contentMdRef.current.getValue().trim(); if(des===""){ this.props.showSnackbar("请输入实践课程的简介"); window.location.href="#part_Des"; @@ -115,7 +48,7 @@ class PathNew extends Component{ window.location.href="#part_Des"; return; } - let point = this.Point_editMD.getValue(); + let point = this.Point_editMD.current.getValue().trim(); if(point===""){ this.props.showSnackbar("请输入实践课程的学习须知"); window.location.href="#part_point"; @@ -207,13 +140,9 @@ class PathNew extends Component{ this.setState({ pathName: response.data.name }) + this.contentMdRef.current.setValue(response.data && response.data.description); + this.Point_editMD.current.setValue(response.data && response.data.learning_notes); - const Des_editMD = create_editorMD("shixun_introduction","100%","490px" - ,"请在此输入实践课程的简介,最大限制8000个字符","/api/attachments.json", response.data.description,""); - this.Des_editMD=Des_editMD; - const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px" - ,"请在此输入实践课程的学习须知,最大限制2000个字符","/api/attachments.json",response.data.learning_notes,""); - this.Point_editMD=Point_editMD; } }).catch((error)=>{ console.log(error); @@ -221,10 +150,8 @@ class PathNew extends Component{ } else { this.isEditPage = false - const Des_editMD = create_editorMD("shixun_introduction","100%","490px","请在此输入实践课程的简介,最大限制8000个字符","/api/attachments.json","",""); - this.Des_editMD=Des_editMD; - const Point_editMD = create_editorMD("shixun_propaedeutics","100%","260px","请在此输入实践课程的学习须知,最大限制2000个字符","/api/attachments.json","",""); - this.Point_editMD=Point_editMD; + this.contentMdRef.current.setValue(""); + this.Point_editMD.current.setValue(""); } } @@ -266,8 +193,14 @@ class PathNew extends Component{
    *
    -
    - +
    + {/**/} + +

    @@ -280,8 +213,13 @@ class PathNew extends Component{
    *
    -
    - +
    + {/**/} +

    diff --git a/public/react/src/modules/projectPackages/MDEditors.js b/public/react/src/modules/projectPackages/MDEditors.js index abd1d2da8..ab69aa83c 100644 --- a/public/react/src/modules/projectPackages/MDEditors.js +++ b/public/react/src/modules/projectPackages/MDEditors.js @@ -4,7 +4,7 @@ import {Input, Select, Radio, Checkbox, Popconfirm, message, Modal} from 'antd'; import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; -import { getImageUrl, toPath, getUrl } from 'educoder'; +import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder'; require('codemirror/lib/codemirror.css'); @@ -222,7 +222,7 @@ export default class MDEditors extends Component { const _placeholder = placeholder || ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 创建editorMd let react_id = `react_${_id}`; diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 95813c28c..5831de122 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -19,7 +19,9 @@ import Addcourses from '../courses/coursesPublic/Addcourses'; import LoginDialog from '../login/LoginDialog'; -import Trialapplication from '../login/Trialapplication' +import Trialapplication from '../login/Trialapplication'; + +import GotoQQgroup from '../../modal/GotoQQgroup' import 'antd/lib/modal/style/index.css'; @@ -31,6 +33,8 @@ import 'antd/lib/input/style/index.css'; import './TPMIndex.css'; + + const $ = window.$ // TODO 这部分脚本从公共脚本中直接调用 @@ -69,6 +73,7 @@ class NewHeader extends Component { headtypesonClickbool:false, headtypess:"/", mygetHelmetapi2: null, + goshowqqgtounp:false, } console.log("176") // console.log(props); @@ -649,6 +654,18 @@ submittojoinclass=(value)=>{ return; } + + + if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){ + this.setgoshowqqgtounp(true); + return; + } + + + + + + if(url !== undefined || url!==""){ window.location.href = url; } @@ -790,6 +807,14 @@ submittojoinclass=(value)=>{ return false } } + + + // 处理弹框 + setgoshowqqgtounp=(bool)=>{ + this.setState({ + goshowqqgtounp:bool + }) + } render() { const isLogin = true; // 这里不会出现未登录的情况,服务端在服务端路由时发现如果是未登录,则跳转到登录页了。 const {match} = this.props; @@ -808,6 +833,7 @@ submittojoinclass=(value)=>{ headtypesonClickbool, headtypess, mygetHelmetapi2, + goshowqqgtounp, }=this.state; /* 用户名称 用户头像url @@ -898,7 +924,9 @@ submittojoinclass=(value)=>{ }) } - + // console.log("newHeadersnewHeaders"); + // console.log(this.props); + // this.props.current_user.is_shixun_marker return (
    @@ -914,6 +942,14 @@ submittojoinclass=(value)=>{ {...this.props} {...this.state} />:""} + + { + goshowqqgtounp===true? + this.setgoshowqqgtounp(bool)}> + : + "" + } + this.headtypesonClick("/",false)} className={"fl mr30 ml25 mt10"}> { mygetHelmetapi2 === null ? @@ -1100,9 +1136,6 @@ submittojoinclass=(value)=>{ {/*课堂*/} 翻转课堂 - - {} - {console.log(activeShixuns)}
  • 实训项目 {/**/} @@ -1287,7 +1320,9 @@ submittojoinclass=(value)=>{ {this.props.current_user&&this.props.current_user.user_identity==="学生"?"":coursestypes===false?
  • this.getUser("/courses/new")}>{this.props.user&&this.props.user.main_site===false?"新建课堂":"新建翻转课堂"}
  • :"" } - {shixuntype===true?"":
  • this.getUser("/shixuns/new")}>新建实训项目
  • } + {shixuntype===true?"": +
  • this.getUser("/shixuns/new")}>新建实训项目
  • + } {this.props.user&&this.props.user.main_site===false?"":this.props.Headertop===undefined?"":
  • this.getUser("/paths/new")} >新建实践课程
  • } {this.props.user&&this.props.user.main_site===true?"":this.props.Headertop===undefined?"": pathstype===true?"":this.props.user&&this.props.user.admin===true||this.props.user&&this.props.user.is_teacher===true||this.props.user&&this.props.user.business===true?
  • this.getUser("/paths/new")} >新建实践课程
  • :"" diff --git a/public/react/src/modules/tpm/TPMsettings/oldTPMsettings.js b/public/react/src/modules/tpm/TPMsettings/oldTPMsettings.js index 8688e9669..3c42b38db 100644 --- a/public/react/src/modules/tpm/TPMsettings/oldTPMsettings.js +++ b/public/react/src/modules/tpm/TPMsettings/oldTPMsettings.js @@ -15,7 +15,7 @@ import axios from 'axios'; import './css/TPMsettings.css'; -import { getImageUrl, toPath, getUrl ,appendFileSizeToUploadFileAll, getUploadActionUrl} from 'educoder'; +import { getImageUrl, toPath, getUrl ,getUploadActionUrl} from 'educoder'; let origin = getUrl(); @@ -280,7 +280,7 @@ export default class TPMsettings extends Component { const placeholder = ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 创建editorMd const description_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> { @@ -307,7 +307,7 @@ export default class TPMsettings extends Component { const placeholder = ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 创建editorMd const evaluate_script_editormd =create_editorMD(id, '100%', 400, placeholder, imageUrl, initValue,()=> { diff --git a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js index 22326e9e7..64cc373dc 100644 --- a/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js +++ b/public/react/src/modules/tpm/challengesnew/TPMMDEditor.js @@ -6,7 +6,7 @@ import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; // import "antd/dist/antd.css"; -import { getImageUrl, toPath, getUrl } from 'educoder'; +import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder'; import '../../courses/css/Courses.css' import axios from 'axios'; @@ -226,7 +226,7 @@ export default class TPMMDEditor extends Component { const _placeholder = placeholder || ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 创建editorMd let react_id = `react_${_id}`; // 将实例存到了window diff --git a/public/react/src/modules/tpm/challengesnew/editorMD.js b/public/react/src/modules/tpm/challengesnew/editorMD.js index 50f15b601..26d21d86a 100644 --- a/public/react/src/modules/tpm/challengesnew/editorMD.js +++ b/public/react/src/modules/tpm/challengesnew/editorMD.js @@ -1,6 +1,6 @@ import React, {Component} from 'react'; -import {getUrl} from 'educoder'; +import {getUrl,getUploadActionUrl} from 'educoder'; let path = getUrl("/editormd/lib/"); @@ -85,7 +85,7 @@ export default class TPMeditorMD extends Component { // amp; // 编辑时要传memoId // const imageUrl = `/upload_with_markdown?container_id=&container_type=Memo`; - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 创建editorMd let questio_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { diff --git a/public/react/src/modules/tpm/challengesnew/old/TPManswer.js b/public/react/src/modules/tpm/challengesnew/old/TPManswer.js index 7d090c607..350a5ca8d 100644 --- a/public/react/src/modules/tpm/challengesnew/old/TPManswer.js +++ b/public/react/src/modules/tpm/challengesnew/old/TPManswer.js @@ -6,7 +6,7 @@ import {BrowserRouter as Router, Route, Link, Switch} from "react-router-dom"; // import "antd/dist/antd.css"; -import { getImageUrl, toPath, getUrl } from 'educoder'; +import { getImageUrl, getUploadActionUrl, getUrl } from 'educoder'; import axios from 'axios'; @@ -170,7 +170,7 @@ export default class TPManswer extends Component { const placeholder = ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `${getUploadActionUrl()}`; // 创建editorMd const answers_editormd = create_editorMD(id, '100%', 400, placeholder, imageUrl, () => { diff --git a/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js b/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js index 1eaee9ad6..4904219bb 100644 --- a/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js +++ b/public/react/src/modules/tpm/newshixuns/oldNewshixuns.js @@ -243,7 +243,7 @@ class Newshixuns extends Component { const placeholder = ""; // amp; // 编辑时要传memoId - const imageUrl = `/api/attachments.json`; + const imageUrl = `getUploadActionUrl`; // 创建editorMd const taskpass_editormd = create_editorMD("memoMD", '100%', 400, placeholder, imageUrl, () => { diff --git a/public/react/src/modules/tpm/shixuns/ShixunCardList.js b/public/react/src/modules/tpm/shixuns/ShixunCardList.js index 937e96894..948bbed48 100644 --- a/public/react/src/modules/tpm/shixuns/ShixunCardList.js +++ b/public/react/src/modules/tpm/shixuns/ShixunCardList.js @@ -12,6 +12,7 @@ import classNames from 'classnames' import 'antd/lib/switch/style/index.css' import './shixunCss/ShixunCardList.css'; +import GotoQQgroup from '../../../modal/GotoQQgroup' import { on, off } from 'educoder' @@ -33,6 +34,7 @@ class ShixunCardList extends Component { shixunid:"", upcircle:false, typekeyid:undefined, + goshowqqgtounp:false, } } @@ -52,7 +54,7 @@ class ShixunCardList extends Component { componentWillUnmount = () => { off('searchKeywordChange') } - + latestHot=(e,key)=>{ @@ -171,6 +173,10 @@ class ShixunCardList extends Component { this.props.showProfileCompleteDialog() return } + if(this.props&&this.props.current_user&&this.props.current_user.is_shixun_marker===false){ + this.setgoshowqqgtounp(true); + return; + } if(url !== undefined || url!==""){ window.location.href = url; @@ -178,8 +184,15 @@ class ShixunCardList extends Component { } + + // 处理弹框 + setgoshowqqgtounp=(bool)=>{ + this.setState({ + goshowqqgtounp:bool + }) + } render(){ - let {mine,InputValue,upcircle}=this.state; + let {mine,InputValue,upcircle,goshowqqgtounp}=this.state; // console.log("NewHeadermygetHelmetapi123123123123"); let shixuntype=false; @@ -196,10 +209,19 @@ class ShixunCardList extends Component { } }) } + + return (
    + { + goshowqqgtounp===true? + this.setgoshowqqgtounp(bool)}> + : + "" + } + {/*
    this.latestHot(e,1)}>全部*/} diff --git a/public/react/src/modules/user/account/common.css b/public/react/src/modules/user/account/common.css index e3bdb24fd..6039ffd26 100644 --- a/public/react/src/modules/user/account/common.css +++ b/public/react/src/modules/user/account/common.css @@ -1,118 +1,119 @@ -.basicForm { - background: #fff; - padding: 30px; - margin-bottom: 10px; - box-sizing: border-box; - width: 100%; - min-height: 390px; -} - .basicForm .title { - font-size: 16px; - padding-left: 30px; - margin-bottom: 10px; - } -.flexTable { - display: flex; - flex-direction: column; -} -.flexRow { - display: flex; -} - -.mb15{margin-bottom: 15px!important;} -/* BUTTOn */ -.ant-btn { - border-radius: 2px; -} -button.ant-btn.ant-btn-primary.grayBtn { - background: #CBCBCB; - border-color: #CBCBCB; -} -.borderBottom { - border-bottom: 1px solid #4CACFF; -} - -/* form ---------------- START */ -.formItemInline { - display: flex; -} -.formItemInline .ant-form-item-control-wrapper { - display: inline-block; -} -.hideRequireTag .ant-form-item-required:before{ - display: none; -} - - - /* .basicForm .ant-form-item-label { - width: 100px; - padding-right: 10px; - } - .basicForm .ant-form-item-label label { - color: #979797 - } */ - - -.courseNormalForm .ant-select-show-search { - height: 40px; -} -.courseNormalForm .ant-select-auto-complete.ant-select .ant-input { - height: 40px; -} -.courseNormalForm .ant-select-search__field__mirror { - height: 40px; -} -.courseNormalForm .ant-input-lg { - height: 40px; -} -.courseNormalForm .ant-select-selection--single { - height: 40px; -} -.courseNormalForm .ant-select-auto-complete.ant-select .ant-select-selection--single { - height: 40px -} -.courseNormalForm .ant-input-affix-wrapper { - height: 40px; -} -/* 职业 */ -.courseNormalForm .ant-select-selection-selected-value { - line-height: 38px -} -.courseNormalForm input { - height: 40px; -} -.autoModal .ant-modal-body{ - height: auto; - overflow-y: auto; -} - -@media screen and (max-height: 765px) { - .autoModal .ant-modal-body { - height: 670px; - overflow-y: auto; - } -} -@media screen and (max-height: 735px) { - .autoModal .ant-modal-body { - height: 600px; - overflow-y: auto; - } -} -@media screen and (max-height: 635px) { - .autoModal .ant-modal-body { - height: 500px; - overflow-y: auto; - } -} -@media screen and (max-height: 566px) { - .autoModal .ant-modal-body { - height: 465px; - overflow-y: auto; - } -} -@media screen and (max-height: 472px) { - .autoModal .ant-modal-body { - height: 360px; - overflow-y: auto; - } -} \ No newline at end of file +.basicForm { + background: #fff; + padding: 30px; + margin-bottom: 10px; + box-sizing: border-box; + width: 100%; + min-height: 390px; +} + .basicForm .title { + font-size: 16px; + padding-left: 30px; + margin-bottom: 10px; + } +.flexTable { + display: flex; + flex-direction: column; +} +.flexRow { + display: flex; +} + +.mb15{margin-bottom: 15px!important;} +/* BUTTOn */ +.ant-btn { + border-radius: 2px; +} +button.ant-btn.ant-btn-primary.grayBtn { + background: #CBCBCB; + border-color: #CBCBCB; +} +.borderBottom { + border-bottom: 1px solid #4CACFF; +} + +/* form ---------------- START */ +.formItemInline { + display: flex; +} +.formItemInline .ant-form-item-control-wrapper { + display: inline-block; +} +.hideRequireTag .ant-form-item-required:before{ + display: none; +} + + + /* .basicForm .ant-form-item-label { + width: 100px; + padding-right: 10px; + } + .basicForm .ant-form-item-label label { + color: #979797 + } */ + + +.courseNormalForm .ant-select-show-search { + height: 40px; +} +.courseNormalForm .ant-select-auto-complete.ant-select .ant-input { + height: 40px; +} +.courseNormalForm .ant-select-search__field__mirror { + height: 40px; +} +.courseNormalForm .ant-input-lg { + height: 40px; +} +.courseNormalForm .ant-select-selection--single { + height: 40px; +} +.courseNormalForm .ant-select-auto-complete.ant-select .ant-select-selection--single { + height: 40px +} +.courseNormalForm .ant-input-affix-wrapper { + height: 40px; +} +/* 职业 */ +.courseNormalForm .ant-select-selection-selected-value { + line-height: 38px +} +.courseNormalForm input { + height: 40px; +} +.autoModal .ant-modal-body{ + height: auto; + overflow-y: auto; +} + +@media screen and (max-height: 765px) { + .autoModal .ant-modal-body { + height: 670px; + overflow-y: auto; + } +} +@media screen and (max-height: 735px) { + .autoModal .ant-modal-body { + height: 600px; + overflow-y: auto; + } +} +@media screen and (max-height: 635px) { + .autoModal .ant-modal-body { + height: 500px; + overflow-y: auto; + } +} +@media screen and (max-height: 566px) { + .autoModal .ant-modal-body { + height: 465px; + overflow-y: auto; + } +} +@media screen and (max-height: 472px) { + .autoModal .ant-modal-body { + height: 360px; + overflow-y: auto; + } +} + diff --git a/public/react/src/modules/user/usersInfo/InfosShixun.js b/public/react/src/modules/user/usersInfo/InfosShixun.js index b5811e44f..b45ba65f6 100644 --- a/public/react/src/modules/user/usersInfo/InfosShixun.js +++ b/public/react/src/modules/user/usersInfo/InfosShixun.js @@ -9,6 +9,7 @@ import { setImagesUrl } from 'educoder'; import "./usersInfo.css" import Create from './publicCreatNew' +import GotoQQgroup from "../../../modal/GotoQQgroup"; class InfosShixun extends Component{ constructor(props){ @@ -22,7 +23,8 @@ class InfosShixun extends Component{ sort_by: "updated_at", sort_direction: "desc", totalCount:undefined, - data:undefined + data:undefined, + goshowqqgtounp:false, } } @@ -144,6 +146,13 @@ class InfosShixun extends Component{ this.getCourses(category, status, sort_by, page, sort_directiony); } + // 处理弹框 + setgoshowqqgtounp=(bool)=>{ + this.setState({ + goshowqqgtounp:bool + }) + } + render(){ let{ @@ -154,7 +163,8 @@ class InfosShixun extends Component{ data, totalCount, sort_direction, - isSpin + isSpin, + goshowqqgtounp } = this.state; let is_current=this.props.is_current; @@ -171,6 +181,12 @@ class InfosShixun extends Component{ ); return(
    + { + goshowqqgtounp===true? + this.setgoshowqqgtounp(bool)}> + : + "" + }