91 lines
2.1 KiB
Vue
91 lines
2.1 KiB
Vue
<template>
|
|
<view class="app">
|
|
<view class="title">
|
|
账号登录
|
|
</view>
|
|
<view class="loginphone">
|
|
<input class="phone" type="text" placeholder="手机号码" maxlength="11" v-model="phonenumber" />
|
|
</view>
|
|
<view class="logincode loginphone" style="top: 40%;">
|
|
<u-input class='code phone' placeholder="密码" maxlength="10" v-model="password" type="password"
|
|
:border="true" :password-icon="true" />
|
|
</view>
|
|
<view class="forget" @tap='forgetpassword'>
|
|
忘记密码
|
|
</view>
|
|
<!-- <u-checkbox-group>
|
|
<u-checkbox v-model="checked" shape="circle">记住密码</u-checkbox>
|
|
</u-checkbox-group> -->
|
|
<view class="loginbtn" @tap='pwdlogin'>
|
|
登录
|
|
</view>
|
|
<view class="loginbtn" style="top: 70%; color: #969394;background-color: #ffffff;" @tap='goregister'>
|
|
注册
|
|
</view>
|
|
<u-toast ref="uToast" />
|
|
</view>
|
|
</template>
|
|
<script>
|
|
import {
|
|
appLogin
|
|
} from '../../api/login/index.js'
|
|
export default {
|
|
data() {
|
|
return {
|
|
checked: false,
|
|
phonenumber: '',
|
|
password: '',
|
|
userId: '',
|
|
};
|
|
},
|
|
//获取到传值
|
|
onLoad(options) {},
|
|
methods: {
|
|
//密码登录
|
|
pwdlogin() {
|
|
var that = this
|
|
appLogin(this.phonenumber, this.password).then(res => {
|
|
console.log(res)
|
|
if (res.code == 200) {
|
|
uni.setStorageSync("phonenumber", that.phonenumber)
|
|
uni.setStorageSync("password", that.password)
|
|
uni.setStorageSync("nursePersonId", res.data.nursePersonId)
|
|
this.$refs.uToast.show({
|
|
title: '登录成功',
|
|
type: 'success',
|
|
duration: '1500'
|
|
})
|
|
setTimeout(() => {
|
|
uni.reLaunch({
|
|
url: '/pages/homepage/homepage',
|
|
})
|
|
}, 1500);
|
|
} else {
|
|
console.log(res)
|
|
this.$refs.uToast.show({
|
|
title: res.msg,
|
|
type: 'error'
|
|
})
|
|
}
|
|
})
|
|
},
|
|
//跳转注册页
|
|
goregister() {
|
|
uni.navigateTo({
|
|
url: '/pages/register/register'
|
|
})
|
|
},
|
|
forgetpassword() {
|
|
uni.navigateTo({
|
|
url: '/pages/forgotPassword/forgotPassword'
|
|
})
|
|
},
|
|
},
|
|
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
@import './login.scss';
|
|
</style>
|