zj
2024-06-03 89d48809779ae41f8712539584798d5900b64b78
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
512
513
514
515
516
517
518
<template>
  <div class="wrapper">
    <div class="header">
      <!-- <a href="/homes" class="nav-left pull-left">
          <img :src="siteInfo.siteLogo" alt="">
      </a> -->
      <home-header></home-header>
    </div>
    <div class="loginbg-box">
      <!-- <img class="login-img" src="../../assets/image/login.jpeg" alt=""> -->
    </div>
    <div class="login-box">
      <div class="form-box top-box">
      <!--  <p class="animated fadeInDown">专线直连 机构版交易</p>
        <p class="prompt animated fadeInUp">为投资者量身定做机构版投资软件</p> -->
      </div>
      <div class="form-box">
        <h2 style="text-align: center;">注册</h2>
        <el-form :hide-required-asterisk='true' :model="form" ref="ruleForm" :rules="rule" class="demo-form-inline">
          <el-form-item label="" prop="phone">
            <el-input maxlength='11' class="user-phone" max="11" type='text' v-model="form.phone" placeholder="请输入手机号码">
              <i slot="prepend" class="iconfont icon-shouji1" style="font-size:14px"></i>
            </el-input>
          </el-form-item>
          <el-form-item label=""  prop="code" v-if="$store.state.siteInfo.smsDisplay">
            <el-input type='text' class="user-phone" v-model="form.code" placeholder="验证码">
              <el-button v-if="codeshow" @click="getCode" slot="append">点击获取验证码</el-button>
              <el-button v-if="!codeshow" slot="append">{{count}}S</el-button>
              <i slot="prepend" class="iconfont icon-tongguo5" ></i>
            </el-input>
          </el-form-item>
          <el-form-item label="" prop="pwd">
            <el-input type='password' class="user-phone" v-model="form.pwd" placeholder="密码为6~12位数字、字母或符号">
              <i slot="prepend" class="iconfont icon-zu" style="font-size: 15px;"></i>
            </el-input>
          </el-form-item>
          <el-form-item label="" prop="pwd2">
            <el-input type='password' class="user-phone" v-model="form.pwd2" placeholder="请再次确认密码">
              <i slot="prepend" class="iconfont icon-zu" style="font-size: 15px;"></i>
            </el-input>
          </el-form-item>
          <el-form-item label="" prop="invitecode">
            <el-input type='text' class="user-phone" v-model="form.invitecode" placeholder="机构代码">
              <i slot="prepend" class="iconfont icon-tuijian"></i>
            </el-input>
          </el-form-item>
        </el-form>
        <el-row class="buy-item text-left agree-box">
          <el-checkbox class="check-box" v-model="agree" name="type"></el-checkbox>
          我已阅读并同意<a @click="agreeDialogVisible = true" href="javascript:;">《注册协议》</a>和<a
          @click="tradeDialogVisible = true" href="javascript:;">《{{siteInfo.tradeAgreeTitle}}》</a>
        </el-row>
        <div slot="footer" class="dialog-footer">
          <el-button class="box-btn" type="primary" :loading="islogin" @click="submit('ruleForm')">注 册</el-button>
        </div>
        <div class="text-left" style="text-align: right;">
          已有账号?<a @click="toLogin">返回登录</a>
        </div>
      </div>
    </div>
    <div>
 
    </div>
    <newFooter></newFooter>
    <!-- <home-footer :siteInfo="siteInfo"></home-footer> -->
    <!-- <code-dialog ref="codeDialog"></code-dialog> -->
    <el-dialog
      title="验证码"
      class="er-code-dialog"
      :center='true'
      :visible.sync="dialogVisible"
      width="400px">
      <div class="dialog-box">
        <el-form :hide-required-asterisk='true' class="demo-form-inline">
          <el-form-item label="" prop="phone">
            <el-input type='text' v-model="form.code2" placeholder="请输入验证码">
              <img slot="append" @click="refreshImg" :src="adminUrl+'/code/getCode.do?time=' + imgCodeTime" height="45px"
                   width="100px">
            </el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="text-center dialog-footer">
          <el-button type="primary" @click="checkImg">确定</el-button>
        </div>
      </div>
 
    </el-dialog>
    <el-dialog
      title="注册协议"
      class="agree-dialog"
      :center='true'
      :visible.sync="agreeDialogVisible"
      width="80%">
      <div class="dialog-iframe">
        <div class="content" style="margin:20px;background:#fff;border-radius:5px;margin-top:60px;line-height:200%;">
            <p v-for="item in regAgreeText.split('。')" :key="item">{{item}}。</p>
        </div>
        <!-- <iframe class="iframe-box" :src="$store.state.siteInfo.regAgree" frameborder="0"></iframe> -->
        <div slot="footer" class="text-center dialog-footer">
          <el-button type="primary" @click="agreeRegister">我已阅读并同意注册协议</el-button>
        </div>
      </div>
    </el-dialog>
    <el-dialog
      :title="siteInfo.tradeAgreeTitle"
      class="agree-dialog"
      :center='true'
      :visible.sync="tradeDialogVisible"
      width="80%">
      <div class="dialog-iframe">
        <div class="content" style="margin:20px;background:#fff;border-radius:5px;margin-top:60px;line-height:200%;">
            <p v-for="item in tradeAgreeText.split('。')" :key="item">{{item}}。</p>
        </div>
        <!-- <iframe class="iframe-box" :src="$store.state.siteInfo.tradeAgree" frameborder="0"></iframe> -->
        <div slot="footer" class="text-center dialog-footer clearfix">
          <el-button type="primary" @click="agreeTrade">我已阅读并同意{{siteInfo.tradeAgreeTitle}}</el-button>
        </div>
      </div>
    </el-dialog>
  </div>
</template>
 
<script>
  import HomeFooter from '../../components/Footer'
  import HomeHeader from '../../components/HeaderOrder'
  // import CodeDialog from './code'
  import * as api from '../../axios/api'
import newFooter from '@/components/newFooter'
 
  export default {
    components: {
      HomeFooter,
      HomeHeader,
      newFooter
      // CodeDialog
    },
    props: {},
    data () {
      let validatePass = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请输入手机号码'))
        } else {
          // let myreg = /^[1][3,4,5,7,8][0-9]{9}$/  //手机号码验证
          let myreg = /^[0-9]{11}$/ // 手机号码验证
          if (!myreg.test(value)) {
            callback(new Error('请输入正确的手机号码'))
          }
          callback()
        }
      }
      let validatePass2 = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请输入密码'))
        } else {
          // let val = value.replace(/\s*/g, '')
          let valuereg = value.replace(/\s*/g, '')
          let myreg = /^[a-zA-Z0-9!@#$%^&*.]{6,12}$/ // 密码
          if (!myreg.test(valuereg)) {
            callback(new Error('请输入正确的密码'))
          }
          callback()
        }
      }
      let validatePass3 = (rule, value, callback) => {
        if (value === '') {
          callback(new Error('请确认密码'))
        } else {
          if (value !== this.form.pwd) {
            callback(new Error('两次输入的密码不一致'))
          }
          callback()
        }
      }
      return {
        agree: true,
        tradeDialogVisible: false, // 风险揭示
        agreeDialogVisible: false, // 协议弹窗
        dialogVisible: false,
        islogin: false,
        regAgreeText: '',
        tradeAgreeText: '',
        siteInfo: {},
        form: {
          phone: '',
          code: '',
          code2: '',
          pwd: '',
          pwd2: '',
          invitecode: ''
        },
        rule: {
          phone: [
            { required: true, validator: validatePass, message: '请输入手机号码', trigger: 'blur' }
          ],
          pwd: [
            { required: true, validator: validatePass2, message: '请输入密码', trigger: 'blur' }
            // { min: 6,max:12, message: '密码最少为6到12位数', trigger: 'blur' },
          ],
          code: [
            { required: true, message: '请输入验证码', trigger: 'blur' }
          ],
          pwd2: [
            { required: true, validator: validatePass3, message: '请确认密码', trigger: 'blur' }
          ],
          invitecode: [
            { required: true, message: '请输入机构代码', trigger: 'blur' }
          ]
        },
        adminUrl: '',
        timer: null,
        count: 0,
        codeshow: true,
        imgCodeTime: 0
      }
    },
    watch: {},
    computed: {},
    created () {},
    mounted () {
      this.getInfoSite()
      this.form.invitecode = this.$route.query.code
    },
    methods: {
      refreshImg () {
        this.adminUrl = ''
        this.imgCodeTime = Date.now()
        this.dialogImgShow = false
        let this_ = this
        setTimeout(function () {
          this_.adminUrl = process.env.API_HOST
          if (this_.adminUrl === undefined) {
            this_.adminUrl = ''
          }
          this_.dialogImgShow = true
        }, 500)
      },
      async getInfoSite () {
        // 获取网站信息
        let result = await api.getInfoSite()
        if (result.status === 0) {
          this.siteInfo = result.data
          if(this.siteInfo.smsDisplay === false){
              this.form.code = '6666'
          }
          this.regAgreeText = this.siteInfo.regAgreeText
          this.tradeAgreeText = this.siteInfo.tradeAgreeText
          this.$store.state.siteInfo = this.siteInfo
          this.form.invitecode = this.siteInfo.agentCode
        } else {
          this.$message.error(result.msg)
        }
      },
      submit (formName) {
        // 提交
        this.$refs[formName].validate(async (valid) => {
          if (valid) {
            if (!this.agree) {
              this.$message.error('请先同意注册协议')
            }
            let opts = {
              // agentCode:'4023', // SR330001
              phone: this.form.phone,
              yzmCode: this.form.code,
              userPwd: this.form.pwd,
              agentCode: this.form.invitecode
            }
            this.islogin = true
            let data = await api.register(opts)
            if (data.status === 0) {
              this.$message.success('注册成功,请登录')
              this.$router.push('/login')
            } else {
              this.$message.error(data.msg)
            }
            this.islogin = false
          } else {
            return false
          }
        })
      },
      getCode () {
        if (!this.form.phone) {
          this.$message.error('请输入电话号码')
        } else {
          // let myreg = /^[1][3,4,5,7,8][0-9]{9}$/  //手机号码验证
          let myreg = /^[0-9]{11}$/ // 手机号码验证
          if (!myreg.test(this.form.phone)) {
            this.$message.error('请输入正确的电话号码')
          } else {
            this.checkPhone()
          }
        }
      },
      async checkPhone () {
        // 先验证是否已经注册
        let data = await api.checkPhone({ phoneNum: this.form.phone })
        if (data.status === 0) {
          // 如果用户已存在返回 0
          this.$message.error('已注册,请登录')
          this.$router.push('/login')
        } else {
          this.adminUrl = process.env.API_HOST
          if (this.adminUrl === undefined) {
            this.adminUrl = ''
          }
          // this.dialogVisible = true
          this.getcode()
        }
      },
      async checkImg () {
        if (!this.form.code2) {
          this.$message.error('您输入的验证码有误,请重新输入')
          return
        }
        // await this.checkCode()
        let data = await api.checkCode({ code: this.form.code2 })
        if (data === 'true' || data === true) {
          this.getcode()
          this.dialogVisible = false
        } else {
          this.refreshImg()
          this.$message.error('您输入的验证码有误,请重新输入')
        }
      },
      async getcode () {
        //   var sign  = this.$md5(this.phone+'W&WzL42v').toUpperCase()
        let result = await api.getCode({ phoneNum: this.form.phone })
        if (result.status === 0) {
          const TIME_COUNT = 60
          if (!this.timer) {
            this.count = TIME_COUNT
            this.codeshow = false
            this.timer = setInterval(() => {
              if (this.count > 0 && this.count <= TIME_COUNT) {
                this.count--
              } else {
                this.codeshow = true
                clearInterval(this.timer)
                this.timer = null
              }
            }, 1000)
          } else {
            this.$message.error(result.msg)
          }
        } else {
          this.$message.error(result.msg)
        }
      },
      toLogin () {
        // 去注册
        this.$store.state.loginIsShow = false
        this.$router.push('/login')
      },
      agreeRegister () {
        // this.agree = true
        this.agreeDialogVisible = false
      },
      agreeTrade () {
        // this.agree = true
        this.tradeDialogVisible = false
      }
    }
  }
</script>
<style lang="less" scoped>
/deep/ .user-phone input {
  border: none;
  margin-left: 10px;
  
}
/deep/ .login-box .el-input-group__prepend {
  left: 12px;
}
.login-box .text-right[data-v-23b3be22]{
      margin: 25px 0 22px;
      
}
.login-box .form-box[data-v-23b3be22]{
  
    height: 400px;
    border-radius: 5px;
}
.black-bg {
  .user-phone {
    background-color: #2f2f2f;
    border-radius: 50px;
  }
  .el-button--primary{
    background-color: rgb(2, 77, 161) !important;
    border: none;
    border-radius: 50px;
  }
}
.red-bg {
  .user-phone {
    
    border: 1px solid rgb(150, 150, 150);
    border-radius: 50px;
  }
  .el-button--primary{
    border: none;
    border-radius: 50px;
  }
}
  .header {
    height: 60px;
    // background: #fff;
    // padding: 0 20px;
 
    img {
      height: 58px;
      line-height: 58px;
    }
  }
 
  .login-box {
    width: 80%;
    margin: 0 auto;
    height: 540px;
    position: relative;
 
    .form-box {
      width: 320px;
      height: 500px;
      text-align: center;
      position: absolute;
      right: 0;
      top: 32px;
      // background: #fff;
      z-index: 2;
      padding: 0 40px;
      border-radius: 4px;
 
      h2 {
        height: 30px;
        line-height: 30px;
        text-align: left;
        font-size: 26px;
        padding-top: 30px;
      }
 
      .el-form {
        padding-top: 20px;
 
      }
    }
 
    .dialog-footer {
      margin-top: 15px;
    }
  }
 
  .login-box .text-left {
    padding: 10px 0;
  }
 
  .er-code-dialog {
    /deep/ .el-input-group__append {
      padding: 0;
      border: none;
    }
 
    /deep/ .el-input__inner {
      height: 45px;
      line-height: 45px;
    }
 
    /deep/ .el-button--primary {
      width: 80%;
 
    }
  }
 
  .dialog-iframe {
    .iframe-box {
      width: 100%;
      height: 460px;
    }
 
    .dialog-footer {
      //  height: 300px;
      margin-top: 20px;
    }
  }
 
  .form-box {
    .agree-box {
      padding: 10px 0px 0px;
      font-size: 12px;
      line-height: 20px;
    }
 
    .dialog-footer[data-v-94470b58] {
      margin-top: 10px;
    }
  }
 
  .login-box .top-box {
    position: absolute;
    top: 34%;
    width: 50%;
    height: 150px;
    left: 0;
    right: auto;
    background: none;
 
    .prompt {
      color: #b6b6b6;
      font-size: 18px;
    }
 
    p {
      color: #efbb53;
      font-size: 34px;
      margin-bottom: 40px;
    }
  }
</style>