MrShi
3 天以前 4fabfe4dbd2eb28d07a4350597d314958cc1c281
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
    <view class="login">
        <view class="login_title">欢迎登录</view>
        <view class="login_info">滨湖森林公园运营中心</view>
        <view class="login_form">
            <view class="login_form_item">
                <image src="@/static/icon/login_ic_name@2x.png" mode="widthFix"></image>
                <input type="text" v-model="from.account" placeholder="账号" />
            </view>
            <view class="login_form_item">
                <image src="@/static/icon/login_ic_password@2x.png" mode="widthFix"></image>
                <input type="password" v-model="from.password" placeholder="密码" />
            </view>
        </view>
        <view class="login_btn" @click="login">登录</view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                from: {
                    account: '',
                    password: ''
                }
            };
        },
        methods: {
            login() {
                var that = this;
                if (!this.from.account) return uni.showToast({
                    title: '请输入账号',
                    icon: 'none'
                })
                if (!this.from.password) return uni.showToast({
                    title: '请输入密码',
                    icon: 'none'
                })
                uni.showLoading({ title: '加载中' });
                that.$u.api.login({
                    password: that.from.password,
                    username: that.from.account
                }).then(res => {
                    if (res.code === 200) {
                        uni.hideLoading();
                        that.$store.commit('setUserInfo', res.data)
                        uni.navigateTo({
                            url: '/pages/operationsCenter/operationsCenter'
                        })
                    }
                })
            }
        }
    }
</script>
 
<style lang="scss" scoped>
    .login {
        width: 100vw;
        height: 100vh;
        padding: 80rpx 60rpx;
        box-sizing: border-box;
        background: linear-gradient( 179deg, #E1FBFA 0%, #FBFEFE 17%, #FFFFFF 100%);
        .login_title {
            font-weight: 600;
            font-size: 52rpx;
            color: #333333;
        }
        .login_info {
            font-weight: 400;
            font-size: 28rpx;
            color: #999999;
            margin-top: 16rpx;
        }
        .login_form {
            width: 100%;
            margin-top: 80rpx;
            .login_form_item {
                width: 100%;
                height: 98rpx;
                padding: 0 40rpx;
                box-sizing: border-box;
                background: #F4F9F8;
                border-radius: 50rpx;
                border: 1rpx solid #E4EFED;
                margin-bottom: 40rpx;
                display: flex;
                align-items: center;
                &:last-child {
                    margin: 0 !important;
                }
                image {
                    width: 40rpx;
                    height: 40rpx;
                    margin-right: 24rpx;
                    flex-shrink: 0;
                }
                input {
                    flex: 1;
                    height: 100%;
                    font-weight: 400;
                    font-size: 30rpx;
                    color: #222222;
                }
            }
        }
        .login_btn {
            width: 100%;
            height: 96rpx;
            line-height: 96rpx;
            text-align: center;
            font-weight: 600;
            font-size: 32rpx;
            color: #FFFFFF;
            background: #01B6AD;
            box-shadow: 0rpx 6rpx 16rpx 0rpx rgba(1,182,173,0.24);
            border-radius: 50rpx;
            margin-top: 80rpx;
        }
    }
</style>