YOS-DRVOGPU6U78\Administrator
2023-07-17 66f2bb78ae330785cdf2e04829ebd036e92edb92
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<template>
    <view>
        <view>
            <image src="../../static/img/bg2.jpg" style="width: 100%; display: block;"></image>
        </view>
        <view>
            <u--form labelPosition="left" :model="userInfo" ref="uForm">
                <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.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>
            </u--form>
            <u-button text="登陆" type="primary" style="margin-top: 10px;" @click="login()"></u-button>
        </view>
        <u-toast ref="uToast" />
    </view>
</template>
 
<script>
    import {
        login
    } from '../../api/login'
    export default {
        data() {
            return {
                showPassward: true,
                userInfo: {
                    account: '',
                    password: ''
                }
            }
        },
        methods: {
            login() {
                // 输入检验
                if (this.userInfo.account == null || this.userInfo.account == '') {
                    this.$refs.uToast.show({
                        message: '用户名为空',
                        type: 'error'
                    })
                    return
                }
 
                if (this.userInfo.password == null || this.userInfo.password == '') {
                    this.$refs.uToast.show({
                        message: '密码为空',
                        type: 'error'
                    })
                    return
                }
 
 
                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.navigateTo({
                        url:'/pages/index/index'
                    })
                })
 
 
            }
        }
    }
</script>
 
<style>
    .uni-input {
        height: 28px;
        line-height: 28px;
        font-size: 15px;
        padding: 0px;
        flex: 1;
        background-color: #FFFFFF;
    }
</style>