From d8d184a00d3581b3a77aa26864a153f0515524e0 Mon Sep 17 00:00:00 2001
From: Mr.Shi <1878285526@qq.com>
Date: 星期二, 29 八月 2023 18:30:03 +0800
Subject: [PATCH] 小程序

---
 minipro_standard/pages/login/login.vue |   29 ++++++++++++++++++++++-------
 1 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/minipro_standard/pages/login/login.vue b/minipro_standard/pages/login/login.vue
index 6f10dc0..1632dbc 100644
--- a/minipro_standard/pages/login/login.vue
+++ b/minipro_standard/pages/login/login.vue
@@ -11,7 +11,7 @@
 		</view>
 		<view class="bg_w rd8 ptb30 pl40 bbox mt40 flex input-height">
 			<image src="@/static/login_ic_phone@2x.png" mode="" class="img40 mr25"></image>
-			<u--input placeholder="鎵嬫満鍙�" border="none" v-model="loginForm.account"></u--input>
+			<u--input placeholder="鎵嬫満鍙�" border="none" v-model="loginForm.username"></u--input>
 		</view>
 		<view class="bg_w rd8 ptb30 pl40 bbox mt40 flex input-height">
 			<image src="@/static/login_ic_password@2x.png" mode="" class="img40 mr25"></image>
@@ -22,21 +22,37 @@
 </template>
 
 <script>
+	import { wxAccountLogin, getUserInfo } from '@/util/api/index.js'
 	export default {
 		data() {
 			return {
 				loginForm: {
 					companyId: '',
-					account: '',
+					username: '',
 					password: ''
 				}
 			};
 		},
 		methods: {
-			loginAction() {
-				uni.reLaunch({
-					url: '/pages/workbench/workbench'
+			async loginAction() {
+				if (!this.loginForm.companyId) return uni.showToast({ title: '浼佷笟浠g爜涓嶈兘涓虹┖', icon:"error", duration: 2000 });
+				if (!this.loginForm.username) return uni.showToast({ title: '鎵嬫満鍙蜂笉鑳戒负绌�', icon:"error", duration: 2000 });
+				if (!this.loginForm.password) return uni.showToast({ title: '瀵嗙爜涓嶈兘涓虹┖', icon:"error", duration: 2000 });
+				let res = await wxAccountLogin({
+					companyId: this.loginForm.companyId,
+					username: this.loginForm.username,
+					password: this.loginForm.password
 				})
+				if (res.code === 200) {
+					let user = await getUserInfo({})
+					if (user.code === 200) {
+						await this.$store.commit('SETUSERINFO', user.data)
+						await this.$store.dispatch('getMenuList', 2)
+						uni.reLaunch({
+							url: '/pages/workbench/workbench'
+						})
+					}
+				}
 			}
 		}
 	}
@@ -56,7 +72,6 @@
 			height: 100%;
 		}
 		.login-log {
-			// margin-top: ;
 			margin: 356rpx auto 0 auto ;
 			left: 0;
 			right: 0;
@@ -75,7 +90,7 @@
 		}
 	}
 	.input-height {
-		height: 100rpx;
+		height: 100rpx; 
 	}
 	.com-input {
 		margin-top: -60px;

--
Gitblit v1.9.3