| 
							
								 | 
							
							/**
 | 
						
						
						
						
							 | 
							
								 | 
							
							 * Created by guange on 16/6/22.
 | 
						
						
						
						
							 | 
							
								 | 
							
							 */
 | 
						
						
						
						
							 | 
							
								 | 
							
							
 | 
						
						
						
						
							 | 
							
								 | 
							
							
 | 
						
						
						
						
							 | 
							
								 | 
							
							app.controller('InviteCodeController', ['$scope','$http', '$routeParams','config','auth','wx','common', function($scope, $http, $routeParams, config, auth, wx,common){
 | 
						
						
						
						
							 | 
							
								 | 
							
							    var vm = $scope;
 | 
						
						
						
						
							 | 
							
								 | 
							
							
 | 
						
						
						
						
							 | 
							
								 | 
							
							    vm.course = {};
 | 
						
						
						
						
							 | 
							
								 | 
							
							    var courseid = $routeParams.id;
 | 
						
						
						
						
							 | 
							
								 | 
							
							    $http.get(config.apiUrl+ 'courses/'+courseid+"?token="+auth.token()).then(
 | 
						
						
						
						
							 | 
							
								 | 
							
							        function(response){
 | 
						
						
						
						
							 | 
							
								 | 
							
							            console.log(response.data);
 | 
						
						
						
						
							 | 
							
								 | 
							
							            vm.course = response.data.data;
 | 
						
						
						
						
							 | 
							
								 | 
							
							
 | 
						
						
						
						
							 | 
							
								 | 
							
							            var desc = "您的好友邀请您加入班级:【"+vm.course.name+"】,和小伙伴一起踏上便捷的学习之旅吧!";
 | 
						
						
						
						
							 | 
							
								 | 
							
							            var link = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="+window.g_appid+
 | 
						
						
						
						
							 | 
							
								 | 
							
							                "&redirect_uri="+window.g_localhost+"/wechat/user_activities?id="+vm.course.id+
 | 
						
						
						
						
							 | 
							
								 | 
							
							                "&response_type=code&scope=snsapi_base&state=invite_code&connect_redirect=1#wechat_redirect";
 | 
						
						
						
						
							 | 
							
								 | 
							
							
 | 
						
						
						
						
							 | 
							
								 | 
							
							            common.wxConfig("",desc,"",link);
 | 
						
						
						
						
							 | 
							
								 | 
							
							
 | 
						
						
						
						
							 | 
							
								 | 
							
							//            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 () {
 | 
						
						
						
						
							 | 
							
								 | 
							
							//                        // 用户取消分享后执行的回调函数
 | 
						
						
						
						
							 | 
							
								 | 
							
							//                    }
 | 
						
						
						
						
							 | 
							
								 | 
							
							//                });
 | 
						
						
						
						
							 | 
							
								 | 
							
							//            });
 | 
						
						
						
						
							 | 
							
								 | 
							
							        }
 | 
						
						
						
						
							 | 
							
								 | 
							
							    );
 | 
						
						
						
						
							 | 
							
								 | 
							
							
 | 
						
						
						
						
							 | 
							
								 | 
							
							}]);
 |