Merge branch 'develop' of https://bdgit.educoder.net/Hjqreturn/pgfqe6ch8 into develop
commit
ec83c30929
@ -0,0 +1,75 @@
|
|||||||
|
# encoding=utf-8
|
||||||
|
# 好大学接口数据
|
||||||
|
module Mobile
|
||||||
|
module Apis
|
||||||
|
class Cnmooc < Grape::API
|
||||||
|
before {cnmooc_access_key!}
|
||||||
|
content_type :json, 'application/json;charset=UTF-8'
|
||||||
|
|
||||||
|
resources :cnmoocs do
|
||||||
|
desc '获取实训数据'
|
||||||
|
get "get_resources_data" do
|
||||||
|
CnmoocsService.new.get_resources_data params
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "实训搜索功能"
|
||||||
|
params do
|
||||||
|
requires :name, type: String, desc: "搜索名称"
|
||||||
|
end
|
||||||
|
get 'search_resources' do
|
||||||
|
CnmoocsService.new.search_resources params
|
||||||
|
end
|
||||||
|
|
||||||
|
desc " 查找用户"
|
||||||
|
params do
|
||||||
|
requires :userName, type: String, desc: "好大学用户名"
|
||||||
|
end
|
||||||
|
get 'find_user' do
|
||||||
|
CnmoocsService.new.find_user params
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "创建用户"
|
||||||
|
params do
|
||||||
|
requires :userName, type: String, desc: "好大学用户名"
|
||||||
|
end
|
||||||
|
post "create_user" do
|
||||||
|
CnmoocsService.new.create_user params
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "获取资源访问地址"
|
||||||
|
params do
|
||||||
|
requires :userId, type: Integer, desc: "用户ID"
|
||||||
|
requires :resouceId, type: String, desc: "资源唯一标示"
|
||||||
|
requires :accessType, type: Integer, desc: "资源类型"
|
||||||
|
end
|
||||||
|
get "source_url" do
|
||||||
|
if session[:third_party_user_id].blank?
|
||||||
|
user = User.find(params[:userId])
|
||||||
|
session[:third_party_user_id] = user.user_source.id
|
||||||
|
end
|
||||||
|
|
||||||
|
CnmoocsService.new.source_url(params)
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "远程登录"
|
||||||
|
params do
|
||||||
|
requires :mail, type: String, desc: "邮箱地址"
|
||||||
|
requires :password, type: String, desc: "密码"
|
||||||
|
end
|
||||||
|
get "login_educoder" do
|
||||||
|
CnmoocsService.new.login_educoder params
|
||||||
|
end
|
||||||
|
|
||||||
|
desc "资源学习情况查询"
|
||||||
|
params do
|
||||||
|
requires :userId, type: Integer, desc: "用户ID"
|
||||||
|
requires :resouceId, type: String, desc: "资源唯一标示"
|
||||||
|
end
|
||||||
|
get 'get_students_data' do
|
||||||
|
CnmoocsService.new.get_students_data params
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,8 @@
|
|||||||
|
class CnmoocUser < UserSource
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def email_prefix
|
||||||
|
'cnmooc_'
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,21 @@
|
|||||||
|
class UserSource < ActiveRecord::Base
|
||||||
|
belongs_to :user
|
||||||
|
|
||||||
|
def generate_email
|
||||||
|
email = rand_email
|
||||||
|
while User.exists?(mail: email) do
|
||||||
|
email = rand_email
|
||||||
|
end
|
||||||
|
email
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def rand_email
|
||||||
|
email_prefix + Random.rand.to_s[2..8] + '@educoder.com'
|
||||||
|
end
|
||||||
|
|
||||||
|
def email_prefix
|
||||||
|
''
|
||||||
|
end
|
||||||
|
end
|
@ -1 +1 @@
|
|||||||
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/react/build/css/css_min_all.css"><link rel="stylesheet" href="/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.ce4a97cd.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/react/build/js/js_min_all.js"></script><script type="text/javascript" src="/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/react/build/js/create_kindeditor.js"></script><script type="text/javascript" src="/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.8545f40f.js"></script></body></html>
|
<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><meta name="theme-color" content="#000000"><meta name="renderer" content="webkit"/><meta name="force-rendering" content="webkit"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><link rel="manifest" href="/manifest.json"><link rel="shortcut icon" href="/favicon.ico"><title>Educoder</title><script type="text/javascript">window.__isR=!0</script><link rel="stylesheet" href="/react/build/css/css_min_all.css"><link rel="stylesheet" href="/assets/iconfont/iconfont.css"><link href="/react/build/./static/css/main.0568ccaf.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="md_div" style="display:none"></div><div id="root" class="page -layout-v -fit"></div><div id="picture_display" style="display:none"></div><script type="text/javascript" src="/react/build/js/js_min_all.js"></script><script type="text/javascript" src="/assets/kindeditor/kindeditor.js"></script><script type="text/javascript" src="/react/build/js/create_kindeditor.js"></script><script type="text/javascript" src="/javascripts/educoder/edu_application.js"></script><script type="text/javascript" src="/react/build/./static/js/main.dfa4489a.js"></script></body></html>
|
@ -0,0 +1,30 @@
|
|||||||
|
<div class="task-popup" style="width:460px;">
|
||||||
|
<div class=" task-popup-title clearfix task-popup-bggrey">
|
||||||
|
重命名
|
||||||
|
</div>
|
||||||
|
<div class="task_popup_con">
|
||||||
|
<%= form_for "", :url => rename_homework_homework_common_path(@homework), :remote => true, :html => {:id => "rename_shixun_homework_form"} do |f| %>
|
||||||
|
<div class="df pl20 pr20 mb20 mt10">
|
||||||
|
<span class="fl pt3">作业名称:</span>
|
||||||
|
<div class="flex1">
|
||||||
|
<input type="text" class="input-100-35 greyInput" maxlength="20" value="<%= @homework.name %>" name="name" id="rename_homework_name" placeholder="请输入作业名称"/>
|
||||||
|
<p class="lineh-20" style="height: 20px;"><span class="color-orange-tip none" id="printNotice">请输入作业名称</span></p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<% end %>
|
||||||
|
<li class="clearfix mt10 edu-txt-center">
|
||||||
|
<a href="javascript:void(0);" class="task-btn mr20" onclick="hideModal()">取消</a>
|
||||||
|
<a href="javascript:void(0);" class="task-btn task-btn-orange" onclick="surePutIn();">确定</a>
|
||||||
|
</li>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script>
|
||||||
|
function surePutIn(){
|
||||||
|
if($("#rename_homework_name").val() == "") {
|
||||||
|
$("#printNotice").removeClass("none");
|
||||||
|
} else {
|
||||||
|
$("#rename_shixun_homework_form").submit();
|
||||||
|
hideModal();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
@ -0,0 +1,5 @@
|
|||||||
|
<% if @notice %>
|
||||||
|
notice_box("作业名称不能为空");
|
||||||
|
<% else %>
|
||||||
|
$("#homework_name_<%= @homework.id %>").html(<%= @homework.name %>);
|
||||||
|
<% end %>
|
@ -0,0 +1,2 @@
|
|||||||
|
var html = '<%= escape_javascript(render :partial => "homework_common/rename_shixun_homework") %>';
|
||||||
|
pop_box_new(html, 460, 227);
|
@ -0,0 +1,8 @@
|
|||||||
|
class ModifyExecTimeForShixun < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
change_column(:shixuns, :exec_time, :integer, :default => 20)
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,15 @@
|
|||||||
|
class CreateUserSources < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
create_table :user_sources do |t|
|
||||||
|
t.string :type
|
||||||
|
t.integer :user_id
|
||||||
|
t.string :uuid
|
||||||
|
t.string :name
|
||||||
|
|
||||||
|
t.timestamps
|
||||||
|
end
|
||||||
|
|
||||||
|
add_index :user_sources, [:type, :uuid], unique: true
|
||||||
|
add_index :user_sources, :user_id
|
||||||
|
end
|
||||||
|
end
|
@ -0,0 +1,14 @@
|
|||||||
|
class AddShixunNameToExQuestion < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :exercise_questions, :shixun_name, :string
|
||||||
|
add_column :exercise_bank_questions, :shixun_name, :string
|
||||||
|
|
||||||
|
ExerciseQuestion.where(question_type: 5).each do |question|
|
||||||
|
question.update_column("shixun_name", question.shixun.try(:name))
|
||||||
|
end
|
||||||
|
|
||||||
|
ExerciseBankQuestion.where(question_type: 5).each do |question|
|
||||||
|
question.update_column("shixun_name", question.shixun.try(:name))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in new issue