zengh
2022-05-09 52c39f5e2711e5535b689b66dfa5e100c7882b7f
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
<template>
    <view class="container">
        <u-navbar :is-fixed="false" :border-bottom="false" :is-back="false" back-icon-name="arrow-leftward" title="登录"
            :background="{ background: '#fff' }" title-color="#000000">
            <view class="" slot="right">
                <image src="/static/images/login/c8.png" class="set-icon" mode="widthFix"></image>
            </view>
        </u-navbar>
 
        <view class="content">
            <view class="top">
                <view class="titie">
                    <span>洪城义警APP</span>
                </view>
                <view class="cell">
                    <view class="name">账号</view>
                    <view class="input-box">
                        <input type="text" v-model="names" placeholder="请输入账号" class="ipt" placeholder-class="hold"
                            @blur="handleInputCheck" />
                    </view>
                </view>
                <view class="cell">
                    <view class="name">密码</view>
                    <view class="input-box">
                        <input type="password" v-model="passwords" placeholder="请输入密码" class="ipt"
                            placeholder-class="hold" @blur="handleInputCheck" />
                    </view>
                </view>
                
                <!-- <view class="agree">
                    登录即代表同意
                    <text class="a">《用户协议》</text>
                    和
                    <text class="a">《隐私政策》</text>
                </view> -->
                <button class="submit" @click="longing(names,passwords)" :disabled="disabled">登录</button>
                <view class="tip">未注册用户注册审核通过后才可登录</view>
                <navigator url="/pages/registerUser/registerUser" hover-class="none" class="change">注册 ></navigator>
            </view>
 
            <!-- 社交账号登录 -->
            <view class="bottom">
                <view class="tag"></view>
                <!-- <view class="tsp">江西北邮信息通信技术有限公司</view> -->
            </view>
        </view>
        <!--  -->
    </view>
</template>
 
<script>
    import WxStorage from "../../static/lib/wxStorage.js" //微信Storage
    export default {
        data() {
            return {
                icons: '',
                names: '',
                passwords: '',
                msg: '',
                colors: '#123456',
                disabled: true
            }
        },
        computed: {
            OURpass() {
                return this.$store.state.loging;
            }
        },
        methods: {
            judgeUse() {
                
                // var main = plus.android.runtimeMainActivity();//获取当前的Activity
                // var res=main.getResData();//直接调用自定义Activity中的getResData方法
                // uni.showToast({
                //     title: res,
                //     icon:'none',
                //     duration: 2000
                // });
                
                var login = WxStorage.get("init") //重复登录
                var name = WxStorage.get("name")
                var userID = WxStorage.get("ids")
                var accounts = WxStorage.get("accounts");
                var pass = WxStorage.get("pass");
                console.log(login);
                if (login == "true" && name != '') {
                    //获取用户信息
                    var data = {
                        userName: name,
                        userID: userID
                    }
                    this.$store.commit('getUse', data)
                    // wx.reLaunch({
                    //     url: '/pages/alarm_list/alarm_list?login=' + data.userName
                    // })
                    this.names = accounts;
                    this.passwords = pass;
                }
            },
            judgeMsg() {
                this.msg = this.names == '' ? (this.passwords == '' ? '账号密码不能为空' : '账号不能为空') : (this.passwords == '' ?
                    '密码不能为空' : this.passwords.length <= 5 ? '密码最少6位' :
                    '格式正确');
                if (this.msg == "格式正确") {
                    this.icons = 'success';
                    this.colors = '#4ac503';
                    this.disabled = false
                } else {
                    this.icons = 'warn';
                    this.colors = '#d53c00';
                }
            },
            longing(name, pass) {
                var data = {
                    name: name,
                    pass: pass,
                }
                this.judgeMsg();
                if (this.msg == "格式正确") {
                    uni.showNavigationBarLoading();
                    this.$store.dispatch('loging', data)
                }else{
                    uni.showToast({
                        title: '格式错误,请重试',
                        icon:'none',
                        duration: 2000
                    });
                }
            },
            handleInputCheck() {
                //this.disabled = false
            },
            zhuce(){
                uni.navigateTo({
                    url:'/pages/registerUser/registerUser'
                })
            }
        },
        created() {
            this.judgeUse();
        },
        watch: {
            names() {
                this.judgeMsg();
            },
            passwords() {
                this.judgeMsg();
            },
            OURpass() {
                if (this.OURpass == true) {
                    this.passwords = '******';
                    uni.hideNavigationBarLoading();
                    uni.reLaunch({
                        url: '../home/home'
                    })
                    return '成功登录'
                } else {
                    this.icons = 'warn';
                    this.colors = '#d53c00';
                    this.msg = '账号密码错误';
                    this.$store.commit('loginReset', this); //重置登录
                    uni.hideNavigationBarLoading();
                    return '未成功登录'
                }
            }
        }
    }
</script>
 
<style lang="scss">
    .titie{
        display: block;
        width: 281rpx;
        height: auto;
        margin: 0 auto 120rpx;
        span {
            font-weight: 600;
            font-size: 6vw;
            color: #103289;
        }
    }
    .container {
        min-height: 100vh;
        overflow: hidden;
    
        .set-icon {
            vertical-align: middle;
            width: 41rpx;
            height: auto;
            margin-right: 35rpx;
        }
    }
    
    .content {
        display: flex;
        flex-direction: column;
        justify-content: space-around;
        align-items: center;
    
        height: 90vh;
        width: 100%;
    
        .top {
            width: 100%;
        }
    
        .logo {
            display: block;
            width: 281rpx;
            height: auto;
            margin: 0 auto 120rpx;
        }
    
        .cell {
            width: 100%;
            padding: 0 85rpx;
            box-sizing: border-box;
            margin-top: 36rpx;
    
            .name {
                font-size: 22rpx;
                font-family: Source Han Sans CN;
                font-weight: 400;
                color: #3e4a59;
                line-height: 30rpx;
                opacity: 0.72;
            }
    
            .input-box {
                padding: 30rpx 0;
                border-bottom: 2rpx solid #f6f6f6;
                display: flex;
                align-items: center;
    
                .code {
                    font-size: 22rpx;
                    font-family: Source Han Sans CN;
                    font-weight: 400;
                    color: #0d0d0d;
                    line-height: 30rpx;
    
                    text {
                        color: #103289;
                    }
                }
    
                .ipt {
                    flex: 1;
                    // height: 24rpx;
                    font-size: 24rpx;
                }
    
                .hold {
                    font-size: 26rpx;
                    font-family: Source Han Sans CN;
                    font-weight: 400;
                    color: #3e4a59;
                    line-height: 30px;
                    opacity: 0.45;
                }
            }
        }
    
        .agree {
            margin: 27rpx 95rpx 0;
            font-size: 22rpx;
            font-family: Adobe Heiti Std;
            font-weight: normal;
            color: #cacaca;
            line-height: 34rpx;
    
            .a {
                color: #000000;
            }
        }
    
        .submit {
            margin: 60rpx 90rpx 0;
            border: none;
            width: 572rpx;
            height: 86rpx;
            line-height: 86rpx;
            box-sizing: border-box;
            border-radius: 15rpx;
            background-color: #103289;
            color: #ffffff;
    
            &::after {
                content: none;
            }
    
            &::before {
                content: none;
            }
    
            &[disabled='true'] {
                background: #e4e4e4;
                font-size: 36rpx;
                font-family: Source Han Sans CN;
                font-weight: 500;
                color: #ffffff;
            }
        }
    
        .tip {
            margin-top: 30rpx;
            text-align: center;
            font-size: 22rpx;
            font-family: Adobe Heiti Std;
            font-weight: normal;
            color: #cacaca;
            line-height: 34rpx;
        }
        .tsp {
            margin-top: 30rpx;
            text-align: center;
            font-size: 28rpx;
            font-family: Adobe Heiti Std;
            font-weight: normal;
            color: #a8a8a8;
            line-height: 34rpx;
        }
    
        .change {
            margin-top: 20rpx;
            text-align: center;
            font-size: 22rpx;
            font-family: Adobe Heiti Std;
            font-weight: normal;
            color: #103289;
            line-height: 34rpx;
        }
    
        .tag {
            display: flex;
            justify-content: center;
            align-items: center;
            font-size: 22rpx;
            font-family: Adobe Heiti Std;
            font-weight: normal;
            color: #9f9f9f;
            line-height: 34rpx;
    
            &::before {
                content: '';
                display: block;
                width: 160rpx;
                height: 1px;
                background: #d8d8d8;
                opacity: 0.86;
            }
    
            &::after {
                content: '';
                display: block;
                width: 160rpx;
                height: 1px;
                background: #d8d8d8;
                opacity: 0.86;
            }
        }
    
        .chat-arr {
            margin-top: 50rpx;
            display: flex;
            align-items: center;
            justify-content: space-between;
    
            .icon {
                width: 73rpx;
                height: 73rpx;
            }
        }
    }
</style>