zhangxiaoxu123456
2021-12-20 301289e539c417995f95f5cb91fd1f6043bb7cfd
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
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
<template>
    <view class="login-wrap">
        <view class="login-wrap-inside">
            <view class="login-main">
                <text class="title">金隅太行水泥智慧工会</text>
                <view class="login-main-inside">
                    <text class="welcom">欢迎登陆!</text>
                </view>
                <view class="user-box">
                    <u-form :model="valiFormData" ref="valiFormData">
                        <u-form-item label="账号" prop="loginName">
                            <u-input v-model="valiFormData.loginName" class="uni-input" placeholder="请输入账号"/>
                        </u-form-item>
                        <u-form-item label="密码" prop="password">
                            <view class="login-flex-box">
                                <u-input :password-icon="true" type="password" v-model="valiFormData.password" placeholder="请输入密码"></u-input>
                            </view>
                        </u-form-item>
                    </u-form>
                    <u-button plain hover-class="none" class="dengluBtn" size="mini" open-type="getUserInfo" @getuserinfo="appLoginWx('valiFormData')">绑定</u-button>
                </view>
            </view>
        </view>
    </view>
</template>
 
<script>
    export default {
        data() {
            return {
                valiFormData: {
                    loginName: '',
                    password: '', 
                    openid:''
                },
                rules: {
                    loginName:[
                        {
                            required: true,
                            message: '账号不能为空',
                            trigger: ['change', 'blur']
                        }
                    ],
                    password: [
                        {   
                            required: true,
                            min:6,
                            message: '密码长度不能小于6个字符',
                            trigger: ['change', 'blur']
                        }
                    ]
                },
                showPassword: false,
                type_text: "text",
                type_password: "password",
                psdType:"password"
            }
        },
        onLoad(options) {
            console.log('options----',options)
            if(options.openid) {
                this.valiFormData.openid = options.openid
            }
        },
        onReady() {
            this.$refs.valiFormData.setRules(this.rules)
        },
        methods: {
            changePassword: function() {
                this.showPassword = !this.showPassword
            },
            appLoginWx(ref) {
                this.$refs.valiFormData.validate(valid => {
                    if(valid) {
                        console.log(' this.valiFormData.loginName----',this)
                        this.$u.api.loginIndex(this.valiFormData).then(res => {
                            console.log('this.valiFormData----',this.valiFormData)
                            if(res.success) {
                                    this.setStore("userInfo",res.obj)
                                    uni.switchTab({
                                        url: '/pages/learn/learn'
                                    });
                                }
                        })
                    }
                })
            }
        }
    }
</script>
 
<style>
 
</style>
<style lang="scss" scoped>
    /deep/ .uni-forms-item {
        border-bottom: 1px solid #ffffff;
    }
 
    /deep/ .uni-forms-item__inner {
        padding-top: 36rpx;
        padding-bottom: 22rpx;
    }
    /deep/ .u-btn--default{
        background-color: transparent!important;
        color: #fff!important;
    }
    /deep/ .u-hairline-border:after{
        border:none!important;
    }
    /deep/ .u-size-mini{
        width: 100%!important;
    }
    .login-wrap {
        width: 100%;
        height: 100vh;
        background: $login-bj;
        background-size: 100% 100%;
        display: flex;
        justify-content: center;
    }
    .login-flex-box{
        display: flex;
    }
    .login-wrap-inside {
        width: 60%;
        display: flex;
        justify-content: center;
 
        .login-main {
            display: flex;
            flex-direction: column;
            margin-top: 50%;
 
            .title {
                text-align: center;
                color: #34404e;
                font-size: 42rpx;
                text-shadow: 0px 4px 4px rgba(0, 0, 0, 0.4);
            }
        }
    }
 
    .login-main-inside {
        margin-top: 100rpx;
 
        .welcom {
            color: #ff3c2e;
            font-size: 36rpx;
        }
    }
 
    // /deep/.uni-input-wrapper {
    //     /* #ifndef APP-NVUE */
    //     display: flex;
    //     /* #endif */
    //     padding: 8px 13px;
    //     flex-direction: row;
    //     flex-wrap: nowrap;
    // }
 
    .user-box {
        margin-top: 60rpx;
    }
 
    .dengluBtn {
        background-color: #ff4e00!important;
        color: #fff;
        font-size: 30rpx;
        border-radius: 50rpx;
        width: 450rpx;
        height: 74rpx;
        display: flex;
        justify-content: center;
        align-items: center;
        margin-top: 60rpx;
    }
 
    
 
    
</style>