登出增加提示

main
wuyize 2022-07-02 10:50:52 +08:00
parent 6a6a6d6f3a
commit ecc916c954
4 changed files with 22 additions and 7 deletions

View File

@ -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: '新增项目成功',

View File

@ -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'})
}

View File

@ -30,15 +30,15 @@
display: flex; flex-direction: row-reverse; align-items: center">
<div style="width: 42px;height: 42px; background-color: #409EFF; border-radius: 21px;
display: flex; justify-content: center;align-items: center;">
<span style="color: white">{{ this.$store.state.staff.staffFullname[0] }}</span>
<span style="color: white">{{ this.$store.state.staff===null? this.$store.state.staff:this.$store.state.staff.staffFullname[0] }}</span>
</div>
<div style="height: 100%; margin-right: 10px;
display: flex; flex-direction: column;justify-content: center;align-items: flex-end;">
<span
style="color: #606266; font-family: 'Segoe UI',sans-serif;font-size: 14px;font-weight: bold; ">
{{ this.$store.state.staff.staffFullname }}</span>
{{ this.$store.state.staff===null? this.$store.state.staff: this.$store.state.staff.staffFullname }}</span>
<span style="color: #606266; font-family: 'Segoe UI',sans-serif;font-size: 12px;">{{
this.$store.state.staff.staffUsername
this.$store.state.staff===null? this.$store.state.staff:this.$store.state.staff.staffUsername
}}</span>
</div>
@ -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)

View File

@ -28,7 +28,7 @@
</el-table-column>
<el-table-column min-width="10%" align="right">
<template #default="scope">
<el-button v-show="this.$store.state.staff.staffId===scope.row.projectCreator" type="primary" plain
<el-button v-show="this.$store.state.staff===null? false:(this.$store.state.staff.staffId===scope.row.projectCreator)" type="primary" plain
@click="onCloseProject(scope.row)">结项
</el-button>
</template>
@ -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',