From aaa1c01eed479ed91991a4fe0d2383450d526476 Mon Sep 17 00:00:00 2001
From: yuanke <249218296@qq.com>
Date: Thu, 4 Aug 2016 10:47:35 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BE=AE=E4=BF=A1=E5=8A=A8=E6=80=81=E5=88=86?=
=?UTF-8?q?=E4=BA=AB=E5=9B=BE=E7=89=87=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/views/wechats/user_activities.html.erb | 1 +
public/assets/wechat/join_class.html | 2 +-
.../wechat/controllers/invite_code.js | 60 ++++++++-------
.../wechat/controllers/project_invite_code.js | 62 +++++++--------
public/javascripts/wechat/others/factory.js | 76 +++++++++++--------
5 files changed, 110 insertions(+), 91 deletions(-)
diff --git a/app/views/wechats/user_activities.html.erb b/app/views/wechats/user_activities.html.erb
index 2824ee8f0..8c31c2106 100644
--- a/app/views/wechats/user_activities.html.erb
+++ b/app/views/wechats/user_activities.html.erb
@@ -17,6 +17,7 @@
window.g_debug = false; //调试标志,如果在本地请置为true
window.apiUrl = '/api/v1/';
window.g_redirect_path = '<%= @path %>';
+ window.g_localhost = "<%= Setting.protocol%>://"+"<%= Setting.host_name%>";
<% if @course_id %>
window.g_courseid = <%= @course_id %>;
<% elsif @project_id %>
diff --git a/public/assets/wechat/join_class.html b/public/assets/wechat/join_class.html
index f6992d073..41dcd6e0e 100644
--- a/public/assets/wechat/join_class.html
+++ b/public/assets/wechat/join_class.html
@@ -13,7 +13,7 @@
提示
- - •教师、教辅角色需要班级管理员审批
+ - •教师、助教角色需要班级管理员审批
- •学生角色无需管理员审批
diff --git a/public/javascripts/wechat/controllers/invite_code.js b/public/javascripts/wechat/controllers/invite_code.js
index ad74ef5d1..53fcd3d87 100644
--- a/public/javascripts/wechat/controllers/invite_code.js
+++ b/public/javascripts/wechat/controllers/invite_code.js
@@ -3,7 +3,7 @@
*/
-app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx', function($scope, $http, $routeParams, config, auth, wx){
+app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx','common', function($scope, $http, $routeParams, config, auth, wx,common){
var vm = $scope;
vm.course = {};
@@ -15,35 +15,37 @@ app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config
var desc = "班级邀请:"+vm.course.name+" 班级";
- wx.ready(function(){
- wx.onMenuShareTimeline({
- title: 'Trustie创新实践平台', // 分享标题
-// link: 'http://www.trustie.net/', // 分享链接
- imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
- success: function () {
- console.log("share successed.");
- },
- cancel: function () {
- console.log("share canceled.");
- }
- });
+ common.wxConfig(desc,"");
- wx.onMenuShareAppMessage({
- title: 'Trustie创新实践平台', // 分享标题
- desc: desc, // 分享描述
-// link: '', // 分享链接
-// imgUrl: '', // 分享图标
- imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
-// type: '', // 分享类型,music、video或link,不填默认为link
-// dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
- success: function () {
- // 用户确认分享后执行的回调函数
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- });
+// wx.ready(function(){
+// wx.onMenuShareTimeline({
+// title: 'Trustie创新实践平台', // 分享标题
+//// link: 'http://www.trustie.net/', // 分享链接
+// imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
+// success: function () {
+// console.log("share successed.");
+// },
+// cancel: function () {
+// console.log("share canceled.");
+// }
+// });
+//
+// wx.onMenuShareAppMessage({
+// title: 'Trustie创新实践平台', // 分享标题
+// desc: desc, // 分享描述
+//// link: '', // 分享链接
+//// imgUrl: '', // 分享图标
+// imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
+//// type: '', // 分享类型,music、video或link,不填默认为link
+//// dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+// success: function () {
+// // 用户确认分享后执行的回调函数
+// },
+// cancel: function () {
+// // 用户取消分享后执行的回调函数
+// }
+// });
+// });
}
);
diff --git a/public/javascripts/wechat/controllers/project_invite_code.js b/public/javascripts/wechat/controllers/project_invite_code.js
index 8e31a139e..39a4c1aaf 100644
--- a/public/javascripts/wechat/controllers/project_invite_code.js
+++ b/public/javascripts/wechat/controllers/project_invite_code.js
@@ -3,7 +3,7 @@
*/
-app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx', function($scope, $http, $routeParams, config, auth,wx){
+app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx','common', function($scope, $http, $routeParams, config, auth,wx,common){
var vm = $scope;
vm.project = {};
@@ -15,35 +15,37 @@ app.controller('ProjectInviteCodeController', ['$scope','$http', '$routeParams',
var desc = "项目邀请:"+vm.project.name+" 项目";
- wx.ready(function(){
- wx.onMenuShareTimeline({
- title: 'Trustie创新实践平台', // 分享标题
-// link: 'http://www.trustie.net/', // 分享链接
- imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
- success: function () {
- console.log("share successed.");
- },
- cancel: function () {
- console.log("share canceled.");
- }
- });
-
- wx.onMenuShareAppMessage({
- title: 'Trustie创新实践平台', // 分享标题
- desc: desc, // 分享描述
-// link: '', // 分享链接
-// imgUrl: '', // 分享图标
- imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
-// type: '', // 分享类型,music、video或link,不填默认为link
-// dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
- success: function () {
- // 用户确认分享后执行的回调函数
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- });
+ common.wxConfig(desc,"");
+
+// wx.ready(function(){
+// wx.onMenuShareTimeline({
+// title: 'Trustie创新实践平台', // 分享标题
+//// link: 'http://www.trustie.net/', // 分享链接
+// imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
+// success: function () {
+// console.log("share successed.");
+// },
+// cancel: function () {
+// console.log("share canceled.");
+// }
+// });
+//
+// wx.onMenuShareAppMessage({
+// title: 'Trustie创新实践平台', // 分享标题
+// desc: desc, // 分享描述
+//// link: '', // 分享链接
+//// imgUrl: '', // 分享图标
+// imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
+//// type: '', // 分享类型,music、video或link,不填默认为link
+//// dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+// success: function () {
+// // 用户确认分享后执行的回调函数
+// },
+// cancel: function () {
+// // 用户取消分享后执行的回调函数
+// }
+// });
+// });
}
);
diff --git a/public/javascripts/wechat/others/factory.js b/public/javascripts/wechat/others/factory.js
index db7a4837d..8d55717c6 100644
--- a/public/javascripts/wechat/others/factory.js
+++ b/public/javascripts/wechat/others/factory.js
@@ -203,6 +203,7 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
console.log(response.data);
var tmptile = "动态";
+ var imgUrl = "";
if(response.data.data.title){
tmptile = response.data.data.title;
@@ -212,43 +213,19 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
if(response.data.data.user){
tmpname = response.data.data.user.realname;
+ imgUrl = response.data.data.user.img_url;
}
if(response.data.data.author){
tmpname = response.data.data.author.realname;
+ imgUrl = response.data.data.author.img_url;
}
+ imgUrl = window.g_localhost+imgUrl;
var desc = tmpname+":"+tmptile;
console.log("desc = "+desc);
- wx.ready(function(){
- wx.onMenuShareTimeline({
- title: 'Trustie创新实践平台', // 分享标题
-// link: 'http://www.trustie.net/', // 分享链接
- imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
- success: function () {
- console.log("share successed.");
- },
- cancel: function () {
- console.log("share canceled.");
- }
- });
-
- wx.onMenuShareAppMessage({
- title: 'Trustie创新实践平台', // 分享标题
- desc: desc, // 分享描述
-// link: '', // 分享链接
-// imgUrl: '', // 分享图标
- imgUrl: 'http://www.trustie.net/images/logo2.png', // 分享图标
-// type: '', // 分享类型,music、video或link,不填默认为link
-// dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
- success: function () {
- // 用户确认分享后执行的回调函数
- },
- cancel: function () {
- // 用户取消分享后执行的回调函数
- }
- });
- });
+ console.log("imgUrl= "+imgUrl);
+ wxConfig(desc);
args.loadCallback(response.data);
}, function errorCallback(response) {
@@ -352,7 +329,44 @@ app.factory('common', ['$http', 'auth', '$routeParams','rms','config','wx', func
args.scope.commentreply_path = config.rootPath+ 'templates/comment_reply.html';
- }
+ };
+
+ var wxConfig = function(desc,imgUrl){
+
+ if(imgUrl == null || imgUrl == ""){
+ imgUrl = 'http://www.trustie.net/images/logo2.png';
+ }
+
+ wx.ready(function(){
+ wx.onMenuShareTimeline({
+ title: 'Trustie创新实践平台', // 分享标题
+// link: 'http://www.trustie.net/', // 分享链接
+ imgUrl: imgUrl, // 分享图标
+ success: function () {
+ console.log("share successed.");
+ },
+ cancel: function () {
+ console.log("share canceled.");
+ }
+ });
+
+ wx.onMenuShareAppMessage({
+ title: 'Trustie创新实践平台', // 分享标题
+ desc: desc, // 分享描述
+// link: '', // 分享链接
+// imgUrl: '', // 分享图标
+ imgUrl: imgUrl, // 分享图标
+// type: '', // 分享类型,music、video或link,不填默认为link
+// dataUrl: '', // 如果type是music或video,则要提供数据链接,默认为空
+ success: function () {
+ // 用户确认分享后执行的回调函数
+ },
+ cancel: function () {
+ // 用户取消分享后执行的回调函数
+ }
+ });
+ });
+ };
- return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise};
+ return {init: init, addCommonReply: addCommonReply, loadCommonData: loadCommonData, addCommonPraise: addCommonPraise, decreaseCommonPraise: decreaseCommonPraise, wxConfig: wxConfig};
}]);