From 0ecc37dbf1deb70f8e02f0077e872d906941ce17 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 5 Mar 2020 16:54:56 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/routes.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/config/routes.rb b/config/routes.rb index ba0827676..7da30bc7e 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1463,9 +1463,9 @@ Rails.application.routes.draw do get 'oauth/get_code', to: 'oauth#get_code' get 'oauth/get_token_callback', to: 'oauth#get_token_callback' - root 'main#index' + # root 'main#index' ## react用 - get '*path', to: 'main#index', constraints: ReactConstraint.new + # get '*path', to: 'main#index', constraints: ReactConstraint.new end From cf464bd506861c8f3c06c6372000275ddcc3cc85 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Thu, 5 Mar 2020 17:47:53 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=9F=9F=E5=90=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/main_controller.rb | 36 +++++++++++++++--------------- config/routes.rb | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index 69323bf49..dd0b1ee97 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -8,24 +8,24 @@ class MainController < ApplicationController end def index - domain_session = params[:_educoder_session] - if domain_session - uid_logger("main start domain_session is #{domain_session}") - if cookies[:_educoder_session] != domain_session - cookies[:_educoder_session] = nil - cookies[:_educoder_session] = domain_session - end - - - uid_logger("main start is #{cookies[:_educoder_session]}") - end - - # TODO: 这块之后需要整合,者架构重新变化,统一跳转到index后再路由分发 - if params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild" - render file: 'public/h5educoderbuild/index.html', :layout => false - else - render file: 'public/react/build/index.html', :layout => false - end + # domain_session = params[:_educoder_session] + # if domain_session + # uid_logger("main start domain_session is #{domain_session}") + # if cookies[:_educoder_session] != domain_session + # cookies[:_educoder_session] = nil + # cookies[:_educoder_session] = domain_session + # end + # + # + # uid_logger("main start is #{cookies[:_educoder_session]}") + # end + # + # # TODO: 这块之后需要整合,者架构重新变化,统一跳转到index后再路由分发 + # if params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild" + # render file: 'public/h5educoderbuild/index.html', :layout => false + # else + # render file: 'public/react/build/index.html', :layout => false + # end end end \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index 7da30bc7e..6b2f7d22c 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1463,7 +1463,7 @@ Rails.application.routes.draw do get 'oauth/get_code', to: 'oauth#get_code' get 'oauth/get_token_callback', to: 'oauth#get_token_callback' - # root 'main#index' + root 'main#index' ## react用 From 66d67608605629a529d0f3f22b3fb8422a779e36 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 10 Mar 2020 12:05:54 +0800 Subject: [PATCH 3/4] reset routes --- config/routes.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/routes.rb b/config/routes.rb index 6b2f7d22c..ba0827676 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -1467,5 +1467,5 @@ Rails.application.routes.draw do ## react用 - # get '*path', to: 'main#index', constraints: ReactConstraint.new + get '*path', to: 'main#index', constraints: ReactConstraint.new end From 95635d2073643b1eb990ed69f69cde31c3e063ee Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 10 Mar 2020 12:08:17 +0800 Subject: [PATCH 4/4] main --- app/controllers/main_controller.rb | 36 +++++++++++++++--------------- 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/app/controllers/main_controller.rb b/app/controllers/main_controller.rb index dd0b1ee97..69323bf49 100644 --- a/app/controllers/main_controller.rb +++ b/app/controllers/main_controller.rb @@ -8,24 +8,24 @@ class MainController < ApplicationController end def index - # domain_session = params[:_educoder_session] - # if domain_session - # uid_logger("main start domain_session is #{domain_session}") - # if cookies[:_educoder_session] != domain_session - # cookies[:_educoder_session] = nil - # cookies[:_educoder_session] = domain_session - # end - # - # - # uid_logger("main start is #{cookies[:_educoder_session]}") - # end - # - # # TODO: 这块之后需要整合,者架构重新变化,统一跳转到index后再路由分发 - # if params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild" - # render file: 'public/h5educoderbuild/index.html', :layout => false - # else - # render file: 'public/react/build/index.html', :layout => false - # end + domain_session = params[:_educoder_session] + if domain_session + uid_logger("main start domain_session is #{domain_session}") + if cookies[:_educoder_session] != domain_session + cookies[:_educoder_session] = nil + cookies[:_educoder_session] = domain_session + end + + + uid_logger("main start is #{cookies[:_educoder_session]}") + end + + # TODO: 这块之后需要整合,者架构重新变化,统一跳转到index后再路由分发 + if params[:path] && params[:path]&.include?("h5educoderbuild") && params[:path].split("/").first == "h5educoderbuild" + render file: 'public/h5educoderbuild/index.html', :layout => false + else + render file: 'public/react/build/index.html', :layout => false + end end end \ No newline at end of file