// 验证码
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
}
})
}
相关文章
- 01-18Vue——Mall项目初始化及登录模块(九)
- 01-18vue拖放组件dnd-grid,容器与box间数据传递和渲染的代码逻辑
- 01-18vue-admin-template取消登录验证
- 01-18基于Vue+SpringCloudAlibaba微服务电商项目实战-构建会员服务-012:Vue如何解决SSO单点登录问题
- 01-18Vue登录密码的显示隐藏
- 01-18tp5.0+vue前后分离加入ucerter,实现同步通讯,登录,注册,退出
- 01-18Vue中Facebook第三方登录api实现
- 01-18vue router路由配置,元信息meta的使用-登录拦截验证
- 01-18Vue-element-UI中实现自己接口的登录步骤
- 01-18vue项目之登录功能