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

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

parent d0de8dad
...@@ -21,6 +21,12 @@ export function login(username, password, code, uuid,type) { ...@@ -21,6 +21,12 @@ export function login(username, password, code, uuid,type) {
headers: {} headers: {}
}) })
} }
export function handleLogout() {
return request({
url: '/auth/logout',
method: 'get'
})
}
// 刷新token // 刷新token
export function refreshToken(params) { export function refreshToken(params) {
return request({ return request({
......
...@@ -66,6 +66,7 @@ ...@@ -66,6 +66,7 @@
<script> <script>
import { mapGetters } from 'vuex' import { mapGetters } from 'vuex'
import Hamburger from '@/components/Hamburger' import Hamburger from '@/components/Hamburger'
import { handleLogout } from '@/api/login'
export default { export default {
components: { components: {
Hamburger Hamburger
...@@ -117,8 +118,13 @@ export default { ...@@ -117,8 +118,13 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(() => { }).then(() => {
this.$store.dispatch('FedLogOut').then(() => { handleLogout().then(res => {
location.reload() if (res.code === 200) {
this.$message.success('退出成功!')
this.$store.dispatch('FedLogOut').then(() => {
location.reload()
})
}
}) })
}) })
// await this.$store.dispatch('user/logout') // await this.$store.dispatch('user/logout')
......
...@@ -4,6 +4,7 @@ import store from '@/store' ...@@ -4,6 +4,7 @@ import store from '@/store'
import Qs from 'qs' import Qs from 'qs'
import { getToken, setToken } from '@/utils/auth' import { getToken, setToken } from '@/utils/auth'
import SM4 from './gmUtil' import SM4 from './gmUtil'
import router from '../router'
import errorCode from '@/utils/errorCode' import errorCode from '@/utils/errorCode'
import { refreshToken } from '@/api/login.js' import { refreshToken } from '@/api/login.js'
...@@ -101,6 +102,14 @@ service.interceptors.response.use(res => { ...@@ -101,6 +102,14 @@ service.interceptors.response.use(res => {
// location.reload() // 为了重新实例化vue-router对象 避免bug // 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) { } else if (code === 500 || code === 400) {
const errMsg = res.data.data || res.data.message || res.data.msg const errMsg = res.data.data || res.data.message || res.data.msg
Message({ Message({
......
...@@ -796,7 +796,7 @@ ...@@ -796,7 +796,7 @@
<el-dialog :title="formTitle" :visible.sync="formOpen" width="40%" append-to-body> <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 ref="formModel" :model="formModel" :rules="formRules" label-width="auto">
<el-form-item label="所属商家:" prop="unitId"> <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 <el-option
v-for="(item,index) in deptList" v-for="(item,index) in deptList"
:key="index" :key="index"
...@@ -878,7 +878,7 @@ import { ...@@ -878,7 +878,7 @@ import {
cmspriceclickUpdate cmspriceclickUpdate
} from '@/api/contentManagement/sysContentVideoInformation' } from '@/api/contentManagement/sysContentVideoInformation'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { listAllByUnitIdType, handleAddForm,handleImportTemplate } from '@/api/clickManagement' import { listAllByUnitIdType, handleAddForm, handleImportTemplate } from '@/api/clickManagement'
export default { export default {
name: 'Index', name: 'Index',
data() { data() {
...@@ -1185,13 +1185,18 @@ export default { ...@@ -1185,13 +1185,18 @@ export default {
}, },
/** 通过所属商家和类型获取标题下拉*/ /** 通过所属商家和类型获取标题下拉*/
handleChangeType() { handleChangeType() {
const params = { if (this.formModel.type && this.formModel.unitId) {
type: this.formModel.type, const params = {
unitId: this.formModel.unitId 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() { handleExport() {
cmspriceclickExport({ unitId: this.queryParams.unitId }).then(response => { 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