From 176a3d89c13595c508a73fa0883f937e402c2345 Mon Sep 17 00:00:00 2001 From: fanluyan <754122931@qq.com> Date: Tue, 23 May 2023 09:19:04 +0800 Subject: [PATCH] login --- src/views/Login.vue | 25 ++++++++++++++++--------- src/views/realTimeMonitor/index.vue | 4 ++-- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/src/views/Login.vue b/src/views/Login.vue index 7f46786..77d38d8 100644 --- a/src/views/Login.vue +++ b/src/views/Login.vue @@ -91,19 +91,26 @@ export default { // identifyCodes: "1234567890abcdefjhijklinopqrsduvwxyz", }; }, - computed: {}, + computed: { + ...mapMutations(["SET_TOKEN", "SET_USERINFO"]), + }, methods: { submitForm() { this.$refs.loginForm.validate((valid) => { if (valid) { - console.log(valid); - //console.log(this.userInfo.verificationCode); - //this.userInfo.password = this.$md5(this.userInfo.password); //密码加密 - this.token = this.$md5(this.userInfo.password); //获取token - this.$store.commit("SET_TOKEN", this.token); //将token保存在vuex中 - this.$store.commit("SET_USERINFO", this.userInfo.username); //将用户信息保存在vuex中 - this.$router.push("/realTimeMonitor"); - this.$message.success("登录成功"); + // this.userInfo.password = this.$md5(this.userInfo.password); //密码加密 + loginJoggle(this.userInfo) + .then((res) => { + if (res.code == 200) { + this.$store.commit("SET_TOKEN", res.data.sessionId); //将token保存在vuex中 + this.$store.commit("SET_USERINFO", res.data); //将用户信息保存在vuex中 + this.$router.push("/realTimeMonitor"); + this.$message.success("登录成功"); + } else { + this.$message.error(res.msg); + } + }) + .catch((err) => {}); } else { this.$message.error("请输入账号和密码"); console.log("error submit!!"); diff --git a/src/views/realTimeMonitor/index.vue b/src/views/realTimeMonitor/index.vue index 03c0a76..9e04007 100644 --- a/src/views/realTimeMonitor/index.vue +++ b/src/views/realTimeMonitor/index.vue @@ -434,8 +434,8 @@ export default { }, handleWarn() { console.log("声光报警"); - console.log(this.newTermId); - alarmMarkJoggle({ termid: this.newTermId }) + console.log(this.cmdid); + alarmMarkJoggle({ cmdId: this.cmdid, ctrl: 1 }) .then((res) => { console.log(res); if (res.code == 200) {