|
|
|
@ -47,8 +47,8 @@ import medicationApi from '@/api/medication.js'; |
|
|
|
} |
|
|
|
}, |
|
|
|
onLoad() { |
|
|
|
uni.hideHomeButton() |
|
|
|
console.log(uni.getStorageSync('um_id')) |
|
|
|
// uni.hideHomeButton() |
|
|
|
// console.log(uni.getStorageSync('um_id')) |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
input(e) { |
|
|
|
@ -62,16 +62,41 @@ import medicationApi from '@/api/medication.js'; |
|
|
|
url: '/pages/student/login/forgot' |
|
|
|
}) |
|
|
|
}, |
|
|
|
//登陆 |
|
|
|
login() { |
|
|
|
let item = {}; |
|
|
|
item['username'] = this.user |
|
|
|
item['password'] = this.password1 |
|
|
|
//登陆 |
|
|
|
medicationApi.login(item).then(res => { |
|
|
|
if (res.status == 200) { |
|
|
|
if (res.code == 1) { |
|
|
|
res.data.userType = 2 |
|
|
|
|
|
|
|
uni.setStorageSync('token', res.data.token); |
|
|
|
uni.switchTab({ |
|
|
|
url: '/pages/my/my' |
|
|
|
}) |
|
|
|
uni.setStorageSync('userType', res.data.userType); |
|
|
|
|
|
|
|
let url_path = '' |
|
|
|
switch (String(res.data.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' |
|
|
|
}) |
|
|
|
return; |
|
|
|
} |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
url: url_path |
|
|
|
}) |
|
|
|
} else { |
|
|
|
uni.showToast({ |
|
|
|
title: res.msg, |
|
|
|
|