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

chromesetting
cxt 5 years ago
commit 054ed1439b

@ -62,6 +62,17 @@ module LoginHelper
end
def start_user_session(user)
# re_subdomain = "#{request.subdomain.split('.').first}_user_id"
# session[:"#{request.subdomain}_user_id"] = user.id
# Rails.logger.info("domain_user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}")
# Rails.logger.info("user_id session is: 3333332222111#{session[:"#{request.subdomain}_user_id"]}")
#
# # if current_laboratory.main_site?
# # session[:user_id] = user.id
# # else
# # session[:"#{request.subdomain}_user_id"] = user.id
# # end
session[:user_id] = user.id
session[:ctime] = Time.now.utc.to_i
session[:atime] = Time.now.utc.to_i

@ -49,6 +49,12 @@ class GitsController < ApplicationController
repo_name = username + "/" + shixunname
uid_logger("git start: repo_name is #{repo_name}")
shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).where(repo_name: repo_name).first
if shixun.blank?
shixun_id = ShixunSecretRepository.where(repo_name: repo_name).pluck(:shixun_id).first
logger.info("####repo_name:#{repo_name}")
logger.info("####shixun_id:#{shixun_id}")
shixun = Shixun.select([:id, :user_id, :repo_name, :identifier]).find_by(id: shixun_id)
end
uid_logger("git start auth: shixun identifier is #{shixun.try(:identifier)}")
uid_logger("git start auth: systemuser is #{system_user.try(:login)}")

@ -103,7 +103,7 @@ class HackUserLastestCodesController < ApplicationController
if exec_mode == "submit"
@hack.hack_sets.map{|set| {input: set.input, output: set.output, caseId: set.id}}
else
{input: params[:input]}
[{input: params[:input]}]
end
testCases = Base64.urlsafe_encode64(test_sets.to_json)
#codeFileContent = Base64.urlsafe_encode64(@my_hack.code)
@ -136,7 +136,9 @@ class HackUserLastestCodesController < ApplicationController
if @my_hack.hack_user_debug.present?
@my_hack.hack_user_debug.update_attributes!(debug_params)
else
@my_hack.hack_user_debug.create!(debug_params)
debug = HackUserDebug.new(debug_params)
debug.hack_user_lastest_code_id = @my_hack.id
debug.save!
end
end

@ -27,7 +27,7 @@ class HacksController < ApplicationController
# 筛选过滤与排序
params_filter_or_order
# 我解决的编程题数
user_codes = HackUserLastestCode.mine(current_user).passed.joins(:hack)
user_codes = HackUserLastestCode.joins(:hack).mine_hack(current_user).passed
@simple_count = user_codes.where(hacks: {difficult: 1}).count
@medium_count = user_codes.where(hacks: {difficult: 2}).count
@diff_count = user_codes.where(hacks: {difficult: 3}).count

@ -9,6 +9,7 @@ class HackUserLastestCode < ApplicationRecord
has_many :hack_user_codes, dependent: :destroy
has_one :hack_user_debug
scope :mine, ->(author_id){ find_by(user_id: author_id) }
scope :mine_hack, ->(author_id){ where(user_id: author_id) }
scope :passed, -> {where(status: 1)}
end

@ -44,7 +44,9 @@ Rails.application.routes.draw do
get :start
get :result
end
resources :comments
resources :comments do
end
end
resources :hack_user_lastest_codes, path: :myproblems, param: :identifier do

@ -0,0 +1,5 @@
class AddCodeForhackUserDebugs < ActiveRecord::Migration[5.2]
def change
add_column :hack_user_debugs, :code, :text
end
end

@ -58,7 +58,7 @@ class ConclusionEvaluation extends Component {
<span>
<Tooltip placement="bottom" title={
<pre>
分数{record.eff_scores.eff_score}/总分{record.eff_score_full}
分数{record.eff_scores.eff_score}/总分{record.eff_scores.eff_score_full}
</pre>
}>
<span style={{color:'#FF6800'}}>{record.eff_scores.eff_score}</span><span className={"color-grey-9"}>/{record.eff_scores.eff_score_full}</span>

@ -149,9 +149,9 @@ class ShixunsHome extends Component {
<style>
{
`
.shixunsHome .educontent {
width: 1223px;
}
.shixunsHome .educontent {
width: 1250px;
}
.banners{
overflow: hidden;
}
@ -242,7 +242,7 @@ class ShixunsHome extends Component {
</div>
<Link to={"/paths"} className="moreitem">更多<i className="fa fa-angle-right ml5"></i></Link>
<div className="square-list clearfix" style={{width:'102%'}}>
<div className="square-list clearfix" style={{width:'100%'}}>
{homedatalist===undefined?"":homedatalist.subjects.map((item,key)=>{
@ -321,7 +321,7 @@ class ShixunsHome extends Component {
</div>
<Link to={"/shixuns"} className="moreitem">更多<i className="fa fa-angle-right ml5"></i></Link>
<div className="square-list clearfix" style={{width:'102%'}}>
<div className="square-list clearfix" style={{width:'100%'}}>
<style>
{
`

@ -117,7 +117,16 @@ class Osshackathon extends Component {
this.props.showProfileCompleteDialog()
return
}
//判断是否绑定邮箱
if(this.props.user.email===null){
this.props.showhideAccountPhoneemailDialog()
return
}
if(this.props.user.phone===null){
this.props.showhideAccountPhoneemailDialog()
return
}
this.props.confirm({
content: `是否确认报名?`,
onOk: () => {

@ -11,7 +11,7 @@ import { Spin } from 'antd';
import './TPMIndex.css';
import LoginDialog from '../login/LoginDialog';
import AccountProfile from '../user/AccountProfile';
import AccountPhoneemail from '../user/AccountPhoneemail';
import Trialapplication from "../login/Trialapplication";
// import "antd/dist/antd.css";
// import '../../css/educoder/edu-common.css'
@ -80,7 +80,7 @@ export function TPMIndexHOC(WrappedComponent) {
isRender: false,
AccountProfiletype: false,
AccountPhoneemailtype:false,
globalLoading: false,
dataquerys:{},
isloginCancel:undefined,
@ -532,6 +532,17 @@ export function TPMIndexHOC(WrappedComponent) {
AccountProfiletype: true
})
}
showhideAccountPhoneemailDialog = () => {
this.dialogObj = {}
this.setState({
AccountPhoneemailtype: true
})
}
hideAccountPhoneemailtype=()=>{
this.setState({
AccountPhoneemailtype:false
})
}
//验证是否完善资料
checkIfProfileCompleted = () => {
return this.state.current_user && this.state.current_user.profile_completed
@ -625,7 +636,7 @@ export function TPMIndexHOC(WrappedComponent) {
}
render() {
let{Headertop,Footerdown, isRender, AccountProfiletype,mygetHelmetapi}=this.state;
let{Headertop,Footerdown, isRender, AccountProfiletype,AccountPhoneemailtype}=this.state;
const common = {
isSuperAdmin:this.isSuperAdmin,
isAdminOrCreator:this.isAdminOrCreator,
@ -645,6 +656,7 @@ export function TPMIndexHOC(WrappedComponent) {
showLoginDialog: this.showLoginDialog,
checkIfLogin: this.checkIfLogin,
showProfileCompleteDialog: this.showProfileCompleteDialog,
showhideAccountPhoneemailDialog:this.showhideAccountPhoneemailDialog,
checkIfProfileCompleted: this.checkIfProfileCompleted,
checkIfProfessionalCertification: this.checkIfProfessionalCertification,
showProfessionalCertificationDialog: this.showProfessionalCertificationDialog,
@ -677,6 +689,13 @@ export function TPMIndexHOC(WrappedComponent) {
{...this.state}
{...this.dialogObj}
/>:""}
{/*验证是否注册手机邮箱*/}
{AccountPhoneemailtype===true?<AccountPhoneemail
hideAccountProfile={()=>this.hideAccountPhoneemailtype()}
{...this.props}
{...this.state}
{...this.dialogObj}
/>:""}
<SiderBar
{...this.props}
{...this.state}

@ -0,0 +1,79 @@
import React, { Component } from 'react';
import {getImageUrl} from 'educoder';
import {Modal} from 'antd';
import axios from 'axios';
class AccountPhoneemail extends Component {
constructor(props) {
super(props);
this.state = {
AccountPhoneemailtype:false
}
}
componentDidMount() {
if(this.props.AccountPhoneemailtype!=undefined){
this.setState({
AccountPhoneemailtype:this.props.AccountPhoneemailtype
})
}
axios.interceptors.response.use((response) => {
if (response != undefined)
if (response && response.data.status === 402) {
this.setState({
AccountPhoneemailtype: true
})
}
return response;
}, (error) => {
});
}
gotoback=()=>{
if(this.props.AccountPhoneemailtype!=undefined){
this.setState({
AccountPhoneemailtype:false
})
this.props.hideAccountProfile()
}else{
window.location.href="/";
this.setState({
AccountPhoneemailtype:false
})
}
}
/**
content: '您需要去完成您的职业认证,才能使用此功能',
okText: '立即完成',
okHref: '/account/certification'
*/
render() {
const { content, okText, okHref } = this.props;
return(
<Modal
keyboard={false}
title="提示"
visible={this.state.AccountPhoneemailtype}
closable={false}
footer={null}
destroyOnClose={true}
centered={true}
width="530px"
>
<div className="task-popup-content">
<p className="task-popup-text-center font-16"> 您需要完成手机号码和邮箱的绑定才能使用此功能</p>
<div className="clearfix mt30 edu-txt-center">
<a className="task-btn mr30" onClick={()=>this.gotoback()}>稍后绑定</a>
<a className="task-btn task-btn-orange" href={ "/account/secure" }> {'立即绑定'}</a>
</div>
</div>
</Modal>
)
}
}
export default AccountPhoneemail;

@ -154,7 +154,7 @@ class LoginRegisterComponent extends Component {
// console.log(this.props);
let pcipns=this.IsPC();
if (this.props.match.url === "/login") {
console.log("11111111111111111111111111");
// this.state = {
// tab:["0"],
//
@ -163,7 +163,7 @@ class LoginRegisterComponent extends Component {
tab:["0"]
})
} else if (this.props.match.url === "/register") {
console.log("11111111111111111111111111");
// this.state = {
// tab:["1"],
//
@ -968,6 +968,7 @@ class LoginRegisterComponent extends Component {
// window.location.href='http://www.cnblogs.com/a-cat/';
}
return (
<div className="login_register_content login_register_contents"
@ -1077,7 +1078,7 @@ class LoginRegisterComponent extends Component {
<Button className="login_btn font-16" type="primary" style={{height:"46px"}} onClick={() => this.postLogin()}
size={"large"}>登录</Button>
{this.props.user&&this.props.user.main_site===true?this.state.isphone===true?<p className="clearfix mb10 textcenter">
{this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?this.state.isphone===true?<p className="clearfix mb10 textcenter">
<span className={"startlogin"}> 快速登录 </span>
<div className={"mt10"}>
@ -1252,7 +1253,7 @@ class LoginRegisterComponent extends Component {
<Button className=" font-16 mb20" type="primary" style={this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?{height:"46px", width: "100%",marginTop:"26px"}:{height:"46px", width: "100%"}} onClick={() => this.postregistered()}
size={"large"}>注册</Button>
{this.props.user&&this.props.user.main_site===true?this.state.isphone===true?<p className="clearfix mb10 textcenter">
{this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?this.state.isphone===true?<p className="clearfix mb10 textcenter">
<span className={"startlogin"}> 快速登录 </span>
<div className={"mt10"}>

Loading…
Cancel
Save