Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange

This commit is contained in:
txz 2016-07-15 16:14:55 +08:00
commit 0d08d6b192
34 changed files with 193 additions and 408 deletions

1
.gitignore vendored
View File

@ -35,3 +35,4 @@ vendor/cache
public/javascripts/wechat/node_modules/
.ruby-version
.access_token
tmux*.log

View File

@ -5,7 +5,7 @@ unless RUBY_PLATFORM =~ /w32/
gem 'iconv'
if RUBY_PLATFORM =~ /darwin/
gem "rmagick", "= 2.15.4" ## osx must be this version
else
elsif RUBY_PLATFORM =~ /linux/
#gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel
end
gem 'certified'
@ -51,7 +51,7 @@ gem 'elasticsearch-rails'
### profile
#gem 'oneapm_rpm'
gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'

114
Gemfile~
View File

@ -1,114 +0,0 @@
source 'https://ruby.taobao.org/'
unless RUBY_PLATFORM =~ /w32/
# unix-like only
gem 'iconv'
gem "rmagick", ">= 2.0.0"
gem 'certified'
end
gem 'net-ssh', '2.9.1'
gem 'jenkins_api_client'
gem 'nokogiri'
gem 'wechat',path: 'lib/wechat'
gem 'grack', path:'lib/grack'
gem 'gitlab', path: 'lib/gitlab-cli'
gem 'rest-client'
gem "mysql2", "= 0.3.18"
gem 'redis-rails'
gem 'rubyzip'
gem 'delayed_job_active_record'#, :group => :production
gem 'daemons'
gem 'grape', '~> 0.9.0'
gem 'grape-entity'
gem 'rack-cors', :require => 'rack/cors'
gem 'seems_rateable', '~> 1.0.13'
gem 'rails', '~> 3.2'
gem "jquery-rails", "~> 2.0.2"
gem "i18n", "~> 0.6.0"
gem 'coderay', '~> 1.1.0'
gem "fastercsv", "~> 1.5.0", :platforms => [:mri_18, :mingw_18, :jruby]
gem "builder", "3.0.0"
gem 'acts-as-taggable-on', '2.4.1'
gem 'spreadsheet'
gem 'ruby-ole'
gem 'rails_kindeditor',path:'lib/rails_kindeditor'
gem 'binding_of_caller'
gem 'chinese_pinyin'
# gem 'sunspot_rails', '~> 1.3.3'
# gem 'sunspot_solr'
# gem 'sunspot'
# gem 'progress_bar'
gem 'ansi'
gem 'kaminari'
gem 'elasticsearch-model'
gem 'elasticsearch-rails'
### profile
#gem 'oneapm_rpm'
group :development do
gem 'grape-swagger'
gem 'better_errors', '~> 1.1.0'
# gem "query_reviewer"
# gem 'rack-mini-profiler', '~> 0.9.3'
if RUBY_PLATFORM =~ /w32/
gem 'win32console'
end
end
group :development, :test do
unless RUBY_PLATFORM =~ /w32/
gem 'pry-rails'
if RUBY_VERSION >= '2.0.0'
gem 'pry-byebug'
end
gem 'pry-stack_explorer'
if RUBY_PLATFORM =~ /darwin/
gem 'puma'
end
end
gem 'rspec-rails', '~> 3.0'
gem 'factory_girl_rails'
end
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
# Optional gem for LDAP authentication
group :ldap do
gem "net-ldap", "~> 0.3.1"
end
# Optional gem for OpenID authentication
group :openid do
gem "ruby-openid", "~> 2.1.4", :require => "openid"
gem "rack-openid"
end
database_file = File.join(File.dirname(__FILE__), "config/database.yml")
if File.exist?(database_file)
else
warn("Please configure your config/database.yml first")
end
# Load plugins' Gemfiles
Dir.glob File.expand_path("../plugins/*/Gemfile", __FILE__) do |file|
puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v`
instance_eval File.read(file)
end

View File

@ -8,23 +8,13 @@ module Mobile
desc '获取所有课件'
params do
requires :token, type: String
requires :page, type: Integer
end
post do
get do
authenticate!
page = params[:page] ? params[:page] : 0
rs = ResourcesService.new
# data = current_user.course_attachments
data = rs.all_course_attachments current_user
all_count = data.count
data = data.limit(10).offset(page * 10)
count = data.count
present :data, data, with: Mobile::Entities::Attachment,user: current_user
present :all_count, all_count
present :count, count
present :page, page
present :status, 0
end
@ -34,24 +24,14 @@ module Mobile
desc '获取所有作业'
params do
requires :token, type: String
requires :page, type: Integer
end
post 'homeworks' do
get 'homeworks' do
authenticate!
page = params[:page] ? params[:page] : 0
rs = ResourcesService.new
homeworks = rs.all_homework_commons current_user
all_count = homeworks.count
homeworks = homeworks.limit(10).offset(page * 10)
count = homeworks.count
present :data, homeworks, with: Mobile::Entities::Homework,user: current_user
present :all_count, all_count
present :count, count
present :page, page
present :status, 0
end
@ -59,23 +39,13 @@ module Mobile
desc '获取所有测验'
params do
requires :token, type: String
requires :page, type: Integer
end
post 'exercises' do
get 'exercies' do
authenticate!
page = params[:page] ? params[:page] : 0
rs = ResourcesService.new
exercises = rs.all_exercises current_user
all_count = exercises.count
exercises = exercises.limit(10).offset(page * 10)
count = exercises.count
present :data, exercises, with: Mobile::Entities::Exercise,user: current_user
present :all_count, all_count
present :count, count
present :page, page
present :status, 0
end

View File

@ -61,7 +61,7 @@ class AdminController < ApplicationController
if params[:syllabus_id] && params[:course_id]
course = Course.where("id = #{params[:course_id].to_i}").first
unless course.nil?
course.update_attribute('syllabus_id', params[:syllabus_id].to_i)
course.update_column('syllabus_id', params[:syllabus_id].to_i)
@flag = true
end
end
@ -112,10 +112,10 @@ class AdminController < ApplicationController
def non_syllabus_courses
@name = params[:name].to_s.strip.downcase
if @name && @name != ""
@courses = Course.where("syllabus_id is null").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)}
@courses = Course.where("syllabus_id is null and is_delete = 0").select{ |course| (course.teacher[:lastname].to_s.downcase + course.teacher[:firstname].to_s.downcase).include?(@name) || course.name.include?(@name)}
@courses = @courses.sort{|x, y| y.created_at <=> x.created_at}
else
@courses = Course.where("syllabus_id is null").order('created_at desc')
@courses = Course.where("syllabus_id is null and is_delete = 0").order('created_at desc')
end
@courses = paginateHelper @courses,30
@page = (params['page'] || 1).to_i - 1
@ -124,11 +124,11 @@ class AdminController < ApplicationController
end
end
#修改课程名称
#修改班级名称
def update_course_name
@course = Course.where("id = #{params[:course_id].to_i}").first
unless @course.nil?
@course.update_attribute("name", params[:name])
@course.update_column("name", params[:name])
respond_to do |format|
format.js
end

View File

@ -114,7 +114,7 @@ class QualityAnalysisController < ApplicationController
end
end
rescue => e
puts e
@message = e.message
end
respond_to do |format|
if @current_build_status == "success"
@ -227,9 +227,6 @@ class QualityAnalysisController < ApplicationController
end
@ha.store(key,value)
end
issue_date = open(@sonar_address + "/api/resources/index?resource=#{@resource_id}&depth=0&metrics=blocker_violations,critical_violations,major_violations,minor_violations,info_violations,violations").read
@sonar_issues = JSON.parse(issue_date).first
end
rescue => e
puts e

View File

@ -110,9 +110,9 @@ class StudentWorkController < ApplicationController
#status 0:答案正确 -5program_test_ex 函数出错 -4judge代码出错 -3http超时 -2:编译错误 -1:答案错误 2:程序运行超时
resultObj[:status] = -3
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>-3,:wait_time=>tUsedtime,:student_work_id=>student_work.id)
rescue
rescue => e
#-4 judge代码 出错
logger.debug "program_test_error 1"
logger.debug "program_test_error #{e}"
resultObj[:status] = -4
tmpstatus = -4
CodeTests.create(:homework_id=>@homework.id,:language=>@homework.homework_detail_programing.language,:status=>tmpstatus,:time_used=>0,:wait_time=>0,:student_work_id=>student_work.id)
@ -197,7 +197,7 @@ class StudentWorkController < ApplicationController
resultObj[:status] = 0
end
student_work.save!
resultObj[:time] = student_work_test.created_at.to_s(:db)
resultObj[:time] = student_work_test.created_at.strftime(format='%Y-%m-%d %H:%M:%S')
resultObj[:index] = student_work.student_work_tests.count
end

View File

@ -2023,7 +2023,7 @@ class UsersController < ApplicationController
@flag = true
if params[:send_id].present?
rs = ResourcesService.new
@ori, @flag, @save_message = rs.send_resource_to_course(params)
@ori, @flag, @save_message = rs.send_resource_to_course(User.current, params)
elsif params[:send_ids].present?
send_ids = params[:send_ids].split(",")
course_ids = params[:course_ids]

View File

@ -3,16 +3,16 @@ module QualityAnalysisHelper
def sqale_rating_status val
arr = []
if val < 5
if val <= 5
arr << "很好"
arr << "b_green2"
elsif val. > 5 && val < 10
elsif val. > 5 && val <= 10
arr << "较好"
arr << "b_slow_yellow"
elsif val > 10 && val < 20
elsif val > 10 && val <= 20
arr << "中等"
arr << "b_yellow"
elsif val > 20 && val < 50
elsif val > 20 && val <= 50
arr << "较差"
arr << "b_slow_red"
elsif val > 20
@ -23,10 +23,10 @@ module QualityAnalysisHelper
def complexity_status val
arr = []
if val < 10
if val <= 10
arr << "良好"
arr << "b_green2"
elsif val > 10 && val < 15
elsif val > 10 && val <= 15
arr << "较高"
arr << "b_yellow"
elsif val > 15
@ -37,10 +37,10 @@ module QualityAnalysisHelper
def duplicated_lines_density_status val
arr = []
if val < 30
if val <= 30
arr << "良好"
arr << "b_green2"
elsif val > 30 && val < 50
elsif val > 30 && val <= 50
arr << "较高"
arr << "b_yellow"
elsif val > 50
@ -51,10 +51,10 @@ module QualityAnalysisHelper
def comment_lines_density_status val
arr = []
if val < 20
if val <= 20
arr << "较低"
arr << "b_yellow"
elsif val > 20 && val < 50
elsif val > 20 && val <= 50
arr << "正常"
arr << "b_green2"
elsif val > 50
@ -64,15 +64,15 @@ module QualityAnalysisHelper
end
def score_sqale_rating val
if val > 0 && val < 5
if val >= 0 && val <= 5
"5"
elsif val > 5 && val < 10
elsif val > 5 && val <= 10
"4"
elsif val > 10 && val < 20
elsif val > 10 && val <= 20
"3"
elsif val > 20 && val < 50
elsif val > 20 && val <= 50
"2"
elsif val > 20
elsif val > 50
"1"
end
end

View File

@ -45,7 +45,7 @@ class StudentWorkTest < ActiveRecord::Base
private
def get_success_count
self.results.inject(0) do |sum, result|
sum += (result["status"] && result["status"].to_i == 0 ? 1 : 0)
sum += (result["status"] && result["status"].class == ::Fixnum && result["status"].to_i == 0 ? 1 : 0)
end || 0
end

View File

@ -7,7 +7,7 @@
</span>
</td>
<td align="center">
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
<%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
</td>
<td align="center">
<%= course.class_period %>
@ -15,6 +15,9 @@
<td class="center">
<%= checked_image course.is_public? %>
</td>
<td class="center">
<%= course.is_delete == 0 ? '正常' : '归档' %>
</td>
<td class="center">
<%= format_date(course.created_at) %>
</td>

View File

@ -27,10 +27,10 @@
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
<th style="width: 20px;">
序号
</th>
<th style="width: 85px;">
<th style="width: 70px;">
班级
</th>
<th style="width: 35px;">
@ -42,6 +42,9 @@
<th style="width: 15px;">
<%=l(:field_is_public)%>
</th>
<th style="width: 20px;">
状态
</th>
<th style="width: 45px;">
<%=l(:field_created_on)%>
</th>
@ -58,9 +61,11 @@
</thead>
<tbody>
<% @courses.each do |course| %>
<% unless course.teacher.nil? %>
<tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>">
<%=render :partial => 'courselist_detail_tr', :locals => {:course => course} %>
</tr>
<% end %>
<% end %>
</tbody>
</table>

View File

@ -27,10 +27,10 @@
<table class="list" style="width: 100%;table-layout: fixed">
<thead>
<tr>
<th style="width: 30px;">
<th style="width: 20px;">
序号
</th>
<th style="width: 85px;">
<th style="width: 70px;">
班级
</th>
<th style="width: 35px;">
@ -42,6 +42,9 @@
<th style="width: 15px;">
<%=l(:field_is_public)%>
</th>
<th style="width: 20px;">
状态
</th>
<th style="width: 45px;">
<%=l(:field_created_on)%>
</th>
@ -58,17 +61,18 @@
</thead>
<tbody>
<% @courses.each do |course| %>
<% unless course.teacher.nil? %>
<tr class="<%= cycle("odd", "even") %>" id="course_<%=course.id %>">
<td style="text-align: center;">
<%= course.id %>
</td>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>'>
<td style="white-space: nowrap;overflow: hidden;text-overflow: ellipsis;" class="name" title='<%=course.name%>' id="syllabus_course_name_<%=course.id %>">
<span>
<a title="<%=course.name %>" id="rename_course_name_<%=course.id %>" ondblclick="rename_course_name($(this),'<%=course.name %>','<%=course.id %>');"><%= course.name%></a>
</span>
</td>
<td align="center">
<%= link_to(course.try(:teacher).try(:realname).truncate(6, omission: '...'), user_path(course.teacher)) %>
<%= link_to(course.teacher.show_name.truncate(6, omission: '...'), user_path(course.teacher)) %>
</td>
<td align="center">
<%= course.class_period %>
@ -76,6 +80,9 @@
<td class="center">
<%= checked_image course.is_public? %>
</td>
<td class="center">
<%= course.is_delete == 0 ? '正常' : '归档' %>
</td>
<td class="center">
<%= format_date(course.created_at) %>
</td>
@ -90,6 +97,7 @@
</td>
</tr>
<% end %>
<% end %>
</tbody>
</table>
</div>

View File

@ -17,10 +17,10 @@
<% if @quality_analyses.count >0 %>
<% @quality_analyses.each do |qa| %>
<ul class="analysis-result-list">
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2" %></li>
<li class="analysis-result-version fl fontBlue2" title="分支名"><%= qa.branch %></li>
<li class="analysis-result-loc fl fontBlue2" title="语言"><%= qa.language %></li>
<li class="analysis-result-debt fl fontBlue2" title="时间"><%= qa.path %></li>
<li title="Name" title="名称"><%=link_to "#{qa.author_login}:#{qa.rep_identifier}", project_quality_analysis_path(:resource_id => qa.sonar_name, :branch => (qa.branch.nil? ? "master" : qa.branch)), :class => "analysis-result-name fl fontBlue2 hidden" %></li>
<li class="analysis-result-version fl fontBlue2 hidden" title="分支名"><%= qa.branch %></li>
<li class="analysis-result-loc fl fontBlue2 hidden" title="语言"><%= qa.language %></li>
<li class="analysis-result-debt fl fontBlue2 hidden" title="路径"><%= qa.path %></li>
<% if User.current.try(:login) == qa.author_login %>
<li class="analysis-result-time fl" title="编辑">
<%=link_to "编辑", edit_project_quality_analysi_path(qa, :project_id => @project.id), :remote => true, :class => "fontBlue2" %>

View File

@ -58,17 +58,17 @@
<span class="fontGrey2">可定性评价为:<span class="c_red">质量<%= @ha["sqale_rating"].nil? ? "很好" : sqale_rating_status(@ha["sqale_rating"].to_i)[0] %></span></span></div>
<div class="analysis-block mt10 mb40 f14">
<div><span class="fontGrey3 mr30">技术债务</span>
<span class="w70 pInline">
<span class="w100 pInline">
<% if @ha["sqale_index"].to_i == 0 %>
0
0
<% else %>
<%= /[0-9]*/.match(@ha["sqale_index"])[0] %>天
<%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? 0 : / [0-9]*/.match(@ha["sqale_index"]) %>小时
<%= / [0-9]*/.match(@ha["sqale_index"]).nil? ? "" : (/ [0-9]*/.match(@ha["sqale_index"]).to_s + "小时") %>
<% end %>
</span>
<span class="fontGrey2"><a class="linkBlue2" target="_blank" href="<%= @sonar_address %>/drilldown/measures/<%= @resource_id %>?metric=sqale_index">查看详情</a></span></div>
<div><span class="fontGrey3 mr30 fl">质量问题</span>
<span class="fontBlue2 w70 pInline">
<div><span class="fontGrey3 mr30 fl">&nbsp;质量问题</span>
<span class="fontBlue2 w100 pInline">
<a class="fontBlue2 w70 pInline" target="_blank" href="<%= @sonar_address %>/component_issues?id=<%= @resource_id %>#resolved=false">
<%= @ha["violations"].nil? ? 0 : @ha["violations"] %>
</a>

View File

@ -1,14 +1,6 @@
<% if @name_flag %>
<%= render :partial => "result_list" %>
<% else %>
<% if params[:current_build_status].nil? || params[:current_build_status] == "success" %>
<%= render :partial => "show", :locals => {:branch => @branch} %>
<% else %>
<% if params[:build_console_result] %>
运行结果超时
<% else %>
<%= render :partial => "console_output" %>
<% end %>
<% end %>
<%= render :partial => "show", :locals => {:branch => @branch} %>
<% end %>

View File

@ -18,7 +18,7 @@
<p>真实姓名:<%= User.find(ma.course_message_id).realname %></p>
<p>申请课程:<%= Course.find(ma.course_id).name%></p>
<div class="fl">课程描述:</div>
<div class="ml60"><%= Course.find(ma.course_id).description.html_safe %></div>
<div class="ml60"><%= Course.find(ma.course_id).description %></div>
<p>申请职位:<%= ma.content == '9' ? "教师" : "教辅"%></p>
</div>
<li class="<%=(ma.status == 0 || ma.status.nil?) ? 'homepageHomeworkContentWarn2' : 'homepageHomeworkContentWarn' %> fl">

View File

@ -8,7 +8,7 @@
<% send_ids = send_ids.class == String ? send_ids : send_ids.join(",") %>
<% end %>
<select class="resourcesSendType" onclick="chooseSendType2('<%= send_id %>', '<%= send_ids%>','<%= User.current.id %>','file', '<%= @type %>');">
<option value="1">课程</option>
<option value="1">班级</option>
<option value="2">项目</option>
<option value="3">组织</option>
</select>
@ -20,7 +20,7 @@
<%= form_tag search_user_course_user_path(user),:method => 'get', :remote=>true, :id=> 'search_user_course_form', :class=> 'resourcesSearchBox' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入班级ID或者名称搜索" class="searchResourcePopup" />
<script>
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>','file')
</script>

View File

@ -5,8 +5,8 @@
</div>
<!--<div class="resourcePopupClose"> <a href="javascript:void(0);" class="resourceClose" onclick="closeModal();"></a></div>-->
<div class="fl">
<!--<input type="text" name="search" placeholder="输入课程ID或者名称搜索" class="subjectSearch fr" />-->
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="mt10 mb10 course-search" />
<!--<input type="text" name="search" placeholder="输入班级ID或者名称搜索" class="subjectSearch fr" />-->
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入班级ID或者名称搜索" class="mt10 mb10 course-search" />
</div>
<div id="send_homework_to_course_form">
<%= render :partial => "users/send_homework_to_course_form", :locals => {:user => user, :courses => courses, :send_id => send_id} %>

View File

@ -18,7 +18,7 @@
:remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入班级ID或者名称搜索" class="searchResourcePopup" />
<script>
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>','message')
</script>

View File

@ -18,7 +18,7 @@
:remote=>true,:id=>'search_user_course_form',:class=>'resourcesSearchBox' do %>
<%= hidden_field_tag(:send_id, send_id) %>
<%= hidden_field_tag(:send_ids, send_ids) %>
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入课程ID或者名称搜索" class="searchResourcePopup" />
<input type="text" id="search_course_input" value="<%= @search %>" name="search" placeholder="输入班级ID或者名称搜索" class="searchResourcePopup" />
<script>
observeSearchfieldOnInput('search_course_input','<%= search_user_course_user_path(user)%>','<%= send_id %>','<%= send_ids%>','news')
</script>

View File

@ -1,5 +1,5 @@
<% if ma.class == CourseMessage %>
<% if ma.course_message_type == "News" %>
<% if ma.course_message_type == "News" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"),user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了通知:</span></li>
@ -19,7 +19,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Comment" %>
<% if ma.course_message_type == "Comment" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.author, user_path(ma.course_message.author), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">评论了通知:</span></li>
@ -39,7 +39,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status.nil?%>
<% if ma.course_message_type == "HomeworkCommon" && ma.status.nil? && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + "老师", user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %>
@ -98,7 +98,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 1 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user.lastname + ma.course_message.user.firstname + '老师',
@ -133,7 +133,7 @@
</ul>
<% end %>
<!--作品开启匿评 待整合:时间紧-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 2 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
@ -168,7 +168,7 @@
</ul>
<% end %>
<!--作品关闭匿评-->
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 3 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
@ -199,7 +199,7 @@
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 4 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
@ -235,18 +235,18 @@
</ul>
<% end %>
<!--资源申请-->
<% if ma.course_message_type == "ApplyResource" && ma.status == 0 %>
<% if ma.course_message_type == "ApplyResource" && ma.status == 0 && ma.course_message %>
<ul class="homepageNewsList fl" id="apply_resource_message_<%=ma.id %>">
<%= render :partial => 'apply_resource_course_message', :locals => {:ma => ma} %>
</ul>
<% end %>
<!--资源申请回复-->
<% if ma.course_message_type == "ApplyResource" && ma.status == 1 %>
<% if ma.course_message_type == "ApplyResource" && ma.status == 1 && ma.course_message %>
<ul class="homepageNewsList fl" id="apply_resource_message_<%=ma.id %>">
<%= render :partial => 'apply_resource_course_message_reply', :locals => {:ma => ma} %>
</ul>
<% end %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 %>
<% if ma.course_message_type == "HomeworkCommon" && ma.status == 6 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag(url_to_avatar(User.find(ma.apply_user_id)), width: "30px", height: "30px", class: "mt3") %></div></a></li>
<li class="homepageNewsPubType fl">
@ -271,7 +271,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Poll" %>
<% if ma.course_message_type == "Poll" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl"><%=link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %><span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>">发布了问卷:</span></li>
@ -287,7 +287,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "Message" %>
<% if ma.course_message_type == "Message" && !ma.nil? && !ma.course_message.nil? %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.author), :width => "30", :height => "30"), user_path(ma.course_message.author), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
@ -376,7 +376,7 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "JournalsForMessage" %>
<% if ma.course_message_type == "JournalsForMessage" && ma.course_message %>
<% if ma.course_message.jour_type == 'Course' %>
<% if params[:type] != 'homework' %>
<ul class="homepageNewsList fl">
@ -459,7 +459,7 @@
<% end %>
<% end %>
<!-- 作业迟交,不能参与匿评提醒消息 -->
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) %>
<% if ma.course_message_type == "StudentWork" && !ma.course_message.homework_common.nil? && !User.current.allowed_to?(:as_teacher, ma.course_message.homework_common.course) && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.homework_common.user), :width => "30", :height => "30"), user_path(ma.course_message.homework_common.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
@ -493,7 +493,7 @@
<% end %>
<% if ma.course_message_type == "StudentWork" && ma.status == 1 %>
<% if ma.course_message_type == "StudentWork" && ma.status == 1 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
@ -514,7 +514,7 @@
</ul>
<% end %>
<!-- 学生追加作品附件 -->
<% if ma.course_message_type == "StudentWork" && ma.status == 2 %>
<% if ma.course_message_type == "StudentWork" && ma.status == 2 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><%= link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a>
@ -534,7 +534,7 @@
</ul>
<% end %>
<!-- 创建课程消息 -->
<% if ma.course_message_type == "Course" %>
<% if ma.course_message_type == "Course" && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl">
<a href="javascript:void(0);"><div class="navHomepageLogo fl"><%= image_tag("/images/trustie_logo1.png", width: "30px", height: "30px", class: "mt3") %></div></a>
@ -569,7 +569,9 @@
<li class="homepageNewsTime fl"><%= time_tag(ma.created_at).html_safe %> </li>
</ul>
<% end %>
<% if ma.course_message_type == "JoinCourseRequest" %>
<!--# ma.course_message_id 是用户id-->
<% if ma.course_message_type == "JoinCourseRequest" && !ma.nil? %>
<ul class="homepageNewsList fl" id="course_message_join_<%=ma.id %>">
<%= render :partial => 'join_course_course_message', :locals => {:ma => ma} %>
</ul>
@ -710,7 +712,7 @@
<% end %>
<!--老师发布测验 发给学生看-->
<% if ma.course_message_type == "Exercise" && ma.status == 2 %>
<% if ma.course_message_type == "Exercise" && ma.status == 2 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">
@ -747,7 +749,7 @@
<% end %>
<% if ma.course_message_type == "Exercise" && ma.status == 3 %>
<% if ma.course_message_type == "Exercise" && ma.status == 3 && ma.course_message %>
<ul class="homepageNewsList fl">
<li class="homepageNewsPortrait fl"><a href="javascript:void(0);"><%=link_to image_tag(url_to_avatar(ma.course_message.user), :width => "30", :height => "30"), user_path(ma.course_message.user), :target => '_blank' %></a></li>
<li class="homepageNewsPubType fl">

View File

@ -27,32 +27,32 @@
</div>
<!--<script src="https://dn-demotest.qbox.me/angular.all.min.js"></script>-->
<script src="/javascripts/wechat/build/angular.all.min.js"></script>
<!--<script src="/javascripts/wechat/build/app.min.js?version=20160709-0920"></script>-->
<script src="/javascripts/wechat/app.js"></script>
<script src="/javascripts/wechat/others/factory.js"></script>
<script src="/javascripts/wechat/others/filter.js"></script>
<script src="/javascripts/wechat/directives/alert.js"></script>
<script src="/javascripts/wechat/directives/form_validate.js"></script>
<script src="/javascripts/wechat/directives/input_auto.js"></script>
<script src="/javascripts/wechat/directives/loading_spinner.js"></script>
<script src="/javascripts/wechat/controllers/reg.js"></script>
<script src="/javascripts/wechat/controllers/invite_code.js"></script>
<script src="/javascripts/wechat/controllers/login.js"></script>
<script src="/javascripts/wechat/controllers/activity.js"></script>
<script src="/javascripts/wechat/controllers/new_class.js"></script>
<script src="/javascripts/wechat/controllers/edit_class.js"></script>
<script src="/javascripts/wechat/controllers/blog.js"></script>
<script src="/javascripts/wechat/controllers/course_notice.js"></script>
<script src="/javascripts/wechat/controllers/discussion.js"></script>
<script src="/javascripts/wechat/controllers/homework.js"></script>
<script src="/javascripts/wechat/controllers/issue.js"></script>
<script src="/javascripts/wechat/controllers/journals.js"></script>
<script src="/javascripts/wechat/controllers/class.js"></script>
<script src="/javascripts/wechat/controllers/class_list.js"></script>
<script src="/javascripts/wechat/controllers/myresource.js"></script>
<script src="/javascripts/wechat/controllers/send_class_list.js"></script>
<script src="/javascripts/wechat/others/routes.js"></script>
<script src="/javascripts/wechat/build/angular.all.min.js"></script>
<script src="/javascripts/wechat/build/app.min.js?version=20160715-1449"></script>
<!-- <script src="/javascripts/wechat/app.js"></script> -->
<!-- <script src="/javascripts/wechat/others/factory.js"></script> -->
<!-- <script src="/javascripts/wechat/others/filter.js"></script> -->
<!-- <script src="/javascripts/wechat/directives/alert.js"></script> -->
<!-- <script src="/javascripts/wechat/directives/form_validate.js"></script> -->
<!-- <script src="/javascripts/wechat/directives/input_auto.js"></script> -->
<!-- <script src="/javascripts/wechat/directives/loading_spinner.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/reg.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/invite_code.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/login.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/activity.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/new_class.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/edit_class.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/blog.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/course_notice.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/discussion.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/homework.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/issue.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/journals.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/class.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/class_list.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/myresource.js"></script> -->
<!-- <script src="/javascripts/wechat/controllers/send_class_list.js"></script> -->
<!-- <script src="/javascripts/wechat/others/routes.js"></script> -->
</body>
</html>

View File

@ -2,21 +2,18 @@ button:
-
type: "view"
name: "我的动态"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_b
ase&state=activities#wechat_redirect"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=activities#wechat_redirect"
-
name: "我的课程"
sub_button:
-
type: "view"
name: "课程"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi
_base&state=class_list#wechat_redirect"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=class_list#wechat_redirect"
-
type: "view"
name: "资源"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=http://test.forge.trustie.net/wechat/user_activities&response_type=code&scope=snsapi
_base&state=myresource#wechat_redirect"
url: "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d&redirect_uri=https://ucloudtest.trustie.net/wechat/user_activities&response_type=code&scope=snsapi_base&state=myresource#wechat_redirect"
-
name: "更多"

View File

@ -11,7 +11,7 @@ common: &default_settings
# 如果您修改了此处的app_name一个新的应用会出现在后台
# 数据会上传到这个新应用,并停止向旧的应用上传数据。
#
app_name: trustie
app_name: trustie_wechat
#
# 环境相关配置
@ -25,7 +25,7 @@ development:
<<: *default_settings
# development模式下探针开启并上传性能数据
monitor_mode: true
app_name: trustie(Development)
app_name: My Application (Development)
test:
<<: *default_settings

View File

@ -8,8 +8,8 @@ default: &default
#secret: "743e038392f1d89540e95f8f7645849a"
#production
# appid: "wx8e1ab05163a28e37"
# secret: "beb4d3bc4b32b3557811680835357841"
#appid: "wx8e1ab05163a28e37"
#secret: "beb4d3bc4b32b3557811680835357841"
#test
appid: "wxc09454f171153c2d"

View File

@ -15,10 +15,13 @@ namespace :update_homework do
unless student_works.nil?
student_works.each do |s|
project = Project.find s.project_id
unless project.nil? && project.gpid.nil?
unless project.nil? && project.gpid.blank?
project_time=project.updated_on
project_time=ForgeActivity.where("project_id=?",project.id).last.updated_at if ForgeActivity.where("project_id=?",project.id).last
puts "the time is =========================> #{time}"
puts "the project_time is =========================> #{project_time}"
if time.strftime('%Y-%m-%d %H:%M:%S') < project_time.strftime('%Y-%m-%d %H:%M:%S')
#if format_time(time) < format_time(project_time)
time = project_time
end
begin
@ -28,8 +31,12 @@ namespace :update_homework do
changesets = g.commits(project.gpid, :ref_name => default_branch)
changesets_latest_coimmit = changesets[0]
unless changesets[0].blank?
if time.strftime('%Y-%m-%d %H:%M:%S') <changesets_latest_coimmit.created_at.strftime('%Y-%m-%d %H:%M:%S')
time = changesets_latest_coimmit.created_at
puts "the time is =========================> #{time}"
puts "the changesets_latest_coimmit is =========================> #{changesets_latest_coimmit.created_at}"
puts "the distance time is =========================> #{changesets_latest_coimmit.created_at.to_time > Time.now}"
if time.strftime('%Y-%m-%d %H:%M:%S') < changesets_latest_coimmit.created_at.to_time.strftime('%Y-%m-%d %H:%M:%S')
#if format_time(time) < format_time(changesets_latest_coimmit.created_at)
time = changesets_latest_coimmit.created_at.to_time
end
end
rescue Exception => e

View File

@ -11,33 +11,24 @@
</div>
<div ng-class="{'undis': currentTab!=1}">
<div ng-repeat="r in resources|filter:{filename:searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]">
<img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /> <span class="fl ml10 resource-width">{{r.filename}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl courseware-from-width hidden">课件来源:{{r.coursename}}</span><span class="f12 ml10 mt5 c-grey4 fl">大小:{{r.attafile_size}}</span><div class="cl"></div>
</div>
<div ng-if="has_more">
<div id="more" class="more-events mt10" ng-click="loadResourceData(1,page+1);">更多</div>
</div>
<div ng-repeat="r in resources|filter:{filename:searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]">
<img src="/images/wechat/courseware.png" width="15" class="ml10 fl" /> <span class="fl ml10 resource-width">{{r.filename}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl courseware-from-width hidden">课件来源:{{r.coursename}}</span><span class="f12 ml10 mt5 c-grey4 fl">大小:{{r.attafile_size}}</span><div class="cl"></div>
</div>
<p ng-show="resources && resources.length<=0" class="class-test-tip">暂无课件,<br />
请登录Trustie网站在PC浏览器中上传课件。</p>
</div>
<div ng-class="{'undis': currentTab!=2}">
<div ng-repeat="r in homeworks|filter:{homework_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2 undis">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl other-from-width hidden">作业来源:{{r.coursename}}</span><div class="cl"></div>
</div>
<div ng-if="homework_has_more">
<div id="more_homeworks" class="more-events mt10" ng-click="loadResourceData(2,homework_page+1);">更多</div>
<div ng-repeat="r in homeworks|filter:{homework_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/homework.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.homework_name}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2 undis">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 fl other-from-width hidden">作业来源:{{r.coursename}}</span><div class="cl"></div>
</div>
<p ng-show="homeworks && homeworks.length<=0" class="class-test-tip">暂无作业,<br />
请登录Trustie网站在PC浏览器中创建作业。</p>
</div>
<div ng-class="{'undis': currentTab!=3}">
<div ng-repeat="r in exercise|filter:{exercise_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/test.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.exercise_name}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2 undis">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 other-from-width hidden">题目来源:{{r.coursename}}</span><div class="cl"></div>
</div>
<div ng-if="exercise_has_more">
<div id="more_exercises" class="more-events mt10" ng-click="loadResourceData(3,exercise_page+1);">更多</div>
</div>
<div ng-repeat="r in exercise|filter:{exercise_name: searchText}" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><img src="/images/wechat/test.png" width="15" class="ml10 fl" /><span class="fl ml10 resource-width">{{r.exercise_name}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2 undis">发送</a><div class="cl"></div>
<span class="f12 mt5 ml35 c-grey4 other-from-width hidden">题目来源:{{r.coursename}}</span><div class="cl"></div>
</div>
<p ng-show="exercise && exercise.length<=0" class="class-test-tip">暂无测验,<br />
请登录Trustie网站在PC浏览器中创建测验。</p>
</div>

View File

@ -1601,7 +1601,7 @@ function expand_course_list(id, target, btnid, count) {
target.show();
}else{
btn.data('init',0);
btn.html('共'+count+ '个课程,点击全部展开');
btn.html('共'+count+ '个班级,点击全部展开');
target.hide();
target.eq(0).show();
target.eq(1).show();

View File

@ -1,7 +1,7 @@
var app=angular.module("wechat",["ngRoute"]);app.constant("config",{rootPath:"/assets/wechat/",rootUrl:"/",apiUrl:"/api/v1/"}),app.run(["$rootScope","auth","$location","$routeParams",function(t,a,e,r){g_redirect_path&&g_redirect_path.length>1&&(e.path(g_redirect_path),g_redirect_path=null),t.$on("$routeChangeError",function(t,a,r){a&&a.templateUrl&&(a.templateUrl.endsWith("login.html")||a.templateUrl.endsWith("reg.html")||e.path("/login"))}),t.$on("$routeChangeStart",function(t,a,e){})}]);
app.factory("alertService",function(){function t(){this.title=null,this.message=null,this.visible=null,this.cb=null}return t.prototype.showMessage=function(t,e,n){this.message=e,this.title=t,this.visible=!0,this.cb=n},t.prototype.dismiss=function(){this.message=null,this.title=null,this.visible=!1,this.cb&&this.cb()},{create:function(){return new t}}}),app.factory("auth",["$http","$routeParams","$q","session","config",function(t,e,n,o,a){var i=function(){var a=n.defer(),i=c();if(i&&i.length>10)a.resolve(i);else{window.g_code||e.code||o.get("code");t.post("/wechat/get_bind",{}).then(function(t){0!=t.data.status?a.reject(t.data.message):(o.save("token",t.data.token),a.resolve(t.data.token))})["catch"](function(t){a.reject(t)})}return a.promise},c=function(){return o.get("token")};return{get_bind:i,token:c}}]),app.factory("session",function(){return{save:function(t,e){sessionStorage.setItem(t,e)},get:function(t){return sessionStorage.getItem(t)}}}),app.factory("rms",function(){var t={},e=function(e,n){t[e]=n},n=function(e){return t[e]};return{save:e,get:n}}),app.factory("common",["$http","auth","$routeParams",function(t,e,n){var o=function(n,o,a,i){if(a.comment&&!(a.comment.length<=0)){var c=a.comment.replace(/\n/g,"<br/>"),s={type:o,content:c,token:e.token()};a.disabled=!0,t({method:"POST",url:apiUrl+"new_comment/"+n,data:s}).then(function(t){a.disabled=!1,"function"==typeof i&&i()},function(t){})}},a=function(n,o){return t({method:"GET",url:apiUrl+o+"/"+n+"?token="+e.token()})},i=function(n){n.praise_count+=1,n.has_praise=!0,t({method:"POST",url:apiUrl+"praise/"+n.act_id,data:{token:e.token(),type:n.act_type}}).then(function(t){console.log(t.data)},function(t){})},c=function(n){n.praise_count-=1,n.has_praise=!1,t({method:"POST",url:apiUrl+"praise/"+n.act_id,data:{token:e.token(),type:n.act_type}}).then(function(t){console.log(t.data)},function(t){})},s=function(t){t.scope.formData={comment:""};var e=function(e){a(e,t.type).then(function(e){t.loadCallback(e.data)},function(t){})};e(t.id),t.scope.addReply=function(n){console.log(n.comment),o(t.id,t.replyType,n,function(){t.scope.formData={comment:""},e(t.id),"function"==typeof t.replyCallback&&t.replyCallback()})},t.scope.addPraise=i,t.scope.decreasePraise=c};return{init:s,addCommonReply:o,loadCommonData:a,addCommonPraise:i,decreaseCommonPraise:c}}]);
app.factory("alertService",function(){function t(){this.title=null,this.message=null,this.visible=null,this.cb=null}return t.prototype.showMessage=function(t,i,e){this.message=i,this.title=t,this.visible=!0,this.cb=e},t.prototype.dismiss=function(){this.message=null,this.title=null,this.visible=!1,this.cb&&this.cb()},{create:function(){return new t}}}),app.factory("auth",["$http","$routeParams","$q","session","config",function(t,i,e,a,c){var s=function(){var c=e.defer(),s=o();if(s&&s.length>10)c.resolve(s);else{window.g_code||i.code||a.get("code");t.post("/wechat/get_bind",{}).then(function(t){0!=t.data.status?c.reject(t.data.message):(a.save("token",t.data.token),c.resolve(t.data.token))})["catch"](function(t){c.reject(t)})}return c.promise},o=function(){return a.get("token")};return{get_bind:s,token:o}}]),app.factory("session",function(){return{save:function(t,i){sessionStorage.setItem(t,i)},get:function(t){return sessionStorage.getItem(t)}}}),app.factory("rms",function(){var t={},i=function(i,e){t[i]=e},e=function(i){return t[i]};return{save:i,get:e}}),app.factory("common",["$http","auth","$routeParams","rms",function(t,i,e,a){var c=function(e,a,c,s){if(c.comment&&!(c.comment.length<=0)){var o=c.comment.replace(/\n/g,"<br/>"),n={type:a,content:o,token:i.token()};c.disabled=!0,t({method:"POST",url:apiUrl+"new_comment/"+e,data:n}).then(function(t){c.disabled=!1,"function"==typeof s&&s()},function(t){})}},s=function(e,a){return t({method:"GET",url:apiUrl+a+"/"+e+"?token="+i.token()})},o=function(e){t({method:"POST",url:apiUrl+"praise/"+e.act_id,data:{token:i.token(),type:e.act_type}}).then(function(t){console.log(t.data)},function(t){})},n=function(e){t({method:"POST",url:apiUrl+"praise/"+e.act_id,data:{token:i.token(),type:e.act_type}}).then(function(t){console.log(t.data)},function(t){})},r=function(t){t.scope.formData={comment:""};var i=function(i){s(i,t.type).then(function(i){t.loadCallback(i.data)},function(t){})};i(t.id),t.scope.addReply=function(e){console.log(e.comment),c(t.id,t.replyType,e,function(){t.scope.formData={comment:""},i(t.id),"function"==typeof t.replyCallback&&t.replyCallback()})},t.scope.addPraise=function(t){activities=a.get("activities")||[],course_activities=a.get("course_activities")||[],project_activities=a.get("project_activities")||[];for(var i in activities)if(activities[i].act_id==t.act_id){activities[i].praise_count+=1,activities[i].has_praise=!0;break}for(var i in course_activities)if(course_activities[i].act_id==t.act_id){course_activities[i].praise_count+=1,course_activities[i].has_praise=!0;break}for(var i in project_activities)if(project_activities[i].act_id==t.act_id){project_activities[i].praise_count+=1,project_activities[i].has_praise=!0;break}a.save("activities",activities),a.save("course_activities",course_activities),a.save("project_activities",project_activities),t.praise_count+=1,t.has_praise=!0,o(t)},t.scope.decreasePraise=function(t){activities=a.get("activities")||[],course_activities=a.get("course_activities")||[],project_activities=a.get("project_activities")||[];for(var i in activities)if(activities[i].act_id==t.act_id){activities[i].praise_count-=1,activities[i].has_praise=!1;break}for(var i in course_activities)if(course_activities[i].act_id==t.act_id){course_activities[i].praise_count-=1,course_activities[i].has_praise=!1;break}for(var i in project_activities)if(project_activities[i].act_id==t.act_id){project_activities[i].praise_count-=1,project_activities[i].has_praise=!1;break}a.save("activities",activities),a.save("course_activities",course_activities),a.save("project_activities",project_activities),t.praise_count-=1,t.has_praise=!1,n(t)}};return{init:r,addCommonReply:c,loadCommonData:s,addCommonPraise:o,decreaseCommonPraise:n}}]);
app.filter("safeHtml",["$sce",function(t){return function(n){return t.trustAsHtml(n)}}]),app.filter("identify",function(){return function(t){return"TeachingAsistant"==t?"教辅":""}});
app.controller("ActivityController",["$anchorScroll","$location","$scope","$http","$timeout","auth","rms","common","alertService",function(e,a,t,c,o,i,r,s,n){t.replaceUrl=function(e){return e},t.menus=["所有动态","课程动态","项目动态"],t.alertService=n.create(),console.log("ActivityController load"),t.page=r.get("page")||0,t.activities=r.get("activities")||[],t.has_more=r.get("has_more"),t.course_page=r.get("course_page")||0,t.course_activities=r.get("course_activities")||[],t.course_has_more=r.get("course_has_more"),t.project_page=r.get("project_page")||0,t.project_activities=r.get("project_activities")||[],t.project_has_more=r.get("project_has_more"),t.loadActData=function(e,a){switch(container_type="All",e){case 1:container_type="All",t.page=a;break;case 2:container_type="Course",t.course_page=a;break;case 3:container_type="Project",t.project_page=a}c({method:"POST",url:apiUrl+"activities",data:{token:i.token(),page:a,container_type:container_type}}).then(function(e){if(e.data.page>0)switch(e.data.container_type){case"All":t.activities=t.activities.concat(e.data.data);break;case"Course":t.course_activities=t.course_activities.concat(e.data.data);break;case"Project":t.project_activities=t.project_activities.concat(e.data.data);break;case 3:}else switch(e.data.container_type){case"All":t.activities=e.data.data;break;case"Course":t.course_activities=e.data.data;break;case"Project":t.project_activities=e.data.data;break;case 3:}switch(e.data.container_type){case"All":r.save("activities",t.activities),t.has_more=e.data.count+10*e.data.page<e.data.all_count,r.save("has_more",t.has_more),r.save("page",e.data.page);break;case"Course":r.save("course_activities",t.course_activities),t.course_has_more=e.data.count+10*e.data.page<e.data.all_count,r.save("course_has_more",t.course_has_more),r.save("course_page",e.data.page);break;case"Project":r.save("project_activities",t.project_activities),t.project_has_more=e.data.count+10*e.data.page<e.data.all_count,r.save("project_has_more",t.project_has_more),r.save("project_page",e.data.page);break;case 3:}console.log(e.data)},function(e){})},t.tab=function(e){switch(t.currentTab=e,e){case 1:t.activities.length<=0&&t.loadActData(e,0);break;case 2:t.course_activities.length<=0&&t.loadActData(e,0);break;case 3:t.project_activities.length<=0&&t.loadActData(e,0)}},t.currentTab=1,t.activities.length<=0?t.loadActData(1,0):o(function(){window.scrollTo(0,r.get("yoffset"))}),t.goDetail=function(e,t,c){r.save("yoffset",window.document.body.scrollTop),a.path("/"+e+"/"+t)},t.addPraise=function(e){s.addCommonPraise(e)},t.decreasePraise=function(e){s.decreaseCommonPraise(e)}}]);
app.controller("ActivityController",["$anchorScroll","$location","$scope","$http","$timeout","auth","rms","common","alertService",function(a,e,t,i,c,s,o,r,_){t.replaceUrl=function(a){return a},t.menus=["所有动态","课程动态","项目动态"],t.alertService=_.create(),console.log("ActivityController load"),t.page=o.get("page")||0,t.activities=o.get("activities")||[],t.has_more=o.get("has_more"),t.course_page=o.get("course_page")||0,t.course_activities=o.get("course_activities")||[],t.course_has_more=o.get("course_has_more"),t.project_page=o.get("project_page")||0,t.project_activities=o.get("project_activities")||[],t.project_has_more=o.get("project_has_more"),t.loadActData=function(a,e){switch(container_type="All",a){case 1:container_type="All",t.page=e;break;case 2:container_type="Course",t.course_page=e;break;case 3:container_type="Project",t.project_page=e}i({method:"POST",url:apiUrl+"activities",data:{token:s.token(),page:e,container_type:container_type}}).then(function(a){if(a.data.page>0)switch(a.data.container_type){case"All":t.activities=t.activities.concat(a.data.data);break;case"Course":t.course_activities=t.course_activities.concat(a.data.data);break;case"Project":t.project_activities=t.project_activities.concat(a.data.data);break;case 3:}else switch(a.data.container_type){case"All":t.activities=a.data.data;break;case"Course":t.course_activities=a.data.data;break;case"Project":t.project_activities=a.data.data;break;case 3:}switch(a.data.container_type){case"All":o.save("activities",t.activities),t.has_more=a.data.count+10*a.data.page<a.data.all_count,o.save("has_more",t.has_more),o.save("page",a.data.page);break;case"Course":o.save("course_activities",t.course_activities),t.course_has_more=a.data.count+10*a.data.page<a.data.all_count,o.save("course_has_more",t.course_has_more),o.save("course_page",a.data.page);break;case"Project":o.save("project_activities",t.project_activities),t.project_has_more=a.data.count+10*a.data.page<a.data.all_count,o.save("project_has_more",t.project_has_more),o.save("project_page",a.data.page);break;case 3:}console.log(a.data)},function(a){})},t.tab=function(a){switch(t.currentTab=a,a){case 1:t.activities.length<=0&&t.loadActData(a,0);break;case 2:t.course_activities.length<=0&&t.loadActData(a,0);break;case 3:t.project_activities.length<=0&&t.loadActData(a,0)}},t.currentTab=1,t.activities.length<=0?t.loadActData(1,0):c(function(){window.scrollTo(0,o.get("yoffset"))}),t.goDetail=function(a,i,c){o.save("yoffset",window.document.body.scrollTop),o.save("activities",t.activities),o.save("course_activities",t.course_activities),o.save("project_activities",t.project_activities),e.path("/"+a+"/"+i)},t.addPraise=function(a){for(var e in t.activities)if(t.activities[e].act_id==a.act_id){t.activities[e].praise_count+=1,t.activities[e].has_praise=!0;break}for(var e in t.course_activities)if(t.course_activities[e].act_id==a.act_id){t.course_activities[e].praise_count+=1,t.course_activities[e].has_praise=!0;break}for(var e in t.project_activities)if(t.project_activities[e].act_id==a.act_id){t.project_activities[e].praise_count+=1,t.project_activities[e].has_praise=!0;break}r.addCommonPraise(a)},t.decreasePraise=function(a){for(var e in t.activities)if(t.activities[e].act_id==a.act_id){t.activities[e].praise_count-=1,t.activities[e].has_praise=!1;break}for(var e in t.course_activities)if(t.course_activities[e].act_id==a.act_id){t.course_activities[e].praise_count-=1,t.course_activities[e].has_praise=!1;break}for(var e in t.project_activities)if(t.project_activities[e].act_id==a.act_id){t.project_activities[e].praise_count-=1,t.project_activities[e].has_praise=!1;break}r.decreaseCommonPraise(a)}}]);
app.controller("BlogController",["$scope","$http","$routeParams","auth","common",function(o,l,t,n,a){a.init({id:t.id,scope:o,type:"blog_comments",replyType:"BlogComment",loadCallback:function(l){o.blog=l.data},replyCallback:function(){}})}]);
app.controller("ClassController",["$scope","config","$http","auth","$location","$routeParams",function(e,s,t,o,a,n){var r=e,c=n.id,u=function(){r.teachers.length<=0&&t.get(s.apiUrl+"courses/teachers?token="+o.token()+"&course_id="+c).then(function(e){console.log(e.data),r.teachers=e.data.data}),r.students.length<=0&&t.get(s.apiUrl+"courses/students?token="+o.token()+"&course_id="+c).then(function(e){console.log(e.data),r.students=e.data.data})},i=function(){r.resources.length<=0&&t.post(s.apiUrl+"courses/"+c+"/attachments",{token:o.token(),name:""}).then(function(e){r.resources=e.data.data,r.resources_tag=!0})},h=function(){r.homeworks.length<=0&&t.get(s.apiUrl+"courses/homeworks/"+c+"?token="+o.token()).then(function(e){r.homeworks=e.data.data,console.log(e.data),r.homeworks_tag=!0})},l=function(){r.exercises.length<=0&&t.get(s.apiUrl+"courses/"+c+"/exercises?token="+o.token()).then(function(e){r.exercises=e.data.data,console.log(e.data),r.exercises_tag=!0})};r.isTeacher=!1,r.currentTab=1,r.tab=function(e){r.currentTab=e,r.searchText="",r.showClassMate=!1,r.showResources=!1,r.showHomework=!1,r.showTestcase=!1,r.resources_tag=!1,r.homeworks_tag=!1,r.exercises_tag=!1,r.isTeacher?1==e?(i(),r.showResources=!0):2==e?(h(),r.showHomework=!0):3==e?(l(),r.showTestcase=!0):4==e&&(u(),r.showClassMate=!0):2==e?(u(),r.showClassMate=!0):1==e&&(i(),r.showResources=!0)},r.course={},r.students=[],r.teachers=[],r.resources=[],r.homeworks=[],r.exercises=[],r.invite=function(){a.path("/invite_code").search({id:c})},r.sendFile=function(e){a.path("/send_class_list").search({id:e.id})},t.get(s.apiUrl+"courses/"+c+"?token="+o.token()).then(function(e){console.log(e.data),r.course=e.data.data,d(r.course.current_user_is_teacher),r.tab(1)});var d=function(e){r.isTeacher=e,e?r.menus=["课件","作业","小测验","学生管理"]:r.menus=["课件","我的同学"]}}]);
app.controller("ClassListController",["$scope","config","auth","$http","$location","alertService","rms",function(e,s,a,t,o,l,n){var c=e;c.syllabuses=n.get("syllabuses")||[],c.alertService=l.create();var i=function(){t.get(s.apiUrl+"syllabuses?token="+a.token()).then(function(e){console.log(e.data),c.syllabuses=e.data.data,n.save("syllabuses",c.syllabuses)})};c.syllabuses.length<=0&&i(),c.goClass=function(e){console.log(e),o.path("/class").search({id:e})},c.newClass=function(){t.post(s.apiUrl+"syllabuses/auth",{token:a.token()}).then(function(e){console.log(e.data),0==e.data.auth?c.alertService.showMessage("提示","非教师身份不能创建课程哦~"):o.path("/new_class")})},c.goResource=function(){o.path("/myresource")},c.joinClass=function(){var e=window.prompt("请输入5位班级邀请码(不区分大小写)");e&&5==e.length?t.post(s.apiUrl+"courses/join",{token:a.token(),invite_code:e}).then(function(e){console.log(e.data),0!=e.data.status?c.alertService.showMessage("错误",e.data.message):(c.alertService.showMessage("提示","加入课程成功"),i())}):e&&c.alertService.showMessage("错误","邀请码格式不正确")},c.onSetting=function(e){console.log(e),n.save("current_edit_syllobus",e),o.path("/edit_class").search({id:e.id})}}]);
@ -14,11 +14,11 @@ app.controller("IssueController",["$scope","$http","$routeParams","auth","common
app.controller("JournalsController",["$scope","$http","$routeParams","auth","common",function(o,a,e,l,n){n.init({id:e.id,scope:o,type:"journal_for_messages",replyType:"JournalsForMessage",loadCallback:function(a){o.message=a.data},replyCallback:function(){}})}]);
app.controller("LoginController",["$scope","$http","$location","$routeParams","alertService","config","auth","session",function(e,o,t,a,i,n,s,l){s.get_bind().then(function(){t.path("/activities")}),a.code&&l.save("code",a.code);var r=e;r.loginFailed=!1,r.alertService=i.create(),r.findPwdDialog=i.create(),r.login=function(a,i){return a.$setSubmitted(),console.log(i),a.$valid?(console.log(apiUrl+"auth"),void o.post(n.apiUrl+"users/wxbind",{login:i.login,password:i.password}).then(function(o){console.log(o.data),r.loginFailed=0!=o.data.status,e.loginFailed?r.alertService.showMessage("出错了",o.data.message):r.alertService.showMessage("提示",o.data.message,function(){t.path("/activities")})})["catch"](function(e){r.alertService.showMessage("出错了",e)})):void console.log(a.$error)},r.showBox=function(){r.findPwdDialog.showMessage("提示","请访问www.trustie.net获取密码谢谢")},r.goReg=function(){t.path("/reg")}}]);
app.controller("MyResourceController",["$scope","$http","auth","config","$location",function(e,o,t,n,r){var s=e;s.menus=["课件","作业","测验"],s.resources=null,s.homeworks=null,s.exercise=null,s.searchText="",s.tab=function(e){s.currentTab=e,s.searchText="",1==e&&(!s.resources||s.resources.length<=0)?o.get(n.apiUrl+"resources?token="+t.token()).then(function(e){console.log(e.data),s.resources=e.data.data}):2==e&&(!s.homeworks||s.homeworks.length<=0)?o.get(n.apiUrl+"resources/homeworks?token="+t.token()).then(function(e){console.log(e.data),s.homeworks=e.data.data}):3==e&&(!s.exercise||s.exercise.length<=0)&&o.get(n.apiUrl+"resources/exercies?token="+t.token()).then(function(e){console.log(e.data),s.exercise=e.data.data})},s.tab(1),s.sendFile=function(e){r.path("/send_class_list").search({id:e.id})}}]);
app.controller("NewClassController",["$scope","$http","auth","config","alertService","$location",function(s,e,a,o,l,t){var r=s;r.alertService=l.create(),r.syllabus={courses:[{name:""}]},r.addClass=function(){r.syllabus.courses.push({})},r.deleteClass=function(s){r.syllabus.courses.splice(s,1)},r.newClass=function(s,l){if(s.$setSubmitted(),console.log(l),!s.$valid)return void console.log(s.$error);var t=[];for(var n in r.syllabus.courses)t.push(r.syllabus.courses[n].name);e.post(o.apiUrl+"syllabuses",{token:a.token(),title:l.title,courses:t}).then(function(s){0!=s.data.status?r.alertService.showMessage("出错了",s.data.message):r.alertService.showMessage("提示","新建课程成功",function(){window.history.back()}),console.log(s.data.data)})}}]);
app.controller("NewClassController",["$scope","$http","auth","config","alertService","$location","rms",function(s,e,a,l,t,o,r){var n=s;n.alertService=t.create(),n.syllabus={courses:[{name:""}]},n.addClass=function(){n.syllabus.courses.push({})},n.deleteClass=function(s){n.syllabus.courses.splice(s,1)},n.newClass=function(s,t){if(s.$setSubmitted(),console.log(t),!s.$valid)return void console.log(s.$error);var c=[];for(var u in n.syllabus.courses)c.push(n.syllabus.courses[u].name);e.post(l.apiUrl+"syllabuses",{token:a.token(),title:t.title,courses:c}).then(function(s){0!=s.data.status?n.alertService.showMessage("出错了",s.data.message):n.alertService.showMessage("提示","新建课程成功",function(){r.save("syllabuses",[]),o.path("/class_list")}),console.log(s.data.data)})}}]);
app.controller("RegController",["$scope","$http","$location","alertService","$location",function(e,o,a,s,a){var t=e;t.errDialog=s.create(),t.successDialog=s.create(),t.goLogin=function(){a.path("/login")},t.isagreed=!0,t.agreed=function(e){t.isagreed=!e},t.reg=function(e,s){return e.$setSubmitted(),console.log(e),e.$valid?(console.log(s),void o.post(apiUrl+"users",{login:s.username,password:s.password,mail:s.email}).then(function(e){0!=e.data.status?t.errDialog.showMessage("出错了",e.data.message):t.successDialog.showMessage("提示","注册且绑定微信成功",function(){a.path("/activities")})},function(e){t.errDialog.showMessage("出错了",e.data)})):void console.log(e.$error)}}]);
app.controller("SendClassListController",["$scope","$http","$routeParams","config","auth","alertService","rms",function(e,s,o,a,t,r,c){var n=e,l=o.id;n.alertService=r.create(),n.syllabuses=[];var i=function(){s.get(a.apiUrl+"syllabuses?token="+t.token()).then(function(e){console.log(e.data),n.syllabuses=e.data.data})};i(),n.selectCourse=function(e){"boolean"!=typeof e.checked&&(e.checked=!1),e.checked=!e.checked},n.sendToCourses=function(){var e=[];for(var o in n.syllabuses)for(var r in n.syllabuses[o].courses)n.syllabuses[o].courses[r].checked&&e.push(n.syllabuses[o].courses[r].id);return e.length<=0?void n.alertService.showMessage("提醒","请先选择班级"):void s.post(a.apiUrl+"resources/send",{token:t.token(),course_ids:e,send_id:l}).then(function(e){console.log(e.data),0==e.data.status?n.alertService.showMessage("提示","发送成功",function(){window.history.back()}):n.alertService.showMessage("发送出错",e.data.message)})}}]);
app.directive("myAlert",["config",function(t){return{templateUrl:t.rootPath+"templates/alert.html",scope:{title:"=",message:"=",visible:"=",cb:"="},link:function(t){t.dismiss=function(){t.visible=!1,"function"==typeof t.cb&&t.cb()}}}}]),app.directive("myAlert2",["config",function(t){return{templateUrl:t.rootPath+"templates/alert2.html",scope:{title:"=",message:"=",visible:"=",cb:"="},link:function(t){t.dismiss=function(){t.visible=!1},t.confirm=function(){t.visible=!1,"function"==typeof t.cb&&t.cb()}}}}]);
app.directive("pwdconfirm",function(){return{require:"ngModel",link:function(r,n,i,e){e.$validators.pwdconfirm=function(n,i){return r.user&&r.user.password==i}}}});
app.directive("inputAuto",function(){return{restrict:"A",scope:{},link:function(n,t){var e=t.parent().children().children().eq(0),i=t.next();t.on("input",function(){console.log(i),e.html(t[0].value);var n=e[0].scrollHeight;t.css("height",n+"px")}),i.on("click",function(){t.css("height","28px")})}}});
app.directive("inputAuto",function(){return{restrict:"A",scope:{},link:function(n,t){var i=t.parent().children().children().eq(0),c=t.next();t.on("input",function(){console.log(c),i.html(t[0].value);var n=i[0].scrollHeight;t.css("height",n+"px")}),c.on("click",function(){t.css("height","28px")})}}});
app.directive("loadingSpinner",["$http","config",function(t,e){return{templateUrl:e.rootPath+"templates/loading.html"}}]);
app.config(["$routeProvider","$httpProvider","$locationProvider","config",function(e,o,t,l){var r=l.rootPath,s={delay:["auth",function(e){return e.get_bind()}]},n=function(e,o){return{templateUrl:r+e,controller:o,resolve:s}};e.when("/login",{templateUrl:r+"login.html",controller:"LoginController"}).when("/reg",{templateUrl:r+"reg.html",controller:"RegController"}).when("/activites",n("activities.html","ActivityController")).when("/issues/:id",n("issue_detail.html","IssueController")).when("/project_discussion/:id",n("project_discussion.html","DiscussionController")).when("/homework/:id",n("homework_detail.html","HomeworkController")).when("/course_notice/:id",n("course_notice.html","CourseNoticeController")).when("/course_discussion/:id",n("course_discussion.html","DiscussionController")).when("/journal_for_message/:id",n("jour_message_detail.html","JournalsController")).when("/blog_comment/:id",n("blog_detail.html","BlogController")).when("/class",n("class.html","ClassController")).when("/new_class",n("new_class.html","NewClassController")).when("/edit_class",n("edit_class.html","EditClassController")).when("/class_list",n("class_list.html","ClassListController")).when("/myresource",n("myresource.html","MyResourceController")).when("/invite_code",n("invite_code.html","InviteCodeController")).when("/send_class_list",n("send_class_list.html","SendClassListController")).otherwise({redirectTo:"/activites"}),o.interceptors.push(["$q","$rootScope",function(e,o){return void 0==o.activeCalls&&(o.activeCalls=0),{request:function(e){return o.activeCalls+=1,e},requestError:function(e){return o.activeCalls-=1,e},response:function(e){return o.activeCalls-=1,e},responseError:function(e){return o.activeCalls-=1,e}}}])}]);

View File

@ -2,124 +2,36 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l
var vm = $scope;
vm.menus = ['课件', '作业', '测验'];
vm.resources = [];
vm.homeworks = [];
vm.exercise = [];
vm.has_more = false;
vm.page = 0;
vm.homework_has_more = false;
vm.homework_page = 0;
vm.exercise_has_more = false;
vm.exercise_page = 0;
vm.resources = null;
vm.homeworks = null;
vm.exercise = null;
vm.searchText = "";
vm.sendFile = function(r){
$location.path("/send_class_list").search({id: r.id});
}
vm.loadResourceData = function (index,page){
if(index == 1){
vm.page = page;
$http({
method: 'POST',
url: apiUrl+ "resources",
data: {token: auth.token(), page: page}
}).then(function successCallback(response) {
if(response.data.page >0) {
vm.resources = vm.resources.concat(response.data.data);
} else {
vm.resources = response.data.data;
}
// rms.save("resources", vm.resources);
vm.has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
// rms.save('homework_has_more', vm.has_more);
// rms.save('homework_page', vm.data.page);
console.log(response.data);
}, function errorCallback(response) {
});
}
else if(index==2 ){
vm.homework_page = page;
$http({
method: 'POST',
url: apiUrl+ "resources/homeworks",
data: {token: auth.token(), page: page}
}).then(function successCallback(response) {
if(response.data.page >0) {
vm.homeworks = vm.homeworks.concat(response.data.data);
} else {
vm.homeworks = response.data.data;
}
// rms.save("homeworks", vm.homeworks);
vm.homework_has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
// rms.save('homework_has_more', vm.has_more);
// rms.save('homework_page', vm.data.page);
console.log(response.data);
}, function errorCallback(response) {
});
}
else if(index==3 ){
vm.exercise_page = page;
$http({
method: 'POST',
url: apiUrl+ "resources/exercises",
data: {token: auth.token(), page: page}
}).then(function successCallback(response) {
if(response.data.page >0) {
vm.exercise = vm.exercise.concat(response.data.data);
} else {
vm.exercise = response.data.data;
}
// rms.save("homeworks", vm.homeworks);
vm.exercise_has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
// rms.save('homework_has_more', vm.has_more);
// rms.save('homework_page', vm.data.page);
console.log(response.data);
}, function errorCallback(response) {
});
}
}
vm.tab = function(index){
vm.currentTab = index;
vm.searchText = "";
switch(index){
//ALL
case 1:
if(vm.resources.length<=0){
vm.loadResourceData(index,0);
}
break;
//homework
case 2:
if(vm.homeworks.length<=0){
vm.loadResourceData(index,0);
}
break;
//exercise
case 3:
if(vm.exercise.length<=0){
vm.loadResourceData(index,0);
}
break;
if(index==1 && (!vm.resources || vm.resources.length <= 0 )){
$http.get(config.apiUrl + "resources?token="+auth.token()).then(function(response){
console.log(response.data);
vm.resources = response.data.data;
});
} else if(index==2 && (!vm.homeworks || vm.homeworks.length <= 0) ){
$http.get(config.apiUrl + "resources/homeworks?token="+auth.token()).then(function(response){
console.log(response.data);
vm.homeworks = response.data.data;
});
} else if(index==3 && (!vm.exercise || vm.exercise.length <= 0) ){
$http.get(config.apiUrl + "resources/exercies?token="+auth.token()).then(function(response){
console.log(response.data);
vm.exercise = response.data.data;
});
}
}
vm.tab(1);
vm.sendFile = function(r){
$location.path("/send_class_list").search({id: r.id});
}
}] );

View File

@ -57,7 +57,7 @@ a:hover.news_foot{ color:#787b7e; border:1px solid #d4d4d4;}
.hworkList60 {width:60px; text-align:center;}
.hworkList60 {width:60px; text-align:center;}
.hworkList70 {width:70px; text-align:center;}
.hworkList80 {width:90px; text-align:center;}
.hworkList80 {width:80px; text-align:center;}
.hworkList90 {width:90px; text-align:center;}
.hworkList100 {width:100px; text-align:center;}
.hworkList110 {width:110px; text-align:center;}

View File

@ -292,4 +292,18 @@ div.modal {
.resourceUploadPopup {width:400px; height:auto; border:3px solid #269ac9 !important; padding-left:16px; padding-bottom:16px; background-color:#ffffff; position:absolute; top:50%; left:50%; margin-left:-200px; z-index:1000;}
a.Blue-btn{ display:block; margin-right:15px;width:65px; height:22px; background-color:#ffffff; line-height:24px; vertical-align:middle; text-align:center; border:1px solid #3598db; color:#3598db; -moz-border-radius:5px; -webkit-border-radius:5px; border-radius:5px;}
a:hover.Blue-btn{ background:#3598db; color:#fff;}
/***** end Ajax indicator ******/
/***** end Ajax indicator ******/
/*消息弹框*/
.shadowbox_news{ width:305px; background-color:#fff; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); position: absolute; left: -131px; top: 45px; z-index: 9999;}
.shadowbox_news_title{ height:40px; line-height:40px;padding-left:10px; font-size:12px; color:#333;border-bottom:1px solid #eee;}
.shadowbox_news_p{ height:40px; line-height:40px; font-size:12px; color:#333;}
.shadowbox_news font{ border: 1px solid #dddddd; display: block; border-width: 8px; position: absolute; top: -15px;left: 140px; border-style:solid; border-color: transparent transparent #fff transparent;font-size: 0;line-height: 0; box-shadow:2px rgba(146, 153, 169, 0.5); }
.shadowbox_news_list{ max-height:400px; overflow:hidden;}
.shadowbox_news_list a{ color:#999;}
.shadowbox_news_list li{ height:40px; border-bottom:1px dashed #ebebeb; line-height:40px;overflow:hidden; white-space: nowrap; text-overflow:ellipsis; padding:0 10px;}
.shadowbox_news_list li:hover{ background-color:#eee;}
span.shadowbox_news_user{ color:#3b94d6;}
a.shadowbox_news_all{ display:block; width:305px; height:40px; line-height:40px; color:#3b94d6; text-align:center;border-top:1px solid #eee;}
.undis {display:none;}
.text_c {text-align:center;}

View File

@ -1273,11 +1273,11 @@ a.pages-big{ width:50px;}
.analysis-result-list {padding:5px;}
.analysis-result-list:nth-of-type(odd){background:#fff;}/*奇数行*/
.analysis-result-list:nth-of-type(even){background:#f5f5f5;}/*偶数行*/
.analysis-result-name {width:200px; cursor:pointer;}
.analysis-result-version {width:90px; text-align:right; cursor:pointer;}
.analysis-result-loc {width:60px; text-align:right; cursor:pointer;}
.analysis-result-debt {width:160px; text-align:right; cursor:pointer;}
.analysis-result-time {width:150px; text-align:right; cursor:pointer;}
.analysis-result-name {width:200px;}
.analysis-result-version {width:90px; text-align:right;}
.analysis-result-loc {width:60px; text-align:right;}
.analysis-result-debt {width:160px; text-align:right;}
.analysis-result-time {width:150px; text-align:right;}
.analysis-name-icon {background:url(../images/code-analysis-icon.png) -2px -148px no-repeat; width:16px; height:16px; display:inline-block; vertical-align:middle;}
/*未登录回复提示*/