vue login.js登录逻辑
2023-09-27 14:26:02 时间
// 验证码
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
}
})
}
相关文章
- vue.js 错误提示bash: vue: command not found
- vue.js--基础 事件结合双向数据绑定实现todolist,增加和删除功能
- vue.js--基础 数据的双向绑定
- vue.js--基础 v-bind绑定属性使用
- Vue 样式绑定、事件绑定
- vue - config(index.js)
- 【Vue】Vue中“插件”的调用方法
- Vue Nuxt.js - 根据后端返回的唯一 ID / code,生成 “唯一“ 的推荐码、邀请码、订单号、加密路由、一串英文+数字长字符等 (支持反序列化原 ID 解码,逆向得出 ID 二者互转)
- Vue技能树使用情况测评及建议
- Node.js安装使用-VueCLI安装使用-工程化的Vue.js开发
- (12)打鸡儿教你Vue.js
- (5)打鸡儿教你Vue.js
- vue you can run: npm install --save !!vue-styles-loader!css-loader?
- Vue知识点总结(23)——Vue-Cli3脚手架基本配置和快速原型开发(超级详细)
- Vue 项目如何实现一个全局菜单搜索框
- 【Vue】Vue2组件传参总结来了(建议收藏)
- Vue事件总线
- 基于springboot+vue的“汽车租赁系统”程序设计实现【毕业论文,源码】
- 基于vue-cli构建vue-router的入门级demo
- vue中封装一个全局的弹窗js
- vue项目刷新当前页面的几种解决方案对比:如何优雅的强制重新渲染子组件
- Vue-cli 4在vue.config.js中配置别名
- vue These dependencies were not found: * core-js/modules/es.array.iterator in ./node_modules/@babe
- 深入理解Vue组件3大核心概念
- Vue路由跳转后 Index.html中引入的JS文件失效 问题解决
- 用JS简单实现Vue的双向绑定