loginSuccess.js 777 字节
Newer Older
DCloud_JSON's avatar
DCloud_JSON 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14
export default function(result){
	uni.showToast({
		title: '登陆成功',
		icon: 'none'
	});
	console.log('登陆成功',result);
	uni.setStorageSync('uni_id_uid', result.uid)
	uni.setStorageSync('uni_id_token', result.token)
	uni.setStorageSync('uni_id_token_expired', result.tokenExpired)
	//delete result.userInfo.token
	// this.setUserInfo(result.userInfo)
	
	var delta = 0//判断需要返回几层
	let pages = getCurrentPages();
DCloud_JSON's avatar
DCloud_JSON 已提交
15
	// console.log(pages);
DCloud_JSON's avatar
DCloud_JSON 已提交
16
	pages.forEach((page,index)=>{
DCloud_JSON's avatar
DCloud_JSON 已提交
17
		// console.log(pages[pages.length-index-1].route.split('/')[2]);
DCloud_JSON's avatar
DCloud_JSON 已提交
18 19
		pages[pages.length-index-1].route.split('/')
		if(pages[pages.length-index-1].route.split('/')[2] == 'login-page'){
DCloud_JSON's avatar
DCloud_JSON 已提交
20 21 22
			delta ++
		}
	})
DCloud_JSON's avatar
DCloud_JSON 已提交
23
	// console.log('判断需要返回几层',delta);
DCloud_JSON's avatar
DCloud_JSON 已提交
24 25
	uni.navigateBack({delta})
}