From 86baa8ff948d2e79588e0dd7efa16f6b8ac3b157 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期五, 06 十二月 2024 15:29:15 +0800
Subject: [PATCH] ll
---
h5/pages/driver/login.vue | 72 ++++++++++++++++++++----------------
1 files changed, 40 insertions(+), 32 deletions(-)
diff --git a/h5/pages/driver/login.vue b/h5/pages/driver/login.vue
index cc0ff66..26b8fed 100644
--- a/h5/pages/driver/login.vue
+++ b/h5/pages/driver/login.vue
@@ -1,18 +1,19 @@
<template>
<view class="login">
- <image class="login_bg" src="@/static/login_bg@2x.png" />
+ <image class="login_bg" src="@/static/login_bg@2x.png" mode="widthFix" />
<image class="login_logo" src="@/static/logo@2x.png" mode="widthFix" />
<view class="login_title">瀹夋嘲鐗╂祦鏅烘収鍥尯</view>
<view class="login_title">鐗╂祦杞﹀徃鏈虹櫥褰�</view>
<view class="login_list">
<view class="login_list_item">
<image src="@/static/login_ic_phone@2x.png" mode="widthFix" />
- <input v-model="form.phone" maxlength="18" placeholder="鎵嬫満鍙�" />
+ <input v-model="form.username" @focus="showKeyboard = true" @blur="showKeyboard = false" maxlength="18" placeholder="鎵嬫満鍙�" />
</view>
<view class="login_list_item">
<image src="@/static/login_ic_password@2x.png" mode="widthFix" />
<input
v-model="form.password"
+ @focus="showKeyboard = true" @blur="showKeyboard = false"
type="password"
placeholder="瀵嗙爜"
/>
@@ -22,55 +23,57 @@
<view class="login_btn_n" @click="onLogin">绔嬪嵆鐧诲綍</view>
</view>
<!-- -->
- <view class="btns">
+ <view class="btns" v-if="!showKeyboard">
<view class="btn" @click="handleRegister">绔嬪嵆娉ㄥ唽</view>
<view class="btn separate"> | </view>
- <view class="btn">蹇樿瀵嗙爜</view>
+ <view class="btn" @click="handleSetPsd">蹇樿瀵嗙爜</view>
</view>
</view>
</template>
<script>
-import { resetPassword, sendSms } from '@/api'
+import { driverLogin, loginCaptcha, getUserInfo } from '@/api'
+import { mapState, mapMutations } from 'vuex'
export default {
data() {
return {
form: {
+ username: '',
+ password: ''
},
isShowProtocol: false,
+ showKeyboard: false,
countDown: 0
}
},
-
onLoad() {
+ this.initCaptcha()
},
-
+
methods: {
+ ...mapMutations(["setToken", "setDriverInfo"]),
handleRegister() {
uni.navigateTo({
url: "/pages/driver/register"
+ })
+ },
+ handleSetPsd() {
+ uni.navigateTo({
+ url: "/pages/driver/forgetPsd?phone=" + this.form.username
})
},
dealChange(e) {
console.log(e)
},
initCaptcha() {
- if (!this.form.phone) return uni.showToast({
- title: '鎵嬫満鍙蜂笉鑳戒负绌�',
- icon: 'none'
- })
- sendSms({ phone: this.form.phone }).then(res => {
- this.countDown = 60
- setInterval(() => {
- if (this.countDown == 0) return
- this.countDown--
- }, 1000)
+ loginCaptcha().then(res => {
+ this.captcha = res.data
})
},
onLogin() {
const { form } = this
- if (!form.phone) return uni.showToast({
+ if (!form.username) return uni.showToast({
title: '鎵嬫満鍙蜂笉鑳戒负绌�',
icon: 'none'
})
@@ -78,19 +81,22 @@
title: '瀵嗙爜涓嶈兘涓虹┖',
icon: 'none'
})
- resetPassword({
- ...form
+ driverLogin({
+ ...form,
+ uuid: this.captcha.uuid,
+ openid: this.$store.state.openId,
+ code: '1'
}).then(res => {
- if (res && res.code == 200) {
- setTimeout(() => {
- uni.showToast({
- title: '瀵嗙爜淇敼鎴愬姛,璇烽噸鏂扮櫥褰�',
- icon: 'success',
- duration: 2000
+ if (res.code === 200) {
+ this.setToken(res.data)
+ getUserInfo().then(ress => {
+ setTimeout(() => {
+ this.showToast('鐧诲綍鎴愬姛')
+ })
+ this.setDriverInfo(ress.data)
+ uni.redirectTo({
+ url: "/pages/driver/index"
})
- })
- uni.redirectTo({
- url: "/pages/staffLogin/login"
})
}
})
@@ -118,9 +124,11 @@
margin-bottom: 40rpx;
}
.login_bg {
- position: absolute;
- top: 0;
- width: 750rpx;
+ position: absolute;
+ top: 0;
+ left: 0;
+ width: 100%;
+ z-index: -1;
}
.login_title {
font-size: 44rpx;
--
Gitblit v1.9.3