import { exit } from "./examRequest";
// 前端页面跳转
export function redirectTo(toUrl) {
	console.log(toUrl);
	let user = sessionStorage.getItem("user")
	let token = sessionStorage.getItem("token")
	if (user === null || token === null) {
		exit()
	} else if (toUrl!= undefined) {
		uni.redirectTo({
			url: toUrl // 关闭当前页面，跳转到对应路径的页面
		});
	} else {
		console.log("跳转失败或无需跳转");
	}
}

export function toLogin() {
	redirectTo('/pages/login/Login');
}

export function toExamInfo() {
	redirectTo('/pages/examPage/examInfo');
}
export function toExamStart() {
	redirectTo('/pages/examPage/examStart');
}