2016-06-17 18:18:03 +08:00
|
|
|
|
app.factory('alertService', function(){
|
|
|
|
|
function Alert(){
|
|
|
|
|
this.title = null;
|
|
|
|
|
this.message = null;
|
|
|
|
|
this.visible = null;
|
2016-06-20 14:39:20 +08:00
|
|
|
|
this.cb = null;
|
2016-07-19 10:50:36 +08:00
|
|
|
|
this.invite = "";
|
2016-06-17 18:18:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-06-20 14:39:20 +08:00
|
|
|
|
Alert.prototype.showMessage = function(title, msg, cb){
|
2016-06-17 18:18:03 +08:00
|
|
|
|
this.message = msg;
|
|
|
|
|
this.title = title;
|
|
|
|
|
this.visible = true;
|
2016-06-20 14:39:20 +08:00
|
|
|
|
this.cb = cb;
|
2016-07-19 10:50:36 +08:00
|
|
|
|
this.invite = "";
|
2016-06-17 18:18:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Alert.prototype.dismiss = function(){
|
|
|
|
|
this.message = null;
|
|
|
|
|
this.title = null;
|
|
|
|
|
this.visible = false;
|
2016-07-19 10:50:36 +08:00
|
|
|
|
this.invite = "";
|
2016-06-20 14:39:20 +08:00
|
|
|
|
if(this.cb) {this.cb();}
|
2016-06-17 18:18:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
create: function(){
|
|
|
|
|
return new Alert();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2016-08-02 17:27:40 +08:00
|
|
|
|
app.factory('wx', ['$window', function($window){
|
|
|
|
|
var wechat = $window.wx;
|
|
|
|
|
return wechat;
|
|
|
|
|
}]);
|
2016-06-17 18:18:03 +08:00
|
|
|
|
|
2016-06-20 14:39:20 +08:00
|
|
|
|
app.factory('auth', ['$http','$routeParams', '$q', 'session', 'config',function($http,$routeParams, $q, session,config){
|
|
|
|
|
//是否已经绑定
|
|
|
|
|
var isBind = function(){
|
|
|
|
|
var defer = $q.defer();
|
|
|
|
|
|
|
|
|
|
var token = getToken();
|
|
|
|
|
if(token && token.length>10){
|
|
|
|
|
defer.resolve(token);
|
|
|
|
|
} else {
|
2016-06-22 12:11:34 +08:00
|
|
|
|
var code = window.g_code || $routeParams.code || session.get("code");
|
|
|
|
|
$http.post(
|
|
|
|
|
'/wechat/get_bind',
|
|
|
|
|
{} ///不用传code了,都由服务器来处理
|
|
|
|
|
).then(function(response){
|
2016-06-20 14:39:20 +08:00
|
|
|
|
if(response.data.status!=0){
|
|
|
|
|
defer.reject(response.data.message);
|
|
|
|
|
}else {
|
|
|
|
|
session.save("token", response.data.token);
|
|
|
|
|
defer.resolve(response.data.token);
|
|
|
|
|
}
|
|
|
|
|
}).catch(function(e){
|
|
|
|
|
defer.reject(e);
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return defer.promise;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var getToken = function(){
|
2016-07-25 16:59:52 +08:00
|
|
|
|
return 'token';//session.get("token");
|
2016-06-20 14:39:20 +08:00
|
|
|
|
}
|
2016-06-22 12:11:34 +08:00
|
|
|
|
return {get_bind: isBind, token: getToken};
|
2016-06-14 16:03:10 +08:00
|
|
|
|
}]);
|
2016-06-14 14:24:39 +08:00
|
|
|
|
|
2016-06-17 18:18:03 +08:00
|
|
|
|
app.factory("session", function(){
|
|
|
|
|
return {
|
|
|
|
|
save: function(key,value){
|
|
|
|
|
sessionStorage.setItem(key,value);
|
|
|
|
|
},
|
|
|
|
|
get: function(key){
|
|
|
|
|
return sessionStorage.getItem(key);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
2016-06-14 14:24:39 +08:00
|
|
|
|
|
|
|
|
|
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};
|
|
|
|
|
});
|
|
|
|
|
|
2016-08-09 09:23:06 +08:00
|
|
|
|
app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx','$location', function($http, auth, $routeParams,rms,config,wx,$location){
|
2016-08-11 09:58:45 +08:00
|
|
|
|
var addCommonReply = function(id, type, data,args, cb){
|
2016-08-10 16:08:30 +08:00
|
|
|
|
//先判断有没有绑定
|
|
|
|
|
$http.post(
|
|
|
|
|
'/wechat/is_bind',
|
|
|
|
|
{} ///不用传code了,都由服务器来处理
|
|
|
|
|
).then(function(response){
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
if(response.data.status != 0){
|
|
|
|
|
$location.path("/login_tip");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2016-06-14 14:24:39 +08:00
|
|
|
|
if(!data.comment || data.comment.length<=0){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var temp = data.comment.replace(/\n/g,'<br/>');
|
|
|
|
|
|
|
|
|
|
var userInfo = {
|
|
|
|
|
type: type,
|
|
|
|
|
content: temp,
|
2016-06-20 14:39:20 +08:00
|
|
|
|
token: auth.token()
|
2016-06-14 14:24:39 +08:00
|
|
|
|
};
|
|
|
|
|
//回复按钮禁用
|
|
|
|
|
data.disabled = true;
|
|
|
|
|
|
|
|
|
|
$http({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: apiUrl+ "new_comment/"+id,
|
|
|
|
|
data: userInfo
|
|
|
|
|
}).then(function successCallback(response) {
|
|
|
|
|
//alert("提交成功");
|
|
|
|
|
//数据提交完成,回复按钮启用
|
2016-08-11 09:58:45 +08:00
|
|
|
|
console.log(response);
|
|
|
|
|
if(response.data.status == -1){
|
|
|
|
|
console.log("回复失败!");
|
|
|
|
|
data.comment = "";
|
|
|
|
|
if(response.data.tip == 0){
|
|
|
|
|
args.scope.replytip = "您不是该私有班级成员,不能回复";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
args.scope.replytip = "您不是该私有项目成员,不能回复";
|
|
|
|
|
}
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2016-06-14 14:24:39 +08:00
|
|
|
|
data.disabled = false;
|
|
|
|
|
if(typeof cb === 'function'){
|
|
|
|
|
cb();
|
|
|
|
|
}
|
2016-07-22 15:37:25 +08:00
|
|
|
|
|
|
|
|
|
//保证内外回复数一致
|
|
|
|
|
activities = rms.get("activities") || [];
|
|
|
|
|
course_activities = rms.get("course_activities") || [];
|
|
|
|
|
project_activities = rms.get("project_activities") || [];
|
|
|
|
|
for(var i in activities){
|
|
|
|
|
if(activities[i].act_id == id){
|
|
|
|
|
activities[i].reply_count += 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i in course_activities){
|
|
|
|
|
if(course_activities[i].act_id == id){
|
|
|
|
|
course_activities[i].reply_count += 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i in project_activities){
|
|
|
|
|
if(project_activities[i].act_id == id){
|
|
|
|
|
project_activities[i].reply_count += 1;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rms.save("activities",activities);
|
|
|
|
|
rms.save("course_activities",course_activities);
|
|
|
|
|
rms.save("project_activities",project_activities);
|
|
|
|
|
|
2016-06-14 14:24:39 +08:00
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2016-07-20 13:34:58 +08:00
|
|
|
|
// var loadCommonData = function(id, type,replytype,page){
|
|
|
|
|
// return $http({
|
|
|
|
|
// method: 'GET',
|
|
|
|
|
// url: apiUrl+ type + "/" + id+"?token="+auth.token(),
|
|
|
|
|
// })
|
|
|
|
|
// };
|
|
|
|
|
|
|
|
|
|
var loadCommonData = function(id, type,replytype,page){
|
2016-06-14 14:24:39 +08:00
|
|
|
|
return $http({
|
2016-07-20 13:34:58 +08:00
|
|
|
|
method: 'POST',
|
|
|
|
|
url: apiUrl+ type + "/" + id,
|
2016-07-26 09:46:55 +08:00
|
|
|
|
dataType: 'jsonp',
|
2016-07-20 13:34:58 +08:00
|
|
|
|
data:{token:auth.token(),type:replytype,page:page}
|
2016-06-14 14:24:39 +08:00
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var addCommonPraise = function(act){
|
2016-07-13 14:06:56 +08:00
|
|
|
|
// act.praise_count += 1;
|
|
|
|
|
// act.has_praise = true;
|
2016-06-14 14:24:39 +08:00
|
|
|
|
|
|
|
|
|
$http({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: apiUrl + "praise/" + act.act_id,
|
2016-06-20 14:39:20 +08:00
|
|
|
|
data:{token:auth.token(),type:act.act_type}
|
2016-06-14 14:24:39 +08:00
|
|
|
|
}).then(function successCallback(response) {
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
var decreaseCommonPraise = function(act){
|
2016-07-13 14:06:56 +08:00
|
|
|
|
// act.praise_count -= 1;
|
|
|
|
|
// act.has_praise = false;
|
2016-06-14 14:24:39 +08:00
|
|
|
|
$http({
|
|
|
|
|
method: 'POST',
|
|
|
|
|
url: apiUrl + "praise/" + act.act_id,
|
2016-06-20 14:39:20 +08:00
|
|
|
|
data:{token:auth.token(),type:act.act_type}
|
2016-06-14 14:24:39 +08:00
|
|
|
|
}).then(function successCallback(response) {
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2016-06-20 14:39:20 +08:00
|
|
|
|
var init = function(args){
|
2016-08-11 09:58:45 +08:00
|
|
|
|
args.scope.replytip = "输入回复内容~";
|
2016-06-20 14:39:20 +08:00
|
|
|
|
args.scope.formData = {comment: ''};
|
2016-07-20 10:09:27 +08:00
|
|
|
|
var loadData = function(id,replytype,page){
|
|
|
|
|
loadCommonData(id, args.type,replytype,page).then(function successCallback(response) {
|
2016-08-04 10:00:55 +08:00
|
|
|
|
console.log(response.data);
|
2016-08-04 11:17:50 +08:00
|
|
|
|
//--------------分享内容定制-------------
|
|
|
|
|
var tmptile = "分享动态";
|
2016-08-04 10:47:35 +08:00
|
|
|
|
var imgUrl = "";
|
2016-08-04 10:00:55 +08:00
|
|
|
|
|
|
|
|
|
if(response.data.data.title){
|
|
|
|
|
tmptile = response.data.data.title;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var tmpname = "匿名用户";
|
|
|
|
|
|
|
|
|
|
if(response.data.data.user){
|
|
|
|
|
tmpname = response.data.data.user.realname;
|
2016-08-04 10:48:13 +08:00
|
|
|
|
imgUrl = window.g_localhost+response.data.data.user.img_url;
|
2016-08-04 10:00:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(response.data.data.author){
|
|
|
|
|
tmpname = response.data.data.author.realname;
|
2016-08-04 10:48:13 +08:00
|
|
|
|
imgUrl = window.g_localhost+response.data.data.author.img_url;
|
2016-08-04 10:00:55 +08:00
|
|
|
|
}
|
|
|
|
|
|
2016-08-04 14:07:35 +08:00
|
|
|
|
var desc = ""
|
2016-08-04 11:17:50 +08:00
|
|
|
|
if(response.data.data.content){
|
|
|
|
|
desc = response.data.data.content.replace(/<[^>]+>/g,"").replace(/\s*/g,"").replace(/ /g,"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(response.data.data.description){
|
|
|
|
|
desc = response.data.data.description.replace(/<[^>]+>/g,"").replace(/\s*/g,"").replace(/ /g,"");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(desc.length > 30){
|
|
|
|
|
desc = desc.substring(0,30)+"...";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
var title = tmpname+":"+tmptile;
|
2016-08-04 10:00:55 +08:00
|
|
|
|
console.log("desc = "+desc);
|
2016-08-04 10:47:35 +08:00
|
|
|
|
console.log("imgUrl= "+imgUrl);
|
2016-08-04 09:08:18 +08:00
|
|
|
|
|
2016-08-09 17:01:06 +08:00
|
|
|
|
var link = "";
|
|
|
|
|
|
|
|
|
|
if(args.urlName == "discussion"){
|
|
|
|
|
var urlName = response.data.type_name + "_discussion";
|
|
|
|
|
link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" +
|
|
|
|
|
"&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+
|
|
|
|
|
"&response_type=code&scope=snsapi_base&state="+urlName+"&connect_redirect=1#wechat_redirect";
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxc09454f171153c2d" +
|
|
|
|
|
"&redirect_uri=https://test.forge.trustie.net/wechat/user_activities?id="+response.data.data.act_id+
|
|
|
|
|
"&response_type=code&scope=snsapi_base&state="+args.urlName+"&connect_redirect=1#wechat_redirect";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
console.log("link= "+link);
|
|
|
|
|
|
|
|
|
|
wxConfig(title,desc,imgUrl,link);
|
2016-08-04 11:17:50 +08:00
|
|
|
|
|
|
|
|
|
//--------------分享内容定制-------------
|
2016-07-20 13:34:58 +08:00
|
|
|
|
args.loadCallback(response.data);
|
2016-06-20 14:39:20 +08:00
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2016-07-20 10:09:27 +08:00
|
|
|
|
loadData(args.id,0,0);
|
2016-06-20 14:39:20 +08:00
|
|
|
|
args.scope.addReply = function(data){
|
|
|
|
|
console.log(data.comment);
|
2016-08-11 09:58:45 +08:00
|
|
|
|
addCommonReply(args.id, args.replyType, data,args, function(){
|
2016-06-20 14:39:20 +08:00
|
|
|
|
args.scope.formData = {comment: ''};
|
2016-07-20 10:09:27 +08:00
|
|
|
|
loadData(args.id,0,0);
|
2016-06-20 14:39:20 +08:00
|
|
|
|
if(typeof args.replyCallback === 'function'){
|
|
|
|
|
args.replyCallback();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
2016-07-11 16:46:07 +08:00
|
|
|
|
|
|
|
|
|
// 动态详情界面点赞与动态界面的数据要同步 保证进入详情点赞后出来显示一致
|
|
|
|
|
args.scope.addPraise = function(act){
|
|
|
|
|
activities = rms.get("activities") || [];
|
|
|
|
|
course_activities = rms.get("course_activities") || [];
|
|
|
|
|
project_activities = rms.get("project_activities") || [];
|
|
|
|
|
for(var i in activities){
|
|
|
|
|
if(activities[i].act_id == act.act_id){
|
|
|
|
|
activities[i].praise_count += 1;
|
|
|
|
|
activities[i].has_praise = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i in course_activities){
|
|
|
|
|
if(course_activities[i].act_id == act.act_id){
|
|
|
|
|
course_activities[i].praise_count += 1;
|
|
|
|
|
course_activities[i].has_praise = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i in project_activities){
|
|
|
|
|
if(project_activities[i].act_id == act.act_id){
|
|
|
|
|
project_activities[i].praise_count += 1;
|
|
|
|
|
project_activities[i].has_praise = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rms.save("activities",activities);
|
|
|
|
|
rms.save("course_activities",course_activities);
|
|
|
|
|
rms.save("project_activities",project_activities);
|
|
|
|
|
|
2016-07-13 14:06:56 +08:00
|
|
|
|
act.praise_count += 1;
|
|
|
|
|
act.has_praise = true;
|
2016-07-11 16:46:07 +08:00
|
|
|
|
addCommonPraise(act);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
args.scope.decreasePraise = function(act){
|
|
|
|
|
activities = rms.get("activities") || [];
|
|
|
|
|
course_activities = rms.get("course_activities") || [];
|
|
|
|
|
project_activities = rms.get("project_activities") || [];
|
|
|
|
|
for(var i in activities){
|
|
|
|
|
if(activities[i].act_id == act.act_id){
|
|
|
|
|
activities[i].praise_count -= 1;
|
|
|
|
|
activities[i].has_praise = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i in course_activities){
|
|
|
|
|
if(course_activities[i].act_id == act.act_id){
|
|
|
|
|
course_activities[i].praise_count -= 1;
|
|
|
|
|
course_activities[i].has_praise = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
for(var i in project_activities){
|
|
|
|
|
if(project_activities[i].act_id == act.act_id){
|
|
|
|
|
project_activities[i].praise_count -= 1;
|
|
|
|
|
project_activities[i].has_praise = false;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
rms.save("activities",activities);
|
|
|
|
|
rms.save("course_activities",course_activities);
|
|
|
|
|
rms.save("project_activities",project_activities);
|
|
|
|
|
|
2016-07-13 14:06:56 +08:00
|
|
|
|
act.praise_count -= 1;
|
|
|
|
|
act.has_praise = false;
|
2016-07-11 16:46:07 +08:00
|
|
|
|
decreaseCommonPraise(act);
|
|
|
|
|
};
|
2016-07-20 13:34:58 +08:00
|
|
|
|
|
2016-07-21 14:03:04 +08:00
|
|
|
|
args.scope.showMoreReply = function(replytype,data){
|
|
|
|
|
if(!data.page){
|
|
|
|
|
data.page = 1;
|
|
|
|
|
}
|
|
|
|
|
else{
|
|
|
|
|
data.page = data.page + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
loadCommonData(data.id, args.type,replytype,data.page).then(function successCallback(response) {
|
2016-07-20 13:34:58 +08:00
|
|
|
|
args.loadCallback(response.data);
|
|
|
|
|
}, function errorCallback(response) {
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
2016-07-22 15:37:25 +08:00
|
|
|
|
args.scope.commentreply_path = config.rootPath+ 'templates/comment_reply.html';
|
|
|
|
|
|
2016-08-04 10:47:35 +08:00
|
|
|
|
};
|
|
|
|
|
|
2016-08-09 17:01:06 +08:00
|
|
|
|
var wxConfig = function(title,desc,imgUrl,link){
|
2016-08-04 11:17:50 +08:00
|
|
|
|
|
|
|
|
|
if(title == null || title == ""){
|
|
|
|
|
title = 'Trustie创新实践平台';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(desc == null || desc == ""){
|
|
|
|
|
desc = 'Trustie创新实践平台';
|
|
|
|
|
}
|
2016-08-04 10:47:35 +08:00
|
|
|
|
|
|
|
|
|
if(imgUrl == null || imgUrl == ""){
|
2016-08-11 10:33:22 +08:00
|
|
|
|
imgUrl = window.g_localhost+'/images/wechat/wx_logo.jpg';
|
2016-08-04 10:47:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wx.ready(function(){
|
|
|
|
|
wx.onMenuShareTimeline({
|
2016-08-04 11:17:50 +08:00
|
|
|
|
title: title, // 分享标题
|
2016-08-09 17:01:06 +08:00
|
|
|
|
link: link, // 分享链接
|
2016-08-04 10:47:35 +08:00
|
|
|
|
imgUrl: imgUrl, // 分享图标
|
|
|
|
|
success: function () {
|
|
|
|
|
console.log("share successed.");
|
|
|
|
|
},
|
|
|
|
|
cancel: function () {
|
|
|
|
|
console.log("share canceled.");
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
wx.onMenuShareAppMessage({
|
2016-08-04 11:17:50 +08:00
|
|
|
|
title: title, // 分享标题
|
2016-08-04 10:47:35 +08:00
|
|
|
|
desc: desc, // 分享描述
|
2016-08-09 17:01:06 +08:00
|
|
|
|
link: link, // 分享链接
|
2016-08-04 10:47:35 +08:00
|
|
|
|
// imgUrl: '', // 分享图标
|
|
|
|
|
imgUrl: imgUrl, // 分享图标
|
|
|
|
|
// type: '', // 分享类型,music、video或link,不填默认为link
|
|
|
|
|
// dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
|
|
|
|
|
success: function () {
|
|
|
|
|
// 用户确认分享后执行的回调函数
|
|
|
|
|
},
|
|
|
|
|
cancel: function () {
|
|
|
|
|
// 用户取消分享后执行的回调函数
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
};
|
2016-06-20 14:39:20 +08:00
|
|
|
|
|
2016-08-09 09:23:06 +08:00
|
|
|
|
var checkLogin = function(){
|
|
|
|
|
$http.post(
|
|
|
|
|
'/wechat/is_bind',
|
|
|
|
|
{} ///不用传code了,都由服务器来处理
|
|
|
|
|
).then(function(response){
|
|
|
|
|
console.log(response.data);
|
|
|
|
|
if(response.data.status != 0){
|
|
|
|
|
$location.path("/login");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise, wxConfig: wxConfig, checkLogin: checkLogin};
|
2016-07-25 16:59:52 +08:00
|
|
|
|
}]);
|