Merge branch 'weixin_guange' of https://git.trustie.net/jacknudt/trustieforge into weixin_guange
This commit is contained in:
commit
cce503f32f
|
@ -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
|
||||
|
|
|
@ -141,4 +141,4 @@ class SyllabusesService
|
|||
status
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -28,31 +28,31 @@
|
|||
|
||||
<script src="https://dn-demotest.qbox.me/angular.all.min.js"></script>
|
||||
<!-- <script src="/javascripts/wechat/build/angular.all.min.js"></script> -->
|
||||
<script src="/javascripts/wechat/build/app.min.js"></script>
|
||||
<!-- <script src="/javascripts/wechat/app.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/others/factory.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/others/filter.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/directives/alert.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/directives/form_validate.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/directives/input_auto.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/directives/loading_spinner.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/reg.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/invite_code.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/login.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/activity.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/new_class.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/edit_class.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/blog.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/course_notice.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/discussion.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/homework.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/issue.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/journals.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/class.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/class_list.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/myresource.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/controllers/send_class_list.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/others/routes.js"></script> -->
|
||||
<!-- <script src="/javascripts/wechat/build/app.min.js"></script> -->
|
||||
<script src="/javascripts/wechat/app.js"></script>
|
||||
<script src="/javascripts/wechat/others/factory.js"></script>
|
||||
<script src="/javascripts/wechat/others/filter.js"></script>
|
||||
<script src="/javascripts/wechat/directives/alert.js"></script>
|
||||
<script src="/javascripts/wechat/directives/form_validate.js"></script>
|
||||
<script src="/javascripts/wechat/directives/input_auto.js"></script>
|
||||
<script src="/javascripts/wechat/directives/loading_spinner.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/reg.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/invite_code.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/login.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/activity.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/new_class.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/edit_class.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/blog.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/course_notice.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/discussion.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/homework.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/issue.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/journals.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/class.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/class_list.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/myresource.js"></script>
|
||||
<script src="/javascripts/wechat/controllers/send_class_list.js"></script>
|
||||
<script src="/javascripts/wechat/others/routes.js"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
class RenewQrcode < ActiveRecord::Migration
|
||||
def up
|
||||
Course.update_all(:qrcode => '')
|
||||
end
|
||||
|
||||
def down
|
||||
end
|
||||
end
|
|
@ -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
|
||||
|
|
|
@ -6,22 +6,22 @@
|
|||
</div>
|
||||
<div class="class-search-wrap">
|
||||
<div class="class-search-inner"> <img src="/images/wechat/search.png" width="18" class="class-search-icon" />
|
||||
<input class="class-detail-search" placeholder="输入关键词进行搜索" />
|
||||
<input class="class-detail-search" placeholder="输入关键词进行搜索" ng-model="searchText" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-class="{'undis': currentTab!=1}">
|
||||
<div ng-repeat="r in resources" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.filename}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2">发送</a></div>
|
||||
<div ng-repeat="r in resources|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.filename}}</span><a ng-click="sendFile(r)" class="fr mr10 link-blue2">发送</a></div>
|
||||
<p ng-show="resources && resources.length<=0" class="class-test-tip">暂无课件,<br />
|
||||
请登录Trustie网站,在PC浏览器中上传课件。</p>
|
||||
</div>
|
||||
<div ng-class="{'undis': currentTab!=2}">
|
||||
<div ng-repeat="r in homeworks" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.homework_name}}</span></div>
|
||||
<div ng-repeat="r in homeworks|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.homework_name}}</span></div>
|
||||
<p ng-show="homeworks && homeworks.length<=0" class="class-test-tip">暂无作业,<br />
|
||||
请登录Trustie网站,在PC浏览器中创建作业。</p>
|
||||
</div>
|
||||
<div ng-class="{'undis': currentTab!=3}">
|
||||
<div ng-repeat="r in exercise" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.exercise_name}}</span></div>
|
||||
<div ng-repeat="r in exercise|filter:searchText" ng-class="['class-detail-row', 'f13', 'c-grey3', {'border-top': $first}]"><span class="fl ml10">{{r.exercise_name}}</span></div>
|
||||
<p ng-show="exercise && exercise.length<=0" class="class-test-tip">暂无测验,<br />
|
||||
请登录Trustie网站,在PC浏览器中创建测验。</p>
|
||||
</div>
|
||||
|
|
|
@ -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});
|
||||
}
|
||||
}] );
|
||||
}] );
|
||||
|
|
|
@ -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
|
|||
})
|
||||
}
|
||||
|
||||
}]);
|
||||
}]);
|
||||
|
|
Loading…
Reference in New Issue