<commit_before>/**
* Created by 于士博 on 2017/7/25.
* QQ: 491387425
* weChat: 491387425
* 移动端登录页：目前功能为登录
*/

<template>
  <div class="login">
    <div class="title">
      <h2>密码登录</h2>
      <img class="photo" src="../../assets/JS-logo.png" alt="">
    </div>
    <input-del
            placeholder="请输入邮箱或者手机号码"
            @check="checkAccount">
    </input-del>
    <input-del
            placeholder="请输入密码"
            inputType="password"
            @check="checkPwd">
    </input-del>
    <div class="btn-login"
         :class="{btnAvailable : account && password }"
         @click="login">
      登录
    </div>
    <span class="btn-forget" @click="toForget">
      忘记密码?
    </span>
  </div>
</template>

<script>
  // 组件
  import inputDel from './inputDel.vue'
  import Toast from './toast/toast.js'
  export default {
    data () {
      return {
        account: null,
        password: <PASSWORD>
      }
    },
    components: {
      inputDel
    },
    created () {

    },
    methods: {
      toForget () {
        Toast('router到 忘记密码.vue')
      },
      checkAccount (msg) {
        this.account = msg
      },
      checkPwd (msg) {
        this.password = <PASSWORD>
      },
      login () {
        if (this.account && this.password) {
          if (!this.checkPhoneOrEmail(this.account)) {
            Toast('请输入正确的手机或邮箱')
          } else if (this.checkComplex(this.password) < 3) {
            Toast('密码必须含有大小写字母、数字、标点符号三种以上')
          } else {
            Toast('验证接口')
          }
        }
      },
      // 校验邮箱或手机 返回值为布尔值
      checkPhoneOrEmail (msg) {
        let emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
        let phoneReg = /^[1][0-9][0-9]{9}$/
        if (emailReg.test(msg) || phoneReg.test(msg)) {
          return true<commit_msg>增加登录接口<commit_after>/**
* Created by 于士博 on 2017/7/25.
* QQ: 491387425
* weChat: 491387425
* 移动端登录页：目前功能为登录
*/

<template>
  <div class="login">
    <div class="title">
      <h2>密码登录</h2>
      <img class="photo" src="../../assets/JS-logo.png" alt="">
    </div>
    <input-del
            placeholder="请输入邮箱或者手机号码"
            @check="checkAccount">
    </input-del>
    <input-del
            placeholder="请输入密码"
            inputType="password"
            @check="checkPwd">
    </input-del>
    <div class="btn-login"
         :class="{btnAvailable : account && password }"
         @click="login">
      登录
    </div>
    <span class="btn-forget" @click="toForget">
      忘记密码?
    </span>
  </div>
</template>

<script>
  // 组件
  import inputDel from './inputDel.vue'
  import Toast from './toast/toast.js'
  export default {
    data () {
      return {
        account: null,
        password: <PASSWORD>
      }
    },
    components: {
      inputDel
    },
    created () {

    },
    methods: {
      toForget () {
        Toast('router到 忘记密码.vue')
      },
      checkAccount (msg) {
        this.account = msg
      },
      checkPwd (msg) {
        this.password = msg
      },
      login () {
        if (this.account && this.password) {
          if (!this.checkPhoneOrEmail(this.account)) {
            Toast('请输入正确的手机或邮箱')
          } else if (this.checkComplex(this.password) < 3) {
            Toast('密码必须含有大小写字母、数字、标点符号三种以上')
          } else {
            let data = {
              username: this.account,
              password: <PASSWORD>
            }
            this.http.login(data).then(result => {
              console.log(result.data)
              if (result.data.code === '200') {
                this.$store.commit('login', result.data)
              } else {
                Toast({
                  message: result.data.msg,
                  position: 'bottom'
                })
              }
            })
          }
        }
      },
      // 校验邮箱或手机 返回值为布尔值
      checkPhoneOrEmail (msg) {
        let emailReg = /^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
        let phoneReg = /^[1][0-9][0-9]{9}$/
        if (emailReg.test(msg) || phoneReg.test(msg)) {
          return true
{'fraction_non_alphanumeric': 0.16960516513533647, 'fraction_numerical': 0.01763099081201887, 'mean_word_length': 1.5853658536585367, 'pattern_counts': {'":': 0, '<': 45, '<?xml version=': 0, '>': 44, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7225870', 'n_tokens_mistral': 1506, 'n_tokens_neox': 1539, 'n_words': 233}