rukou.js 740 Bytes
Newer Older
hanpeng committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
define(['zepto','medtap'],function($,medtap){
	var main = {
		token:medtap.getRequest('token'),
		wechatId:medtap.getRequest('wechatId'),
		portType:getEnvironment(),
		init:function(){
			localStorage.wechatToken = main.token;
			window.location.replace('appShelf.html');
			//main.getToken();
		},
		getToken:function(){
			localStorage.wechatToken = '';
			medtap._ajax({
				url:'/user/auth/token',
				type:'post',
				portType: main.portType,
				contentType: "application/json",
				data:{
					wechatId:main.wechatId
				},
				success:function(res){
					if(res.success == true){
						localStorage.wechatToken = res.content.token;
						window.location.replace('appShelf.html?v=1.0')
					}
				}
				
			})
		}
	}
	main.init()
})