微信动态分享修改

This commit is contained in:
yuanke 2016-08-04 11:17:50 +08:00
parent 4bae4527a2
commit 3c2ab32121
3 changed files with 31 additions and 9 deletions

View File

@ -15,7 +15,7 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
var desc = "班级邀请:"+vm.course.name+" 班级";
common.wxConfig(desc,"");
common.wxConfig("",desc,"");
// wx.ready(function(){
// wx.onMenuShareTimeline({

View File

@ -15,7 +15,7 @@ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams',
var desc = "项目邀请:"+vm.project.name+" 项目";
common.wxConfig(desc,"");
common.wxConfig("",desc,"");
// wx.ready(function(){
// wx.onMenuShareTimeline({

View File

@ -201,8 +201,8 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
var loadData = function(id,replytype,page){
loadCommonData(id, args.type,replytype,page).then(function successCallback(response) {
console.log(response.data);
var tmptile = "动态";
//--------------分享内容定制-------------
var tmptile = "分享动态";
var imgUrl = "";
if(response.data.data.title){
@ -221,11 +221,25 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
imgUrl = window.g_localhost+response.data.data.author.img_url;
}
var desc = tmpname+""+tmptile;
if(response.data.data.content){
desc = response.data.data.content.replace(/<[^>]+>/g,"").replace(/\s*/g,"").replace(/&nbsp;/g,"");
}
if(response.data.data.description){
desc = response.data.data.description.replace(/<[^>]+>/g,"").replace(/\s*/g,"").replace(/&nbsp;/g,"");
}
if(desc.length > 30){
desc = desc.substring(0,30)+"...";
}
var title = tmpname+""+tmptile;
console.log("desc = "+desc);
console.log("imgUrl= "+imgUrl);
wxConfig(desc);
wxConfig(title,desc,imgUrl);
//--------------分享内容定制-------------
args.loadCallback(response.data);
}, function errorCallback(response) {
});
@ -330,7 +344,15 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
};
var wxConfig = function(desc,imgUrl){
var wxConfig = function(title,desc,imgUrl){
if(title == null || title == ""){
title = 'Trustie创新实践平台';
}
if(desc == null || desc == ""){
desc = 'Trustie创新实践平台';
}
if(imgUrl == null || imgUrl == ""){
imgUrl = 'http://www.trustie.net/images/logo2.png';
@ -338,7 +360,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
wx.ready(function(){
wx.onMenuShareTimeline({
title: 'Trustie创新实践平台', // 分享标题
title: title, // 分享标题
// link: 'http://www.trustie.net/', // 分享链接
imgUrl: imgUrl, // 分享图标
success: function () {
@ -350,7 +372,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
});
wx.onMenuShareAppMessage({
title: 'Trustie创新实践平台', // 分享标题
title: title, // 分享标题
desc: desc, // 分享描述
// link: '', // 分享链接
// imgUrl: '', // 分享图标