From 068c8967e1a10aa551e28dc34e3ef113bace085c Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 8 Jul 2016 17:04:17 +0800 Subject: [PATCH 1/3] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E6=97=B6=E5=90=8D=E7=A7=B0=E4=B8=BA1=E4=B8=AA=E5=AD=97?= =?UTF-8?q?=E7=AC=A6=E6=97=B6=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 2 +- app/services/syllabuses_service.rb | 2 +- app/views/wechats/user_activities.html.erb | 50 +++++++++---------- .../wechat/controllers/send_class_list.js | 11 +--- 4 files changed, 29 insertions(+), 36 deletions(-) diff --git a/app/models/course.rb b/app/models/course.rb index d98ac0f1e..4b4313ee1 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -72,7 +72,7 @@ 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_format_of :name,:with =>/^[^ ]+[a-zA-Z0-9_\u4e00-\u9fa5\s\S]*$/ validates_length_of :description, :maximum => 10000 before_save :self_validate diff --git a/app/services/syllabuses_service.rb b/app/services/syllabuses_service.rb index 530c550ed..dc6bfac91 100644 --- a/app/services/syllabuses_service.rb +++ b/app/services/syllabuses_service.rb @@ -61,4 +61,4 @@ class SyllabusesService end -end \ No newline at end of file +end diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb index bb7d96d50..dfb6e125e 100644 --- a/app/views/wechats/user_activities.html.erb +++ b/app/views/wechats/user_activities.html.erb @@ -28,31 +28,31 @@ - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/public/javascripts/wechat/controllers/send_class_list.js b/public/javascripts/wechat/controllers/send_class_list.js index caca3cd6a..f9d6ef193 100644 --- a/public/javascripts/wechat/controllers/send_class_list.js +++ b/public/javascripts/wechat/controllers/send_class_list.js @@ -1,18 +1,11 @@ -app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', function($scope, $http, $routeParams, config, auth, alertService,rms){ +app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'config','auth','alertService', 'rms', function($scope, $http, $routeParams, config, auth, alertService,rms){ var vm = $scope; var send_id = $routeParams.id; vm.alertService = alertService.create(); -// vm.courses = []; vm.syllabuses = []; 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; -// } -// ); $http.get(config.apiUrl + "syllabuses?token=" + auth.token()).then( function (response) { console.log(response.data); @@ -59,4 +52,4 @@ app.controller('SendClassListController', ['$scope', '$http','$routeParams', 'co }) } -}]); \ No newline at end of file +}]); From 3c23560d770a88bb9cefeb8f4f3887c6fbb01a2a Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 8 Jul 2016 17:11:16 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E6=88=91=E7=9A=84=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E6=97=A0=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/assets/wechat/myresource.html | 8 ++++---- public/javascripts/wechat/controllers/myresource.js | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/public/assets/wechat/myresource.html b/public/assets/wechat/myresource.html index 1317ac11a..068c503ce 100644 --- a/public/assets/wechat/myresource.html +++ b/public/assets/wechat/myresource.html @@ -6,22 +6,22 @@
- +
-
{{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/javascripts/wechat/controllers/myresource.js b/public/javascripts/wechat/controllers/myresource.js index 462a35842..b371ee8cc 100644 --- a/public/javascripts/wechat/controllers/myresource.js +++ b/public/javascripts/wechat/controllers/myresource.js @@ -6,8 +6,11 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.homeworks = null; vm.exercise = null; + vm.searchText = ""; + 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); @@ -31,4 +34,4 @@ app.controller('MyResourceController', ['$scope', '$http', 'auth', 'config', '$l vm.sendFile = function(r){ $location.path("/send_class_list").search({id: r.id}); } -}] ); \ No newline at end of file +}] ); From 5c0468f8fd870e9a2d2b14a9f940fe1e14a0e361 Mon Sep 17 00:00:00 2001 From: guange <8863824@gmail.com> Date: Fri, 8 Jul 2016 17:18:09 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E4=BA=8C=E7=BB=B4=E7=A0=81=E8=BF=87?= =?UTF-8?q?=E6=9C=9F=E6=94=B9=E4=B8=BA=E4=B8=80=E4=B8=AA=E6=9C=88=E6=9C=89?= =?UTF-8?q?=E6=95=88=E6=9C=9F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/course.rb | 2 +- db/migrate/20160708091258_renew_qrcode.rb | 8 ++++++++ db/schema.rb | 4 ++-- 3 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 db/migrate/20160708091258_renew_qrcode.rb diff --git a/app/models/course.rb b/app/models/course.rb index 4b4313ee1..561a031ae 100644 --- a/app/models/course.rb +++ b/app/models/course.rb @@ -495,7 +495,7 @@ class Course < ActiveRecord::Base def generate_qrcode ticket = self.qrcode if !ticket || ticket.size < 10 - response = Wechat.api.qrcode_create_scene(invite_code) + response = Wechat.api.qrcode_create_scene(invite_code, 2592000) logger.debug "response = #{response}" self.qrcode = response['ticket'] save! && reload diff --git a/db/migrate/20160708091258_renew_qrcode.rb b/db/migrate/20160708091258_renew_qrcode.rb new file mode 100644 index 000000000..59f92b315 --- /dev/null +++ b/db/migrate/20160708091258_renew_qrcode.rb @@ -0,0 +1,8 @@ +class RenewQrcode < ActiveRecord::Migration + def up + Course.update_all(:qrcode => '') + end + + def down + end +end diff --git a/db/schema.rb b/db/schema.rb index 619ccb7bb..3a56c6af4 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 => 20160630112733) do +ActiveRecord::Schema.define(:version => 20160708091258) do create_table "activities", :force => true do |t| t.integer "act_id", :null => false @@ -562,9 +562,9 @@ ActiveRecord::Schema.define(:version => 20160630112733) 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