diff --git a/public/javascripts/wechat/app.js b/public/javascripts/wechat/app.js
index 5c0d7d5bf..00d6bf3bc 100644
--- a/public/javascripts/wechat/app.js
+++ b/public/javascripts/wechat/app.js
@@ -1,66 +1,9 @@
var app = angular.module('wechat', ['ngRoute']);
-<<<<<<< HEAD
app.constant('config', {
rootPath: '/assets/wechat/',
rootUrl: '/',
apiUrl: '/api/v1/'
-=======
-if(debug===true){
- //apiUrl = 'http://localhost:3000/api/v1/';
- apiUrl = 'http://www.trustie.net/api/v1/';
-}
-
-
-app.factory('auth', function($http,$routeParams, $q){
- var _openid = '';
-
- if(typeof g_openid !== 'undefined'){
- _openid = g_openid;
- }
-
- if(debug===true){
- _openid = "1"; //guange的帐号
- }
-
- var getOpenId = function() {
- var deferred = $q.defer();
- if (typeof _openid !== 'undefined' && _openid.length > 0){
- deferred.resolve(_openid);
- } else {
- var code = $routeParams.code;
- $http({
- url: '/wechat/get_open_id',
- data: {code: code},
- method: 'POST'
- }).then(function successCallback(response) {
- _openid = response.data.openid;
- deferred.resolve(_openid);
- }, function errorCallback(response) {
- deferred.reject(response);
- });
- }
- return deferred.promise;
- };
- var openid = function(){
- return _openid;
- };
- return {getOpenId: getOpenId, openid: openid};
-});
-
-
-app.factory('rms', function(){
- var _saveStorage = {};
- var save = function(key, value){
- _saveStorage[key] = value;
- };
-
- var get = function(key){
- return _saveStorage[key];
- };
-
- return {save: save, get: get};
->>>>>>> b17b92cc3ec7341ef1d1e2179be0de623605a725
});
@@ -73,394 +16,14 @@ app.run(['$rootScope', 'auth', '$location', '$routeParams', function($rootScope,
$rootScope.$on('$routeChangeError', function(event, next, current){
-<<<<<<< HEAD
if(next && next.templateUrl){
if(!next.templateUrl.endsWith("login.html") && !next.templateUrl.endsWith("reg.html")){
$location.path("/login");
-=======
- $scope.decreasePraise = function(act){
- common.decreaseCommonPraise(act);
- };
-});
-
-app.factory('common', function($http, auth, $routeParams){
- var addCommonReply = function(id, type, data, cb){
-
- if(!data.comment || data.comment.length<=0){
- return;
- }
-
- var temp = data.comment.replace(/\n/g,'
');
-
- var userInfo = {
- type: type,
- content: temp,
- openid: auth.openid()
- };
- //回复按钮禁用
- data.disabled = true;
-
- $http({
- method: 'POST',
- url: apiUrl+ "new_comment/"+id,
- data: userInfo
- }).then(function successCallback(response) {
- //alert("提交成功");
- if(typeof cb === 'function'){
- cb();
->>>>>>> b17b92cc3ec7341ef1d1e2179be0de623605a725
}
}
-<<<<<<< HEAD
});
$rootScope.$on('$routeChangeStart', function(event, next, current){
});
}
-]);
-=======
- );
-
- $scope.addIssueReply = function(data){
- console.log(data.comment);
- common.addCommonReply($routeParams.id, 'Issue', data, function(){
- $scope.formData = {comment: ''};
- loadData($routeParams.id);
- //数据提交完成,回复按钮启用
- data.disabled = false;
- });
-
- };
-
- $scope.addPraise = function(act){
- common.addCommonPraise(act);
- };
-
- $scope.decreasePraise = function(act){
- common.decreaseCommonPraise(act);
- };
-});
-
-app.controller('HomeworkController', function($scope, $http, $routeParams, auth, common){
- $scope.formData = {comment: ''};
-
- var loadData = function(id){
- common.loadCommonData(id, 'whomeworks').then(function successCallback(response) {
- console.log(response.data);
- $scope.homework = response.data.data;
- }, function errorCallback(response) {
- });
- };
-
- auth.getOpenId().then(
- function successCallback(response){
- loadData($routeParams.id);
- }, function errorCallback(response) {
- alert("获取openid出错:"+response);
- }
- );
-
- $scope.addHomeworkReply = function(data){
- console.log(data.comment);
- common.addCommonReply($routeParams.id, 'HomeworkCommon', data, function(){
- $scope.formData = {comment: ''};
- loadData($routeParams.id);
- //数据提交完成,回复按钮启用
- data.disabled = false;
- });
- };
-
- $scope.addPraise = function(act){
- common.addCommonPraise(act);
- };
-
- $scope.decreasePraise = function(act){
- common.decreaseCommonPraise(act);
- };
-});
-
-app.controller('CourseNoticeController', function($scope, $http, $routeParams, auth, common){
- $scope.formData = {comment: ''};
-
- var loadData = function(id){
- common.loadCommonData(id, 'newss').then(function successCallback(response) {
- console.log(response.data);
- $scope.news = response.data.data;
- }, function errorCallback(response) {
- });
- };
-
- auth.getOpenId().then(
- function successCallback(response){
- loadData($routeParams.id);
- }, function errorCallback(response) {
- alert("获取openid出错:"+response);
- }
- );
-
- $scope.addNoticeReply = function(data){
- console.log(data.comment);
- common.addCommonReply($routeParams.id, 'News', data, function(){
- $scope.formData = {comment: ''};
- loadData($routeParams.id);
- //数据提交完成,回复按钮启用
- data.disabled = false;
- });
- };
-
- $scope.addPraise = function(act){
- common.addCommonPraise(act);
- };
-
- $scope.decreasePraise = function(act){
- common.decreaseCommonPraise(act);
- };
-});
-
-app.controller('DiscussionController', function($scope, $http, $routeParams, auth, common){
- $scope.formData = {comment: ''};
-
- var loadData = function(id){
- common.loadCommonData(id, 'messages').then(function successCallback(response) {
- console.log(response.data);
- $scope.discussion = response.data.data;
- }, function errorCallback(response) {
- });
- };
-
- auth.getOpenId().then(
- function successCallback(response){
- loadData($routeParams.id);
- }, function errorCallback(response) {
- alert("获取openid出错:"+response);
- }
- );
-
- $scope.addDiscussionReply = function(data){
- console.log(data.comment);
- common.addCommonReply($routeParams.id, 'Message', data, function(){
- $scope.formData = {comment: ''};
- loadData($routeParams.id);
- //数据提交完成,回复按钮启用
- data.disabled = false;
- });
- };
-
- $scope.addPraise = function(act){
- common.addCommonPraise(act);
- };
-
- $scope.decreasePraise = function(act){
- common.decreaseCommonPraise(act);
- };
-});
-
-app.controller('JournalsController', function($scope, $http, $routeParams, auth, common){
- $scope.formData = {comment: ''};
-
- var loadData = function(id){
- common.loadCommonData(id, 'journal_for_messages').then(function successCallback(response) {
- console.log(response.data);
- $scope.message = response.data.data;
- }, function errorCallback(response) {
- });
- };
-
- auth.getOpenId().then(
- function successCallback(response){
- loadData($routeParams.id);
- }, function errorCallback(response) {
- alert("获取openid出错:"+response);
- }
- );
-
- $scope.addJournalReply = function(data){
- console.log(data.comment);
- common.addCommonReply($routeParams.id, 'JournalsForMessage', data, function(){
- $scope.formData = {comment: ''};
- loadData($routeParams.id);
- //数据提交完成,回复按钮启用
- data.disabled = false;
- });
- };
-
- $scope.addPraise = function(act){
- console.log(act);
- common.addCommonPraise(act);
- };
-
- $scope.decreasePraise = function(act){
- console.log(act);
- common.decreaseCommonPraise(act);
- };
-});
-
-app.controller('BlogController', function($scope, $http, $routeParams, auth, common){
- $scope.formData = {comment: ''};
-
- var loadData = function(id){
- common.loadCommonData(id, 'blog_comments').then(function successCallback(response) {
- console.log(response.data);
- $scope.blog = response.data.data;
- }, function errorCallback(response) {
- });
- };
-
- auth.getOpenId().then(
- function successCallback(response){
- loadData($routeParams.id);
- }, function errorCallback(response) {
- alert("获取openid出错:"+response);
- }
- );
-
- $scope.addBlogReply = function(data){
- console.log(data.comment);
- common.addCommonReply($routeParams.id, 'BlogComment', data, function(){
- $scope.formData = {comment: ''};
- loadData($routeParams.id);
- //数据提交完成,回复按钮启用
- data.disabled = false;
- });
- };
-
- $scope.addPraise = function(act){
- console.log(act);
- common.addCommonPraise(act);
- };
-
- $scope.decreasePraise = function(act){
- console.log(act);
- common.decreaseCommonPraise(act);
- };
-});
-
-app.filter('safeHtml', function ($sce) {
- return function (input) {
- return $sce.trustAsHtml(input);
- }
-});
-
-//app.directive('textAutoHeight', function($timeout){
-// return {
-// restrict: 'A',
-// scope: {},
-// link: function(scope, element, attr){
-// scope.text = '点击展开';
-// $timeout(function(){
-// var e = element.parent().children().eq(5);
-// var height = e[0].scrollHeight;
-// if(height>90){
-// element.css('display', 'block');
-// element.on('click', function(){
-// if(element.text() == "点击展开"){
-// e.css("height", height+'px');
-// element.text("点击隐藏");
-// } else {
-// e.css("height", '90px');
-// element.text("点击展开");
-// }
-//
-// });
-// }
-// }, false);
-//
-// }
-// }
-//});
-
-app.directive('inputAuto',function(){
- return{
- restrict: 'A',
- scope: {},
- link: function(scope, element){
- var copyContainer = element.parent().children().eq(0);
- var sendButton = element.parent().next();
- element.on('input',function(){
- console.log(sendButton);
- copyContainer.html(element[0].value);
- var textHeight = copyContainer[0].scrollHeight;
- element.css('height', textHeight + 'px');
- });
- sendButton.on('click',function(){
- element.css('height','28px');
- });
- }
- }
-});
-
-app.directive('loadingSpinner', ['$http', function ($http) {
- return {
- restrict: 'A',
- replace: true,
- template: '