|
|
@ -36,14 +36,14 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script> |
|
|
<script> |
|
|
import medicationApi from '@/api/medication.js'; |
|
|
import medicationApi from '@/api/medication.js'; |
|
|
|
|
|
|
|
|
export default { |
|
|
export default { |
|
|
data() { |
|
|
data() { |
|
|
return { |
|
|
return { |
|
|
password: true, |
|
|
password: true, |
|
|
user: '',//账户 |
|
|
user: '18888888888', //账户 |
|
|
password1: ''//密码 |
|
|
password1: '123456' //密码 |
|
|
} |
|
|
} |
|
|
}, |
|
|
}, |
|
|
onLoad() { |
|
|
onLoad() { |
|
|
@ -62,41 +62,38 @@ import medicationApi from '@/api/medication.js'; |
|
|
url: '/pages/student/login/forgot' |
|
|
url: '/pages/student/login/forgot' |
|
|
}) |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
//登陆 |
|
|
//登陆 |
|
|
login() { |
|
|
login() { |
|
|
let item = {}; |
|
|
let item = {}; |
|
|
item['username'] = this.user |
|
|
item['username'] = this.user |
|
|
item['password'] = this.password1 |
|
|
item['password'] = this.password1 |
|
|
//登陆 |
|
|
//登陆 |
|
|
medicationApi.login(item).then(res => { |
|
|
medicationApi.login(item).then(res => { |
|
|
if (res.code == 1) { |
|
|
if (res.code == 1) { |
|
|
res.data.userType = 2 |
|
|
|
|
|
|
|
|
|
|
|
uni.setStorageSync('token', res.data.token); |
|
|
uni.setStorageSync('token', res.data.token); |
|
|
uni.setStorageSync('userType', res.data.userType); |
|
|
uni.setStorageSync('userType', res.data.userType); |
|
|
|
|
|
|
|
|
let url_path = '' |
|
|
let url_path = '' |
|
|
switch (String(res.data.userType)) { |
|
|
switch (String(res.data.userType)) { |
|
|
case '1'://教练 |
|
|
case '1': //教练 |
|
|
url_path = '/pages/coach/home/index' |
|
|
url_path = '/pages/coach/home/index' |
|
|
break; |
|
|
break; |
|
|
case '2'://销售 |
|
|
case '2': //销售 |
|
|
url_path = '/pages/market/index/index' |
|
|
url_path = '/pages/market/index/index' |
|
|
break; |
|
|
break; |
|
|
case '3'://学员 |
|
|
case '3': //学员 |
|
|
url_path = '/pages/student/index/index' |
|
|
url_path = '/pages/student/index/index' |
|
|
break; |
|
|
break; |
|
|
default: |
|
|
default: |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: '用户类型错误', |
|
|
title: '用户类型错误', |
|
|
icon: 'none' |
|
|
icon: 'none' |
|
|
}) |
|
|
}) |
|
|
return; |
|
|
return; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
uni.navigateTo({ |
|
|
url: url_path |
|
|
url: url_path |
|
|
}) |
|
|
}) |
|
|
} else { |
|
|
} else { |
|
|
uni.showToast({ |
|
|
uni.showToast({ |
|
|
title: res.msg, |
|
|
title: res.msg, |
|
|
|