liangjin
2021-04-09 80e6ce085931caecbca5a00c02a4f98cff7d21ad
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!--
 * @Author: 小明丶
 * @Date: 2020-11-09 09:08:28
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-12-23 17:36:02
 * @Description:
-->
<!--
 * @Author: 小明丶
 * @Date: 2019-08-15 10:20:56
 * @LastEditors: 小明丶
 * @LastEditTime: 2020-07-09 16:12:26
 * @Description: 登录页面
 -->
<template>
    <div class="login-page">
 
        <form class="pagebody" @submit.prevent="loginBut">
            <div class="login-input">
                <div class="height-44">登录</div>
 
                <div class="logo_img">
                    <img :src="loginImg" alt="">
                </div>
 
                <van-field v-model="userNo" type="tel" clearable maxlength='11'
                    placeholder="请输入手机号码" >
                    <template #left-icon>
                      <van-icon name="phone-o" :color="$store.state.backColor" />
                    </template>
                </van-field>
                <van-field v-model="password" clearable maxlength='16' :type="pwdType"
                    placeholder="请输入8-16位数字字母组合密码"
                    >
                     <template #left-icon>
                      <van-icon name="contact" :color="$store.state.backColor" />
                    </template>
                    <template #right-icon>
                      <van-icon :name="pwdType== 'text' ? 'closed-eye':'eye-o' " :color="$store.state.backColor" @click="showPassword"/>
                    </template>
                </van-field>
 
                <van-button :color="$store.state.backColor" class="log-btn" native-type="submit">登录</van-button>
 
            </div>
            <div class="input-other flex-between-g">
                <span class="forget-pwd" @click="$router.push('/user/forgetpassword')">忘记密码?</span>
                <span class="register-u" @click="$router.push('/user/register-home')">注册</span>
            </div>
        </form>
        <div style="font-size: 12px; color: #666;text-align: center;width: 100%;margin-top: 150px;">
            客服电话:028-86043722
        </div>
    </div>
</template>
 
<script>
    import {
        mapActions,mapState
    } from 'vuex';
    import prodConfig from '@/utils/config'
    export default {
        data() {
            return {
                //数据
                // 18108048791 1234qwer
                userNo: '',
                password: '',
                //点击显示密码为明文,眼睛的样式也是根据这个来判断的
                pwdType: 'password',
                test: false,
                loginImg: 'static/img/logo.png',
 
            };
        },
 
        methods: {
            ...mapActions(['login','loginByToken','setColor']),
            //是否显示明文密码
            showPassword() {
                if (this.pwdType === 'password') {
                    this.pwdType = 'text';
                } else {
                    this.pwdType = 'password';
                }
            },
            //登录验证
            loginBut() {
                let v = this.$tool;
                if (v.checkValEmpty(this.userNo)) {
                    v.toast('请输入手机号');
                    return;
                }
                if (!v.checkPhone(this.userNo)) {
                    v.toast('请输入正确的手机号');
                    return;
                }
                if (v.checkValEmpty(this.password)) {
                    v.toast('请输入密码');
                    return;
                }
                if (!v.checkPassword(this.password)) {
                    v.toast('请输入8-16位数字字母组合密码');
                    return;
                }
                this.login({
                    vm: this,
                    userNo: this.userNo,
                    password: this.password,
                    sib_mer_sysPlat: localStorage.sib_mer_sysPlat
                })
            },
        },
        created() {
            console.log(this.$route.query.platNo)
            sessionStorage.clear();
            if (this.$route.query.sysPlat !== undefined) {
                localStorage.sib_mer_sysPlat = this.$route.query.sysPlat // 1 微信 2支付宝
            }
            prodConfig.setClientInfo();
            if (!localStorage.getItem('deviceInfo')) {
                //H5环境
                // this.loginImg = 'static/img/logo.png';
            } else {
                //APP环境,拉渠道json
                prodConfig.fetchProductConfig().then(
                    res => {
                        //让该渠道和json里面的渠道列表做匹配,拿到登陆页面的Logo
                        let childChan = JSON.parse(localStorage.getItem('deviceInfo')).childChan;
                        let chanList = res.childChanList;
                        let chanKeys = Object.keys(chanList);
                        if (chanKeys.includes(childChan)) {
                            this.loginImg = chanList[childChan].icon;
                        } else {
                            //如果没有找到该渠道,则显示默认图片
                            this.loginImg = 'https://sie.jycash.cn/scene/img/zlwjr.png';
                        }
                    }
                )
            }
        }
    };
</script>
<style lang="less" scoped>
    #app .vux-header::after {
        display: none;
    }
 
    .login-page {
        background-color: @c-fff;
        min-height: 662px;
 
        .log-btn {
            border-radius: 22px;
        }
 
        .logo_img {
            width: 100px;
            height: 100px;
            margin: 0 auto;
            padding: 48px 0;
 
            img {
                width: 100%;
                height: 100%;
            }
        }
 
        .pagebody {
            padding: 0 24px;
 
 
            .height-44 {
                .lh(44px);
                .flex(center, center);
                font-size: @font-20;
                color: @c-333;
            }
 
 
            .weui-cell {
                padding: 0;
                margin-top: 12px;
            }
 
            .weui-select {
                padding: 0;
            }
 
            .vux-cell-value {
                width: 100%;
            }
 
            .weui-cells:before {
                display: none;
            }
 
            .weui-cell:before {
                display: none;
            }
 
            .weui-cells:after {
                display: none;
            }
 
            .f-button {
                width: 100%;
            }
        }
 
        .login-icon {
            font-size: 20px;
            padding-right: 12px;
        }
 
        .icon-pd {
            padding-left: 1rem;
        }
 
        .input-other {
            margin-top: 20px;
 
            .register {
                float: right;
            }
        }
    }
</style>