1 changed files with 155 additions and 155 deletions
@ -1,175 +1,175 @@ |
|||||
<template> |
<template> |
||||
<view> |
<view> |
||||
<view style="height: 500rpx;background-color:#fff;"> |
<view style="height: 500rpx;background-color:#fff;"> |
||||
<view style="height: 150rpx;"></view> |
<view style="height: 150rpx;"></view> |
||||
<view class="image-container;"> |
<view class="image-container;"> |
||||
<image src="@/static/images/login/login1.png" class="base-image"></image> |
<image src="@/static/images/login/login1.png" class="base-image"></image> |
||||
<image src="@/static/images/login/login2.png" class="overlay-image"></image> |
<image src="@/static/images/login/login2.png" class="overlay-image"></image> |
||||
</view> |
</view> |
||||
<view style="width: 100%;font-size: 60rpx;color: #ccc;text-align: center;margin-top: 60rpx;"> |
<view style="width: 100%;font-size: 60rpx;color: #ccc;text-align: center;margin-top: 60rpx;"> |
||||
运动课堂 |
运动课堂 |
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
<view :style="{'background-color':'#fff','width':'100%','height':'100vh' }"> |
<view :style="{'background-color':'#fff','width':'100%','height':'100vh' }"> |
||||
<view style="width: 95%;height: 30rpx;"></view> |
<view style="width: 95%;height: 30rpx;"></view> |
||||
<view style="width: 95%;margin:30rpx auto;"> |
<view style="width: 95%;margin:30rpx auto;"> |
||||
<fui-input borderTop placeholder="登录账号" v-model="user" @input="input" |
<fui-input borderTop placeholder="登录账号" v-model="user" @input="input" |
||||
backgroundColor="#f2f2f2"></fui-input> |
backgroundColor="#f2f2f2"></fui-input> |
||||
</view> |
</view> |
||||
<view style="width: 95%;margin: auto;"> |
<view style="width: 95%;margin: auto;"> |
||||
<fui-input borderTop :padding="['20rpx','32rpx']" v-model="password1" placeholder="登录密码" |
<fui-input borderTop :padding="['20rpx','32rpx']" v-model="password1" placeholder="登录密码" |
||||
:password="password" @input="input" backgroundColor="#f2f2f2"> |
:password="password" @input="input" backgroundColor="#f2f2f2"> |
||||
<fui-icon :name="password?'invisible':'visible'" color="#B2B2B2" :size="50" |
<fui-icon :name="password?'invisible':'visible'" color="#B2B2B2" :size="50" |
||||
@click="change"></fui-icon> |
@click="change"></fui-icon> |
||||
</fui-input> |
</fui-input> |
||||
</view> |
</view> |
||||
<view style="width: 95%;margin:60rpx auto;"> |
<view style="width: 95%;margin:60rpx auto;"> |
||||
<fui-button background="#00be8c" radius="5rpx" @click="login">登录</fui-button> |
<fui-button background="#00be8c" radius="5rpx" @click="login">登录</fui-button> |
||||
</view> |
</view> |
||||
|
|
||||
<view style="width: 95%;margin:60rpx auto;"> |
<view style="width: 95%;margin:60rpx auto;"> |
||||
<fui-button background="#fff" radius="5rpx" @click="forgot" color="#00be8c">忘记登录密码</fui-button> |
<fui-button background="#fff" radius="5rpx" @click="forgot" color="#00be8c">忘记登录密码</fui-button> |
||||
</view> |
</view> |
||||
|
|
||||
</view> |
</view> |
||||
</view> |
</view> |
||||
</template> |
</template> |
||||
|
|
||||
<script> |
<script> |
||||
import memberApi from '@/api/member.js'; |
import memberApi from '@/api/member.js'; |
||||
|
|
||||
export default { |
export default { |
||||
data() { |
data() { |
||||
return { |
return { |
||||
password: true, |
password: true, |
||||
user: '18888888888', //账户 |
user: '18888888888', //账户 |
||||
password1: '123456' //密码 |
password1: '123456' //密码 |
||||
} |
} |
||||
}, |
}, |
||||
onLoad() { |
onLoad() { |
||||
// uni.hideHomeButton() |
// uni.hideHomeButton() |
||||
// console.log(uni.getStorageSync('um_id')) |
// console.log(uni.getStorageSync('um_id')) |
||||
}, |
}, |
||||
methods: { |
methods: { |
||||
input(e) { |
input(e) { |
||||
console.log(e) |
console.log(e) |
||||
}, |
}, |
||||
change() { |
change() { |
||||
this.password = !this.password |
this.password = !this.password |
||||
}, |
}, |
||||
forgot() { |
forgot() { |
||||
uni.navigateTo({ |
uni.navigateTo({ |
||||
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 |
||||
//登陆 |
//登陆 |
||||
memberApi.login(item).then(res => { |
memberApi.login(item).then(res => { |
||||
if (res.code == 1) { |
if (res.code == 1) { |
||||
uni.setStorageSync('token', res.data.token); |
uni.setStorageSync('token', res.data.token); |
||||
let userType = res.data.userType |
let userType = res.data.userType |
||||
|
|
||||
// userType = 2//测试完注释本行 |
// userType = 3//测试完注释本行 |
||||
console.log('用户类型',userType) |
console.log('用户类型', userType) |
||||
|
|
||||
uni.setStorageSync('userType', userType); |
uni.setStorageSync('userType', userType); |
||||
uni.setStorageSync('tabBerIndex', 0); |
uni.setStorageSync('tabBerIndex', 0); |
||||
|
|
||||
let url_path = '' |
let url_path = '' |
||||
switch (String(userType)) { |
switch (String(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, |
||||
icon: 'none' |
icon: 'none' |
||||
}) |
}) |
||||
} |
} |
||||
}); |
}); |
||||
}, |
}, |
||||
loginWx() { |
loginWx() { |
||||
uni.login({ |
uni.login({ |
||||
provider: 'weixin', |
provider: 'weixin', |
||||
success: (res) => { |
success: (res) => { |
||||
console.log(res) |
console.log(res) |
||||
medication.wechatminilogin({ |
medication.wechatminilogin({ |
||||
code: res.code |
code: res.code |
||||
}).then(res1 => { |
}).then(res1 => { |
||||
if (res1.status == 200) { |
if (res1.status == 200) { |
||||
uni.setStorageSync('um_id', res1.data.um_id); |
uni.setStorageSync('um_id', res1.data.um_id); |
||||
uni.setStorageSync('user', res1.data); |
uni.setStorageSync('user', res1.data); |
||||
uni.switchTab({ |
uni.switchTab({ |
||||
url: '/pages/my/my' |
url: '/pages/my/my' |
||||
}) |
}) |
||||
} else { |
} else { |
||||
uni.showToast({ |
uni.showToast({ |
||||
title: res.msg, |
title: res.msg, |
||||
icon: 'none' |
icon: 'none' |
||||
}) |
}) |
||||
} |
} |
||||
}) |
}) |
||||
} |
} |
||||
}); |
}); |
||||
}, |
}, |
||||
} |
} |
||||
} |
} |
||||
</script> |
</script> |
||||
|
|
||||
<style lang="less" scoped> |
<style lang="less" scoped> |
||||
page { |
page { |
||||
font-weight: normal; |
font-weight: normal; |
||||
} |
} |
||||
|
|
||||
.fui-section__title { |
.fui-section__title { |
||||
margin-left: 32rpx; |
margin-left: 32rpx; |
||||
} |
} |
||||
|
|
||||
.fui-left__icon { |
.fui-left__icon { |
||||
padding-right: 24rpx; |
padding-right: 24rpx; |
||||
} |
} |
||||
|
|
||||
.image-container { |
.image-container { |
||||
margin: auto; |
margin: auto; |
||||
position: relative; |
position: relative; |
||||
width: 150rpx; |
width: 150rpx; |
||||
/* 设置与第一张图片相同的宽度 */ |
/* 设置与第一张图片相同的宽度 */ |
||||
height: 150rpx; |
height: 150rpx; |
||||
/* 设置与第一张图片相同的高度 */ |
/* 设置与第一张图片相同的高度 */ |
||||
} |
} |
||||
|
|
||||
.base-image { |
.base-image { |
||||
width: 100%; |
width: 100%; |
||||
height: 100%; |
height: 100%; |
||||
} |
} |
||||
|
|
||||
.overlay-image { |
.overlay-image { |
||||
position: absolute; |
position: absolute; |
||||
top: 50%; |
top: 50%; |
||||
left: 50%; |
left: 50%; |
||||
transform: translate(-50%, -50%); |
transform: translate(-50%, -50%); |
||||
width: 100rpx; |
width: 100rpx; |
||||
height: 100rpx; |
height: 100rpx; |
||||
} |
} |
||||
</style> |
</style> |
||||
Loading…
Reference in new issue