diff --git a/app/models/course.rb b/app/models/course.rb index d98ac0f1e..561a031ae 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 @@ -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/app/services/syllabuses_service.rb b/app/services/syllabuses_service.rb index b28b01412..e4feb4ad1 100644 --- a/app/services/syllabuses_service.rb +++ b/app/services/syllabuses_service.rb @@ -141,4 +141,4 @@ class SyllabusesService status 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/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 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 +}] ); diff --git a/public/javascripts/wechat/controllers/send_class_list.js b/public/javascripts/wechat/controllers/send_class_list.js index beb94dab2..16875af9f 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){ +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 +}]);