From ecc916c95482ac813a466f5add73bc148bdb0474 Mon Sep 17 00:00:00 2001 From: wuyize Date: Sat, 2 Jul 2022 10:50:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=99=BB=E5=87=BA=E5=A2=9E=E5=8A=A0=E6=8F=90?= =?UTF-8?q?=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CreateProjectDialog.vue | 7 ++++--- src/utils/request.js | 5 +++++ src/views/Home.vue | 14 +++++++++++--- src/views/OngoingProject.vue | 3 ++- 4 files changed, 22 insertions(+), 7 deletions(-) diff --git a/src/components/CreateProjectDialog.vue b/src/components/CreateProjectDialog.vue index dff1a6e..53793c6 100644 --- a/src/components/CreateProjectDialog.vue +++ b/src/components/CreateProjectDialog.vue @@ -354,10 +354,11 @@ export default { }, //提交方法 submitForm(formName) { - + const that = this + //this.$emit("created"); //对表单进行提交验证 this.$refs[formName].validate((valid) => { - const that = this + if (valid) { console.log('submit') let { ...form} = this.ruleForm @@ -374,7 +375,7 @@ export default { console.log(response) if (response.data.code === 200) { //console.log(response.data.data.records) - that.dialogFormVisible = false + //that.dialogFormVisible = false that.$emit("created"); ElMessage({ message: '新增项目成功', diff --git a/src/utils/request.js b/src/utils/request.js index 3100588..7b260d2 100644 --- a/src/utils/request.js +++ b/src/utils/request.js @@ -1,6 +1,7 @@ import router from '@/router' import store from '@/store' import baseUrl from "@/utils/baseUrl" +import {ElMessage} from "element-plus"; const axios = require('axios').default const request = axios.create({ @@ -32,6 +33,10 @@ request.interceptors.response.use( console.log(error.response) if(error.response.status===401) { + ElMessage({ + message: '登录过期,请重新登录', + type: 'error', + }) store.commit('clearStaff') router.push({path: '/login'}) } diff --git a/src/views/Home.vue b/src/views/Home.vue index f57c964..73a85a0 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -30,15 +30,15 @@ display: flex; flex-direction: row-reverse; align-items: center">
- {{ this.$store.state.staff.staffFullname[0] }} + {{ this.$store.state.staff===null? this.$store.state.staff:this.$store.state.staff.staffFullname[0] }}
- {{ this.$store.state.staff.staffFullname }} + {{ this.$store.state.staff===null? this.$store.state.staff: this.$store.state.staff.staffFullname }} {{ - this.$store.state.staff.staffUsername + this.$store.state.staff===null? this.$store.state.staff:this.$store.state.staff.staffUsername }}
@@ -60,6 +60,7 @@ import request from "@/utils/request"; import router from "../router"; +import {ElMessage} from "element-plus"; export default { @@ -80,7 +81,14 @@ export default { url: 'staff/logout', method: 'post', }).then(response => { + this.$store.commit('clearStaff') + + ElMessage({ + message: '已登出', + type: 'success', + }) + router.push({path: '/login'}) }).catch(function (error) { console.log(error) diff --git a/src/views/OngoingProject.vue b/src/views/OngoingProject.vue index e197315..fb4ddcb 100644 --- a/src/views/OngoingProject.vue +++ b/src/views/OngoingProject.vue @@ -28,7 +28,7 @@ @@ -153,6 +153,7 @@ export default { router.push({path: '/', query: {currentPage: this.currentPage, pageSize: this.pageSize}}) }, getProjects() { + this.dialogFormVisible = false const that = this; request({ url: 'project',