king
2022-05-27 b0ac697766a84e6e9643bb9b1d22843cc0df8c55
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
<template>
    <div class="sign-form-wrap">
        <header class="logo-header">
            <img src="../../img/mingke_logo.png" alt="">
            <span class="plat-name">明科开发者平台</span>
            <a class="plat-name" :style="{color: '#40a9ff', border: 0}" href="http://mk9h.cn/a.asp?a=9CCB" ref="nofollow" target="_blank">文档中心</a>
            <!-- <div class="find-password" @click="forgotPwd()">忘记密码?</div> -->
        </header>
        <div v-if="member_type === ''" class="member-wrap">
            <div class="member-item personal" @click="changeType('personal')">
                <div class="title">个人版</div>
                <div class="content">限时注册,终身免费使用</div>
            </div>
            <div class="member-item enterprise" @click="changeType('enterprise')">
                <div class="title">企业版</div>
                <div class="content">更多的业务模板,更好的企业服务</div>
            </div>
        </div>
        <el-tabs v-if="member_type !== ''" :tab-position="'left'" :style="{position: 'absolute'}" :before-leave="changeTab">
            <el-tab-pane label="手机号注册">
            </el-tab-pane>
            <el-tab-pane label="邮箱注册">
            </el-tab-pane>
        </el-tabs>
        <div v-if="member_type !== '' && signtype !== 'email'">
            <div class="header">
                明科帐号注册
                <span class="to-login">
                    已有账号,
                    <a href="http://cloud.mk9h.cn/index.html" ref="nofollow" target="_blank">去登陆<i class="el-icon-arrow-right"></i></a>
                </span>
            </div>
            <div class="center">
                <div>
                    <el-input size="small" placeholder="请输入手机号" @input="valChange()" v-model="phoneNo">
                        <template slot="prepend">+86</template>
                    </el-input>
                </div>
                <div class="slider-block">
                    <SliderVerificationCode v-model="pass"/>
                </div>
                <div>
                    <el-input size="small" class="ver-code" @input="valChange()" placeholder="请输入验证码" v-model="verCode">
                        <el-button slot="append" size="small" @click="getVerCode()" :disabled="!pass || verCodeDisabled"><span v-text="verCodeTip"></span></el-button>
                    </el-input>
                </div>
                <div>
                    <el-input size="small" placeholder="邮箱地址" v-model="email"></el-input>
                </div>
                <div class="password-wrap">
                    <el-input placeholder="密码" size="small" @input="valChange()" :maxlength="12" :show-password="true" v-model="password"></el-input>
                    <el-tooltip class="item" effect="dark" content="密码最大为12位,可以使用数字、字母及!@#$%&*()_" placement="top">
                        <i class="el-icon-info"></i>
                    </el-tooltip>
                </div>
                <div>
                    <el-input placeholder="确认密码" size="small" @input="valChange()" :maxlength="12" :show-password="true" v-model="confirmPassword"></el-input>
                </div>
                <div>
                    <el-date-picker v-model="birthday" type="date" value-format="yyyy-MM-dd" size="small" @change="valChange()" placeholder="选择出生日期"></el-date-picker>
                </div>
                <div>
                    <el-button class="sub-button" type="primary" @click="submitLogin()" :disabled="subdisabled" :loading="subloading">注册</el-button>
                </div>
            </div>
        </div>
        <div v-if="member_type !== '' && signtype === 'email'">
            <div class="header">
                明科帐号注册
                <span class="to-login">已有账号,<a href="http://cloud.mk9h.cn/index.html" ref="nofollow" target="_blank">去登陆<i class="el-icon-arrow-right"></i></a></span>
            </div>
            <div class="center">
                <div>
                    <el-input size="small" placeholder="邮箱地址" v-model="email"></el-input>
                </div>
                <div class="slider-block">
                    <SliderVerificationCode v-model="pass"/>
                </div>
                <div>
                    <el-input size="small" class="ver-code" placeholder="请输入验证码" v-model="verCode">
                        <el-button slot="append" size="small" @click="getVerCode()" :disabled="!pass || verCodeDisabled">
                            <span v-text="verCodeTip"></span>
                        </el-button>
                    </el-input>
                </div>
                <div>
                    <el-input size="small" placeholder="请输入手机号" v-model="phoneNo"></el-input>
                </div>
                <div class="password-wrap">
                    <el-input placeholder="密码" size="small" :maxlength="12" :show-password="true" v-model="password"></el-input>
                    <el-tooltip class="item" effect="dark" content="密码最大为12位,可以使用数字、字母及!@#$%&*()_" placement="top">
                        <i class="el-icon-info"></i>
                    </el-tooltip>
                </div>
                <div>
                    <el-input placeholder="确认密码" size="small" :maxlength="12" :show-password="true" v-model="confirmPassword"></el-input>
                </div>
                <div>
                    <el-date-picker v-model="birthday" type="date" value-format="yyyy-MM-dd" @change="valChange()" size="small" placeholder="选择出生日期"></el-date-picker>
                </div>
                <div>
                    <el-button class="sub-button" type="primary" @click="submitLogin()" :disabled="subdisabled" :loading="subloading">注册</el-button>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script>
    import Utils from '@/utils'
    import md5 from 'md5'
 
    let timer = null
 
    export default {
        data() {
            return {
                signtype: '',
                phoneNo: '',
                email: '',
                verCode: '',
                verCodeTip: '获取验证码',
                verCodeDisabled: false,
                delay: 60,
                password: '',
                pass: false,
                birthday: '',
                confirmPassword: '',
                subdisabled: true,
                subloading: false,
                sendcode: false,
                member_type: ''
            }
        },
        methods: {
            handleChange () {
 
            },
            forgotPwd () {
                this.$router.push({name: 'forgotPwd'})
            },
            getVerCode () {
                let error = false
                let param = null
 
                if (this.signtype !== 'email') {
                    if (!this.phoneNo) {
                        this.$message({
                            message: '请输入手机号!',
                            type: 'warning'
                        })
                        return
                    } else if (!/^1[3456789]\d{9}$/.test(this.phoneNo)) {
                        this.$message({
                            message: '手机号码有误,请重填!',
                            type: 'warning'
                        })
                        return
                    }
                } else {
                    if (!this.email) {
                        this.$message({
                            message: '请输入邮箱地址!',
                            type: 'warning'
                        })
                        return
                    } else if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) {
                        this.$message({
                            message: '邮箱格式有误,请重填!',
                            type: 'warning'
                        })
                        return
                    }
                }
 
                if (this.signtype !== 'email') {
                    param = {
                        func: 'MSN_sms_send_code',
                        send_type: 'register',
                        mob: this.phoneNo,
                        timestamp: Utils.getCurrentTime(),
                        // ID: '20200522115033857N9C7S41G77G31OT52QN'
                        ID: '202009091111401359QCBR94T2GFGBO25PG6'
                    }
 
                    param.LText = md5(`${this.phoneNo}mingke${window.GLOB.appkey}${param.timestamp}`)
                } else {
                    param = {
                        func: 'MSN_email_send_code',
                        send_type: 'register',
                        email: this.email,
                        timestamp: Utils.getCurrentTime(),
                        ID: '20200518162835149CE25P520L0UODMVQ5FM'
                    }
 
                    param.LText = md5(`${window.GLOB.appkey}mingke${this.email}${param.timestamp}`)
                }
 
                param.secretkey = md5(`${param.LText}mingke${param.timestamp}`)
 
                this.verCodeDisabled = true
                this.Service.setSSORequest(param).then(res => {
                    if (res.status) {
                        this.sendcode = true
                        this.verCodeTip = '获取验证码(60s)'
                        timer = setTimeout(this.resetVerCodeTip, 1000)
                    } else {
                        this.verCodeDisabled = false
                        this.$message({
                            message: res.message,
                            type: 'error'
                        })
                    }
                })
            },
            valChange () {
                let valid = true
 
                if (!this.phoneNo) {
                    valid = false
                } else if (!this.email) {
                    valid = false
                } else if (!this.verCode) {
                    valid = false
                } else if (!this.password) {
                    valid = false
                } else if (!this.confirmPassword) {
                    valid = false
                } else if (!this.birthday) {
                    valid = false
                } else if (!this.sendcode) {
                    valid = false
                }
 
                if (valid) {
                    this.subdisabled = false
                } else {
                    this.subdisabled = true
                }
            },
            resetVerCodeTip () {
                if (this.delay > 1) {
                    this.delay--
                    this.verCodeTip = `获取验证码(${this.delay}s)`
                    timer = setTimeout(this.resetVerCodeTip, 1000)
                } else {
                    this.verCodeDisabled = false
                    this.delay = 60
                    this.verCodeTip = '获取验证码'
                }
            },
            submitLogin () {
                if (!this.phoneNo) {
                    this.$message({
                        message: '请输入手机号!',
                        type: 'warning'
                    })
                    return
                } else if (!/^1[3456789]\d{9}$/.test(this.phoneNo)) {
                    this.$message({
                        message: '手机号码有误,请重填!',
                        type: 'warning'
                    })
                    return
                } else if (!this.email) {
                    this.$message({
                        message: '请输入邮箱地址!',
                        type: 'warning'
                    })
                    return
                } else if (!/^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/.test(this.email)) {
                    this.$message({
                        message: '邮箱格式有误,请重填!',
                        type: 'warning'
                    })
                    return
                } else if (!this.verCode) {
                    this.$message({
                        message: '请输入验证码!',
                        type: 'warning'
                    })
                    return
                } else if (!this.password) {
                    this.$message({
                        message: '请输入密码!',
                        type: 'warning'
                    })
                    return
                } else if (!/^[0-9a-zA-Z!@#$%^&*()_]*$/.test(this.password)) {
                    this.$message({
                        message: '密码只可以使用数字、字母及!@#$%&*()_。',
                        type: 'warning'
                    })
                    return
                } else if (this.password !== this.confirmPassword) {
                    this.$message({
                        message: '两次输入密码不一致!',
                        type: 'warning'
                    })
                    return
                } else if (!this.birthday) {
                    this.$message({
                        message: '请选择出生日期!',
                        type: 'warning'
                    })
                    return
                }
 
                let param = {
                    func: 'msn_user_registry',
                    mob: this.phoneNo,
                    email: this.email,
                    country: 'China',
                    check_code: this.verCode,
                    pwd: this.password,
                    birthday: this.birthday,
                    Type_reg: this.signtype !== 'email' ? 'mob' : 'email',
                    member_type: this.member_type,
                    timestamp: Utils.getCurrentTime()
                }
 
                if (this.$route.query.partner_id) {
                    param.partner_id = this.$route.query.partner_id
                }
 
                param.LText = md5(`${window.GLOB.appkey}mingke${this.phoneNo}${this.email}`)
                param.secretkey = md5(`${param.LText}mingke${param.timestamp}`)
 
                this.subdisabled = true
                this.subloading = true
                this.Service.setSSORequest(param).then(res => {
                    if (res.status) {
                        this.subdisabled = false
                        this.subloading = false
                        this.$router.push({name: 'signSuccess', params: {type: 'signup'}})
                    } else {
                        this.subdisabled = false
                        this.subloading = false
                        this.$message({
                            message: res.message,
                            type: 'error'
                        })
                    }
                })
            },
            changeType(type) {
                this.member_type = type
            },
            changeTab () {
                if (this.signtype === 'phone') {
                    this.signtype = 'email'
                } else {
                    this.signtype = 'phone'
                }
 
                this.phoneNo = ''
                this.email = ''
                this.verCode = ''
                this.verCodeTip = '获取验证码'
                this.verCodeDisabled = false
                this.delay = 60
                this.password = ''
                this.birthday = ''
                this.confirmPassword = ''
                this.subdisabled = true
                this.subloading = false
 
                if (timer) {
                    clearTimeout(timer)
                }
            }
        },
        destroyed () {
            if (timer) {
                clearTimeout(timer)
            }
        }
    }
</script>
 
<style lang="less" scoped>
    .member-wrap {
        text-align: center;
        margin-top: 20vh;
        .member-item {
            display: inline-block;
            width: 270px;
            border-radius: 4px;
            padding: 40px 0px;
            cursor: pointer;
            height: 200px;
            vertical-align: top;
            color: #ffffff;
        }
 
        .title {
            font-size: 24px;
            font-weight: bold;
            margin-bottom: 30px;
        }
        .personal {
            background: #1890ff;
            box-shadow: 0 0 4px #1890ff;
        }
        .enterprise {
            margin-left: 40px;
            background: #fa8c16;
            box-shadow: 0 0 4px #fa8c16;
        }
    }
    .sign-form-wrap {
        position: relative;
        width: 1200px;
        margin: 0 auto;
        .logo-header {
            position: relative;
            background: #fafafa;
            margin-bottom: 15px;
            height: 50px;
            padding: 7px 15px;
            img {
                height: 40px;
                line-height: 50px;
            }
            .plat-name {
                border-left: 2px solid #d9d9d9;
                margin-left: 5px;
                padding-left: 10px;
                font-size: 16px;
            }
        }
 
        .slider-block {
            display: inline-block;
            width: 350px;
            margin-bottom: 20px;
        }
 
        .find-password {
            position: absolute;
            top: 15px;
            right: 0px;
            font-size: 13px;
            color: #40a9ff;
            cursor: pointer;
        }
 
        .el-tabs__nav-wrap.is-left::after {
            height: 0;
        }
        .header {
            margin: 0 auto;
            text-align: center;
            padding-top: 30px;
            font-size: 20px;
            
            .to-login {
                display: block;
                font-size: 13px;
 
                a {
                    color: #40a9ff;
                }
            }
        }
        .center {
            text-align: center;
            margin-top: 35px;
            .ver-code {
                .el-input-group__append {
                    .el-button {
                        color: #40a9ff;
                        border: none;
                    }
                }
            }
            .sub-button {
                width: 350px;
                border-radius: 4px;
                margin-top: 30px;
                background-color: #1890ff;
                border-color: #1890ff;
            }
            .sub-button.is-disabled {
                opacity: 0.5;
            }
        }
        .password-wrap {
            position: relative;
            .el-icon-info {
                position: absolute;
                top: 9px;
                margin-left: 5px;
                color: #fa8c16;
            }
        }
    }
 
    @media (min-width: 1550px) {
        .sign-form-wrap {
            .center {
                .sub-button {
                    width: 400px;
                }
            }
            .slider-block {
                width: 400px;
            }
        }
    }
</style>