// 需要登录的界面
let needLogin = [
	
];
// 拦截类型
let list = ["navigateTo", "redirectTo", "reLaunch", "switchTab"];

const install = (Vue,vm) => {
	list.forEach(item => {
		uni.addInterceptor(item, {
			invoke(e) {
				// const token = vm.$store.state.phone_login_token;
				const url = e.url.split('?')[0];
				if (needLogin.includes(url) && !token) {
					uni.showToast({
						title: '该页面需要登录才能访问，请先登录',
						icon: 'none'
					});
					uni.navigateTo({
						url: "/pages/my/compontents/wxLogin?nextUrl="+e.url
					});
					return false;
				}
				return true;
			}
		});
	});
}

export default {
	install
}