diff --git a/app/controllers/admins/mirror_repositories_controller.rb b/app/controllers/admins/mirror_repositories_controller.rb index aed8dc09e..63e4667d1 100644 --- a/app/controllers/admins/mirror_repositories_controller.rb +++ b/app/controllers/admins/mirror_repositories_controller.rb @@ -87,7 +87,6 @@ class Admins::MirrorRepositoriesController < Admins::BaseController end def check_shixun_mirrors! - return return unless request.format.html? Admins::CheckShixunMirrorsService.call diff --git a/app/controllers/admins/shixun_settings_controller.rb b/app/controllers/admins/shixun_settings_controller.rb index 9919c7daa..d635ae8df 100644 --- a/app/controllers/admins/shixun_settings_controller.rb +++ b/app/controllers/admins/shixun_settings_controller.rb @@ -1,8 +1,7 @@ class Admins::ShixunSettingsController < Admins::BaseController def index - params[:sort_by] = params[:sort_by].presence || 'created_on' - params[:sort_direction] = params[:sort_direction].presence || 'desc' + default_sort('created_at', 'desc') shixun_settings = Admins::ShixunSettingsQuery.call(params) @editing_shixuns = shixun_settings.where(status:0).size diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index a6464a151..784bb9c9a 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1084,14 +1084,23 @@ class ExercisesController < ApplicationController @shixun_undo = 0 @ques_undo = 0 ex_answer_time = @exercise.time.to_i - @ex_end_time = @exercise.get_exercise_end_time(current_user.id) - if ex_answer_time > 0 - exercise_end_time = @exercise.exercise_users.exercise_commit_users(current_user.id) - if exercise_end_time.present? - ex_end_times = exercise_end_time.first.start_at.nil? ? Time.now : exercise_end_time.first.start_at - @ex_end_time = ex_end_times + ex_answer_time.minutes - end + if ex_answer_time > 0 #有剩余时间的时候 + user_left_time = get_exercise_left_time(@exercise,current_user) + @ex_end_time = Time.now + user_left_time.to_i.seconds + else + @ex_end_time = @exercise.get_exercise_end_time(current_user.id) end + # @ex_end_time = @exercise.get_exercise_end_time(current_user.id) + # if ex_answer_time > 0 + # left_answer_time = Time.now + ex_answer_time.minutes #判断试卷的倒计时和截止时间哪个先到 + # if left_answer_time < @ex_end_time + # exercise_end_time = @exercise.exercise_users.exercise_commit_users(current_user.id) + # if exercise_end_time.present? + # ex_end_times = exercise_end_time.first.start_at.nil? ? Time.now : exercise_end_time.first.start_at + # @ex_end_time = ex_end_times + ex_answer_time.minutes + # end + # end + # end @exercise_questions.each do |q| if q.question_type == Exercise::PRACTICAL #当为实训题时 user_myshixun = q.shixun.myshixuns.search_myshixun_user(current_user.id) diff --git a/app/controllers/oauth/base_controller.rb b/app/controllers/oauth/base_controller.rb index e2eb26a2a..e4068fbda 100644 --- a/app/controllers/oauth/base_controller.rb +++ b/app/controllers/oauth/base_controller.rb @@ -1,9 +1,14 @@ class Oauth::BaseController < ActionController::Base include RenderHelper include LoginHelper + include ControllerRescueHandler skip_before_action :verify_authenticity_token + def auth_failure + render_error(params[:message]) + end + private def session_user_id @@ -15,6 +20,7 @@ class Oauth::BaseController < ActionController::Base end def auth_hash + Rails.logger.info("[OAuth2] omniauth.auth -> #{request.env['omniauth.auth'].inspect}") request.env['omniauth.auth'] end end \ No newline at end of file diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 395d67913..323bad3cf 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -142,6 +142,9 @@ module ExercisesHelper right_users_count = 0 #该问题的正确率 if ex.question_type == Exercise::MULTIPLE #多选题 + if standard_answer.size == 1 #以前的多选题答案存在一个表里 + standard_answer = standard_answer.first.to_s.split("").map(&:to_i) + end right_user_ids = user_ids standard_answer.each do |choice_position| standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == choice_position}.first&.id @@ -896,7 +899,8 @@ module ExercisesHelper if ex_time > 0 exercise_user = exercise.exercise_users.find_by(user_id:user.id) time_mill = ex_time * 60 #转为秒 - exercise_end_time = exercise.end_time.present? ? exercise.end_time.to_i : 0 + exercise_end_time = exercise.get_exercise_end_time(user.id) #没有考虑分班的情况 + # exercise_end_time = exercise.end_time.present? ? exercise.end_time.to_i : 0 exercise_user_start = exercise_user&.start_at.present? ? exercise_user.start_at.to_i : 0 #用户未开始答题时,即exercise_user_start为0 if exercise_user_start == 0 diff --git a/app/libs/omniauth/strategies/qq.rb b/app/libs/omniauth/strategies/qq.rb index 513257e3c..97cd9de94 100644 --- a/app/libs/omniauth/strategies/qq.rb +++ b/app/libs/omniauth/strategies/qq.rb @@ -6,6 +6,7 @@ module OmniAuth authorize_url: '/oauth2.0/authorize', token_url: '/oauth2.0/token' } + option :token_params, { parse: :query } def request_phase super @@ -21,7 +22,17 @@ module OmniAuth end end - uid { raw_info['openid'].to_s } + uid do + @uid ||= begin + access_token.options[:mode] = :query + access_token.options[:param_name] = :access_token + # Response Example: "callback( {\"client_id\":\"11111\",\"openid\":\"000000FFFF\"} );\n" + response = access_token.get('/oauth2.0/me') + + matched = response.body.match(/"openid":"(?\w+)"/) + matched[:openid] + end + end info do { @@ -35,15 +46,10 @@ module OmniAuth { raw_info: user_info } end - def raw_info - access_token.options[:mode] = :query - @raw_info ||= access_token.get('/oauth2.0/me').parsed - end - def user_info access_token.options[:mode] = :query - params = { oauth_consumer_key: options.client_id, openid: raw_info['openid'], format: 'json' } - @user_info ||= access_token.get('/user/get_user_info', params: params) + param = { oauth_consumer_key: options[:client_id], openid: uid, format: 'json' } + @user_info ||= access_token.get('/user/get_user_info', params: param, parse: :json).parsed end end end diff --git a/app/services/admins/check_shixun_mirrors_service.rb b/app/services/admins/check_shixun_mirrors_service.rb index 868fab042..8334df485 100644 --- a/app/services/admins/check_shixun_mirrors_service.rb +++ b/app/services/admins/check_shixun_mirrors_service.rb @@ -77,10 +77,11 @@ class Admins::CheckShixunMirrorsService < ApplicationService @_bridge_images ||= begin url = EduSetting.get('cloud_bridge') res = Faraday.get(url) + res_body = JSON.parse(res.body) - raise Error, '拉取镜像信息异常' if res && res['code'].nonzero? + raise Error, '拉取镜像信息异常' if res_body && res_body['code'].to_i != 0 - res + res_body rescue => e Rails.logger.error("get response failed ! #{e.message}") raise Error, '实训云平台繁忙(繁忙等级:84)' diff --git a/app/services/oauth/create_or_find_qq_account_service.rb b/app/services/oauth/create_or_find_qq_account_service.rb index c258993bd..92966634c 100644 --- a/app/services/oauth/create_or_find_qq_account_service.rb +++ b/app/services/oauth/create_or_find_qq_account_service.rb @@ -28,7 +28,7 @@ class Oauth::CreateOrFindQqAccountService < ApplicationService user.create_user_extension!(gender: gender) # 下载头像 avatar_path = Util::FileManage.source_disk_filename(user) - Util.download_file(params.dig('info', 'figureurl_qq_1'), avatar_path) + Util.download_file(params.dig('info', 'image'), avatar_path) end new_open_user = OpenUsers::QQ.create!(user: user, uid: params['uid'], extra: params.dig('extra', 'raw_info')) diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder index 7febcd789..870d33d40 100644 --- a/app/views/subjects/show.json.jbuilder +++ b/app/views/subjects/show.json.jbuilder @@ -12,6 +12,7 @@ json.allow_send @user.logged? json.allow_visit @subject.status > 1 || @is_manager json.allow_add_member @is_manager json.is_creator @is_creator +json.cover url_to_avatar(@subject) if @subject.excellent json.has_start @subject.has_course_start? diff --git a/config/initializers/omniauth.rb b/config/initializers/omniauth.rb index 27ade9ed4..3eed48c20 100644 --- a/config/initializers/omniauth.rb +++ b/config/initializers/omniauth.rb @@ -1,4 +1,8 @@ OmniAuth.config.add_camelization 'qq', 'QQ' +OmniAuth.config.logger = Rails.logger +OmniAuth.config.on_failure = Proc.new { |env| + OmniAuth::FailureEndpoint.new(env).redirect_to_failure +} oauth_config = {} begin @@ -13,5 +17,5 @@ rescue => ex end Rails.application.config.middleware.use OmniAuth::Builder do - provider :qq, oauth_config['appid'], oauth_config['secret'] + provider :qq, oauth_config['appid'], oauth_config['secret'], { provider_ignores_state: true } end diff --git a/config/routes.rb b/config/routes.rb index 04d20fd15..796d1d989 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -6,6 +6,8 @@ Rails.application.routes.draw do get 'attachments/download/:id', to: 'attachments#show' get 'attachments/download/:id/:filename', to: 'attachments#show' + get 'auth/qq/callback', to: 'oauth/qq#create' + get 'auth/failure', to: 'oauth/base#auth_failure' resources :edu_settings scope '/api' do diff --git a/public/react/config/webpack.config.dev.js b/public/react/config/webpack.config.dev.js index f335f1705..743b3685c 100644 --- a/public/react/config/webpack.config.dev.js +++ b/public/react/config/webpack.config.dev.js @@ -32,7 +32,7 @@ module.exports = { // See the discussion in https://github.com/facebookincubator/create-react-app/issues/343.s // devtool: "cheap-module-eval-source-map", // 开启调试 - devtool: "source-map", // 开启调试 + // devtool: "source-map", // 开启调试 // These are the "entry points" to our application. // This means they will be the "root" imports that are included in JS bundle. // The first two entry points enable "hot" CSS and auto-refreshes for JS. diff --git a/public/react/public/css/demo_index.html b/public/react/public/css/demo_index.html index 8a75ddb27..c88449b3f 100644 --- a/public/react/public/css/demo_index.html +++ b/public/react/public/css/demo_index.html @@ -222,6 +222,12 @@
&#xe693;
+
  • + +
    关注
    +
    &#xe6c0;
    +
  • +
  • 礼物
    @@ -324,6 +330,12 @@
    &#xe678;
  • +
  • + +
    关注
    +
    &#xe6c5;
    +
  • +
  • 喇叭
    @@ -1718,6 +1730,15 @@
  • +
  • + +
    + 关注 +
    +
    .icon-weibiaoti105 +
    +
  • +
  • @@ -1871,6 +1892,15 @@
  • +
  • + +
    + 关注 +
    +
    .icon-guanzhu +
    +
  • +
  • @@ -3740,6 +3770,14 @@
    #icon-renzhengxinxi
  • +
  • + +
    关注
    +
    #icon-weibiaoti105
    +
  • +
  • #icon-dashujucunchu
  • +
  • + +
    关注
    +
    #icon-guanzhu
    +
  • +
  • -- : this.Viewstudenttraininginformationtysl2(e, record)} onClick={() => this.Viewstudenttraininginformationt(record)}>查看 ) @@ -1505,6 +1508,7 @@ class Listofworksstudentone extends Component { record.submitstate === "未提交" ? -- : this.Viewstudenttraininginformationtysl2(e, record)} onClick={() => this.Viewstudenttraininginformationt(record)}>{record.operating} ) @@ -2779,7 +2783,16 @@ class Listofworksstudentone extends Component { } // 调分 - + Viewstudenttraininginformationtysl2 = (e, data) => { + // console.log("Viewstudenttraininginformationtysl2"); + // console.log("shubiao zhongjian "); + // console.log(e); + this.setState({ + userids: data.myid, + }) + // this.viewtrainingt(e.myid); + window.open(`/courses/${this.state.props.match.params.coursesId}/shixun_homeworks/${data.myid}/shixun_work_report`, '_blank'); + } // 查看学员实训信息 Viewstudenttraininginformationt = (e) => { // console.log("Viewstudenttraininginformation"); diff --git a/public/react/src/modules/home/shixunsHome.js b/public/react/src/modules/home/shixunsHome.js index 4db39a310..217e1cc06 100644 --- a/public/react/src/modules/home/shixunsHome.js +++ b/public/react/src/modules/home/shixunsHome.js @@ -147,7 +147,9 @@ class ShixunsHome extends Component { nextArrow={} prevArrow={} autoplay + autoplaySpeed={4500} animation={false} + pauseOnHover={true} style={{width:"100%"}} arrowPos="outer"> {homedatalist.images_url.map((item, index) => ( diff --git a/public/react/src/modules/page/readme.txt b/public/react/src/modules/page/readme.txt index 21c2ce13c..882c48ee5 100644 --- a/public/react/src/modules/page/readme.txt +++ b/public/react/src/modules/page/readme.txt @@ -1,3 +1,131 @@ +state说明 + tasks详情接口 + allowed_unlock 为true时,才允许非管理员用户解锁隐藏测试集 + discusses_count 总评论数 + + challenge 实训关卡信息 + exec_time -- + modify_time -- + path 关卡文件路径 + position 第几关 + praises_count 点赞数 + score 分数 + shixun_id + st 0-编程题 1-选择题 + subject 关卡名称 + task_pass 过关任务 + web_route -- + + game 为每一个用户独立创建的实训关卡对应的信息 + accuracy -- + answer_deduction-- + answer_open -- + challenge_id + cost_time 通关耗时 + created_at + end_time + evaluate_count + final_score + id + identifier + modify_time + myshixun_id + open_time + picture_path + resubmit_identifier + retry_status + star + status 2-已通关 + test_sets_view true-测试集已解锁 + updated_at + user_id + game_count 关卡数 + git_url 仓库地址,vnc会用到 + has_answer + is_teacher 是否是老师 初始化被赋值到 user.is_teacher + last_compile_output + mirror_name 镜像名称 TPIMonaco会用到这个属性来判断当前关卡使用的什么语言 见 mirror2LanguageMap + myshixun + commit_id: "80cb6fc55a14bdd64a9c99913f416966238ed3de" + created_at: "2019-07-26T09:00:31.000+08:00" + git_url: null + gpid: null + id: 542543 + identifier: "ns53g8vfeo" 有些接口会用到 + is_public: true + modify_time: "2017-11-02T18:12:23.000+08:00" + onclick_time: "2019-07-26T09:00:31.000+08:00" + repo_name: "p15478209/ns53g8vfeo20190726090031" + reset_time: "2017-10-25T09:33:03.000+08:00" + shixun_id: 61 + status: 0 + system_tip: true (如果修改了测试集 || 修改了代码) && system_tip为true 也就是下面代码为true时,才显示更新通知弹框 + const showUpdateButton = (tpm_cases_modified || needUpdateScript) && myshixun.system_tip === true; + updated_at: "2019-11-05T10:58:35.000+08:00" + user_id: 24731 + myshixun_manager: true + next_game: "so7ijzqe63a9" 下一关identifier + praise_count: 120 点赞数 + prev_game: "bxg5w9uonhts" 上一关identifier + record_onsume_time: 0.296 上一次评测耗时 初始化被赋值到newResData.record = newResData.record_onsume_time + sets_error_count: 0 失败测试集数量 + shixun + authentication: false + averge_star: 4.9 + can_copy: false + challenges_count: 4 关卡数 + closer_id: null + code_edit_permission: false 是否允许修改代码 + code_hidden: false 是否隐藏文件目录按钮 + created_at: "2017-06-09T11:32:16.000+08:00" + end_time: null + excute_time: null + exec_time: 25 + forbid_copy: false forbid_copy ? "不允许学员复制和粘贴代码" : "允许学员复制和粘贴代码" + fork_from: null + git_url: "educoder/uznmbg54" + gpid: 2448 + hidden: false + hide_code: false 是否隐藏代码tab + homepage_show: true + id: 61 + identifier: "uznmbg54" + image_text: null + language: "Python3.6" !! + major_id: 635 + mirror_script_id: null + modify_time: "2017-11-02T18:12:23.000+08:00" + multi_webssh: false 多命令行tab + myshixuns_count: 9655 学员数 + name: "Python表达式问题求解(一)※" + opening_time: null + pod_life: 0 + publish_time: "2017-09-01T10:37:49.000+08:00" + repo_name: "educoder/uznmbg54" + reset_time: "2017-10-25T09:33:03.000+08:00" + sigle_training: false + status: 2 shixun.status >= 2 实训已发布 shixun.status <= 1 模拟实战 + task_pass: task_pass ? "允许学员跳关挑战" : "不允许学员跳关挑战" + test_set_permission: true test_set_permission ? "允许学员通过金币解锁查看测试集内容" : "不允许学员通过金币解锁查看测试集内容" + trainee: 1 + updated_at: "2019-10-11T08:50:59.000+08:00" + use_scope: 0 + user_id: 3039 + users_count: 4 + visits: 69699 + webssh: 1 是否显示命令行tab + st 0-编程题 1-选择题 + test_sets 测试集 + test_sets_count: 1 + time_limit: 25 game_status.json轮训次数 + tomcat_url: "http://47.96.157.89" web类型实训,可以打开展现一个测试服务,用来查看评测结果 const webDisplayUrl = `${tomcat_url}:${data.port}/${path}` + tpm_cases_modified: false 参考system_tip属性 + tpm_modified: true 参考system_tip属性 + user 当前关卡所属用户的信息 + user_praise 当前用户是否点赞 + +-------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- -------------- + TPIContextProvider tpi主要的state容器,主要接口:`/tasks/${stageId}.json`,一次性获取所有tpi首屏展示所需要的信息,除了代码内容。 接口返回的内容包括 @@ -54,4 +182,21 @@ TPIContextProvider 没用的文件 LeftNav.js - AnswerListContainer.js left 他人解答 \ No newline at end of file + AnswerListContainer.js left 他人解答 + + + + + +TPI SSH + 命令行的js资源都位于这个目录:/react/public/js/jsFromMiddleLayer/base64.js + + /page/main/CodeRepositoryView.js文件中,open_webssh.json接口返回后,会根据代码区试图大小计算ssh视图的大小(同样的逻辑在js_min_all中也有: + var h = $("#games_repository_contents").height() - $("#top_repository").height() - repositoryTabHeight; ) + 这里有个对应的issue https://www.trustie.net/issues/25279 + 这里是要判断特殊的屏幕(公司dell笔记本可重现),针对这些情况处理,加高命令行的高度 + ps js_min_all中搜`$("#games_repository_contents").height()`可以找到相关代码 + + +VNCDisplay + 使用的github上的代码 https://github.com/novnc/noVNC/ \ No newline at end of file diff --git a/public/react/src/modules/paths/PathDetail/Modifytext.js b/public/react/src/modules/paths/PathDetail/Modifytext.js new file mode 100644 index 000000000..ca12659a9 --- /dev/null +++ b/public/react/src/modules/paths/PathDetail/Modifytext.js @@ -0,0 +1,169 @@ +import React, {Component} from 'react'; +import {Button, Layout, Input, Form} from 'antd'; +import axios from 'axios'; +import {getImageUrl} from 'educoder'; + + +class Modifytext extends Component { + constructor(props) { + super(props) + this.state = {} + } + + componentDidMount() { + + } + + //重新输入教学模式 + Modifytext = () => { + this.props.form.validateFieldsAndScroll((err, values) => { + if (!err) { + const url = `/paths/${this.props.pathid}/update_team_title.json`; + axios.post(url, { + team_title: values.teachingteam + }).then((response) => { + console.log(response); + if (response) { + if (response.data) { + if (response.data.status === 0) { + try { + this.props.showNotification("修改成功!"); + } catch (e) { + + } + try { + this.props.modifysy(2); + } catch (e) { + + } + + + } + } + } + + }).catch((error) => { + console.log(error) + + }) + + + } + }) + + + } + + + render() { + const {getFieldDecorator} = this.props.form; + return ( +
    +
    + +
    + +
    +
    + + {getFieldDecorator('teachingteam', { + rules: [{ + // initialValue: this.state.cityDefaultValue, + required: true, + message: '请输入模式', + }], + })( + + )} + +
    +

    +
    + {/*
    this.yhBanksfalse()}>

    取消

    */} + +
    +
    +
    +
    +
    +
    + +
    +
    + ) + } +} + +const Modifytexts = Form.create({name: 'Modifytext'})(Modifytext); + +export default Modifytexts; + diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index ca52cd9d1..b393d1bb6 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -12,7 +12,7 @@ import Modals from '../../modals/Modals'; import axios from 'axios'; import TPMRightSection from "../../tpm/component/TPMRightSection"; import styled from "styled-components"; - +import Modifytext from './Modifytext'; const getItemStyle = (isDragging, draggableStyle) => ({ // change background colour if dragging background: isDragging ? '#dceeff' : '', @@ -87,7 +87,9 @@ class PathDetailIndex extends Component{ dataquerys:{}, MenuItemsindex:1, MenuItemsindextype:0, - qrcode_img:null + qrcode_img: null, + team_title: "教学团队", + modify: false, } this.onDragEnd = this.onDragEnd.bind(this); @@ -256,6 +258,7 @@ class PathDetailIndex extends Component{ progress:result.data.progress, members:result.data.members, items: getItems(result.data.members.length), + team_title: result.data.team_title }) }).catch((error)=>{ @@ -321,6 +324,7 @@ class PathDetailIndex extends Component{ progress:result.data.progress, members:result.data.members, items: getItems(result.data.members.length), + team_title: result.data.team_title }) }).catch((error)=>{ @@ -458,6 +462,50 @@ class PathDetailIndex extends Component{ console.log(error) }) } + + + modifysy = (i) => { + if (i === 1) { + this.setState({ + modify: true + }) + } else if (i === 2) { + this.setState({ + modify: false + }) + let righturl = "/paths/" + this.props.match.params.pathId + "/right_banner.json"; + axios.get(righturl).then((result) => { + if (result.data.status === 407 || result.data.status === 401) { + debugger + return; + } + + if (result.data.status === 403) { + debugger + // window.location.href = "/403"; + return; + } + + this.setState({ + // detailInfoList:result.data, + tags: result.data.tags, + progress: result.data.progress, + members: result.data.members, + items: getItems(result.data.members.length), + team_title: result.data.team_title + }) + + }).catch((error) => { + console.log(error); + }) + } + } + + setteam_title(name) { + this.setState({ + team_title: name + }) + } render(){ this.updatamakedown("shixuns_propaedeutics"); @@ -475,7 +523,9 @@ class PathDetailIndex extends Component{ tags, qrcode_img, MenuItemsindex, - MenuItemsindextype + MenuItemsindextype, + team_title, + modify } = this.state @@ -613,7 +663,19 @@ class PathDetailIndex extends Component{ { members ===undefined ?"":members === null ?"":
    -

    教学团队

    + { + detailInfoList === undefined ? "" : detailInfoList.allow_add_member === true ? + ( + modify === false ? +

    this.modifysy(1)}>{team_title}

    + : + this.modifysy(i)} + setteam_title={(name) => this.setteam_title(name)}> + ) + + : "" + } { members===undefined? members && members.map((item,key)=>{ @@ -712,4 +774,4 @@ class PathDetailIndex extends Component{ ) } } -export default PathDetailIndex; \ No newline at end of file +export default PathDetailIndex; diff --git a/public/react/src/modules/user/usersInfo/Infos.js b/public/react/src/modules/user/usersInfo/Infos.js index a55cbb74c..488668421 100644 --- a/public/react/src/modules/user/usersInfo/Infos.js +++ b/public/react/src/modules/user/usersInfo/Infos.js @@ -280,7 +280,7 @@ class Infos extends Component{ } > - {/* 实训 */} + {/* 实训项目 */} () @@ -294,7 +294,7 @@ class Infos extends Component{ } > - {/* 项目 */} + {/* 开发项目 */} () diff --git a/public/react/src/modules/user/usersInfo/InfosCourse.js b/public/react/src/modules/user/usersInfo/InfosCourse.js index 14046d495..ec68261a3 100644 --- a/public/react/src/modules/user/usersInfo/InfosCourse.js +++ b/public/react/src/modules/user/usersInfo/InfosCourse.js @@ -71,8 +71,8 @@ class InfosCourse extends Component{ page:1, isSpin:true }) - let{status}=this.state; - this.getCourses(cate,status,1); + let {status, sort_by, sort_direction} = this.state; + this.getCourses(cate, status, 1, sort_by, sort_direction); } //切换状态 changeStatus=(status)=>{ @@ -81,8 +81,8 @@ class InfosCourse extends Component{ page:1, isSpin:true }) - let{category}=this.state; - this.getCourses(category,status,1); + let {category, sort_by, sort_direction} = this.state; + this.getCourses(category, status, 1, sort_by, sort_direction); } //切换页数 changePage=(page)=>{ @@ -90,8 +90,8 @@ class InfosCourse extends Component{ page, isSpin:true }) - let{category,status}=this.state; - this.getCourses(category,status,page); + let {category, status, sort_by, sort_direction} = this.state; + this.getCourses(category, status, page, sort_by, sort_direction); } // 进入课堂 @@ -110,7 +110,7 @@ class InfosCourse extends Component{ this.getCourses(category, status, 1, sort_by, "desc"); } - updatedlists(sort_direction, i) { + updatedlists(sort_directions, i) { // console.log("updatedlistssort_direction"); // console.log(sort_direction); // console.log(i); @@ -118,8 +118,20 @@ class InfosCourse extends Component{ this.setState({ isSpin: true }); - let {category, status, page, sort_by} = this.state; - this.getCourses(category, status, page, sort_by, sort_direction); + + let {category, status, page, sort_by, sort_direction} = this.state; + let sort_directiony = sort_directions; + if (sort_directions === "asc") { + if (sort_directions === sort_direction) { + sort_directiony = "desc" + } + } else if (sort_directions === "desc") { + if (sort_directions === sort_direction) { + sort_directiony = "asc" + } + } + + this.getCourses(category, status, page, sort_by, sort_directiony); } render(){ @@ -147,21 +159,87 @@ class InfosCourse extends Component{ ); - + console.log("InfosCourse"); + console.log(status); return(
    +
    -
  • this.changeCategory()}>全部
  • -
  • this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
  • -
  • this.changeCategory("study")}>{is_current ? "我":"TA"}学习的
  • +
  • this.changeCategory()} className="font-16 w32">全部
  • +
  • this.changeCategory("manage")} + className="font-16 w66">{is_current ? "我" : "TA"}管理的
  • +
  • this.changeCategory("study")} + className="font-16 w66">{is_current ? "我" : "TA"}学习的
  • + + { is_current && -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("processing")}>正在进行
  • -
  • this.changeStatus("end")}>已结束
  • +
    +
  • this.changeStatus()} + className="w32">全部
  • +
  • this.changeStatus("processing")} className="w66">正在进行
  • +
  • this.changeStatus("end")} className="w66">已结束
  • }

    +

    -
  • this.changeCategory()}>全部
  • -
  • this.changeCategory("manage")}>{is_current ? "我":"TA"}管理的
  • -
  • this.changeCategory("bidden")}>{is_current ? "我":"TA"}参与的
  • +
  • this.changeCategory()} className="font-16 w32">全部
  • +
  • this.changeCategory("manage")} + className="font-16 w66">{is_current ? "我" : "TA"}管理的
  • +
  • this.changeCategory("study")} + className="font-16 w66">{is_current ? "我" : "TA"}学习的
  • + { category=="manage"? -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("unpublished")}>未发布
  • -
  • this.changeStatus("bidding")}>竞标中
  • -
  • this.changeStatus("finished")}>已完成
  • +
    +
  • this.changeStatus()} className="w32">全部
  • +
  • this.changeStatus("unpublished")} className="w60">未发布
  • +
  • this.changeStatus("bidding")} className="w60">竞标中
  • +
  • this.changeStatus("finished")} className="w60">已完成
  • : category=="bidden"? -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("bidding_lost")}>未中标
  • -
  • this.changeStatus("bidding_won")}>已中标
  • +
    +
  • this.changeStatus()} className="w32">全部
  • +
  • this.changeStatus("bidding_lost")} className="w60">未中标
  • +
  • this.changeStatus("bidding_won")} className="w60">已中标
  • :"" }

    @@ -289,4 +348,4 @@ class InfosPackage extends Component{ ) } } -export default InfosPackage; \ No newline at end of file +export default InfosPackage; diff --git a/public/react/src/modules/user/usersInfo/InfosPath.js b/public/react/src/modules/user/usersInfo/InfosPath.js index 0b1437f40..b91b29be5 100644 --- a/public/react/src/modules/user/usersInfo/InfosPath.js +++ b/public/react/src/modules/user/usersInfo/InfosPath.js @@ -123,13 +123,24 @@ class InfosPath extends Component{ } //排序 - updatedlists(sort_direction) { + updatedlists(sort_directions) { //是否是倒序 this.setState({ isSpin: true }); - let {category, status, page, sort_by} = this.state; - this.getCourses(category, status, sort_by, page, sort_direction); + let {category, status, page, sort_by, sort_direction} = this.state; + let sort_directiony = sort_directions; + if (sort_directions === "asc") { + if (sort_directions === sort_direction) { + sort_directiony = "desc" + } + } else if (sort_directions === "desc") { + if (sort_directions === sort_direction) { + sort_directiony = "asc" + } + } + + this.getCourses(category, status, sort_by, page, sort_directiony); } @@ -160,26 +171,97 @@ class InfosPath extends Component{ return(

    - + + + + { category && category == "manage" && is_current && -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("editing")}>编辑中
  • -
  • this.changeStatus("applying")}>待审核
  • -
  • this.changeStatus("published")}>已发布
  • + } { category && category == "study" && is_current && -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("unfinished")}>未完成
  • -
  • this.changeStatus("finished")}>已完成
  • + }
    - + + + { is_current && -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("publicly")}>公开
  • -
  • this.changeStatus("personal")}>私有
  • + }

    { if(result){ @@ -124,13 +125,24 @@ class InfosShixun extends Component{ } //排序 - updatedlists(sort_direction) { + updatedlists(sort_directions) { //是否是倒序 this.setState({ isSpin: true }); - let {category, status, page, sort_by} = this.state; - this.getCourses(category, status, sort_by, page, sort_direction); + let {category, status, page, sort_by, sort_direction} = this.state; + let sort_directiony = sort_directions; + if (sort_directions === "asc") { + if (sort_directions === sort_direction) { + sort_directiony = "desc" + } + } else if (sort_directions === "desc") { + if (sort_directions === sort_direction) { + sort_directiony = "asc" + } + } + + this.getCourses(category, status, sort_by, page, sort_directiony); } render(){ @@ -160,27 +172,99 @@ class InfosShixun extends Component{ return(

    - + + + + { category && category == "manage" && is_current && -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("editing")}>编辑中
  • -
  • this.changeStatus("applying")}>待审核
  • -
  • this.changeStatus("published")}>已发布
  • -
  • this.changeStatus("closed")}>已关闭
  • + } { category && category == "study" && is_current && -
    -
  • this.changeStatus()}>全部
  • -
  • this.changeStatus("processing")}>未通关
  • -
  • this.changeStatus("passed")}>已通关
  • + }
    { }, []) @@ -19,7 +19,16 @@ function InfoTab (props) {
    {categories && categories.map(item => { return ( -
  • changeCategory(item.key)}>{item.name}
  • + item.id === 1 ? +
  • changeCategory(item.key)} + style={{width: "70px"}}>{item.name}
  • + : +
  • changeCategory(item.key)} + style={{width: "80px"}}>{item.name}
  • ) })} {/*
  • this.changeCategory()}>全部
  • diff --git a/public/react/src/modules/user/usersInfo/usersInfo.css b/public/react/src/modules/user/usersInfo/usersInfo.css index 1cf335213..9bfabab9b 100644 --- a/public/react/src/modules/user/usersInfo/usersInfo.css +++ b/public/react/src/modules/user/usersInfo/usersInfo.css @@ -439,3 +439,15 @@ .h10 { height: 10px; } + +.w32 { + width: 32px !important; +} + +.w66 { + width: 66px !important; +} + +.w60 { + width: 60px !important; +} diff --git a/public/react/src/modules/user/usersInfo/video/InfosVideo.js b/public/react/src/modules/user/usersInfo/video/InfosVideo.js index 2cbea920b..bcc5acd2e 100644 --- a/public/react/src/modules/user/usersInfo/video/InfosVideo.js +++ b/public/react/src/modules/user/usersInfo/video/InfosVideo.js @@ -193,10 +193,31 @@ function InfoVideo (props) { } // TODO use封装 function onSortChange(key, index) { - const _item = _items[index] - _items.splice(index, 1) - _items.unshift(_item) - setSortKey(key) + + try { + const _item = _items[index]; + _items.splice(index, 1); + _items.unshift(_item); + const keys = key.split('-'); + const sorts = sortKey.split('-'); + if (key === "published_at-desc") { + if (keys[1] === sorts[1]) { + setSortKey("published_at-asc") + } else { + setSortKey(key) + } + } else if (key === "published_at-asc") { + if (keys[1] === sorts[1]) { + setSortKey("published_at-desc") + } else { + setSortKey(key) + } + } + } catch (e) { + + } + + } function getCopyText (file_url, cover_url) { return `` @@ -259,6 +280,23 @@ function InfoVideo (props) { .videoItem { margin-right: 24px; } + .white-panel li.active { + border-radius: 24px; + border: 0px solid #4CACFF; + color: #4CACFF; + } + .whitepanelysllisyt { + width: 70px !important; + height: 48px !important; + line-height: 46px !important; + + } + .whitepanelysllisyts { + width: 80px !important; + height: 48px !important; + line-height: 46px !important; + margin-left: 30px; + } `} @@ -266,10 +304,12 @@ function InfoVideo (props) { {...props} categories={[{ key: 'all', - name: '全部视频' + name: '全部视频', + id: 1, }, { key: 'review', - name: '待审核视频' + name: '待审核视频', + id: 2 }]} {...categoryObj} diff --git a/public/stylesheets/educoder/iconfont/demo_index.html b/public/stylesheets/educoder/iconfont/demo_index.html index 8a75ddb27..c88449b3f 100644 --- a/public/stylesheets/educoder/iconfont/demo_index.html +++ b/public/stylesheets/educoder/iconfont/demo_index.html @@ -222,6 +222,12 @@
    &#xe693;
    +
  • + +
    关注
    +
    &#xe6c0;
    +
  • +
  • 礼物
    @@ -324,6 +330,12 @@
    &#xe678;
  • +
  • + +
    关注
    +
    &#xe6c5;
    +
  • +
  • 喇叭
    @@ -1718,6 +1730,15 @@
  • +
  • + +
    + 关注 +
    +
    .icon-weibiaoti105 +
    +
  • +
  • @@ -1871,6 +1892,15 @@
  • +
  • + +
    + 关注 +
    +
    .icon-guanzhu +
    +
  • +
  • @@ -3740,6 +3770,14 @@
    #icon-renzhengxinxi
  • +
  • + +
    关注
    +
    #icon-weibiaoti105
    +
  • +
  • #icon-dashujucunchu
  • +
  • + +
    关注
    +
    #icon-guanzhu
    +
  • +