From 55fcdfcac9fa9693132a352c6d891866d90f3b3c Mon Sep 17 00:00:00 2001 From: 展杰 <1240968267@qq.com> Date: 星期一, 20 十一月 2023 17:43:33 +0800 Subject: [PATCH] 1 --- pages/login/login.vue | 46 ++++++++++++++++++++++++++++++++++------------ 1 files changed, 34 insertions(+), 12 deletions(-) diff --git a/pages/login/login.vue b/pages/login/login.vue index ce61a34..d99d97f 100644 --- a/pages/login/login.vue +++ b/pages/login/login.vue @@ -8,8 +8,8 @@ <u-form-item label="鐢ㄦ埛鍚�" labelWidth=65 prop="userInfo.account" borderBottom> <u--input v-model="userInfo.account" border="none" placeholder="璇疯緭鍏ョ敤鎴峰悕"></u--input> </u-form-item> - <u-form-item label="瀵嗙爜" labelWidth=65 prop="userInfo.passward"> - <u--input v-model="userInfo.passward" placeholder="璇疯緭鍏ョ敤鎴峰瘑鐮�" border="none" :password="showPassward" + <u-form-item label="瀵嗙爜" labelWidth=65 prop="userInfo.password"> + <u--input v-model="userInfo.password" placeholder="璇疯緭鍏ョ敤鎴峰瘑鐮�" border="none" :password="showPassward" @click="this.showPassward = !this.showPassward " suffixIcon="eye-fill" suffixIconStyle="color: #909399"></u--input> </u-form-item> @@ -21,14 +21,23 @@ </template> <script> + import { + login + } from '../../api/login' export default { data() { return { showPassward: true, userInfo: { account: '', - passward: '' + password: '' } + } + }, + onLoad() { + let user = uni.getStorageSync('userInfo') + if (user) { + this.userInfo.account = user.code } }, methods: { @@ -41,26 +50,39 @@ }) return } - - if (this.userInfo.passward == null || this.userInfo.passward == '') { + + if (this.userInfo.password == null || this.userInfo.password == '') { this.$refs.uToast.show({ message: '瀵嗙爜涓虹┖', type: 'error' }) return } - - console.log(this.userInfo) - - uni.navigateTo({ - url:'/pages/index/index' + // console.log(this.userInfo) + login(this.userInfo.account, this.userInfo.password).then(response => { + console.log(response) + if (!response.result) { + this.$refs.uToast.show({ + message: response.msg, + type: 'error' + }) + return + } + uni.setStorageSync('userInfo', { + username: response.data.FNAME, + code: response.data.FCODE, + company: response.data.FCOMPANY, + factory: response.data.FFACTORY, + }) + uni.navigateTo({ + url: '/pages/index/index', + }) }) } - } + }, } </script> - <style> .uni-input { height: 28px; -- Gitblit v1.9.3