|
|
|
@ -141,7 +141,52 @@ function getDefaultImage() { |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//跳转首页
|
|
|
|
function openHomeView() { |
|
|
|
//获取用户类型缓存
|
|
|
|
let userType = uni.getStorageSync('userType') |
|
|
|
let url_path = '' |
|
|
|
switch (String(userType)) { |
|
|
|
case '1': //教练
|
|
|
|
url_path = '/pages/coach/home/index' |
|
|
|
break; |
|
|
|
case '2': //销售
|
|
|
|
url_path = '/pages/market/index/index' |
|
|
|
break; |
|
|
|
case '3': //学员
|
|
|
|
url_path = '/pages/student/index/index' |
|
|
|
break; |
|
|
|
default: |
|
|
|
uni.showToast({ |
|
|
|
title: '用户类型错误', |
|
|
|
icon: 'none' |
|
|
|
}) |
|
|
|
url_path = '/pages/student/login/login' |
|
|
|
return; |
|
|
|
} |
|
|
|
uni.navigateTo({ |
|
|
|
url: url_path |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
//退出登陆
|
|
|
|
function logout() { |
|
|
|
//清除token
|
|
|
|
uni.removeStorageSync('token') |
|
|
|
//清除用户信息
|
|
|
|
uni.removeStorageSync('userInfo') |
|
|
|
//清除用户类型
|
|
|
|
uni.removeStorageSync('userType') |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
url: '/pages/student/login/login' |
|
|
|
}) |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
module.exports = { |
|
|
|
logout, |
|
|
|
openHomeView, |
|
|
|
formatTime, |
|
|
|
formatDateTime, |
|
|
|
formatLocation, |
|
|
|
|