zoukankan      html  css  js  c++  java
  • vue login.js登录逻辑

        // 验证码
        changeImg() {
            this.imgurl = '/api/changeCode?' + Math.random()
          },
          login() {
            this.$refs.loginForm.validate(valid => {
              if (valid) {
                this.username = this.loginForm.username
                this.password = this.loginForm.password
                this.$http.post('/api/user/frontCheckLogin/' + this.username + '/' + this.password)
                  .then(res => {
                    // console.log(res.data)
                    if (res.data.code == 200) {
                      this.$store.commit('SET_TOKEN', this.loginForm.username)
                      this.$store.commit('GET_USER', this.loginForm)
                      // console.log(this.$store)
                      this.$http.get('/api/perm/2/')
                        .then(res => {
                          this.$store.commit('BTNS', res.data.data)
                        })
                      this.getSelection()
                      this.$message({
                        message: '登陆成功',
                        type: 'success',
                        customClass: 'zZindex',
                        duration: 1000
                      })
                    } else {
                      this.$message({
                        message: res.data.message,
                        type: 'error',
                        customClass: 'zZindex'
                      })
                    }
                  })
                  .catch(err => {
                    console.log(err)
                  })
              } else {
                console.log("error submit!!")
                return false
              }
            })
          }
    
  • 相关阅读:
    day4
    day3
    day2
    day1
    spring-boot-note
    spring-boot-cli
    jquery ajax rest invoke
    spring-boot
    docker mysql
    jpa OneToMany
  • 原文地址:https://www.cnblogs.com/knuzy/p/11374606.html
Copyright © 2011-2022 走看看