Merge branch 'develop' of https://git.trustie.net/jacknudt/trustieforge into develop
This commit is contained in:
commit
5c046f922e
2
Gemfile
2
Gemfile
|
@ -51,7 +51,7 @@ gem 'elasticsearch-rails'
|
|||
|
||||
|
||||
### profile
|
||||
#gem 'oneapm_rpm'
|
||||
gem 'oneapm_rpm'
|
||||
|
||||
group :development do
|
||||
gem 'grape-swagger'
|
||||
|
|
|
@ -193,14 +193,13 @@ module Mobile
|
|||
desc "返回单个课程"
|
||||
params do
|
||||
requires :id, type: Integer
|
||||
optional :token, type: String
|
||||
requires :token,type:String
|
||||
end
|
||||
route_param :id do
|
||||
get do
|
||||
authenticate!
|
||||
# course = Course.find(params[:id])
|
||||
cs = CoursesService.new
|
||||
course = cs.show_course(params,(current_user.nil? ? User.find(2):current_user))
|
||||
#course = Course.find(params[:id])
|
||||
course = cs.show_course(params,current_user)
|
||||
present :data, course, with: Mobile::Entities::Course,user: current_user
|
||||
{ status: 0}
|
||||
end
|
||||
|
@ -393,10 +392,7 @@ module Mobile
|
|||
authenticate!
|
||||
|
||||
course = Course.find(params[:course_id])
|
||||
exercises = course.exercises
|
||||
exercises.each do |v|
|
||||
v[:coursename] = course.nil? ? "未知" : course.name
|
||||
end
|
||||
exercises = course.exercises.where("exercise_status <> 1").order("created_at desc")
|
||||
present :data,exercises,with:Mobile::Entities::Exercise
|
||||
present :status,0
|
||||
end
|
||||
|
|
|
@ -8,13 +8,23 @@ module Mobile
|
|||
desc '获取所有课件'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :page, type: Integer
|
||||
end
|
||||
get do
|
||||
post 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
|
||||
|
@ -24,14 +34,24 @@ module Mobile
|
|||
desc '获取所有作业'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :page, type: Integer
|
||||
end
|
||||
get 'homeworks' do
|
||||
post '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
|
||||
|
@ -39,13 +59,23 @@ module Mobile
|
|||
desc '获取所有测验'
|
||||
params do
|
||||
requires :token, type: String
|
||||
requires :page, type: Integer
|
||||
end
|
||||
get 'exercies' do
|
||||
post 'exercises' 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
|
||||
|
||||
|
|
|
@ -67,7 +67,8 @@ module Mobile
|
|||
openid: openid,
|
||||
user: user
|
||||
)
|
||||
|
||||
ws = WechatService.new
|
||||
ws.binding_succ_notice(user.id, "您已成功绑定Trustie平台", user.login, Time.now.strftime("%Y-%m-%d"))
|
||||
present :data, user, with: Mobile::Entities::User
|
||||
present :status, 0
|
||||
end
|
||||
|
|
|
@ -208,6 +208,9 @@ class WechatsController < ActionController::Base
|
|||
course = Course.where(invite_code: params[:invite_code]).first if params[:invite_code]
|
||||
raise "班级不存在,请确认您的邀请码是否输入正确,谢谢!" unless course
|
||||
|
||||
#取出用户角色类型
|
||||
role = 10
|
||||
|
||||
cs = CoursesService.new
|
||||
status = cs.join_course({invite_code: course.invite_code}, user)
|
||||
logger.info status
|
||||
|
@ -218,7 +221,7 @@ class WechatsController < ActionController::Base
|
|||
news = (1..1).each_with_object([]) { |n, memo| memo << { title: '恭喜您成功加入班级,开始学习吧!',
|
||||
content: "课程名称: #{course.name}\n班级名称: #{course.name}\n任课老师: #{course.teacher.show_name}\n进入班级,和小伙伴愉快的学习吧!"} }
|
||||
return request.reply.news(news) do |article, n, index| # article is return object
|
||||
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect"
|
||||
url = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=#{Wechat.config.appid}&redirect_uri=#{ROOT_URL+'/wechat/user_activities#/class?id='+course.id.to_s}&response_type=code&scope=snsapi_base&state=myclass#wechat_redirect"
|
||||
pic_url = "#{ROOT_URL}/images/wechat/class.jpg"
|
||||
article.item title: "#{n[:title]}",
|
||||
description: n[:content],
|
||||
|
|
|
@ -2992,7 +2992,7 @@ int main(int argc, char** argv){
|
|||
unless projects.empty?
|
||||
project_ids = '('+projects.map{|pro|pro.project_id}.join(',')+')'
|
||||
sort_projects = ForgeActivity.find_by_sql("SELECT MAX(updated_at) AS updated_at,user_id, project_id FROM forge_activities WHERE project_id IN #{project_ids} GROUP BY project_id ORDER BY MAX(updated_at) DESC")
|
||||
|
||||
#sort_projects = sort_projects.sort_by{|sp| (!sp.project.project_score.nil? && !sp.project.project_score.commit_time.nil?) ? '' : sp.project.project_score.commit_time}
|
||||
return sort_projects
|
||||
end
|
||||
end
|
||||
|
@ -3292,7 +3292,7 @@ def strip_html(text,len=0,endss="...")
|
|||
ss = ""
|
||||
if !text.nil? && text.length>0
|
||||
ss=text.gsub(/<\/?.*?>/, '').strip
|
||||
ss = ss.gsub(/ /, ' ')
|
||||
ss = ss.gsub(/ */, ' ')
|
||||
|
||||
if len > 0 && ss.length > len
|
||||
ss = ss[0, len] + endss
|
||||
|
@ -3306,6 +3306,7 @@ end
|
|||
|
||||
def message_content content
|
||||
content = (strip_html content).strip
|
||||
content = content.gsub(/\s+/, " ")
|
||||
if content.gsub(" ", "") == ""
|
||||
content = "[非文本消息]"
|
||||
end
|
||||
|
|
|
@ -187,10 +187,10 @@ class CoursesService
|
|||
else
|
||||
work_unit = get_user_work_unit course.teacher
|
||||
end
|
||||
unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
|
||||
raise '403'
|
||||
end
|
||||
{:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.member_of_course?(course),:current_user_is_teacher => is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
|
||||
# unless (course.is_public == 1 || current_user.member_of_course?(course) || current_user.admin?)
|
||||
# raise '403'
|
||||
# end
|
||||
{:course => course,:work_unit => work_unit, :img_url => url_to_avatar(course),:current_user_is_member => current_user.nil? ? false : current_user.member_of_course?(course),:current_user_is_teacher => current_user.nil? ? false : is_course_teacher(current_user,course),:course_student_num => course ? course.student.count.to_s : 0}
|
||||
end
|
||||
|
||||
#创建课程
|
||||
|
@ -326,8 +326,8 @@ class CoursesService
|
|||
define_error [
|
||||
0, '加入成功',
|
||||
1, '密码错误',
|
||||
2, '课程已过期 请联系课程管理员重启课程。',
|
||||
3, '您已经加入了课程',
|
||||
2, '班级已过期 请联系班级管理员重启班级。',
|
||||
3, '您已经加入了班级',
|
||||
4, '您的邀请码不正确',
|
||||
5, '您还未登录',
|
||||
6, '申请成功,请等待审核完毕',
|
||||
|
@ -354,54 +354,27 @@ class CoursesService
|
|||
roleName = member.roles[0].name if member
|
||||
if params[:invite_code].present?
|
||||
#如果加入角色为学生 并且当前是学生
|
||||
if params[:role] == "10" && roleName == "Student"
|
||||
if roleName == "Student"
|
||||
@state = 3
|
||||
#如果加入的角色为老师,并且当前已经是老师
|
||||
elsif params[:role] == "9" && roleName == "Teacher"
|
||||
elsif roleName == "Teacher"
|
||||
@state = 8
|
||||
#如果加入的角色教辅并且当前为教辅
|
||||
elsif params[:role] == "7" && roleName == "TeachingAsistant"
|
||||
elsif roleName == "TeachingAsistant"
|
||||
@state = 9
|
||||
elsif roleName == "Manager"
|
||||
@state = 10
|
||||
#如果加入角色为教师或者教辅,并且当前是学生,或者是要成为教辅,当前不是教辅,或者要成为教师,当前不是教师。那么要发送请求
|
||||
elsif (params[:role] != "10" && roleName == "Student") || (params[:role] == "7" && roleName != "TeachingAsistant" ) || (params[:role] == "9" && roleName != "Teacher" )
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0 ").count != 0
|
||||
@state = 7
|
||||
else
|
||||
Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||
@state = 6
|
||||
end
|
||||
#如果加入角色是学生,但是是当前课程的教师或者教辅
|
||||
elsif params[:role] == "10" && roleName != "Student"
|
||||
member.role_ids = [params[:role]]
|
||||
member.save
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
@state = 0
|
||||
end
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
else
|
||||
if params[:invite_code].present?
|
||||
if params[:role] == "10" || params[:role] == nil
|
||||
members = []
|
||||
members << Member.new(:role_ids => [10], :user_id => current_user.id)
|
||||
course.members << members
|
||||
StudentsForCourse.create(:student_id => current_user.id, :course_id => course.id)
|
||||
@state = 0
|
||||
else
|
||||
#如果已经发送过消息了,那么就要给个提示
|
||||
if CourseMessage.where("course_message_type = 'JoinCourseRequest' and user_id = #{course.tea_id} and content = #{params[:role]} and course_message_id = #{User.current.id} and course_id = #{course.id} and status = 0").count != 0
|
||||
@state = 7
|
||||
else
|
||||
Mailer.run.join_course_request(course, User.current, params[:role])
|
||||
CourseMessage.create(:user_id => course.tea_id, :course_id => course.id, :viewed => false,:content=> params[:role],:course_message_id=>User.current.id,:course_message_type=>'JoinCourseRequest',:status=>0)
|
||||
@state = 6
|
||||
end
|
||||
end
|
||||
else
|
||||
@state = 1
|
||||
end
|
||||
|
@ -419,7 +392,7 @@ class CoursesService
|
|||
def homework_list params,current_user
|
||||
course = Course.find(params[:id])
|
||||
if course.is_public != 0 || current_user.member_of_course?(course)
|
||||
bids = course.homework_commons.page(params[:page] || 1).per(20).order('created_at DESC')
|
||||
bids = course.homework_commons.where("publish_time <= ?",Time.now.strftime("%Y-%m-%d")).page(params[:page] || 1).per(20).order('created_at DESC')
|
||||
bids = bids.like(params[:name]) if params[:name].present?
|
||||
homeworks = []
|
||||
bids.each do |bid|
|
||||
|
@ -522,7 +495,7 @@ class CoursesService
|
|||
def course_attachments params
|
||||
result = []
|
||||
course = Course.find(params[:course_id])
|
||||
attachments = course.attachments.order("created_on ")
|
||||
attachments = course.attachments.where("is_publish = 1").order("created_on desc")
|
||||
if !params[:name].nil? && params[:name] != ""
|
||||
attachments.each do |atta|
|
||||
result << atta if atta.filename.include?(params[:name])
|
||||
|
|
|
@ -10,12 +10,12 @@
|
|||
<% elsif @state == 1 %>
|
||||
alert("密码错误");
|
||||
<% elsif @state == 2 %>
|
||||
alert("课程已过期\n请联系课程管理员重启课程。(在配置课程处)");
|
||||
alert("班级已过期\n请联系班级管理员重启班级。(在配置班级处)");
|
||||
<% elsif @state == 3 %>
|
||||
alert("您已经加入了课程");
|
||||
alert("您已经加入了班级");
|
||||
window.location.href= "http://"+"<%= Setting.host_name%>"+"/courses/" + "<%= course.id%>"
|
||||
<% elsif @state == 4 %>
|
||||
alert("您加入的课程不存在");
|
||||
alert("您加入的班级不存在");
|
||||
<% elsif @state == 5 %>
|
||||
alert("您还未登录");
|
||||
<% elsif @state == 6 %>
|
||||
|
|
|
@ -198,10 +198,8 @@
|
|||
<%# first_pro = sort_projects.first %>
|
||||
<% first_pro = Project.find sort_projects.first.project_id %>
|
||||
<% commit_time = first_pro.project_score.commit_time %>
|
||||
<% one_time = first_pro.updated_on %>
|
||||
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
|
||||
<% one_time= one_time > one_forge_time ? one_time : one_forge_time %>
|
||||
# <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_time) ? commit_time : one_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
|
||||
# <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% sort_projects.each_with_index do |pro, i| %>
|
||||
|
|
|
@ -208,10 +208,8 @@
|
|||
<div class="mr5 fontGrey2">
|
||||
<% first_pro = Project.find sort_projects.first.project_id %>
|
||||
<% commit_time = first_pro.project_score.commit_time %>
|
||||
<% one_time = first_pro.updated_on %>
|
||||
<% one_forge_time=ForgeActivity.where("project_id=?",first_pro.id).last.updated_at if ForgeActivity.where("project_id=?",first_pro.id).last %>
|
||||
<% one_time= one_time > one_forge_time ? one_time : one_forge_time %>
|
||||
# <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_time) ? commit_time : one_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
|
||||
# <%=time_from_now !commit_time.nil? && format_time(commit_time) > format_time(one_forge_time) ? commit_time : one_forge_time %><%= link_to User.find(first_pro.user_id).show_name, user_activities_path(first_pro.user_id), :class => "newsBlue ml5 mr5"%>更新了项目,最近更新:
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
<% sort_projects.each_with_index do |pro, i| %>
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
<span class="<%= ma.viewed == 0 ? "homepageNewsTypeNotRead fl":"homepageNewsType fl" %>"><%= ma.journals_for_message.reply_id == 0 ? "给你留言了:" : "回复了你的留言:" %></span>
|
||||
</li>
|
||||
<li class="homepageNewsContent fl">
|
||||
<%= link_to ma.journals_for_message.notes.gsub("<p>","").gsub("</p>","").gsub("<br />","").html_safe, feedback_path(ma.journals_for_message.jour_id, :anchor => "user_activity_#{ma.journals_for_message.id}"), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank'%>
|
||||
<%= link_to message_content(ma.journals_for_message.notes), feedback_path(ma.journals_for_message.jour_id, :anchor => "user_activity_#{ma.journals_for_message.id}"), :class =>"#{ma.viewed == 0 ? "newsBlack" : "newsGrey"}", :target => '_blank'%>
|
||||
</li>
|
||||
<div style="display: none" class="message_title_red system_message_style" >
|
||||
<% if ma.journals_for_message.reply_id == 0 %>
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
<div class="fl">
|
||||
<div class="syllabus_class_w ">
|
||||
<p class="syllabus_class_title fl"><%=course.name %></p>
|
||||
<span class="fr sy_p_grey">主讲老师:<%=course.teacher.show_name %></span>
|
||||
<span class="fr sy_p_grey hidden" style="max-width: 120px;">主讲老师:<%=course.teacher.show_name %></span>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
<div class="">
|
||||
|
|
|
@ -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-1953"></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?version=20160715-1737"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/send_class_list.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/others/routes.js"></script> -->
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -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: "更多"
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -8,38 +8,38 @@ default: &default
|
|||
#secret: "743e038392f1d89540e95f8f7645849a"
|
||||
|
||||
#production
|
||||
# appid: "wx8e1ab05163a28e37"
|
||||
# secret: "beb4d3bc4b32b3557811680835357841"
|
||||
appid: "wx8e1ab05163a28e37"
|
||||
secret: "beb4d3bc4b32b3557811680835357841"
|
||||
|
||||
#test
|
||||
appid: "wxc09454f171153c2d"
|
||||
secret: "dff5b606e34dcafe24163ec82c2715f8"
|
||||
# appid: "wxc09454f171153c2d"
|
||||
# secret: "dff5b606e34dcafe24163ec82c2715f8"
|
||||
|
||||
token: "123456"
|
||||
access_token: "1234567"
|
||||
encrypt_mode: false # if true must fill encoding_aes_key
|
||||
|
||||
#production
|
||||
# encoding_aes_key: "QGfP13YP4BbQGkkrlYuxpn4ZIDXpBJww4fxl8CObvNw"
|
||||
# jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket"
|
||||
#
|
||||
# #template
|
||||
# binding_succ_notice: "jjpDrgFErnmkrE9tf2M3o0t31ZrJ7mr0YtuE_wyLaMc"
|
||||
# journal_notice: "uC1zAw4F2q6HTA3Pcj8VUO6wKKKiYFwnPJB4iXxpdoM"
|
||||
# homework_message_notice: "tCf7teCVqc2vl2LZ_hppIdWmpg8yLcrI8XifxYePjps"
|
||||
# class_notice: "MQ_mFupbXP-9jWbeHT3C5xqNBvPo8EIlNv4ULakSpJA"
|
||||
# create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw"
|
||||
|
||||
#test
|
||||
encoding_aes_key: "QyocNOkRmrT5HzBpCG54EVPUQjk86nJapXNVDQm6Yy6"
|
||||
encoding_aes_key: "QGfP13YP4BbQGkkrlYuxpn4ZIDXpBJww4fxl8CObvNw"
|
||||
jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket"
|
||||
|
||||
#template
|
||||
binding_succ_notice: "n4KLwcWNrIMYkKxWL2hUwzunm5RTT54EbWem2MIUapU"
|
||||
journal_notice: "XpHHYkqSGkwuF9vHthRdmPQLvCFRQ4_NbRBP12T7ciE"
|
||||
homework_message_notice: "Kom0TsYYKsNKCS6luweYVRo9z-mH0wRPr24b1clGCPQ"
|
||||
class_notice: "8LVu33l6bP-56SDomVgHn-yJc57YpCwwJ81rAJgRONk"
|
||||
create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I"
|
||||
binding_succ_notice: "jjpDrgFErnmkrE9tf2M3o0t31ZrJ7mr0YtuE_wyLaMc"
|
||||
journal_notice: "uC1zAw4F2q6HTA3Pcj8VUO6wKKKiYFwnPJB4iXxpdoM"
|
||||
homework_message_notice: "tCf7teCVqc2vl2LZ_hppIdWmpg8yLcrI8XifxYePjps"
|
||||
class_notice: "MQ_mFupbXP-9jWbeHT3C5xqNBvPo8EIlNv4ULakSpJA"
|
||||
create_class_notice: "2GtJJGzzNlNy2i0UrsjEDlvfSVIUXQfSo47stpcQAVw"
|
||||
|
||||
#test
|
||||
# encoding_aes_key: "QyocNOkRmrT5HzBpCG54EVPUQjk86nJapXNVDQm6Yy6"
|
||||
# jsapi_ticket: "C:/Users/[user_name]/wechat_jsapi_ticket"
|
||||
#
|
||||
# #template
|
||||
# binding_succ_notice: "n4KLwcWNrIMYkKxWL2hUwzunm5RTT54EbWem2MIUapU"
|
||||
# journal_notice: "XpHHYkqSGkwuF9vHthRdmPQLvCFRQ4_NbRBP12T7ciE"
|
||||
# homework_message_notice: "Kom0TsYYKsNKCS6luweYVRo9z-mH0wRPr24b1clGCPQ"
|
||||
# class_notice: "8LVu33l6bP-56SDomVgHn-yJc57YpCwwJ81rAJgRONk"
|
||||
# create_class_notice: "9CDIvHIKiGwPEQWRw_-wieec1o50tMXQPPZIfECKu0I"
|
||||
|
||||
production:
|
||||
<<: *default
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
class DeleteNoneCourseHomework < ActiveRecord::Migration
|
||||
def up
|
||||
count = HomeworkCommon.all.count / 30 + 2
|
||||
transaction do
|
||||
for i in 1 ... count do i
|
||||
HomeworkCommon.page(i).per(30).each do |h|
|
||||
if h.course_id.nil? || h.course.nil?
|
||||
h.destroy
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
4564
db/schema.rb
4564
db/schema.rb
File diff suppressed because it is too large
Load Diff
|
@ -29,6 +29,12 @@ namespace :update_homework do
|
|||
changesets = g.commits(project.gpid, :ref_name => default_branch)
|
||||
changesets_latest_coimmit = changesets[0]
|
||||
unless changesets[0].blank?
|
||||
project_score = project.project_score
|
||||
if project_score.nil?
|
||||
ProjectScore.create(:project_id => project.id, :score => false)
|
||||
else
|
||||
project_score.update_column(:commit_time, changesets_latest_coimmit.created_at.to_time)
|
||||
end
|
||||
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
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【作业】{{act.subject|safeHtml}}</div>
|
||||
<div class="post-content c-grey3 mt10 mb10">
|
||||
<div class="post-all-content" ng-bind-html="act.description|safeHtml"></div>
|
||||
<span class="mr15 f13 c-grey2">迟交扣分:{{act.homework_common_detail.late_penalty}}分</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f13 c-grey2">匿评开启时间:{{act.homework_common_detail.evaluation_start}}</span><br />
|
||||
<span ng-if="!act.homework_common_detail.anonymous_comment" class="mr15 f13 c-grey2">缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f13 c-grey2">匿评关闭时间:{{act.homework_common_detail.evaluation_end}}</span>
|
||||
<span class="mr15 f12 c-grey2">迟交扣分:{{act.homework_common_detail.late_penalty}}分</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f12 c-grey2">匿评开启时间:{{act.homework_common_detail.evaluation_start}}</span><br />
|
||||
<span ng-if="!act.homework_common_detail.anonymous_comment" class="mr15 f12 c-grey2">缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品</span> <span ng-if="!act.homework_common_detail.anonymous_comment" class="f12 c-grey2">匿评关闭时间:{{act.homework_common_detail.evaluation_end}}</span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
@ -163,8 +163,8 @@
|
|||
<div class="post-dynamic-title c-grey3 hidden mt12 fb">【帖子】{{act.subject|safeHtml}}</div>
|
||||
<div class="post-content c-grey3 mt10 mb10">
|
||||
<div class="post-all-content" ng-bind-html="act.description|safeHtml"></div>
|
||||
<span class="mr15 f13 c-grey2">状态:{{act.issue_detail.issue_status}}</span> <span class="mr15 f13 c-grey2">优先级:{{act.issue_detail.issue_priority}}</span> <br />
|
||||
<span class="mr15 f13 c-grey2">指派给:{{act.issue_detail.issue_assigned_to}}</span> <span class="mr15 f13 c-grey2">完成度:{{act.issue_detail.done_ratio}}%</span>
|
||||
<span class="mr15 f12 c-grey2">状态:{{act.issue_detail.issue_status}}</span> <span class="mr15 f12 c-grey2">优先级:{{act.issue_detail.issue_priority}}</span> <br />
|
||||
<span class="mr15 f12 c-grey2">指派给:{{act.issue_detail.issue_assigned_to}}</span> <span class="mr15 f12 c-grey2">完成度:{{act.issue_detail.done_ratio}}%</span>
|
||||
</div>
|
||||
<div class="cl"></div>
|
||||
</div>
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
|
||||
|
||||
<!--<div ng-repeat="menu in menus">-->
|
||||
<!--<div id="class_tab_1" ng-class="[{'class-detail-tab': isTeacher},{'class-detail-tab3': !isTeacher},{'class-tab-active':currentTab==$index+1}]" ng-click="tab($index+1);"><a herf="javascript:void(0);">{{menu}}</a></div>-->
|
||||
<!--<div ng-if="!$last" class="slice2 fl">-->
|
||||
<!--<div class="slice-line2"></div>-->
|
||||
<!--</div>-->
|
||||
<!--<div id="class_tab_1" ng-class="[{'class-detail-tab': isTeacher},{'class-detail-tab3': !isTeacher},{'class-tab-active':currentTab==$index+1}]" ng-click="tab($index+1);"><a herf="javascript:void(0);">{{menu}}</a></div>-->
|
||||
<!--<div ng-if="!$last" class="slice2 fl">-->
|
||||
<!--<div class="slice-line2"></div>-->
|
||||
<!--</div>-->
|
||||
<!--</div>-->
|
||||
|
||||
<!--<div class="slice3 fl"></div>-->
|
||||
|
@ -23,7 +23,7 @@
|
|||
</div>
|
||||
|
||||
<div ng-class="{'undis': !showResources}">
|
||||
<div ng-repeat="r in resources|filter: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-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
|
||||
<div ng-repeat="r in resources|filter: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-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
|
||||
<p ng-show="resources_tag == true && resources.length<=0" class="class-test-tip">暂无课件,<br />
|
||||
请登录Trustie网站,在PC浏览器中上传课件。</p>
|
||||
</div>
|
||||
|
@ -42,14 +42,14 @@
|
|||
</div>
|
||||
|
||||
<div ng-class="{'undis': !showHomework}">
|
||||
<div ng-repeat="r in homeworks|filter: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-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
|
||||
<div ng-repeat="r in homeworks|filter: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-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2 undis" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
|
||||
<p ng-show="homeworks_tag == true && homeworks.length<=0" class="class-test-tip">暂无作业,<br />
|
||||
请登录Trustie网站,在PC浏览器中上传作业。</p>
|
||||
|
||||
</div>
|
||||
|
||||
<div ng-class="{'undis': !showTestcase}">
|
||||
<div ng-repeat="r in exercises|filter: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-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
|
||||
<div ng-repeat="r in exercises|filter: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-show="isTeacher" herf="javascript:void(0);" class="fr mr10 link-blue2 undis" ng-click="sendFile(r)">发送</a><div class="cl"></div></div>
|
||||
<p ng-show="exercises_tag == true && exercises.length<=0" class="class-test-tip">暂无小测验,<br />
|
||||
请登录Trustie网站,在PC浏览器中上传小测验。</p>
|
||||
</div>
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
<div>
|
||||
<div class="course-diff-row"><span class="c-blue f13 ml10">我创建的课程</span></div>
|
||||
<div ng-show = "syllabus.can_setting" ng-repeat="syllabus in syllabuses">
|
||||
<div ng-click="syllabus.show_plus = !syllabus.show_plus" class="course-list-row f13 c-grey3"><img src="/images/wechat/plus.png" ng-show="syllabus.show_plus" width="15" class="fl ml10 mt11 spread-btn" /><img src="/images/wechat/minus.png" ng-show="!syllabus.show_plus" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">{{syllabus.title}}</span><img src="/images/wechat/setting.png" ng-show = "syllabus.can_setting" width="15" class="fr mr10 mt10" ng-click="onSetting(syllabus)" /></div>
|
||||
<ul ng-show="!syllabus.show_plus" class="class-list f13 c-grey3">
|
||||
<div ng-click="syllabus.show_plus = !syllabus.show_plus" class="course-list-row f13 c-grey3 border-top-none"><img src="/images/wechat/plus.png" ng-show="!syllabus.show_plus" width="15" class="fl ml10 mt11 spread-btn" /><img src="/images/wechat/minus.png" ng-show="syllabus.show_plus" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">{{syllabus.title}}</span><img src="/images/wechat/setting.png" ng-show = "syllabus.can_setting" width="15" class="fr mr10 mt10" ng-click="onSetting(syllabus)" /></div>
|
||||
<ul ng-show="syllabus.show_plus" class="class-list f13 c-grey3">
|
||||
<li ng-show="course.id" ng-click="goClass(course.id)" ng-repeat="course in syllabus.courses" ng-class="{'border-bottom-none': $last}">
|
||||
<img src="/images/wechat/dot.png" width="15px" class="class-list-dot" />
|
||||
<span class="fl ml10 class-list-name hidden">{{course.name}}</span>
|
||||
|
@ -18,8 +18,8 @@
|
|||
<div>
|
||||
<div class="course-diff-row border-top mt10"><span class="c-blue f13 ml10">我参与的课程</span></div>
|
||||
<div ng-show = "!syllabus.can_setting" ng-repeat="syllabus in syllabuses">
|
||||
<div ng-click="syllabus.show_plus = !syllabus.show_plus" class="course-list-row f13 c-grey3"><img src="/images/wechat/plus.png" ng-show="syllabus.show_plus" width="15" class="fl ml10 mt11 spread-btn" /><img src="/images/wechat/minus.png" ng-show="!syllabus.show_plus" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">{{syllabus.title}}</span><img src="/images/wechat/setting.png" ng-show = "syllabus.can_setting" width="15" class="fr mr10 mt10" ng-click="onSetting(syllabus)" /></div>
|
||||
<ul ng-show="!syllabus.show_plus" class="class-list f13 c-grey3">
|
||||
<div ng-click="syllabus.show_plus = !syllabus.show_plus" class="course-list-row f13 c-grey3 border-top-none"><img src="/images/wechat/plus.png" ng-show="!syllabus.show_plus" width="15" class="fl ml10 mt11 spread-btn" /><img src="/images/wechat/minus.png" ng-show="syllabus.show_plus" width="15" class="fl ml10 mt11 retract-btn " /><span class="fl ml10">{{syllabus.title}}</span><img src="/images/wechat/setting.png" ng-show = "syllabus.can_setting" width="15" class="fr mr10 mt10" ng-click="onSetting(syllabus)" /></div>
|
||||
<ul ng-show="syllabus.show_plus" class="class-list f13 c-grey3">
|
||||
<li ng-show="course.id" ng-click="goClass(course.id)" ng-repeat="course in syllabus.courses" ng-class="{'border-bottom-none': $last}">
|
||||
<img src="/images/wechat/dot.png" width="15px" class="class-list-dot" />
|
||||
<span class="fl ml10 class-list-name hidden">{{course.name}}</span>
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
<div class="blue-title">管理课程</div>
|
||||
<form novalidate name="classForm">
|
||||
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">课程</span><input class="new-class-input ml25 c-black" ng-model="syllabus.tmptitle" required placeholder="请输入课程名" /></div>
|
||||
<div class="course-list-row f13 c-grey3 mt30"><span class="fl ml15 c-grey3">课程</span><input ng-change="fadeText()" ng-class="['new-class-input ml25', {'c-grey':change} ]" ng-model="syllabus.tmptitle" required placeholder="请输入课程名" /></div>
|
||||
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-repeat="course in syllabus.courses" ng-show="course.can_setting"><span class="fl ml15 c-grey3">班级</span><input required class="new-class-input ml25 c-black" ng-model="course.tmpname" placeholder="请输入班级名" /><a ng-click="deleteClass($index)" class="fr mr10 c-grey6 delete-class-link">删除</a></div>
|
||||
<div class="course-list-row f13 c-grey3 mt10" ng-repeat="course in syllabus.courses" ng-show="course.can_setting"><span class="fl ml15 c-grey3">班级</span><input ng-change="fadeText()" required ng-class="['new-class-input ml25', {'c-grey':change} ]" ng-model="course.tmpname" placeholder="请输入班级名" /><a ng-click="deleteClass($index)" class="fr mr10 c-grey6 delete-class-link">删除</a></div>
|
||||
<div class="tac"><a ng-click="addClass()" class="link-blue2 f13 mt15 inline-block add-class-link">+新增班级</a></div>
|
||||
<a ng-click="newClass(classForm, syllabus)" ng-class="['finish-btn', {'btn-disabled':!classForm.$valid} ]" >完成</a>
|
||||
</form>
|
||||
|
|
|
@ -15,10 +15,10 @@
|
|||
<div class="post-dynamic-title c-grey3 mt12 fb">{{homework.name}}</div>
|
||||
<div class="c-grey4 f13 mt10"><span class="mr10">{{homework.course_name}} - <span ng-if="homework.homework_type == 1">普通作业</span><span ng-if="homework.homework_type == 2">编程作业</span><span ng-if="homework.homework_type == 3">分组作业</span></span><span>{{homework.publish_time}}</span></div>
|
||||
<div class="f13 c-grey3 mt10 mb10 text-control post-all-content" ng-bind-html="homework.description|safeHtml"></div>
|
||||
<span class="c-grey f13 mr15">迟交扣分:{{homework.late_penalty}}分</span>
|
||||
<span ng-if="!homework.anonymous_comment" class="c-grey f13">缺评扣分:{{homework.absence_penalty}}分/作品</span>
|
||||
<span ng-if="!homework.anonymous_comment" class="c-grey f13 mr15">匿评开启时间:{{homework.evaluation_start}}</span>
|
||||
<span ng-if="!homework.anonymous_comment" class="c-grey f13">匿评关闭时间:{{homework.evaluation_end}}</span>
|
||||
<span class="c-grey f12 mr15">迟交扣分:{{homework.late_penalty}}分</span>
|
||||
<span ng-if="!homework.anonymous_comment" class="c-grey f12">匿评开启时间:{{homework.evaluation_start}}</span><br />
|
||||
<span ng-if="!homework.anonymous_comment" class="c-grey f12 mr15">缺评扣分:{{homework.absence_penalty}}分/作品</span>
|
||||
<span ng-if="!homework.anonymous_comment" class="c-grey f12">匿评关闭时间:{{homework.evaluation_end}}</span>
|
||||
<div class="cl"></div>
|
||||
<div class="fr f13">
|
||||
<div ng-if="!homework.praise_count" ng-click="addPraise(homework);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
<div class="c-grey4 f13 mt10"><span class="mr10">{{issue.project_name}} - 项目问题</span><span>{{issue.created_on}}</span></div>
|
||||
|
||||
<div class="f13 c-grey3 mt10 mb10 text-control post-all-content" ng-bind-html="issue.description|safeHtml"></div>
|
||||
<span class="c-grey f13 mr15">状 态:{{issue.issue_status}}</span>
|
||||
<span class="c-grey f13">优先级:{{issue.issue_priority}}</span><br/>
|
||||
<span class="c-grey f13 mr15">指派给:{{issue.issue_assigned_to}}</span>
|
||||
<span class="c-grey f13">完成度:{{issue.done_ratio}}%</span>
|
||||
<span class="c-grey f12 mr15">状 态:{{issue.issue_status}}</span>
|
||||
<span class="c-grey f12">优先级:{{issue.issue_priority}}</span><br/>
|
||||
<span class="c-grey f12 mr15">指派给:{{issue.issue_assigned_to}}</span>
|
||||
<span class="c-grey f12">完成度:{{issue.done_ratio}}%</span>
|
||||
<div class="cl"></div>
|
||||
<div class="fr f13">
|
||||
<div ng-if="!issue.praise_count" ng-click="addPraise(issue);"><img src="/images/wechat/w_praise.png" width="20" style="vertical-align:top; margin-top:2px;" class="mr5" /><span>赞</span></div>
|
||||
|
|
|
@ -11,25 +11,34 @@
|
|||
</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">课件来源:{{r.coursename}}</span><span class="f12 ml10 mt5 c-grey4">大小:{{r.attafile_size}}</span>
|
||||
</div>
|
||||
<p ng-show="resources && resources.length<=0" class="class-test-tip">暂无课件,<br />
|
||||
<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>
|
||||
<p ng-show="resources_tag && 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">作业来源:{{r.coursename}}</span>
|
||||
</div>
|
||||
<p ng-show="homeworks && homeworks.length<=0" class="class-test-tip">暂无作业,<br />
|
||||
<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>
|
||||
<p ng-show="homeworks_tag == true && 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">题目来源:{{r.coursename}}</span>
|
||||
</div>
|
||||
<p ng-show="exercise && exercise.length<=0" class="class-test-tip">暂无测验,<br />
|
||||
<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>
|
||||
<p ng-show="exercises_tag == true && exercise.length<=0" class="class-test-tip">暂无测验,<br />
|
||||
请登录Trustie网站,在PC浏览器中创建测验。</p>
|
||||
</div>
|
||||
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1021 B |
|
@ -1,24 +1,24 @@
|
|||
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})}}]);
|
||||
app.controller("CourseNoticeController",["$scope","$http","$routeParams","auth","common",function(o,e,t,n,a){a.init({id:t.id,scope:o,type:"newss",replyType:"News",loadCallback:function(e){o.news=e.data},replyCallback:function(){}})}]);
|
||||
app.controller("DiscussionController",["$scope","$http","$routeParams","auth","common",function(o,s,a,e,n){n.init({id:a.id,scope:o,type:"messages",replyType:"Message",loadCallback:function(s){o.discussion=s.data},replyCallback:function(){}})}]);
|
||||
app.controller("EditClassController",["$scope","$http","auth","config","alertService","$location","$routeParams","rms",function(s,e,a,l,t,o,r,u){var n=s;n.syllabus=u.get("current_edit_syllobus");var i=r.id;if(n.syllabus||e.get(l.apiUrl+"syllabuses/"+i+"?token="+a.token()).then(function(s){if(console.log(s.data),n.syllabus=s.data.data,n.syllabus){for(var e in n.syllabus.courses){var a=n.syllabus.courses[e];a.tmpname=a.name}n.syllabus.tmptitle=n.syllabus.title}}),console.log(n.syllabus),n.syllabus){for(var c in n.syllabus.courses){var d=n.syllabus.courses[c];d.tmpname=d.name}n.syllabus.tmptitle=n.syllabus.title}n.alertService_1=t.create(),n.alertService_2=t.create(),n.addClass=function(){n.syllabus.courses.push({can_setting:!0})},n.deleteClass=function(s){var t=n.syllabus.courses[s];t.id>0?n.alertService_2.showMessage("提示","您确定要删除该班级吗?",function(){e.post(l.apiUrl+"courses/"+t.id+"/del",{token:a.token()}).then(function(e){0!=e.data.status?n.alertService_1.showMessage("出错了",e.data.message):n.alertService_1.showMessage("提示","删除班级成功",function(){n.syllabus.courses.splice(s,1)}),console.log(e.data.data)})}):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 r=[],c=[];for(var d in n.syllabus.courses){var b=n.syllabus.courses[d];b.id?b.tmpname!=b.name&&c.push({id:b.id,name:b.tmpname}):r.push(b.tmpname)}e.post(l.apiUrl+"syllabuses/"+i+"/edit",{token:a.token(),id:i,title:n.syllabus.tmptitle,add_courses:r,modify_courses:c}).then(function(s){0!=s.data.status?n.alertService_1.showMessage("出错了",s.data.message):n.alertService_1.showMessage("提示","保存课程成功",function(){u.save("syllabuses",[]),o.path("/class_list")}),console.log(s.data.data)})}}]);
|
||||
app.controller("EditClassController",["$scope","$http","auth","config","alertService","$location","$routeParams","rms",function(s,e,a,l,t,o,r,n){var u=s;u.syllabus=n.get("current_edit_syllobus");var i=r.id;if(u.syllabus||e.get(l.apiUrl+"syllabuses/"+i+"?token="+a.token()).then(function(s){if(console.log(s.data),u.syllabus=s.data.data,u.syllabus){for(var e in u.syllabus.courses){var a=u.syllabus.courses[e];a.tmpname=a.name}u.syllabus.tmptitle=u.syllabus.title}}),console.log(u.syllabus),u.syllabus){for(var c in u.syllabus.courses){var d=u.syllabus.courses[c];d.tmpname=d.name}u.syllabus.tmptitle=u.syllabus.title}u.alertService_1=t.create(),u.alertService_2=t.create(),u.addClass=function(){u.syllabus.courses.push({can_setting:!0})},u.deleteClass=function(s){var t=u.syllabus.courses[s];t.id>0?u.alertService_2.showMessage("提示","您确定要删除该班级吗?",function(){e.post(l.apiUrl+"courses/"+t.id+"/del",{token:a.token()}).then(function(e){0!=e.data.status?u.alertService_1.showMessage("出错了",e.data.message):u.alertService_1.showMessage("提示","删除班级成功",function(){u.syllabus.courses.splice(s,1)}),console.log(e.data.data)})}):u.syllabus.courses.splice(s,1)},u.newClass=function(s,t){if(s.$setSubmitted(),console.log(t),!s.$valid)return void console.log(s.$error);var r=[],c=[];for(var d in u.syllabus.courses){var b=u.syllabus.courses[d];b.id?b.tmpname!=b.name&&c.push({id:b.id,name:b.tmpname}):r.push(b.tmpname)}e.post(l.apiUrl+"syllabuses/"+i+"/edit",{token:a.token(),id:i,title:u.syllabus.tmptitle,add_courses:r,modify_courses:c}).then(function(s){0!=s.data.status?u.alertService_1.showMessage("出错了",s.data.message):u.alertService_1.showMessage("提示","保存课程成功",function(){n.save("syllabuses",[]),o.path("/class_list")}),console.log(s.data.data)})},u.fadeText=function(){s.change=!0}}]);
|
||||
app.controller("HomeworkController",["$scope","$http","$routeParams","auth","common",function(o,e,l,n,r){r.init({id:l.id,scope:o,type:"whomeworks",replyType:"HomeworkCommon",loadCallback:function(e){console.log(e),o.homework=e.data},replyCallback:function(){}})}]);
|
||||
app.controller("InviteCodeController",["$scope","$http","$routeParams","config","auth",function(t,e,i,n,o){var a=t;a.course={};var c=i.id;e.get(n.apiUrl+"courses/"+c+"?token="+o.token()).then(function(t){console.log(t.data),a.course=t.data.data}),a.share=function(){window.WeixinJSBridge.invoke("sendAppMessage",{appid:"wxf694495398c7d470",type:"link",data_url:"",img_url:"http://pnewsapp.tc.qq.com/newsapp_bt/0/9963967/640",img_height:370,img_width:550,link:"http://view.inews.qq.com/a/WXN2013101101385701",desc:"desc",title:"title"},function(t){})}}]);
|
||||
app.controller("IssueController",["$scope","$http","$routeParams","auth","common",function(o,e,l,s,t){t.init({id:l.id,scope:o,type:"issues",replyType:"Issue",loadCallback:function(e){console.log(e),o.issue=e.data},replyCallback:function(){}})}]);
|
||||
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("MyResourceController",["$scope","$http","auth","config","$location","rms",function(e,a,o,s,r,t){var c=e;c.menus=["课件","作业","测验"],c.resources=[],c.homeworks=[],c.exercise=[],c.resources_tag=!1,c.homeworks_tag=!1,c.exercises_tag=!1,c.page=t.get("page")||0,c.resources=t.get("resources")||[],c.has_more=t.get("has_more"),c.homework_page=t.get("homework_page")||0,c.homeworks=t.get("homeworks")||[],c.homework_has_more=t.get("homework_has_more"),c.exercise_page=t.get("exercise_page")||0,c.exercise=t.get("exercise")||[],c.exercise_has_more=t.get("exercise_has_more"),c.searchText="",c.sendFile=function(e){r.path("/send_class_list").search({id:e.id})},c.loadResourceData=function(e,s){1==e?(c.page=s,a({method:"POST",url:apiUrl+"resources",data:{token:o.token(),page:s}}).then(function(e){c.resources_tag=!0,e.data.page>0?c.resources=c.resources.concat(e.data.data):c.resources=e.data.data,t.save("resources",c.resources),c.has_more=e.data.count+10*e.data.page<e.data.all_count,t.save("has_more",c.has_more),t.save("page",e.data.page),console.log(e.data)},function(e){})):2==e?(c.homework_page=s,a({method:"POST",url:apiUrl+"resources/homeworks",data:{token:o.token(),page:s}}).then(function(e){c.homeworks_tag=!0,e.data.page>0?c.homeworks=c.homeworks.concat(e.data.data):c.homeworks=e.data.data,t.save("homeworks",c.homeworks),c.homework_has_more=e.data.count+10*e.data.page<e.data.all_count,t.save("homework_has_more",c.has_more),t.save("homework_page",e.data.page),console.log(e.data)},function(e){})):3==e&&(c.exercise_page=s,a({method:"POST",url:apiUrl+"resources/exercises",data:{token:o.token(),page:s}}).then(function(e){c.exercises_tag=!0,e.data.page>0?c.exercise=c.exercise.concat(e.data.data):c.exercise=e.data.data,t.save("exercise",c.exercise),c.exercise_has_more=e.data.count+10*e.data.page<e.data.all_count,t.save("exercise_has_more",c.exercise_has_more),t.save("exercise_page",e.data.page),console.log(e.data)},function(e){}))},c.tab=function(e){switch(c.currentTab=e,c.searchText="",e){case 1:c.resources.length<=0&&c.loadResourceData(e,0);break;case 2:c.homeworks.length<=0&&c.loadResourceData(e,0);break;case 3:c.exercise.length<=0&&c.loadResourceData(e,0)}},c.tab(1)}]);
|
||||
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}}}])}]);
|
||||
app.config(["$routeProvider","$httpProvider","$locationProvider","config",function(e,l,t,o){var r=o.rootPath,s={delay:["auth",function(e){return e.get_bind()}]},n=function(e,l){return{templateUrl:r+e,controller:l,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",{templateUrl:r+"invite_code.html",controller:"InviteCodeController"}).when("/send_class_list",n("send_class_list.html","SendClassListController")).otherwise({redirectTo:"/activites"}),l.interceptors.push(["$q","$rootScope",function(e,l){return void 0==l.activeCalls&&(l.activeCalls=0),{request:function(e){return l.activeCalls+=1,e},requestError:function(e){return l.activeCalls-=1,e},response:function(e){return l.activeCalls-=1,e},responseError:function(e){return l.activeCalls-=1,e}}}])}]);
|
|
@ -107,4 +107,8 @@ app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'ale
|
|||
|
||||
}
|
||||
|
||||
vm.fadeText = function () {
|
||||
$scope.change = true;
|
||||
}
|
||||
|
||||
}] );
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth', function($scope, $http, $routeParams, config, auth){
|
||||
var vm = $scope;
|
||||
|
||||
|
||||
vm.course = {};
|
||||
var courseid = $routeParams.id;
|
||||
$http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
|
||||
|
@ -14,7 +14,7 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
|
|||
vm.course = response.data.data;
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
vm.share = function(){
|
||||
window.WeixinJSBridge.invoke('sendAppMessage',{
|
||||
'appid': 'wxf694495398c7d470', // 公众号appID
|
||||
|
@ -30,5 +30,5 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
|
|||
//alert(res.err_msg);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
}]);
|
||||
|
|
|
@ -1,37 +1,135 @@
|
|||
app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', function($scope, $http, auth, config, $location){
|
||||
app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', 'rms', function($scope, $http, auth, config, $location,rms){
|
||||
var vm = $scope;
|
||||
vm.menus = ['课件', '作业', '测验'];
|
||||
|
||||
vm.resources = null;
|
||||
vm.homeworks = null;
|
||||
vm.exercise = null;
|
||||
vm.resources = [];
|
||||
vm.homeworks = [];
|
||||
vm.exercise = [];
|
||||
|
||||
vm.resources_tag = false;
|
||||
vm.homeworks_tag = false;
|
||||
vm.exercises_tag = false;
|
||||
|
||||
vm.page = rms.get('page') || 0;
|
||||
vm.resources = rms.get("resources") || [];
|
||||
vm.has_more = rms.get("has_more");
|
||||
|
||||
vm.homework_page = rms.get('homework_page') || 0;
|
||||
vm.homeworks = rms.get("homeworks") || [];
|
||||
vm.homework_has_more = rms.get("homework_has_more");
|
||||
|
||||
vm.exercise_page = rms.get('exercise_page') || 0;
|
||||
vm.exercise = rms.get("exercise") || [];
|
||||
vm.exercise_has_more = rms.get("exercise_has_more");
|
||||
|
||||
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) {
|
||||
vm.resources_tag = true
|
||||
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('has_more', vm.has_more);
|
||||
rms.save('page', response.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) {
|
||||
vm.homeworks_tag = true
|
||||
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', response.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) {
|
||||
vm.exercises_tag = true;
|
||||
if(response.data.page >0) {
|
||||
vm.exercise = vm.exercise.concat(response.data.data);
|
||||
} else {
|
||||
vm.exercise = response.data.data;
|
||||
}
|
||||
|
||||
rms.save("exercise", vm.exercise);
|
||||
vm.exercise_has_more = (response.data.count + response.data.page * 10) < response.data.all_count;
|
||||
rms.save('exercise_has_more', vm.exercise_has_more);
|
||||
rms.save('exercise_page', response.data.page);
|
||||
|
||||
console.log(response.data);
|
||||
|
||||
}, function errorCallback(response) {
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
vm.tab = function(index){
|
||||
vm.currentTab = index;
|
||||
vm.searchText = "";
|
||||
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;
|
||||
});
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
vm.tab(1);
|
||||
|
||||
vm.sendFile = function(r){
|
||||
$location.path("/send_class_list").search({id: r.id});
|
||||
}
|
||||
}] );
|
||||
|
|
|
@ -35,7 +35,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
|
|||
.when('/edit_class', makeRoute('edit_class.html', 'EditClassController'))
|
||||
.when('/class_list', makeRoute('class_list.html', 'ClassListController'))
|
||||
.when('/myresource', makeRoute('myresource.html', 'MyResourceController'))
|
||||
.when('/invite_code', makeRoute('invite_code.html', 'InviteCodeController'))
|
||||
.when('/invite_code', {templateUrl: rootPath + 'invite_code.html', controller: 'InviteCodeController'})
|
||||
.when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController'))
|
||||
.otherwise({
|
||||
redirectTo: '/activites'
|
||||
|
@ -66,4 +66,4 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func
|
|||
}
|
||||
};
|
||||
}]);
|
||||
}]);
|
||||
}]);
|
||||
|
|
|
@ -43,7 +43,7 @@ blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin: 5px 0.4em 5px 1.4e
|
|||
.mr55 {margin-right:55px;}
|
||||
.c-red {color:#e81a1a;}
|
||||
.c-blue {color:#269ac9;}
|
||||
.c-grey {color:#9a9a9a;}
|
||||
.c-grey {color:#9a9a9a !important;}
|
||||
.c-grey2 {color:#707070;}
|
||||
.c-grey3 {color:#555555;}
|
||||
.c-grey4 {color:#888888;}
|
||||
|
@ -194,15 +194,18 @@ a.underline {text-decoration:underline;}
|
|||
.img-circle {border-radius:50%;}
|
||||
.member-banner {height:24px; line-height:24px; text-align:center; vertical-align:middle; background-color:#dfdfdf;}
|
||||
.resource-width {width:76%;}
|
||||
.courseware-from-width {max-width:57%;}
|
||||
.other-from-width {max-width:80%;}
|
||||
|
||||
/*20160614班级列表*/
|
||||
.course-diff-row {width:100%; height:28px; line-height:28px; vertical-align:middle; background-color:#fff;}
|
||||
.course-diff-row {width:100%; height:28px; line-height:28px; vertical-align:middle; background-color:#fff; border-bottom:1px solid #ccc;}
|
||||
.course-list-row {width:100%; height:38px; line-height:38px; vertical-align:middle; border-top:1px solid #ccc; border-bottom:1px solid #ccc; background-color:#fff;}
|
||||
.class-list {width:100%; border-bottom:1px solid #ccc;}
|
||||
.class-list li {height:40px; line-height:40px; vertical-align:middle; margin:0 25px; border-left:1px solid #ccc; border-bottom:1px solid #ccc; position:relative;}
|
||||
.class-list-name {max-width:75%; display:inline-block;}
|
||||
.class-list-dot {position:absolute; top:13px; left:-8px;}
|
||||
.border-bottom-none {border-bottom:none !important;}
|
||||
.border-top-none {border-top:none !important;}
|
||||
.students-amount {height:14px; line-height:14px; vertical-align:middle; padding:2px 5px; background-color:#e6e6e6; border-radius:10px;}
|
||||
.new-class-btn {font-size:15px; color:#fff; background-color:#3b94d6; padding:10px 40px; border-radius:20px; display:inline-block; margin:0 auto;}
|
||||
.join-class-btn {font-size:15px; color:#444; background-color:#ccc; padding:10px 40px; border-radius:20px; display:inline-block; margin:0 auto;}
|
||||
|
|
Loading…
Reference in New Issue