From b2b6536a0f85a66c7ca8e3aabf1780155e50a244 Mon Sep 17 00:00:00 2001 From: txz Date: Tue, 28 Jun 2016 14:48:33 +0800 Subject: [PATCH 01/40] =?UTF-8?q?=E5=BE=AE=E4=BF=A1css=E6=A0=B7=E5=BC=8F?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile~ | 114 +++++++++++++++++++++++++++++ db/schema.rb | 31 ++++---- public/stylesheets/weui/weixin.css | 13 ++-- 3 files changed, 134 insertions(+), 24 deletions(-) create mode 100644 Gemfile~ diff --git a/Gemfile~ b/Gemfile~ new file mode 100644 index 000000000..334f15853 --- /dev/null +++ b/Gemfile~ @@ -0,0 +1,114 @@ +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 diff --git a/db/schema.rb b/db/schema.rb index 148a6e21b..24c769ac8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160624032138) do +ActiveRecord::Schema.define(:version => 20160624103411) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -1125,23 +1125,6 @@ ActiveRecord::Schema.define(:version => 20160624032138) do t.integer "viewed_count", :default => 0 end - create_table "mess", :id => false, :force => true do |t| - t.string "课程名" - t.integer "课程ID", :default => 0, :null => false - t.string "教师姓", :default => "", :null => false - t.string "教师名", :limit => 30, :default => "", :null => false - t.string "主贴名", :default => "", :null => false - t.integer "主贴或回帖ID", :default => 0, :null => false - t.integer "回帖对应主贴ID" - t.integer "帖子点赞数" - t.integer "主贴回复数", :default => 0, :null => false - t.text "主贴或回帖内容" - t.datetime "发帖时间", :null => false - t.integer "发帖或回帖用户ID", :default => 0, :null => false - t.string "发帖或回帖用户姓", :default => "", :null => false - t.string "发帖或回帖用户名", :limit => 30, :default => "", :null => false - end - create_table "message_alls", :force => true do |t| t.integer "user_id" t.integer "message_id" @@ -1539,6 +1522,18 @@ ActiveRecord::Schema.define(:version => 20160624032138) do add_index "projects_trackers", ["project_id", "tracker_id"], :name => "projects_trackers_unique", :unique => true add_index "projects_trackers", ["project_id"], :name => "projects_trackers_project_id" + create_table "quality_analyses", :force => true do |t| + t.integer "project_id" + t.string "author_login" + t.string "rep_identifier" + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.integer "sonar_version", :default => 0 + t.string "path" + t.string "branch" + t.string "language" + end + create_table "queries", :force => true do |t| t.integer "project_id" t.string "name", :default => "", :null => false diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 3360d81ee..3bbab9b6c 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -4,7 +4,7 @@ /*基本样式*/ body,table,input,textarea,select,button { font-family: "微软雅黑","宋体","Helvetica Neue", Helvetica, Arial, sans-serif;} body, ul, h1,h2,h3,h4,h5,p,pre,input {padding:0px; margin:0px;} -body{background-color: #EFEFF4;} +body{background-color: #efeff4;} ul li {list-style:none;} img {max-width:100%;} blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin-left: 1.4em; margin-right: 0.4em; border-radius: 4px; font-family: "Microsoft YaHei"; background-size: 100% 100%; margin-top:5px;} @@ -19,6 +19,7 @@ blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin-left: 1.4em; margin .mt5 {margin-top:5px;} .mt10 {margin-top:10px;} .mt11 {margin-top:11px;} +.mt12 {margin-top:12px;} .mt15 {margin-top:15px;} .mt30 {margin-top:30px;} .mt70 {margin-top:70px;} @@ -44,6 +45,7 @@ blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin-left: 1.4em; margin .c-grey5 {color:#aaaaaa;} .c-grey6 {color:#777777;} .c-blue {color:#3b94d6;} +.c-white {color:#ffffff;} a {color:#707070;} a.c-grey {color:#707070;} a.c-grey2 {color:#9a9a9a;} @@ -73,7 +75,7 @@ a.underline {text-decoration:underline;} .btn1 {width:100%; height:40px; line-height:40px; vertical-align:middle; text-align:center; color:#fff; display:block; border-radius:5px;} .bg-blue:not(.btn-disabled):active {background-color:#2780c2;} .btn-disabled {background-color:#ccc;} - +.btn2 {width:145px; height:35px; color:#fff; font-size:15px; line-height:35px; text-align:center; vertical-align:middle; margin:18px auto 20px auto; border-radius:50px; display:block;} /*tab*/ .tab-wrap {position:relative; line-height:38px; display:flex; font-size:13px; background-color:#fff;} @@ -87,7 +89,6 @@ a.underline {text-decoration:underline;} .bottom-tab-wrap a {display:block; flex:1; position:relative;} .bottom-tab-wrap a:after {content:" "; position:absolute; left:0; top:0; width:1px; height:100%; border-left:1px solid #ccc; color:#707070;} - /*动态样式*/ .post-container {width:100%;} .post-wrapper {width:98%; border-radius:3px; box-shadow:0px 0px 8px rgba(146, 153, 169, 0.5); background-color:#ffffff; margin:10px auto;} @@ -134,7 +135,7 @@ a.underline {text-decoration:underline;} .locked_btn_cir {background: url("/images/wechat/locked.png") 0 0 no-repeat; cursor: default;} /*20150612加入班级样式*/ -.add-class-box {width:80%; max-width:300px; min-width:240px; height:150px; font-size:15px; color:#444; background-color:#fff; margin:0 auto; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); border-radius:5px; margin-top:100px;} +.add-class-box {position:fixed; width:80%; max-width:300px; min-width:240px; font-size:15px; color:#444; background-color:#fff; margin:0 auto; box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5); border-radius:5px; top:50%; left:50%; transform: translate(-50%,-50%);} .add-class-tip {padding-top:20px; padding-bottom:20px;} .class-number-input {width:80%; max-width:240px; height:28px; border:1px solid #ccc; padding-left:5px; margin:0 auto; display:block;} .cancel-btn {width:49%; height:37px; line-height:37px; text-align:center; vertical-align:middle; border-top:1px solid #ccc;} @@ -191,7 +192,7 @@ a.underline {text-decoration:underline;} .input-box { -webkit-appearance: none; font-size: 16px;width:100%; height:16px; padding: 10px 0px 10px 5px; line-height:16px; border:1px solid #ccc; border-radius:5px;} .login-op-wrap {height:30px; line-height:30px; vertical-align:middle;} .login-box{display:inline-block; width:14px; height:14px; line-height:14px; text-align:center; vertical-align:middle; border:1px solid #ccc; background:#fff; border-radius:3px; color:#fff; cursor:pointer;} -.login-box.checked{background:#63c360;} +.login-box.checked{background:#63c360; border:1px solid #63c360;} .login-box.checked:after{content:url(/images/wechat/checked.png);} .forget-psw-wrap {width:60px; margin:0 auto;} -.forget-psw {position:fixed; bottom:10px;} +.forget-psw {position:fixed; bottom:10px;} \ No newline at end of file From 2596231ce7d262c895a393d7865cd69fd0aba6ff Mon Sep 17 00:00:00 2001 From: txz Date: Wed, 29 Jun 2016 15:44:32 +0800 Subject: [PATCH 02/40] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E6=96=B0=E5=8A=A8?= =?UTF-8?q?=E6=80=81=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/stylesheets/weui/weixin.css | 35 ++++++++++++++++++++---------- 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 3bbab9b6c..5b1c1df95 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -11,7 +11,9 @@ blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin-left: 1.4em; margin .text-control {word-break:normal; word-wrap:break-word;} .f12 {font-size:12px;} .f13 {font-size:13px;} +.f14 {font-size:14px;} .f15 {font-size:15px;} +.f16 {font-size:16px;} .fb {font-weight:bold;} .mt2 {margin-top:2px;} .mt3 {margin-top:3px;} @@ -26,6 +28,7 @@ blockquote {border:1px solid #d4d4d4; padding: 0.6em; margin-left: 1.4em; margin .mb5 {margin-bottom:5px;} .mb10 {margin-bottom:10px;} .mb20 {margin-bottom:20px;} +.ml5 {margin-left:5px;} .ml10 {margin-left:10px;} .mr5 {margin-right:5px;} .mr10 {margin-right:10px;} @@ -91,15 +94,15 @@ a.underline {text-decoration:underline;} /*动态样式*/ .post-container {width:100%;} -.post-wrapper {width:98%; border-radius:3px; box-shadow:0px 0px 8px rgba(146, 153, 169, 0.5); background-color:#ffffff; margin:10px auto;} -.post-main {padding:10px; color:#9a9a9a;} -.post-avatar {width:40px; height:40px; margin-right:5px;} +.post-wrapper {width:100%; background-color:#ffffff; margin:10px auto;} +.post-main {padding:10px 15px; color:#9a9a9a;} +.post-avatar {width:30px; height:30px;} .post-title {font-size:13px; text-align:left;} .post-detail-info {font-size:13px; text-align:left; color:#9a9a9a;} .fl {float:left;} .fr {float:right;} .cl {clear:both; overflow:hidden;} -.post-content {width:100%; font-size:13px; line-height:18px; height:90px; overflow:hidden; word-break:break-all; word-wrap:break-word;} +.post-content {width:100%; font-size:14px; line-height:20px; height:100px; overflow:hidden; word-break:break-all; word-wrap:break-word;} .post-all-content a {color:#136ec2;} .post-interactive {width:100%; height:35px; line-height:35px; vertical-align:middle; border-top:1px solid #e6e6e6; background-color:#f8f9fb;} .post-interactive-column, @@ -108,23 +111,32 @@ a.underline {text-decoration:underline;} .more-wrap {width:100%;} .more-events {width:98%; font-size:13px; text-align:center; margin:0 auto; padding: 5px 0; border:1px solid #e6e6e6; border-radius:3px; background-color:#f8f9fb; } .border-bottom {border-bottom:1px solid #e6e6e6;} -.post-reply-wrap, .post-input-wrap {width:100%; background-color:#f8f9fb;} -.post-reply-row {padding:10px; color:#9a9a9a;} +.post-reply-wrap {width:100%;} +.post-input-wrap {width:100%; position:fixed; bottom:0;} +.post-input-wrap2 {width:100%;} +.post-reply-row {padding:10px 15px; color:#9a9a9a; background-color:#fff;} .post-reply-avatar {width:45px; height:30px; text-align:center; margin-right:10px;} .post-reply-user {font-size:13px; text-align:left; margin-bottom:10px;} -.post-reply-content {font-size:13px; text-align:left; word-break:break-all; word-wrap:break-word; overflow:hidden;} +.post-reply-content {font-size:13px; text-align:left; word-break:break-all; word-wrap:break-word; overflow:hidden; padding-bottom:15px; border-bottom:1px solid #ccc;} .post-reply-content img {max-width:100%;} .post-reply-date, .post-reply-trigger {font-size:13px;} -.post-input-container {padding-right:12px;} +.post-input-container {position:relative; padding-right:70px;} .copy-input {width:100%; height:28px; line-height:28px; padding:0 5px; vertical-align: middle; font-size:12px; border-radius:3px; position:absolute; left:-9999em;} -.post-reply-input {width:100%; height:28px; max-height:84px; line-height:28px; vertical-align: middle; font-size:12px; border:1px solid #e6e6e6; outline:none; padding:0 5px; margin:0; border-radius:3px; overflow-y:auto; resize:none;} -.post-reply-submit {font-size:13px; padding:3px 8px; color:#fff; background-color:#269ac9; outline:none; border:none; display:inline-block;} +.post-reply-input {width:100%; height:28px; max-height:84px; line-height:28px; vertical-align: middle; font-size:13px; border:1px solid #e6e6e6; outline:none; padding:0 5px; margin:0; border-radius:3px; overflow-y:auto; resize:none; background-color:#f0eff4;} +.post-reply-submit {position:absolute; font-size:13px; height:30px; line-height:30px; vertical-align:middle; padding:0 8px; color:#fff; background-color:#269ac9; outline:none; border:none; top:0; right:0;} .reply-icon {background:url(/images/wechat/icon_list.gif) -150px -155px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;} .praise-icon {background:url(/images/wechat/icon_list.gif) -36px -88px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;} .praised-icon {background:url(/images/wechat/icon_list.gif) -152px -86px no-repeat; width:20px; height:20px; display:inline-block; vertical-align:middle;} .num-block {display:inline-block; vertical-align:top;} .post-op-banner {height:20px; line-height:20px; vertical-align:middle;} +/*20160628动态新样式*/ +.post-dynamic-author {width:50%; height:30px; line-height:30px; font-size:14px; color:#5b5b5b; vertical-align:middle;} +.post-dynamic-time {height:30px; line-height:30px; vertical-align:middle;} +.post-dynamic-title {font-size:15px;} +.post-dynamic-from {width:50%; font-size:13px;} +.post-box-shadow {box-shadow: 0px 2px 8px rgba(146, 153, 169, 0.5);} + /* loading 弹框*/ .loading-bg {position:fixed; width:100%; height:100%; left:0; top:0; z-index:99; background:rgba(206, 206, 206, 0.3); overflow:hidden;} .loading-box {position:absolute; top:50%; background:rgba(240,240,240, 0.5); width:160px; height:72px; left:50%; margin-top:-36px; margin-left:-80px; text-align:center;} @@ -163,7 +175,8 @@ a.underline {text-decoration:underline;} .class-detail-tab {width:23%; height:38px; line-height:38px; font-size:13px; color:#444; background-color:#fff; float:left; text-align:center; vertical-align:middle; border-bottom:1px solid #ccc;} .class-detail-tab2 {width:32%; height:38px; line-height:38px; font-size:13px; color:#444; background-color:#fff; float:left; text-align:center; vertical-align:middle; border-bottom:1px solid #ccc;} .class-detail-tab3 {width:48%; height:38px; line-height:38px; font-size:13px; color:#444; background-color:#fff; float:left; text-align:center; vertical-align:middle; border-bottom:1px solid #ccc;} -.class-tab-active {border-bottom:1px solid #3b94d6;} +.class-tab-active {border-bottom:3px solid #3b94d6;} +.tab-active-arrow {border-width:4px; position:absolute; top:41px; left:50%; transform:translate(-50%,0); border-color:#3b94d6 transparent transparent transparent; border-style:solid dashed dashed dashed;} .class-search-wrap {padding:8px 12px; position:relative;} .class-search-inner {padding:0 30px; background-color:#fff;} .class-search-icon {position:absolute; top:16px; left:16px;} From 0bb5c8b5fb14c9e852d3b7cf742791569add4a69 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 29 Jun 2016 21:09:49 +0800 Subject: [PATCH 03/40] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E7=BB=91=E5=AE=9A?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/users.rb | 12 ++++- app/views/wechats/user_activities.html.erb | 46 ++++++++++---------- public/assets/wechat/reg.html | 3 +- public/javascripts/wechat/controllers/reg.js | 11 +++-- 4 files changed, 43 insertions(+), 29 deletions(-) diff --git a/app/api/mobile/apis/users.rb b/app/api/mobile/apis/users.rb index b5ee14d19..a6536e73e 100644 --- a/app/api/mobile/apis/users.rb +++ b/app/api/mobile/apis/users.rb @@ -53,10 +53,20 @@ module Mobile requires :password, type: String, desc: 'password' end post do + + openid = session[:wechat_openid] + logger.debug "openid ============== #{openid}" + raise "无法获取到openid,请在微信中打开本页面" unless openid + + us = UsersService.new user = us.register params.merge(:password_confirmation => params[:password], :should_confirmation_password => true) - raise "该邮箱已经被注册过了" if user.new_record? + raise user.errors.full_messages.first if user.new_record? + UserWechat.create!( + openid: openid, + user: user + ) present :data, user, with: Mobile::Entities::User present :status, 0 diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index 1e3957ea9..7b7cb95e5 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -28,29 +28,29 @@ - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/assets/wechat/reg.html b/public/assets/wechat/reg.html index 9184fd0ed..c39eb1619 100644 --- a/public/assets/wechat/reg.html +++ b/public/assets/wechat/reg.html @@ -40,4 +40,5 @@ - \ No newline at end of file + + \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/reg.js b/public/javascripts/wechat/controllers/reg.js index dfa010ad7..44c2e098b 100644 --- a/public/javascripts/wechat/controllers/reg.js +++ b/public/javascripts/wechat/controllers/reg.js @@ -1,8 +1,9 @@ -app.controller('RegController', ['$scope', '$http', '$location', 'alertService', - function ($scope, $http, $location, alertService) { +app.controller('RegController', ['$scope', '$http', '$location', 'alertService','$location', + function ($scope, $http, $location, alertService, $location) { var vm = $scope; vm.errDialog = alertService.create(); + vm.successDialog = alertService.create(); vm.goLogin = function () { $location.path("/login"); @@ -32,10 +33,12 @@ app.controller('RegController', ['$scope', '$http', '$location', 'alertService', if (response.data.status != 0) { vm.errDialog.showMessage('出错了',response.data.message); } else { - vm.errDialog.showMessage("提示","注册且绑定微信成功"); + vm.successDialog.showMessage("提示","注册且绑定微信成功", function(){ + $location.path("/activities"); + }); } }, function (response) { - vm.errDialo.showMessage('出错了',response.data); + vm.errDialog.showMessage('出错了',response.data); }); } From c2482499839f7d8c9aef7983287d090d6e48a9f9 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Wed, 29 Jun 2016 21:11:21 +0800 Subject: [PATCH 04/40] =?UTF-8?q?=E6=B3=A8=E5=86=8C=E6=B2=A1=E6=9C=89loadi?= =?UTF-8?q?ng=E5=9B=BE=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/reg.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/assets/wechat/reg.html b/public/assets/wechat/reg.html index c39eb1619..9e2978e3b 100644 --- a/public/assets/wechat/reg.html +++ b/public/assets/wechat/reg.html @@ -1,4 +1,7 @@
+ +
+
注册登录
From b010ce2e6113dd94fe9ba185eb21d86e3f859ca4 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sat, 2 Jul 2016 23:46:45 +0800 Subject: [PATCH 05/40] =?UTF-8?q?=E5=8F=91=E9=80=81=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .access_token | 2 +- app/api/mobile/apis/courses.rb | 2 +- app/api/mobile/apis/resources.rb | 18 ++++- app/controllers/users_controller.rb | 40 +--------- app/services/courses_service.rb | 2 +- app/services/resources_service.rb | 53 +++++++++++++ app/services/users_service.rb | 4 + app/views/wechats/user_activities.html.erb | 1 + public/assets/wechat/activities.html | 6 +- public/assets/wechat/class.html | 6 +- public/assets/wechat/class_list.html | 5 +- public/assets/wechat/myresource.html | 6 +- public/assets/wechat/new_class.html | 5 +- public/assets/wechat/send_class_list.html | 13 ++++ public/assets/wechat/templates/loading.html | 21 ++++++ .../javascripts/wechat/controllers/class.js | 4 + .../wechat/controllers/class_list.js | 75 ++++++++++++++----- .../wechat/controllers/myresource.js | 6 +- .../wechat/controllers/new_class.js | 10 +-- .../wechat/controllers/send_class_list.js | 47 ++++++++++++ .../wechat/directives/loading_spinner.js | 6 +- public/javascripts/wechat/others/routes.js | 1 + 22 files changed, 251 insertions(+), 82 deletions(-) create mode 100644 app/services/resources_service.rb create mode 100644 public/assets/wechat/send_class_list.html create mode 100644 public/assets/wechat/templates/loading.html create mode 100644 public/javascripts/wechat/controllers/send_class_list.js diff --git a/.access_token b/.access_token index 610b08d2e..2fb2e740f 100644 --- a/.access_token +++ b/.access_token @@ -1 +1 @@ -{"access_token":"oEEf8ZKAB8Y2G0o_xnTPkPJHKKk8iHkLC-f5ptvQ2nCMj9IpC86ivLD2-p38GfOkuG-HuQp3pWZqhs3NJXUMdPLWsr5k67hPZYuqg4ozLccx0xdLswapj0mn8ovZhK1tKIKiAFAOMO","expires_in":7200,"got_token_at":1467012449} \ No newline at end of file +{"access_token":"m8kGwb7G0laM6-0uHmPtxETR6WJk5PgR37te_h8aBwgqGXkml2ZZAvPUBldmzF5hDZsQBHEn8PUACSL60eDKlCWigwwUJReK2wB4UbXIc1UA-rrkpHuWl84H3rcswtlvHENjAHAZWF","expires_in":7200,"got_token_at":1467472907} \ No newline at end of file diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index 42303b63d..cb1db09d8 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -107,7 +107,7 @@ module Mobile status = cs.join_course({role: "10", openid: params[:openid], invite_code: params[:invite_code]}, current_user) { status: status[:state], - messsge:CoursesService::JoinCourseError.message(status[:state]) + message:CoursesService::JoinCourseError.message(status[:state]) } end diff --git a/app/api/mobile/apis/resources.rb b/app/api/mobile/apis/resources.rb index fca94a642..c2fcfa754 100644 --- a/app/api/mobile/apis/resources.rb +++ b/app/api/mobile/apis/resources.rb @@ -46,9 +46,25 @@ module Mobile end - end + desc '发送资源' + params do + requires :token, type: String + requires :course_ids, type: Array[Integer] + requires :send_id, type: Integer + end + post 'send' do + authenticate! + rs = ResourcesService.new + ori, flag, save_message = rs.send_resource_to_course(params) + if flag + present :status, 0 + else + {status: -1, message: save_message.first} + end + end + end end end diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b7972ff6f..3bf582e23 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1977,44 +1977,8 @@ class UsersController < ApplicationController def add_exist_file_to_course @flag = true if params[:send_id].present? - send_id = params[:send_id] - @ori = Attachment.find_by_id(send_id) - course_ids = params[:course_ids] - if course_ids.nil? - @flag = false - end - unless course_ids.nil? - course_ids.each do |id| - next if @ori.blank? - @exist = false - Course.find(id).attachments.each do |att| #如果课程中包含该资源 - if att.id == @ori.id || (!att.copy_from.nil? && !@ori.copy_from.nil? && att.copy_from == @ori.copy_from) || att.copy_from == @ori.id || att.id == @ori.copy_from - att.created_on = Time.now - att.save - @exist = true - break - end - end - next if @exist - attach_copied_obj = @ori.copy - attach_copied_obj.tag_list.add(@ori.tag_list) # tag关联 - attach_copied_obj.container = Course.find(id) - attach_copied_obj.created_on = Time.now - attach_copied_obj.author_id = User.current.id - attach_copied_obj.is_public = 0 - attach_copied_obj.copy_from = @ori.copy_from.nil? ? @ori.id : @ori.copy_from #发送要添加copy_from - if attach_copied_obj.attachtype == nil - attach_copied_obj.attachtype = 4 - end - if attach_copied_obj.save - # 更新引用次数 - quotes = @ori.quotes.to_i + 1 - @ori.update_attribute(:quotes, quotes) unless @ori.nil? - @ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) - end - @save_message = attach_copied_obj.errors.full_messages - end - end + rs = ResourcesService.new + @ori, @flag, @save_message = rs.send_resource_to_course(params) elsif params[:send_ids].present? send_ids = params[:send_ids].split(",") course_ids = params[:course_ids] diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index dce3e1f18..e6143caec 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -324,7 +324,7 @@ class CoursesService 1, '密码错误', 2, '课程已过期 请联系课程管理员重启课程。', 3, '您已经加入了课程', - 4, '您加入的课程不存在', + 4, '您的邀请码不正确', 5, '您还未登录', 6, '申请成功,请等待审核完毕', 7, '您已经发送过申请了,请耐心等待', diff --git a/app/services/resources_service.rb b/app/services/resources_service.rb new file mode 100644 index 000000000..827fc3efd --- /dev/null +++ b/app/services/resources_service.rb @@ -0,0 +1,53 @@ +#coding=utf-8 + +class ResourcesService + + #发送资源到课程 + def send_resource_to_course params + send_id = params[:send_id] + @ori = Attachment.find_by_id(send_id) + course_ids = params[:course_ids] + @flag = false + unless course_ids.nil? + course_ids.each do |id| + next if @ori.blank? + @exist = false + Course.find(id).attachments.each do |att| #如果课程中包含该资源 + if att.id == @ori.id || (!att.copy_from.nil? && !@ori.copy_from.nil? && att.copy_from == @ori.copy_from) || att.copy_from == @ori.id || att.id == @ori.copy_from + att.created_on = Time.now + att.save + @exist = true + @flag = true + break + end + end + next if @exist + attach_copied_obj = @ori.copy + attach_copied_obj.tag_list.add(@ori.tag_list) # tag关联 + attach_copied_obj.container = Course.find(id) + attach_copied_obj.created_on = Time.now + attach_copied_obj.author_id = User.current.id + attach_copied_obj.is_public = 0 + attach_copied_obj.copy_from = @ori.copy_from.nil? ? @ori.id : @ori.copy_from #发送要添加copy_from + if attach_copied_obj.attachtype == nil + attach_copied_obj.attachtype = 4 + end + if attach_copied_obj.save + # 更新引用次数 + quotes = @ori.quotes.to_i + 1 + @ori.update_attribute(:quotes, quotes) unless @ori.nil? + @ori.forwards << Forward.new(:to_type => attach_copied_obj.class.name, :to_id => attach_copied_obj.id,:created_at => Time.now) + @flag = true + else + @flag = false + @save_message = attach_copied_obj.errors.full_messages + break + end + + end + end + + [@ori, @flag, @save_message] + end + +end \ No newline at end of file diff --git a/app/services/users_service.rb b/app/services/users_service.rb index 8df42fb41..ab1bb2ec4 100644 --- a/app/services/users_service.rb +++ b/app/services/users_service.rb @@ -319,4 +319,8 @@ class UsersService my_jours_arr end + + + + end diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index 7b7cb95e5..ab1d18a8d 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -50,6 +50,7 @@ + diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index f042daba7..ef3346e20 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -2,7 +2,11 @@
-
+ + +
我的动态
+ +
diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index dc575dc64..70dd64fad 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -20,7 +20,7 @@
-
{{r.filename}}发送
+
{{r.filename}}发送

暂无课件,
请登录Trustie网站,在PC浏览器中上传课件。

@@ -37,14 +37,14 @@
-
{{r.homework_name}}发送
+
{{r.homework_name}}

暂无作业,
请登录Trustie网站,在PC浏览器中上传作业。

-
{{r.exercise_name}}发送
+
{{r.exercise_name}}

暂无小测验,
请登录Trustie网站,在PC浏览器中上传小测验。

diff --git a/public/assets/wechat/class_list.html b/public/assets/wechat/class_list.html index 8ec8bcaa5..5c64b9a87 100644 --- a/public/assets/wechat/class_list.html +++ b/public/assets/wechat/class_list.html @@ -1,7 +1,7 @@
课程列表
-
未命名课程
+
未命名课程
\ No newline at end of file diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index 9d3bf0fda..dc4d6ea78 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -9,17 +9,17 @@
-
{{r.filename}}发送
+
{{r.filename}}发送

暂无课件,
请登录Trustie网站,在PC浏览器中上传课件。

-
{{r.homework_name}}发送
+
{{r.homework_name}}

暂无作业,
请登录Trustie网站,在PC浏览器中创建作业。

-
{{r.exercise_name}}发送
+
{{r.exercise_name}}

暂无测验,
请登录Trustie网站,在PC浏览器中创建测验。

diff --git a/public/assets/wechat/new_class.html b/public/assets/wechat/new_class.html index 2bb5d2aac..ab0fc96f6 100644 --- a/public/assets/wechat/new_class.html +++ b/public/assets/wechat/new_class.html @@ -3,5 +3,8 @@
课程
班级
- 完成 + 完成 + + +
diff --git a/public/assets/wechat/send_class_list.html b/public/assets/wechat/send_class_list.html new file mode 100644 index 000000000..4b8b8a27f --- /dev/null +++ b/public/assets/wechat/send_class_list.html @@ -0,0 +1,13 @@ + +
+
+ +
发送课程列表
+
未命名课程
+
    +
  • +
+ +
发送
+ +
diff --git a/public/assets/wechat/templates/loading.html b/public/assets/wechat/templates/loading.html new file mode 100644 index 000000000..8113a78c2 --- /dev/null +++ b/public/assets/wechat/templates/loading.html @@ -0,0 +1,21 @@ + +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+

数据加载中

+
+
\ No newline at end of file diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index c2281be88..1cd69bb43 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -105,6 +105,10 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $location.path("/invite_code").search({id: courseid}); }; + vm.sendFile = function(r){ + $location.path("/send_class_list").search({id: r.id}); + } + $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then( function(response) { console.log(response.data); diff --git a/public/javascripts/wechat/controllers/class_list.js b/public/javascripts/wechat/controllers/class_list.js index 4484ff834..21da4aea9 100644 --- a/public/javascripts/wechat/controllers/class_list.js +++ b/public/javascripts/wechat/controllers/class_list.js @@ -3,28 +3,63 @@ */ -app.controller('ClassListController', ['$scope','config','auth','$http','$location', function($scope, config, auth, $http, $location){ - var vm = $scope; - vm.courses = []; - - $http.get(config.apiUrl + "courses?token="+ auth.token() + "&per_page_count=10&page=1").then( - function(response){ - console.log(response.data); - vm.courses = response.data.data; +app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$location', 'alertService', + function ($scope, config, auth, $http, $location, alertService) { + var vm = $scope; + vm.courses = []; + + vm.alertService = alertService.create(); + + + var loadClassList = function () { + $http.get(config.apiUrl + "courses?token=" + auth.token() + "&per_page_count=10&page=1").then( + function (response) { + console.log(response.data); + vm.courses = response.data.data; + } + ); + }; + + loadClassList(); + + vm.goClass = function (course_id) { + console.log(course_id); + $location.path("/class").search({id: course_id}); } - ); - vm.goClass = function(course_id){ - console.log(course_id); - $location.path("/class").search({id: course_id}); - } + vm.newClass = function () { + $location.path("/new_class"); + } - vm.newClass = function(){ - $location.path("/new_class"); - } + vm.goResource = function () { + $location.path("/myresource"); + } + + vm.joinClass = function () { + var code = window.prompt("请输入5位班级邀请码(不区分大小写)"); + if (code && code.length == 5) { + $http.post(config.apiUrl + "courses/join", { + token: auth.token(), + invite_code: code + }).then(function (response) { + console.log(response.data); + if (response.data.status != 0) { + vm.alertService.showMessage('错误', response.data.message); + } else { + vm.alertService.showMessage('提示', '加入课程成功'); + loadClassList(); + } + }); + } else { + if(code){ + vm.alertService.showMessage('错误', '邀请码格式不正确'); + } - vm.goResource =function(){ - $location.path("/myresource"); - } + } + }; + + vm.onSetting = function () { + vm.alertService.showMessage('提示', '此功能正在开发中'); + } -}]); \ No newline at end of file + }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 87b2a4d82..084205fbe 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -1,4 +1,4 @@ -app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', function($scope, $http, auth, config){ +app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$location', function($scope, $http, auth, config, $location){ var vm = $scope; vm.menus = ['课件', '作业', '测验']; @@ -27,4 +27,8 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', fun } vm.tab(1); + + vm.sendFile = function(r){ + $location.path("/send_class_list").search({id: r.id}); + } }] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/new_class.js b/public/javascripts/wechat/controllers/new_class.js index 488db31c6..c3c81eecd 100644 --- a/public/javascripts/wechat/controllers/new_class.js +++ b/public/javascripts/wechat/controllers/new_class.js @@ -1,12 +1,12 @@ -app.controller('NewClassController', ['$scope', '$http', 'auth', 'config', function($scope, $http, auth, config){ +app.controller('NewClassController', ['$scope', '$http', 'auth', 'config', 'alertService', function($scope, $http, auth, config, alertService){ var vm = $scope; - vm.resources = []; - vm.homeworks = []; - vm.exercises = []; + vm.alertService = alertService.create(); - + vm.newClass = function () { + vm.alertService.showMessage('提示', '此功能正在开发中'); + } }] ); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/send_class_list.js b/public/javascripts/wechat/controllers/send_class_list.js new file mode 100644 index 000000000..07d321ba2 --- /dev/null +++ b/public/javascripts/wechat/controllers/send_class_list.js @@ -0,0 +1,47 @@ +app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', function($scope, $http, $routeParams, config, auth, alertService){ + var vm = $scope; + var send_id = $routeParams.id; + + vm.alertService = alertService.create(); + vm.courses = []; + + var loadClassList = function () { + $http.get(config.apiUrl + "courses?token=" + auth.token() + "&per_page_count=10&page=1").then( + function (response) { + console.log(response.data); + vm.courses = response.data.data; + } + ); + }; + + loadClassList(); + + vm.selectCourse = function(course){ + if( typeof course.checked !== 'boolean' ) course.checked = false; + course.checked = !course.checked; + } + + vm.sendToCourses = function(){ + var course_ids = []; + + for(var i in vm.courses){ + if(vm.courses[i].checked){ + course_ids.push(vm.courses[i].id); + } + } + + $http.post(config.apiUrl + "resources/send", { + token: auth.token(), course_ids: course_ids, send_id: send_id + }).then(function(response){ + console.log(response.data); + if(response.data.status == 0){ + vm.alertService.showMessage('提示', '发送成功', function () { + window.history.back(); + }); + } else { + vm.alertService.showMessage('发送出错', response.data.message); + } + }) + } + +}]); \ No newline at end of file diff --git a/public/javascripts/wechat/directives/loading_spinner.js b/public/javascripts/wechat/directives/loading_spinner.js index 780056828..cea916997 100644 --- a/public/javascripts/wechat/directives/loading_spinner.js +++ b/public/javascripts/wechat/directives/loading_spinner.js @@ -1,7 +1,5 @@ -app.directive('loadingSpinner', ['$http', function ($http) { +app.directive('loadingSpinner', ['$http', 'config', function ($http, config) { return { - restrict: 'A', - replace: true, - template: '
加载中...
', + templateUrl: config.rootPath+ 'templates/loading.html', }; }]); diff --git a/public/javascripts/wechat/others/routes.js b/public/javascripts/wechat/others/routes.js index 80efa71e9..ea6dca05d 100644 --- a/public/javascripts/wechat/others/routes.js +++ b/public/javascripts/wechat/others/routes.js @@ -35,6 +35,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/class_list', makeRoute('class_list.html', 'ClassListController')) .when('/myresource', makeRoute('myresource.html', 'MyResourceController')) .when('/invite_code', makeRoute('invite_code.html', 'InviteCodeController')) + .when('/send_class_list', makeRoute('send_class_list.html', 'SendClassListController')) .otherwise({ redirectTo: '/activites' }); From 06733b17a06cab16cef43e4176743bea10c0520e Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sun, 3 Jul 2016 00:07:55 +0800 Subject: [PATCH 06/40] ignore accesstoken --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index dbc349c80..fddb6dc72 100644 --- a/.gitignore +++ b/.gitignore @@ -35,3 +35,4 @@ vendor/cache 1234567 public/javascripts/wechat/node_modules/ .ruby-version +.access_token From 201abd63583b0e2a9a914598ea0d104ddb9a46ca Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Sun, 3 Jul 2016 00:08:51 +0800 Subject: [PATCH 07/40] assets --- app/views/wechats/user_activities.html.erb | 48 +++++++++++----------- public/javascripts/wechat/build/app.min.js | 15 +++---- 2 files changed, 32 insertions(+), 31 deletions(-) diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index ab1d18a8d..2d265484c 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -28,30 +28,30 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/javascripts/wechat/build/app.min.js b/public/javascripts/wechat/build/app.min.js index 1fea6f08a..267ab5dd4 100644 --- a/public/javascripts/wechat/build/app.min.js +++ b/public/javascripts/wechat/build/app.min.js @@ -3,8 +3,8 @@ app.factory("alertService",function(){function t(){this.title=null,this.message= 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(a,t,e,o,i,c,n,r,s){e.replaceUrl=function(a){return a},e.alertService=s.create(),console.log("ActivityController load"),e.page=n.get("page")||0,e.activities=n.get("activities")||[],e.has_more=n.get("has_more"),e.loadActData=function(a){e.page=a,o({method:"POST",url:apiUrl+"activities",data:{token:c.token(),page:a}}).then(function(a){a.data.page>0?e.activities=e.activities.concat(a.data.data):e.activities=a.data.data,n.save("activities",e.activities),e.has_more=a.data.count+10*a.data.page
加载中...
'}}]); -app.config(["$routeProvider","$httpProvider","$locationProvider","config",function(e,o,r,t){var l=t.rootPath,n={delay:["auth",function(e){return e.get_bind()}]},s=function(e,o){return{templateUrl:l+e,controller:o,resolve:n}};e.when("/login",{templateUrl:l+"login.html",controller:"LoginController"}).when("/reg",{templateUrl:l+"reg.html",controller:"RegController"}).when("/activites",s("activities.html","ActivityController")).when("/issues/:id",s("issue_detail.html","IssueController")).when("/project_discussion/:id",s("project_discussion.html","DiscussionController")).when("/homework/:id",s("homework_detail.html","HomeworkController")).when("/course_notice/:id",s("course_notice.html","CourseNoticeController")).when("/course_discussion/:id",s("course_discussion.html","DiscussionController")).when("/journal_for_message/:id",s("jour_message_detail.html","JournalsController")).when("/blog_comment/:id",s("blog_detail.html","BlogController")).when("/class",s("class.html","ClassController")).when("/new_class",s("new_class.html","NewClassController")).when("/class_list",s("class_list.html","ClassListController")).when("/myresource",s("myresource.html","MyResourceController")).when("/invite_code",s("invite_code.html","InviteCodeController")).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}}}])}]); \ No newline at end of file +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("/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}}}])}]); \ No newline at end of file From 2c13184d9da40facec629170b08dcabcde7175a7 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 4 Jul 2016 10:52:32 +0800 Subject: [PATCH 08/40] =?UTF-8?q?=E4=BF=AE=E6=94=B9js=E5=BC=95=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .access_token | 2 +- app/views/wechats/user_activities.html.erb | 52 +++++++++++----------- config/wechat.yml.test | 33 ++++++++++++++ 3 files changed, 60 insertions(+), 27 deletions(-) create mode 100644 config/wechat.yml.test diff --git a/.access_token b/.access_token index 2fb2e740f..f55f73861 100644 --- a/.access_token +++ b/.access_token @@ -1 +1 @@ -{"access_token":"m8kGwb7G0laM6-0uHmPtxETR6WJk5PgR37te_h8aBwgqGXkml2ZZAvPUBldmzF5hDZsQBHEn8PUACSL60eDKlCWigwwUJReK2wB4UbXIc1UA-rrkpHuWl84H3rcswtlvHENjAHAZWF","expires_in":7200,"got_token_at":1467472907} \ No newline at end of file +{"access_token":"0wlw4Hi6bX0ifpmwJ9iO4tOED-8ekIYplhlPcG9vFSQLYC0iW8tPE0MBfuWWnr5SRDVoSQwAmMbeU40QeHXdK7NkBruRSVT9hhFwWef01do3OkFwMr2M3atVCGjRDY_hFUSbAFAMBZ","expires_in":7200,"got_token_at":1467531769} \ No newline at end of file diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index 2d265484c..3ca452a34 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -26,32 +26,32 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/config/wechat.yml.test b/config/wechat.yml.test new file mode 100644 index 000000000..9bc33029e --- /dev/null +++ b/config/wechat.yml.test @@ -0,0 +1,33 @@ +default: &default +# corpid: "corpid" +# corpsecret: "corpsecret" +# agentid: 1 +# Or if using public account, only need above two line + + # guange test + #appid: "wxf694495398c7d470" + #secret: "743e038392f1d89540e95f8f7645849a" + + appid: "wx8e1ab05163a28e37" + secret: "beb4d3bc4b32b3557811680835357841" + + token: "123456" + access_token: ".access_token" + encrypt_mode: false # if true must fill encoding_aes_key + encoding_aes_key: "QGfP13YP4BbQGkkrlYuxpn4ZIDXpBJww4fxl8CObvNw" + jsapi_ticket: "tmp/wechat_jsapi_ticket" + + #template + binding_succ_notice: "jjpDrgFErnmkrE9tf2M3o0t31ZrJ7mr0YtuE_wyLaMc" + journal_notice: "uC1zAw4F2q6HTA3Pcj8VUO6wKKKiYFwnPJB4iXxpdoM" + homework_message_notice: "tCf7teCVqc2vl2LZ_hppIdWmpg8yLcrI8XifxYePjps" + class_notice: "MQ_mFupbXP-9jWbeHT3C5xqNBvPo8EIlNv4ULakSpJA" + +production: + <<: *default + +development: + <<: *default + +test: + <<: *default From bd1aae07fd7ca1c0a418a38a1030909f7d0f134a Mon Sep 17 00:00:00 2001 From: txz Date: Mon, 4 Jul 2016 14:43:51 +0800 Subject: [PATCH 09/40] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Gemfile | 2 +- public/assets/wechat/activities.html | 263 +++++++++++++++------------ public/stylesheets/weui/weixin.css | 2 +- 3 files changed, 149 insertions(+), 118 deletions(-) diff --git a/Gemfile b/Gemfile index eef93c371..fe7d46d01 100644 --- a/Gemfile +++ b/Gemfile @@ -6,7 +6,7 @@ unless RUBY_PLATFORM =~ /w32/ if RUBY_PLATFORM =~ /darwin/ gem "rmagick", "= 2.15.4" ## osx must be this version else - gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel + #gem "rmagick", "= 2.13.1" ## centos yum install ImageMagick-devel end gem 'certified' end diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index ef3346e20..b34098a8e 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -6,43 +6,46 @@
我的动态
+ +
-
-
- - +
+
+ +
{{act.latest_update}}
- -
+ +
迟交扣分:{{act.homework_common_detail.late_penalty}}分 匿评开启时间:{{act.homework_common_detail.evaluation_start}}
缺评扣分:{{act.homework_common_detail.absence_penalty}}分/作品 匿评关闭时间:{{act.homework_common_detail.evaluation_end}}
-
-
- 普通作业 - 编程作业 - 分组作业 - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+ +
@@ -52,28 +55,32 @@
-
-
- - +
+
+ +
{{act.latest_update}}
- -
+ +
-
-
- {{act.activity_type_name}} - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+ +
@@ -83,28 +90,33 @@
-
-
- - +
+
+ +
{{act.latest_update}}
- -
+ +
-
- {{act.activity_type_name}} - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+ +
@@ -115,7 +127,7 @@
-
+
@@ -130,30 +142,34 @@
-
-
- - +
+
+ +
{{act.latest_update}}
- -
+ +
状态:{{act.issue_detail.issue_status}} 优先级:{{act.issue_detail.issue_priority}}
指派给:{{act.issue_detail.issue_assigned_to}} 完成度:{{act.issue_detail.done_ratio}}%
-
-
- {{act.activity_type_name}} - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+ +
@@ -164,28 +180,32 @@
-
-
- - +
+
+ +
{{act.latest_update}}
- -
+ +
-
-
- {{act.activity_type_name}} - {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+ +
@@ -195,7 +215,7 @@
-
+
@@ -210,27 +230,32 @@
-
-
- - -
+
+
+ +
{{act.latest_update}}
-
+
-
- {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+ +
@@ -241,27 +266,33 @@
-
-
- - +
+
+ +
{{act.latest_update}}
- -
+ +
-
- {{act.latest_update}} - 回复 - {{act.reply_count}} -
-
{{act.praise_count}}
-
{{act.praise_count}}
-
+ +
+
+
{{act.praise_count}}
+
{{act.praise_count}}
+
+ +
diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 5b1c1df95..7c219c571 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -109,7 +109,7 @@ a.underline {text-decoration:underline;} .post-interactive-reply, .post-interactive-praise {width:50%; text-align:center; float:left; font-size:13px;} .more-wrap {width:100%;} -.more-events {width:98%; font-size:13px; text-align:center; margin:0 auto; padding: 5px 0; border:1px solid #e6e6e6; border-radius:3px; background-color:#f8f9fb; } +.more-events {width:100%; font-size:13px; text-align:center; margin:0 auto; padding: 5px 0; border-top:1px solid #e6e6e6; border-bottom:1px solid #e6e6e6; border-radius:3px; background-color:#f8f9fb; } .border-bottom {border-bottom:1px solid #e6e6e6;} .post-reply-wrap {width:100%;} .post-input-wrap {width:100%; position:fixed; bottom:0;} From 60367415fae1fbc3c66c248a5e4fadcd5e7f1472 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 4 Jul 2016 16:19:05 +0800 Subject: [PATCH 10/40] =?UTF-8?q?=E6=96=B0=E5=BB=BA=E8=AF=BE=E7=A8=8B?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .access_token | 2 +- app/api/mobile/api.rb | 2 + app/api/mobile/apis/syllabuses.rb | 50 ++++++++++++++++ app/api/mobile/entities/course.rb | 3 + app/api/mobile/entities/syllabus.rb | 12 ++++ app/helpers/users_helper.rb | 15 +++++ app/models/course.rb | 13 +++- app/models/syllabus.rb | 6 +- app/services/courses_service.rb | 2 + app/services/syllabuses_service.rb | 59 +++++++++++++++++++ db/schema.rb | 35 +++++++++-- public/assets/wechat/class_list.html | 23 +++++--- public/assets/wechat/new_class.html | 12 ++-- .../wechat/controllers/class_list.js | 19 +++--- .../wechat/controllers/new_class.js | 45 +++++++++++++- public/stylesheets/weui/weixin.css | 2 +- 16 files changed, 265 insertions(+), 35 deletions(-) create mode 100644 app/api/mobile/apis/syllabuses.rb create mode 100644 app/api/mobile/entities/syllabus.rb create mode 100644 app/services/syllabuses_service.rb diff --git a/.access_token b/.access_token index f55f73861..19fe1d90e 100644 --- a/.access_token +++ b/.access_token @@ -1 +1 @@ -{"access_token":"0wlw4Hi6bX0ifpmwJ9iO4tOED-8ekIYplhlPcG9vFSQLYC0iW8tPE0MBfuWWnr5SRDVoSQwAmMbeU40QeHXdK7NkBruRSVT9hhFwWef01do3OkFwMr2M3atVCGjRDY_hFUSbAFAMBZ","expires_in":7200,"got_token_at":1467531769} \ No newline at end of file +{"access_token":"vEA6yE7AclWpSWvnRngP7PHl7t8xOexEJS73mWtpEYCCtT6otLnxGV71YQIACEChH5jTZteXhgeuqfbVNB_f0HOYyF0yZpVmiMHANI2BqFVyKqqDOppujvyzF7JHk6TMEGLfAFAHJO","expires_in":7200,"got_token_at":1467618773} \ No newline at end of file diff --git a/app/api/mobile/api.rb b/app/api/mobile/api.rb index c555eb633..9b4bdb5d6 100644 --- a/app/api/mobile/api.rb +++ b/app/api/mobile/api.rb @@ -19,6 +19,7 @@ module Mobile require_relative 'apis/new_comment' require_relative 'apis/praise' require_relative 'apis/resources' + require_relative 'apis/syllabuses' class API < Grape::API version 'v1', using: :path @@ -73,6 +74,7 @@ module Mobile mount Apis::NewComment mount Apis::Praise mount Apis::Resources + mount Apis::Syllabuses add_swagger_documentation ({api_version: 'v1', base_path: '/api'}) if Rails.env.development? diff --git a/app/api/mobile/apis/syllabuses.rb b/app/api/mobile/apis/syllabuses.rb new file mode 100644 index 000000000..f8286f56d --- /dev/null +++ b/app/api/mobile/apis/syllabuses.rb @@ -0,0 +1,50 @@ +#coding=utf-8 + +module Mobile + module Apis + class Syllabuses < Grape::API + + resources :syllabuses do + desc "获取大纲列表" + params do + requires :token, type: String + end + get do + authenticate! + + cs = SyllabusesService.new + courses = cs.user_syllabus(current_user) + present :data, courses, with: Mobile::Entities::Syllabus + present :status, 0 + end + + desc "新建大纲" + params do + requires :token, type: String + requires :title, type: String, desc: '大纲标题' + requires :courses, type: Array[String], desc: '课程名' + end + post do + authenticate! + + ss = SyllabusesService.new + + sy = ss.create(current_user, params[:title], + params[:courses].map{|c| {name: c} }) + + if sy.new_record? + {status:-1, message: '创建大纲失败' } + else + present :data, sy, with: Mobile::Entities::Syllabus + present :status, 0 + end + + end + + end + + + + end + end +end \ No newline at end of file diff --git a/app/api/mobile/entities/course.rb b/app/api/mobile/entities/course.rb index 487a75c4d..ea74058f4 100644 --- a/app/api/mobile/entities/course.rb +++ b/app/api/mobile/entities/course.rb @@ -15,6 +15,8 @@ module Mobile #f.img_url if f.respond_to?(:img_url) elsif field == :created_at || field == :updated_at (format_time(c[field]) if (c.is_a?(Hash) && c.key?(field))) || (format_time(c.send(field)) if c.respond_to?(field)) + elsif field == :member_count + ::Course===c ? c.members.count : 0 else (c[field] if (c.is_a?(Hash) && c.key?(field))) || (c.send(field) if c.respond_to?(field)) end @@ -49,6 +51,7 @@ module Mobile course_expose :qrcode course_expose :updated_at course_expose :course_student_num + course_expose :member_count expose :teacher, using: Mobile::Entities::User do |c, opt| if c.is_a? ::Course c.teacher diff --git a/app/api/mobile/entities/syllabus.rb b/app/api/mobile/entities/syllabus.rb new file mode 100644 index 000000000..bb39fa4f6 --- /dev/null +++ b/app/api/mobile/entities/syllabus.rb @@ -0,0 +1,12 @@ +module Mobile + module Entities + class Syllabus < Grape::Entity + include ApplicationHelper + + expose :title + expose :id + + expose :courses, using: Mobile::Entities::Course + end + end +end diff --git a/app/helpers/users_helper.rb b/app/helpers/users_helper.rb index f312d2275..98b993183 100644 --- a/app/helpers/users_helper.rb +++ b/app/helpers/users_helper.rb @@ -388,6 +388,21 @@ module UsersHelper return result end + + #获取指定用户的课程大纲 + def user_syllabus(user) + results = [] + courses = user_courses_list(user) + + other = Syllabus.new(title: '未命名课程') + + courses.each do |c| + other << c unless c.syllabus + end + + user.syllabuses.to_a << other + end + #获取用户参与的公开的课程列表 def user_public_course_list user membership = user.coursememberships.all#@user.coursememberships.all(:conditions => Course.visible_condition(User.current)) diff --git a/app/models/course.rb b/app/models/course.rb index e4b08697b..408a86ad7 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -4,6 +4,8 @@ require 'elasticsearch/model' class Course < ActiveRecord::Base include Redmine::SafeAttributes + include CoursesHelper + STATUS_ACTIVE = 1 STATUS_CLOSED = 5 STATUS_ARCHIVED = 9 @@ -22,7 +24,7 @@ class Course < ActiveRecord::Base end end - attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete + attr_accessible :code, :extra, :name, :state, :tea_id, :time , :location, :state, :term, :password,:is_public,:description,:class_period, :open_student, :enterprise_name, :is_delete, :syllabus_id #belongs_to :project, :class_name => 'Course', :foreign_key => :extra, primary_key: :identifier belongs_to :teacher, :class_name => 'User', :foreign_key => :tea_id # 定义一个方法teacher,该方法通过tea_id来调用User表 belongs_to :school, :class_name => 'School', :foreign_key => :school_id #定义一个方法school,该方法通过school_id来调用School表 @@ -69,8 +71,10 @@ class Course < ActiveRecord::Base validates_presence_of :term,:name validates_format_of :class_period, :with =>/^[1-9]\d*$/ + validates_format_of :time, :with => /^\d{4}$/ validates_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]+$/ validates_length_of :description, :maximum => 10000 + before_save :self_validate # 公开课程变成私有课程,所有资源都变成私有 after_update :update_files_public,:update_course_ealasticsearch_index @@ -296,6 +300,13 @@ class Course < ActiveRecord::Base end end + + def update_default_value + self.time = Time.now.year unless time + self.term = cur_course_term unless term + self.class_period = 10 unless class_period + end + # 创建课程讨论区 def create_board_sync @board = self.boards.build diff --git a/app/models/syllabus.rb b/app/models/syllabus.rb index 5e368f341..5ea8a6b84 100644 --- a/app/models/syllabus.rb +++ b/app/models/syllabus.rb @@ -9,8 +9,10 @@ class Syllabus < ActiveRecord::Base belongs_to :user has_many :courses has_many :journals_for_messages, :as => :jour, :dependent => :destroy - attr_accessible :description, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course - safe_attributes 'title', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course' + attr_accessible :description, :user_id, :title, :eng_name, :syllabus_type, :credit, :hours, :theory_hours, :practice_hours, :applicable_major, :pre_course + safe_attributes 'title','user', 'description', 'eng_name', 'syllabus_type', 'credit', 'hours', 'theory_hours', 'practice_hours', 'credit', 'applicable_major', 'pre_course' + + validates :title, :user_id, presence: true def delete_kindeditor_assets delete_kindeditor_assets_from_disk self.id,OwnerTypeHelper::SYLLABUS diff --git a/app/services/courses_service.rb b/app/services/courses_service.rb index 7a8d0fd32..a55a81e89 100644 --- a/app/services/courses_service.rb +++ b/app/services/courses_service.rb @@ -44,6 +44,8 @@ class CoursesService } end + + #搜索课程 def search_course params,current_user courses_all = Course.all_course diff --git a/app/services/syllabuses_service.rb b/app/services/syllabuses_service.rb new file mode 100644 index 000000000..9b060697c --- /dev/null +++ b/app/services/syllabuses_service.rb @@ -0,0 +1,59 @@ +#coding=utf-8 + +class SyllabusesService + + include ApplicationHelper + include CoursesHelper + + #获取指定用户的课程大纲 + def user_syllabus(user) + courses = CoursesService.new.user_courses_list(user) + + other = Syllabus.new(title: '未命名课程') + + courses.each do |c| + other.courses << c[:course] unless c[:course].syllabus + end + + user.syllabuses.to_a << other + end + + def after_create_course(course, user) + #unless User.current.admin? + r = Role.givable.find_by_id(Setting.new_project_user_role_id.to_i) || Role.givable.first + m = Member.new(:user => user, :roles => [r]) + m.project_id = -1 + course_info = CourseInfos.new(:user_id => user.id, :course_id => course.id) + #user_grades = UserGrade.create(:user_id => User.current.id, :course_id => @course.id) + course.members << m + course.course_infos << course_info + end + + #创建大纲 + # params {title: '大纲名称', [{course}, {course}]} + def create(user, title, courses = []) + sy = Syllabus.new(title: title, user_id: user.id) + ActiveRecord::Base.transaction() do + sy.save! + + courses.each do |course| + if ::Course === course + course.syllabus_id = sy.id + course.save! + elsif Hash === course + c = ::Course.new(course) + c.tea_id = user.id + c.syllabus_id = sy.id + c.update_default_value + c.save! + after_create_course(c, user) + end + end + + end + + sy + end + + +end \ No newline at end of file diff --git a/db/schema.rb b/db/schema.rb index 3258f89c1..d2947c19d 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20160627090316) do +ActiveRecord::Schema.define(:version => 20160630112733) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -57,6 +57,18 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.integer "user_id", :null => false end + create_table "apply_add_schools", :force => true do |t| + t.string "name" + t.string "province" + t.string "city" + t.string "address" + t.string "remarks" + t.integer "school_id" + t.integer "status", :default => 0 + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + end + create_table "apply_homeworks", :force => true do |t| t.integer "status" t.integer "user_id" @@ -550,9 +562,9 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.integer "excellent_option", :default => 0 t.integer "is_copy", :default => 0 t.integer "visits", :default => 0 - t.integer "syllabus_id" t.string "invite_code" t.string "qrcode" + t.integer "syllabus_id" end add_index "courses", ["invite_code"], :name => "index_courses_on_invite_code", :unique => true @@ -1633,10 +1645,11 @@ ActiveRecord::Schema.define(:version => 20160627090316) do create_table "schools", :force => true do |t| t.string "name" t.string "province" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false t.string "logo_link" t.string "pinyin" + t.integer "school_type", :default => 0 end create_table "secdomains", :force => true do |t| @@ -1849,8 +1862,18 @@ ActiveRecord::Schema.define(:version => 20160627090316) do t.string "title" t.text "description" t.integer "user_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false + t.string "eng_name" + t.integer "syllabus_type" + t.integer "credit" + t.integer "hours" + t.integer "theory_hours" + t.integer "practice_hours" + t.string "applicable_major" + t.string "pre_course" + t.integer "visits", :default => 0 + t.integer "des_status", :default => 0 end add_index "syllabuses", ["user_id"], :name => "index_syllabuses_on_user_id" diff --git a/public/assets/wechat/class_list.html b/public/assets/wechat/class_list.html index 5c64b9a87..aded4e443 100644 --- a/public/assets/wechat/class_list.html +++ b/public/assets/wechat/class_list.html @@ -1,15 +1,20 @@
课程列表
-
未命名课程
-
    -
  • - - - > - {{course.course_student_num}}人 -
  • -
+ +
+
{{syllabus.title}}
+
    +
  • + + + > + {{course.member_count}}人 +
  • +
+
+ +
diff --git a/public/assets/wechat/new_class.html b/public/assets/wechat/new_class.html index ab0fc96f6..039d19d75 100644 --- a/public/assets/wechat/new_class.html +++ b/public/assets/wechat/new_class.html @@ -1,10 +1,14 @@
+
+
新建课程
-
课程
-
班级
- - 完成 + +
课程
+
班级删除
+ + 完成 +
diff --git a/public/javascripts/wechat/controllers/class_list.js b/public/javascripts/wechat/controllers/class_list.js index 21da4aea9..c30be8bcb 100644 --- a/public/javascripts/wechat/controllers/class_list.js +++ b/public/javascripts/wechat/controllers/class_list.js @@ -3,25 +3,28 @@ */ -app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$location', 'alertService', - function ($scope, config, auth, $http, $location, alertService) { +app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$location', 'alertService','rms', + function ($scope, config, auth, $http, $location, alertService,rms) { var vm = $scope; - vm.courses = []; + vm.syllabuses = rms.get('syllabuses') || []; vm.alertService = alertService.create(); - var loadClassList = function () { - $http.get(config.apiUrl + "courses?token=" + auth.token() + "&per_page_count=10&page=1").then( + $http.get(config.apiUrl + "syllabuses?token=" + auth.token()).then( function (response) { console.log(response.data); - vm.courses = response.data.data; + vm.syllabuses = response.data.data; + rms.save('syllabuses', vm.syllabuses); } ); }; - loadClassList(); - + if(vm.syllabuses.length<=0){ + loadClassList(); + } + + vm.goClass = function (course_id) { console.log(course_id); $location.path("/class").search({id: course_id}); diff --git a/public/javascripts/wechat/controllers/new_class.js b/public/javascripts/wechat/controllers/new_class.js index c3c81eecd..ef46fc4ba 100644 --- a/public/javascripts/wechat/controllers/new_class.js +++ b/public/javascripts/wechat/controllers/new_class.js @@ -1,12 +1,51 @@ -app.controller('NewClassController', ['$scope', '$http', 'auth', 'config', 'alertService', function($scope, $http, auth, config, alertService){ +app.controller('NewClassController', ['$scope', '$http', 'auth', 'config', 'alertService','$location', function($scope, $http, auth, config, alertService, $location){ var vm = $scope; vm.alertService = alertService.create(); - vm.newClass = function () { - vm.alertService.showMessage('提示', '此功能正在开发中'); + vm.syllabus = { + courses: [{name: ''}], + }; + + vm.addClass = function(){ + vm.syllabus.courses.push({}); + }; + + vm.deleteClass = function(index){ + vm.syllabus.courses.splice(index, 1); + } + + vm.newClass = function (frm, syllabus) { + frm.$setSubmitted(); + console.log(syllabus); + + if(!frm.$valid){ + console.log(frm.$error); + return; + } + + var courses = []; + for(var i in vm.syllabus.courses){ + courses .push(vm.syllabus.courses[i].name); + } + + $http.post(config.apiUrl+"syllabuses", { + token: auth.token(), + title: syllabus.title, + courses: courses + }).then(function(response){ + if(response.data.status!=0){ + vm.alertService.showMessage('出错了', response.data.message); + } else { + vm.alertService.showMessage('提示', '新建课程成功', function(){ + window.history.back(); + }); + } + console.log(response.data.data); + }); + } }] ); \ No newline at end of file diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 5b1c1df95..3b5507170 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -77,7 +77,7 @@ a.underline {text-decoration:underline;} /*按钮样式*/ .btn1 {width:100%; height:40px; line-height:40px; vertical-align:middle; text-align:center; color:#fff; display:block; border-radius:5px;} .bg-blue:not(.btn-disabled):active {background-color:#2780c2;} -.btn-disabled {background-color:#ccc;} +.btn-disabled {background-color:#ccc !important;} .btn2 {width:145px; height:35px; color:#fff; font-size:15px; line-height:35px; text-align:center; vertical-align:middle; margin:18px auto 20px auto; border-radius:50px; display:block;} /*tab*/ From 45b824938e203c6dbf7e565f279ebf2240a34aa2 Mon Sep 17 00:00:00 2001 From: txz Date: Mon, 4 Jul 2016 16:41:41 +0800 Subject: [PATCH 11/40] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E4=B8=8E=E8=AF=BE=E7=A8=8B=E9=80=9A=E7=9F=A5=E8=AF=A6?= =?UTF-8?q?=E6=83=85=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/activities.html | 21 ++++-- public/assets/wechat/course_discussion.html | 72 +++++++++++---------- public/assets/wechat/course_notice.html | 70 +++++++++++--------- public/stylesheets/weui/weixin.css | 1 + 4 files changed, 92 insertions(+), 72 deletions(-) diff --git a/public/assets/wechat/activities.html b/public/assets/wechat/activities.html index b34098a8e..a51a0f5f0 100644 --- a/public/assets/wechat/activities.html +++ b/public/assets/wechat/activities.html @@ -23,7 +23,8 @@
{{act.latest_update}}
@@ -60,7 +61,8 @@
{{act.latest_update}}
@@ -95,7 +97,8 @@
{{act.latest_update}}
@@ -147,7 +150,8 @@
{{act.latest_update}}
@@ -185,7 +189,8 @@
{{act.latest_update}}
@@ -235,7 +240,8 @@
{{act.latest_update}}
@@ -271,7 +277,8 @@
{{act.latest_update}}
diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index cc188f978..142a474fd 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -4,51 +4,57 @@
-
+
-
{{discussion.subject}}
- - - - - - - -
发布者:{{discussion.user.realname}}
来   源:{{discussion.course_project_name}}  |  课程问答区
-
+
+
- {{discussion.created_on}} +
{{discussion.subject}}
+
{{discussion.course_project_name}}-课程问答区{{discussion.created_on}}
+
+
+
+
+
{{discussion.praise_count}}
+
{{discussion.praise_count}}
+
+
-
-
-
回复 ({{discussion.replies_count}})
-
已赞 ({{discussion.praise_count}})
-
赞 ({{discussion.praise_count}})
-
-
-
-
- -
-
{{journal.lasted_comment}}
-
回复
+
+
+
+
+ +
{{journal.lasted_comment}}
+
+
+
-
-
-
+ +
-
- + + + +
- - -
diff --git a/public/assets/wechat/course_notice.html b/public/assets/wechat/course_notice.html index e3346ea93..780aa43a8 100644 --- a/public/assets/wechat/course_notice.html +++ b/public/assets/wechat/course_notice.html @@ -3,51 +3,57 @@
-
+
-
{{news.title}}
- - - - - - - -
发布者:{{news.author.realname}}
来   源:{{news.course_name}}  |  课程通知
+
+ +
+
{{news.title}}
+
{{news.course_name}}-课程通知{{news.created_on}}
- {{news.created_on}} +
+
+
{{news.praise_count}}
+
{{news.praise_count}}
+
+
-
-
回复 ({{news.comments_count}})
-
已赞 ({{news.praise_count}})
-
赞 ({{news.praise_count}})
-
-
-
-
-
- -
-
{{comments.created_on}}
-
回复
+
+
+
+
+ +
{{comments.created_on}}
+
+
+
-
-
-
+ +
-
- + + + +
- - -
diff --git a/public/stylesheets/weui/weixin.css b/public/stylesheets/weui/weixin.css index 7c219c571..1b2e295f5 100644 --- a/public/stylesheets/weui/weixin.css +++ b/public/stylesheets/weui/weixin.css @@ -112,6 +112,7 @@ a.underline {text-decoration:underline;} .more-events {width:100%; font-size:13px; text-align:center; margin:0 auto; padding: 5px 0; border-top:1px solid #e6e6e6; border-bottom:1px solid #e6e6e6; border-radius:3px; background-color:#f8f9fb; } .border-bottom {border-bottom:1px solid #e6e6e6;} .post-reply-wrap {width:100%;} +.post-reply-wrap:first-child {border-top:1px solid #ccc;} .post-input-wrap {width:100%; position:fixed; bottom:0;} .post-input-wrap2 {width:100%;} .post-reply-row {padding:10px 15px; color:#9a9a9a; background-color:#fff;} From 9d0b5789d9493bfccc02049955358b066f7b5c8d Mon Sep 17 00:00:00 2001 From: yuanke <249218296@qq.com> Date: Mon, 4 Jul 2016 16:50:49 +0800 Subject: [PATCH 12/40] =?UTF-8?q?1.=E4=BF=AE=E6=94=B9=E6=88=91=E7=9A=84?= =?UTF-8?q?=E5=8A=A8=E6=80=81=E5=8D=9A=E5=AE=A2=E8=AF=A6=E6=83=85=E9=A1=B5?= =?UTF-8?q?=E9=9D=A2=E6=98=BE=E7=A4=BA=E4=B8=8D=E4=BA=86=E7=9A=84BUG=20=20?= =?UTF-8?q?2.=E8=B5=84=E6=BA=90=E7=95=8C=E9=9D=A2=E5=88=87=E6=8D=A2?= =?UTF-8?q?=E6=98=AF=E6=9A=82=E6=97=A0XX=E5=85=88=E9=9A=90=E8=97=8F=20=203?= =?UTF-8?q?.=20=E5=8F=91=E9=80=81=E8=B5=84=E6=BA=90=E4=B8=8D=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E7=8F=AD=E7=BA=A7=E7=9A=84=E6=8F=90=E7=A4=BA=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/blog_comments.rb | 2 +- public/assets/wechat/class.html | 6 +++--- public/assets/wechat/myresource.html | 9 ++++++--- public/javascripts/wechat/controllers/class.js | 6 ++++++ public/javascripts/wechat/controllers/myresource.js | 12 ++++++------ 5 files changed, 22 insertions(+), 13 deletions(-) diff --git a/app/api/mobile/apis/blog_comments.rb b/app/api/mobile/apis/blog_comments.rb index 5a064245a..bb5758e71 100644 --- a/app/api/mobile/apis/blog_comments.rb +++ b/app/api/mobile/apis/blog_comments.rb @@ -7,7 +7,7 @@ module Mobile desc "get special topic" get ':id' do - user = UserWechat.find_by_openid(params[:openid]).user + user = current_user blog = BlogComment.find params[:id] present :data, blog, with: Mobile::Entities::BlogComment,user: user present :status, 0 diff --git a/public/assets/wechat/class.html b/public/assets/wechat/class.html index 70dd64fad..fa52c9ea4 100644 --- a/public/assets/wechat/class.html +++ b/public/assets/wechat/class.html @@ -21,7 +21,7 @@
{{r.filename}}发送
-

暂无课件,
+

暂无课件,
请登录Trustie网站,在PC浏览器中上传课件。

@@ -38,14 +38,14 @@
{{r.homework_name}}
-

暂无作业,
+

暂无作业,
请登录Trustie网站,在PC浏览器中上传作业。

{{r.exercise_name}}
-

暂无小测验,
+

暂无小测验,
请登录Trustie网站,在PC浏览器中上传小测验。

diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index dc4d6ea78..1317ac11a 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -1,4 +1,5 @@
+
我的资源
{{menu}} @@ -8,19 +9,21 @@
+
{{r.filename}}发送
-

暂无课件,
+

暂无课件,
请登录Trustie网站,在PC浏览器中上传课件。

{{r.homework_name}}
-

暂无作业,
+

暂无作业,
请登录Trustie网站,在PC浏览器中创建作业。

{{r.exercise_name}}
-

暂无测验,
+

暂无测验,
请登录Trustie网站,在PC浏览器中创建测验。

+
diff --git a/public/javascripts/wechat/controllers/class.js b/public/javascripts/wechat/controllers/class.js index 1cd69bb43..d5de23859 100644 --- a/public/javascripts/wechat/controllers/class.js +++ b/public/javascripts/wechat/controllers/class.js @@ -31,6 +31,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location {token: auth.token(), name: ''} ).then(function(response){ vm.resources = response.data.data; + vm.resources_tag = true; }); } } @@ -40,6 +41,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $http.get(config.apiUrl + "courses/homeworks/"+courseid+"?token="+auth.token()).then(function(response){ vm.homeworks = response.data.data; console.log(response.data); + vm.homeworks_tag = true; }); } } @@ -49,6 +51,7 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location $http.get(config.apiUrl + "courses/"+courseid+"/exercises?token="+auth.token()).then(function(response){ vm.exercises = response.data.data; console.log(response.data); + vm.exercises_tag = true; }); } } @@ -64,6 +67,9 @@ app.controller('ClassController', ['$scope', 'config','$http', 'auth','$location vm.showResources = false; vm.showHomework = false; vm.showTestcase = false; + vm.resources_tag = false; + vm.homeworks_tag = false; + vm.exercises_tag = false; if(vm.isTeacher){ if(index == 1){ //课件 diff --git a/public/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 084205fbe..462a35842 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -2,23 +2,23 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l var vm = $scope; vm.menus = ['课件', '作业', '测验']; - vm.resources = []; - vm.homeworks = []; - vm.exercise = []; + vm.resources = null; + vm.homeworks = null; + vm.exercise = null; vm.tab = function(index){ vm.currentTab = index; - if(index==1){ + 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){ + } 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){ + } 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; From 48fb02a2d6c1d905f5e5d39fcf2c6aee5c04d42b Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Mon, 4 Jul 2016 17:04:06 +0800 Subject: [PATCH 13/40] =?UTF-8?q?=E7=AE=A1=E7=90=86=E8=AF=BE=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/api/mobile/apis/courses.rb | 17 ++++ app/api/mobile/apis/syllabuses.rb | 14 ++++ app/controllers/courses_controller.rb | 2 +- app/models/course.rb | 4 + app/views/wechats/user_activities.html.erb | 1 + public/assets/wechat/class_list.html | 4 +- public/assets/wechat/edit_class.html | 14 ++++ .../wechat/controllers/class_list.js | 6 +- .../wechat/controllers/edit_class.js | 77 +++++++++++++++++++ public/javascripts/wechat/others/routes.js | 1 + 10 files changed, 134 insertions(+), 6 deletions(-) create mode 100644 public/assets/wechat/edit_class.html create mode 100644 public/javascripts/wechat/controllers/edit_class.js diff --git a/app/api/mobile/apis/courses.rb b/app/api/mobile/apis/courses.rb index cb1db09d8..917a396e2 100644 --- a/app/api/mobile/apis/courses.rb +++ b/app/api/mobile/apis/courses.rb @@ -396,6 +396,23 @@ module Mobile present :status,0 end + desc '删除课程' + params do + requires :token, type: String + end + post ':course_id/del' do + authenticate! + c = Course.find(params[:course_id]) + if c.members.count > 1 + {status: -1, message: '已经有成员加入,不能删除'} + else + c.delete! + present :status,0 + end + + + end + end end end diff --git a/app/api/mobile/apis/syllabuses.rb b/app/api/mobile/apis/syllabuses.rb index f8286f56d..47989155e 100644 --- a/app/api/mobile/apis/syllabuses.rb +++ b/app/api/mobile/apis/syllabuses.rb @@ -18,6 +18,18 @@ module Mobile present :status, 0 end + desc "获取某个大纲" + params do + requires :token, type: String + end + get ':id' do + authenticate! + + sy = ::Syllabus.find(params[:id]) + present :data, sy, with: Mobile::Entities::Syllabus + present :status, 0 + end + desc "新建大纲" params do requires :token, type: String @@ -41,6 +53,8 @@ module Mobile end + + end diff --git a/app/controllers/courses_controller.rb b/app/controllers/courses_controller.rb index e81251f63..a9d84c2d9 100644 --- a/app/controllers/courses_controller.rb +++ b/app/controllers/courses_controller.rb @@ -1090,7 +1090,7 @@ class CoursesController < ApplicationController #删除课程 #删除课程只是将课程的is_deleted状态改为false,is_deleted为false状态的课程只有管理员可以看到 def destroy - @course.update_attributes(:is_delete => true) + @course.delete! @course = nil redirect_to user_url(User.current) end diff --git a/app/models/course.rb b/app/models/course.rb index 408a86ad7..d98ac0f1e 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -173,6 +173,10 @@ class Course < ActiveRecord::Base ) end + def delete! + update_attribute(:is_delete, true) + end + def visible?(user=User.current) user.allowed_to?(:view_course, self) end diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index 3ca452a34..a9254829b 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -41,6 +41,7 @@ + diff --git a/public/assets/wechat/class_list.html b/public/assets/wechat/class_list.html index aded4e443..919eb1364 100644 --- a/public/assets/wechat/class_list.html +++ b/public/assets/wechat/class_list.html @@ -3,7 +3,7 @@
课程列表
-
{{syllabus.title}}
+
{{syllabus.title}}
  • @@ -15,8 +15,6 @@
- -
新建课程 加入班级 diff --git a/public/assets/wechat/edit_class.html b/public/assets/wechat/edit_class.html new file mode 100644 index 000000000..a1a243b12 --- /dev/null +++ b/public/assets/wechat/edit_class.html @@ -0,0 +1,14 @@ +
+
+ +
管理课程
+
+
课程
+ +
班级删除
+ + 完成 +
+ + +
diff --git a/public/javascripts/wechat/controllers/class_list.js b/public/javascripts/wechat/controllers/class_list.js index c30be8bcb..2896d508d 100644 --- a/public/javascripts/wechat/controllers/class_list.js +++ b/public/javascripts/wechat/controllers/class_list.js @@ -61,8 +61,10 @@ app.controller('ClassListController', ['$scope', 'config', 'auth', '$http', '$lo } }; - vm.onSetting = function () { - vm.alertService.showMessage('提示', '此功能正在开发中'); + vm.onSetting = function (syllabus) { + console.log(syllabus); + rms.save('current_edit_syllobus', syllabus); + $location.path("/edit_class").search({id: syllabus.id}); } }]); \ No newline at end of file diff --git a/public/javascripts/wechat/controllers/edit_class.js b/public/javascripts/wechat/controllers/edit_class.js new file mode 100644 index 000000000..8520a6eca --- /dev/null +++ b/public/javascripts/wechat/controllers/edit_class.js @@ -0,0 +1,77 @@ + + +app.controller('EditClassController', ['$scope', '$http', 'auth', 'config', 'alertService','$location','$routeParams','rms', function($scope, $http, auth, config, alertService, $location,$routeParams, rms){ + var vm = $scope; + + vm.syllabus = rms.get('current_edit_syllobus'); + console.log(vm.syllabus); + + var syllabus_id = $routeParams.id; + if(!vm.syllabus){ + $http.get(config.apiUrl+"syllabuses/"+syllabus_id+"?token="+auth.token()).then(function(response){ + console.log(response.data); + vm.syllabus = response.data.data; + }); + } + + vm.alertService = alertService.create(); + vm.addClass = function(){ + vm.syllabus.courses.push({}); + }; + + vm.deleteClass = function(index){ + var course = vm.syllabus.courses[index]; + if(course.id >0){ + $http.post(config.apiUrl+'courses/'+course.id+'/del', { + token: auth.token() + }).then(function(response){ + if(response.data.status!=0){ + vm.alertService.showMessage('出错了', response.data.message); + } else { + vm.alertService.showMessage('提示', '删除班级成功', function(){ + vm.syllabus.courses.splice(index, 1); + }); + } + console.log(response.data.data); + }); + } else { + vm.syllabus.courses.splice(index, 1); + } + + } + + vm.newClass = function (frm, syllabus) { + frm.$setSubmitted(); + console.log(syllabus); + + if(!frm.$valid){ + console.log(frm.$error); + return; + } + + var courses = []; + for(var i in vm.syllabus.courses){ + var course = vm.syllabus.courses[i]; + if(course.id>0){ + courses.push(course.name); + } + } + + $http.post(config.apiUrl+"syllabuses", { + token: auth.token(), + id: syllabus_id, + courses: courses + }).then(function(response){ + if(response.data.status!=0){ + vm.alertService.showMessage('出错了', response.data.message); + } else { + vm.alertService.showMessage('提示', '保存课程成功', function(){ + window.history.back(); + }); + } + console.log(response.data.data); + }); + + } + +}] ); \ No newline at end of file diff --git a/public/javascripts/wechat/others/routes.js b/public/javascripts/wechat/others/routes.js index ea6dca05d..2c63609b0 100644 --- a/public/javascripts/wechat/others/routes.js +++ b/public/javascripts/wechat/others/routes.js @@ -32,6 +32,7 @@ app.config(['$routeProvider',"$httpProvider", "$locationProvider",'config', func .when('/blog_comment/:id', makeRoute('blog_detail.html', 'BlogController')) .when('/class', makeRoute('class.html', 'ClassController')) .when('/new_class', makeRoute('new_class.html', 'NewClassController')) + .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')) From 3066a564bd5afe0e989cdf7bc823906bbf19066f Mon Sep 17 00:00:00 2001 From: txz Date: Mon, 4 Jul 2016 17:06:43 +0800 Subject: [PATCH 14/40] =?UTF-8?q?=E8=AF=BE=E7=A8=8B=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E8=AF=A6=E6=83=85=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=E6=9B=B4?= =?UTF-8?q?=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/homework_detail.html | 88 +++++++++++------------ 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 387b69867..30d68606f 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -5,65 +5,65 @@
-
{{homework.name}}
- - - - - - - - - - - - -
发布者: - {{homework.author.realname}} - {{homework.author.nickname}}
来   源:{{homework.course_name}}  |  课程作业
类   别:普通作业 - 编程作业 - 分组作业 -
+ +
+ +
+
{{homework.name}}
+
{{homework.course_name}}-普通作业编程作业分组作业{{homework.publish_time}}
- 迟交扣分:{{homework.late_penalty}}分
- 缺评扣分:{{homework.absence_penalty}}分/作品
- 匿评开启时间:{{homework.evaluation_start}}
+ 迟交扣分:{{homework.late_penalty}}分 + 缺评扣分:{{homework.absence_penalty}}分/作品 + 匿评开启时间:{{homework.evaluation_start}} 匿评关闭时间:{{homework.evaluation_end}}
- {{homework.publish_time}} +
+
+
{{homework.praise_count}}
+
{{homework.praise_count}}
+
+
-
-
回复 ({{homework.whomework_journal_count}})
-
已赞 ({{homework.praise_count}})
-
赞 ({{homework.praise_count}})
-
-
-
-
-
- -
-
{{journal.lasted_comment}}
-
回复
+ +
+
+
+
+ +
{{journal.lasted_comment}}
+
+
+
-
+
-
-
+ +
-
- + + + +
- - -
+
\ No newline at end of file From 8a59623a736aa44107bddefd23ca83c67db67d7e Mon Sep 17 00:00:00 2001 From: txz Date: Tue, 5 Jul 2016 10:15:32 +0800 Subject: [PATCH 15/40] =?UTF-8?q?=E9=A1=B9=E7=9B=AE=E9=97=AE=E9=A2=98?= =?UTF-8?q?=EF=BC=8C=E9=A1=B9=E7=9B=AE=E8=AE=A8=E8=AE=BA=E5=8C=BA=EF=BC=8C?= =?UTF-8?q?=E5=8D=9A=E5=AE=A2=EF=BC=8C=E7=95=99=E8=A8=80=E8=AF=A6=E6=83=85?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E6=A0=B7=E5=BC=8F=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/blog_detail.html | 61 ++++++++----- public/assets/wechat/course_discussion.html | 20 ++--- public/assets/wechat/homework_detail.html | 1 - public/assets/wechat/issue_detail.html | 85 ++++++++++--------- public/assets/wechat/jour_message_detail.html | 57 ++++++++----- public/assets/wechat/project_discussion.html | 63 ++++++++------ 6 files changed, 166 insertions(+), 121 deletions(-) diff --git a/public/assets/wechat/blog_detail.html b/public/assets/wechat/blog_detail.html index 762bd090e..c77842e4b 100644 --- a/public/assets/wechat/blog_detail.html +++ b/public/assets/wechat/blog_detail.html @@ -3,47 +3,64 @@
-
+
-
{{blog.title}}
-
{{blog.user.realname}}发表博客
+ +
+
+
{{blog.title}}
+
博客{{blog.created_at}}
+
- {{blog.created_at}} +
+
+
{{blog.praise_count}}
+
{{blog.praise_count}}
+
+
-
-
回复 ({{blog.comment_count}})
-
已赞 ({{blog.praise_count}})
-
赞 ({{blog.praise_count}})
-
-
+ +
+
-
-
- -
-
{{journal.lasted_comment}}
-
回复
+
+ +
{{journal.lasted_comment}}
+
+
+
-
+ +
-
- + + + +
- - -
+
\ No newline at end of file diff --git a/public/assets/wechat/course_discussion.html b/public/assets/wechat/course_discussion.html index 41aaa3355..8c994f8ac 100644 --- a/public/assets/wechat/course_discussion.html +++ b/public/assets/wechat/course_discussion.html @@ -6,18 +6,14 @@
-
{{discussion.subject}}
- - - - - - - -
发布者:{{discussion.user.realname}}
来   源:{{discussion.course_project_name}}  |  班级问答区
-
+
+
-
{{discussion.subject}}
+
{{discussion.subject}}
{{discussion.course_project_name}}-课程问答区{{discussion.created_on}}
@@ -33,7 +29,7 @@
-
+
diff --git a/public/assets/wechat/homework_detail.html b/public/assets/wechat/homework_detail.html index 30d68606f..af17a3cb9 100644 --- a/public/assets/wechat/homework_detail.html +++ b/public/assets/wechat/homework_detail.html @@ -5,7 +5,6 @@
-