From f3bd5baa8eb4eb7a896f7312a2e9a7c89a46cef5 Mon Sep 17 00:00:00 2001
From: liukangdong <898885815@qq.com>
Date: 星期二, 27 八月 2024 09:18:29 +0800
Subject: [PATCH] ll

---
 h5/pages/driver/login.vue |   57 ++++++++++++++++++++++++++++++---------------------------
 1 files changed, 30 insertions(+), 27 deletions(-)

diff --git a/h5/pages/driver/login.vue b/h5/pages/driver/login.vue
index cc0ff66..4dede46 100644
--- a/h5/pages/driver/login.vue
+++ b/h5/pages/driver/login.vue
@@ -7,7 +7,7 @@
     <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" maxlength="18" placeholder="鎵嬫満鍙�" />
       </view>
       <view class="login_list_item">
         <image src="@/static/login_ic_password@2x.png" mode="widthFix" />
@@ -25,52 +25,53 @@
 		<view class="btns">
 			<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: '13996529050',
+				password: '1'
       },
       isShowProtocol: false,
       countDown: 0
     }
   },
-
   onLoad() {
+		this.initCaptcha()
   },
-
+	
   methods: {
+		...mapMutations(["setToken", "setDriverInfo"]),
 		handleRegister() {
 			uni.navigateTo({
 				url: "/pages/driver/register"
+			})
+		},
+		handleSetPsd() {
+			uni.navigateTo({
+				url: "/pages/driver/forgetPsd"
 			})
 		},
     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 +79,21 @@
         title: '瀵嗙爜涓嶈兘涓虹┖',
         icon: 'none'
       })
-      resetPassword({
-        ...form
+      driverLogin({
+        ...form,
+				uuid: this.captcha.uuid,
+				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"
           })
         }
       })

--
Gitblit v1.9.3