登出增加提示

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) { submitForm(formName) {
const that = this
//this.$emit("created");
// //
this.$refs[formName].validate((valid) => { this.$refs[formName].validate((valid) => {
const that = this
if (valid) { if (valid) {
console.log('submit') console.log('submit')
let { ...form} = this.ruleForm let { ...form} = this.ruleForm
@ -374,7 +375,7 @@ export default {
console.log(response) console.log(response)
if (response.data.code === 200) { if (response.data.code === 200) {
//console.log(response.data.data.records) //console.log(response.data.data.records)
that.dialogFormVisible = false //that.dialogFormVisible = false
that.$emit("created"); that.$emit("created");
ElMessage({ ElMessage({
message: '新增项目成功', message: '新增项目成功',

View File

@ -1,6 +1,7 @@
import router from '@/router' import router from '@/router'
import store from '@/store' import store from '@/store'
import baseUrl from "@/utils/baseUrl" import baseUrl from "@/utils/baseUrl"
import {ElMessage} from "element-plus";
const axios = require('axios').default const axios = require('axios').default
const request = axios.create({ const request = axios.create({
@ -32,6 +33,10 @@ request.interceptors.response.use(
console.log(error.response) console.log(error.response)
if(error.response.status===401) if(error.response.status===401)
{ {
ElMessage({
message: '登录过期,请重新登录',
type: 'error',
})
store.commit('clearStaff') store.commit('clearStaff')
router.push({path: '/login'}) router.push({path: '/login'})
} }

View File

@ -30,15 +30,15 @@
display: flex; flex-direction: row-reverse; align-items: center"> display: flex; flex-direction: row-reverse; align-items: center">
<div style="width: 42px;height: 42px; background-color: #409EFF; border-radius: 21px; <div style="width: 42px;height: 42px; background-color: #409EFF; border-radius: 21px;
display: flex; justify-content: center;align-items: center;"> 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>
<div style="height: 100%; margin-right: 10px; <div style="height: 100%; margin-right: 10px;
display: flex; flex-direction: column;justify-content: center;align-items: flex-end;"> display: flex; flex-direction: column;justify-content: center;align-items: flex-end;">
<span <span
style="color: #606266; font-family: 'Segoe UI',sans-serif;font-size: 14px;font-weight: bold; "> 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;">{{ <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> }}</span>
</div> </div>
@ -60,6 +60,7 @@
import request from "@/utils/request"; import request from "@/utils/request";
import router from "../router"; import router from "../router";
import {ElMessage} from "element-plus";
export default { export default {
@ -80,7 +81,14 @@ export default {
url: 'staff/logout', url: 'staff/logout',
method: 'post', method: 'post',
}).then(response => { }).then(response => {
this.$store.commit('clearStaff') this.$store.commit('clearStaff')
ElMessage({
message: '已登出',
type: 'success',
})
router.push({path: '/login'}) router.push({path: '/login'})
}).catch(function (error) { }).catch(function (error) {
console.log(error) console.log(error)

View File

@ -28,7 +28,7 @@
</el-table-column> </el-table-column>
<el-table-column min-width="10%" align="right"> <el-table-column min-width="10%" align="right">
<template #default="scope"> <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)">结项 @click="onCloseProject(scope.row)">结项
</el-button> </el-button>
</template> </template>
@ -153,6 +153,7 @@ export default {
router.push({path: '/', query: {currentPage: this.currentPage, pageSize: this.pageSize}}) router.push({path: '/', query: {currentPage: this.currentPage, pageSize: this.pageSize}})
}, },
getProjects() { getProjects() {
this.dialogFormVisible = false
const that = this; const that = this;
request({ request({
url: 'project', url: 'project',