Commit 5db260ba authored by 张伯涛's avatar 张伯涛

退出调用接口,410问题修改

parent d0de8dad
......@@ -21,6 +21,12 @@ export function login(username, password, code, uuid,type) {
headers: {}
})
}
export function handleLogout() {
return request({
url: '/auth/logout',
method: 'get'
})
}
// 刷新token
export function refreshToken(params) {
return request({
......
......@@ -66,6 +66,7 @@
<script>
import { mapGetters } from 'vuex'
import Hamburger from '@/components/Hamburger'
import { handleLogout } from '@/api/login'
export default {
components: {
Hamburger
......@@ -117,8 +118,13 @@ export default {
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
this.$store.dispatch('FedLogOut').then(() => {
location.reload()
handleLogout().then(res => {
if (res.code === 200) {
this.$message.success('退出成功!')
this.$store.dispatch('FedLogOut').then(() => {
location.reload()
})
}
})
})
// await this.$store.dispatch('user/logout')
......
......@@ -4,6 +4,7 @@ import store from '@/store'
import Qs from 'qs'
import { getToken, setToken } from '@/utils/auth'
import SM4 from './gmUtil'
import router from '../router'
import errorCode from '@/utils/errorCode'
import { refreshToken } from '@/api/login.js'
......@@ -101,6 +102,14 @@ service.interceptors.response.use(res => {
// location.reload() // 为了重新实例化vue-router对象 避免bug
// })
// })
} else if (code === 410) {
Message({
message: '当前登录无权限,请重新登录',
type: 'error'
})
store.dispatch('FedLogOut').then(() => {
location.reload()
})
} else if (code === 500 || code === 400) {
const errMsg = res.data.data || res.data.message || res.data.msg
Message({
......
......@@ -796,7 +796,7 @@
<el-dialog :title="formTitle" :visible.sync="formOpen" width="40%" append-to-body>
<el-form ref="formModel" :model="formModel" :rules="formRules" label-width="auto">
<el-form-item label="所属商家:" prop="unitId">
<el-select v-model="formModel.unitId" clearable filterable placeholder="请选择所属商家" style="width: 100%">
<el-select v-model="formModel.unitId" clearable filterable placeholder="请选择所属商家" style="width: 100%" @change="handleChangeType">
<el-option
v-for="(item,index) in deptList"
:key="index"
......@@ -878,7 +878,7 @@ import {
cmspriceclickUpdate
} from '@/api/contentManagement/sysContentVideoInformation'
import { getToken } from '@/utils/auth'
import { listAllByUnitIdType, handleAddForm,handleImportTemplate } from '@/api/clickManagement'
import { listAllByUnitIdType, handleAddForm, handleImportTemplate } from '@/api/clickManagement'
export default {
name: 'Index',
data() {
......@@ -1185,13 +1185,18 @@ export default {
},
/** 通过所属商家和类型获取标题下拉*/
handleChangeType() {
const params = {
type: this.formModel.type,
unitId: this.formModel.unitId
if (this.formModel.type && this.formModel.unitId) {
const params = {
type: this.formModel.type,
unitId: this.formModel.unitId
}
listAllByUnitIdType(params).then(res => {
this.titleList = res.data
})
} else {
this.formModel.newsVideoId = ''
this.titleList = []
}
listAllByUnitIdType(params).then(res => {
this.titleList = res.data
})
},
handleExport() {
cmspriceclickExport({ unitId: this.queryParams.unitId }).then(response => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment