登录
This commit is contained in:
parent
ef9ec2d8ff
commit
0caee43f6d
33
pages.json
33
pages.json
@ -4,6 +4,13 @@
|
||||
},
|
||||
"pages": [ //pages数组中第一项表示应用启动页,参考:https://uniapp.dcloud.io/collocation/pages
|
||||
{
|
||||
"path": "pages/login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},{
|
||||
"path" : "pages/taskReturn/taskReturn",
|
||||
"style" :
|
||||
{
|
||||
@ -21,7 +28,24 @@
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
"path" : "pages/Changepassword/Changepassword",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "修改密码",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
},
|
||||
{
|
||||
"path" : "pages/Modifyphonenumber/Modifyphonenumber",
|
||||
"style" :
|
||||
{
|
||||
"navigationBarTitleText": "修改手机号",
|
||||
"enablePullDownRefresh": false
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
{
|
||||
"path": "pages/myinformation/myinformation",
|
||||
@ -38,14 +62,7 @@
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationBarBackgroundColor": "#4ac4ab"
|
||||
}
|
||||
}, {
|
||||
"path": "pages/login/login",
|
||||
"style": {
|
||||
"navigationBarTitleText": "",
|
||||
"enablePullDownRefresh": false,
|
||||
"navigationStyle": "custom"
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
</view>
|
||||
<view class="body">
|
||||
<view class="login">
|
||||
<view class="logins">
|
||||
<view class="logins" @tap="pwdlogin">
|
||||
登录
|
||||
</view>
|
||||
<view class="border">
|
||||
@ -14,27 +14,33 @@
|
||||
</view>
|
||||
<view class="name">
|
||||
<u-form :model="form" ref="uForm" label-width="110">
|
||||
<u-form-item label="用户名:"><u-input placeholder="请输入用户名" /></u-form-item>
|
||||
<u-form-item label="用户名:"><u-input placeholder="请输入用户名" maxlength="11" v-model="personAccount" /></u-form-item>
|
||||
<u-form-item label="密码:">
|
||||
<u-input placeholder="请输入密码" :password-icon="true" type="password" />
|
||||
<u-input placeholder="请输入密码" :password-icon="true" type="password" v-model="personPassword" />
|
||||
<!-- <span class="pwd">忘记密码</span> -->
|
||||
</u-form-item>
|
||||
</u-form>
|
||||
</view>
|
||||
<view class="loginsubmit" @tap="gohomepage">
|
||||
<view class="loginsubmit" @tap="login">
|
||||
登录
|
||||
</view>
|
||||
|
||||
</view>
|
||||
|
||||
<u-toast ref="uToast" />
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
appLogin,
|
||||
createMobileToken
|
||||
} from '@/api/login/index.js'
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
title: 'Hello',
|
||||
personAccount: '',
|
||||
personPassword: '',
|
||||
form: {
|
||||
name: '',
|
||||
|
||||
@ -44,15 +50,56 @@
|
||||
// onReady() {
|
||||
// this.$refs.uForm.setRules(this.rules);
|
||||
// },
|
||||
onLoad() {
|
||||
|
||||
},
|
||||
//获取到传值
|
||||
// onLoad(options) {
|
||||
// if (options.phonenumber && options.password) {
|
||||
// this.phonenumber = options.phonenumber
|
||||
// this.password = options.password
|
||||
// }
|
||||
// },
|
||||
methods: {
|
||||
gohomepage() {
|
||||
uni.redirectTo({
|
||||
url: '/pages/homepage/homepage'
|
||||
login() {
|
||||
var that = this
|
||||
appLogin(this.personAccount, this.personPassword).then(res => {
|
||||
if (res.data.code == 200) {
|
||||
uni.setStorageSync("id", res.data.data.id)
|
||||
uni.setStorageSync("status", res.data.data.status)
|
||||
// uni.setStorageSync("nursePersonName", res.data.nursePersonName)
|
||||
// uni.setStorageSync("nurseStationId", res.data.nurseStationId)
|
||||
that.$refs.uToast.show({
|
||||
title: '登录成功',
|
||||
type: 'success',
|
||||
duration: '1500'
|
||||
})
|
||||
if (that.timer) {
|
||||
clearTimeout(that.timer)
|
||||
}
|
||||
that.timer = setTimeout(e => {
|
||||
uni.reLaunch({
|
||||
url: '/pages/homepage/homepage',
|
||||
})
|
||||
}, 1500)
|
||||
} else {
|
||||
that.$refs.uToast.show({
|
||||
title: res.data.msg,
|
||||
type: 'error'
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
//密码登录
|
||||
pwdlogin() {
|
||||
var that = this
|
||||
createMobileToken().then(res => {
|
||||
uni.setStorageSync("token", res.data.token)
|
||||
that.login();
|
||||
})
|
||||
},
|
||||
// gohomepage() {
|
||||
// uni.redirectTo({
|
||||
// url: '/pages/homepage/homepage'
|
||||
// })
|
||||
// },
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -173,4 +220,4 @@
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user