Commit 30d9f5ea authored by 智勇's avatar 智勇

关闭用户订单

parent d1d14822
...@@ -10,23 +10,6 @@ NProgress.configure({ showSpinner: false })// NProgress configuration ...@@ -10,23 +10,6 @@ NProgress.configure({ showSpinner: false })// NProgress configuration
const whiteList = ['/login'] // 不重定向白名单 const whiteList = ['/login'] // 不重定向白名单
router.beforeEach((to, from, next) => { router.beforeEach((to, from, next) => {
NProgress.start() NProgress.start()
// if (whiteList.indexOf(to.path) !== -1) {
// next()
// } else {
// if (store.getters.roles.length === 0) {
// store.dispatch('GetInfo').then(res => { // 拉取用户信息
// next()
// }).catch(() => {
// store.dispatch('FedLogOut').then(() => {
// // Message.error(err || 'Verification failed, please login again')
// next(`/login`) // 否则全部重定向到登录页
// // next({ path: '/' })
// })
// })
// } else {
// next()
// }
// }
if (getToken()) { if (getToken()) {
if (to.path === '/login') { if (to.path === '/login') {
...@@ -39,7 +22,7 @@ router.beforeEach((to, from, next) => { ...@@ -39,7 +22,7 @@ router.beforeEach((to, from, next) => {
}).catch((err) => { }).catch((err) => {
store.dispatch('FedLogOut').then(() => { store.dispatch('FedLogOut').then(() => {
Message.error(err || 'Verification failed, please login again') Message.error(err || 'Verification failed, please login again')
next({ path: '/' }) // next({ path: '/' })
}) })
}) })
} else { } else {
...@@ -50,6 +33,7 @@ router.beforeEach((to, from, next) => { ...@@ -50,6 +33,7 @@ router.beforeEach((to, from, next) => {
if (whiteList.indexOf(to.path) !== -1) { if (whiteList.indexOf(to.path) !== -1) {
next() next()
} else { } else {
Message.warning('请登录...')
next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页 next(`/login?redirect=${to.path}`) // 否则全部重定向到登录页
NProgress.done() NProgress.done()
} }
......
...@@ -2,6 +2,7 @@ import axios from 'axios' ...@@ -2,6 +2,7 @@ import axios from 'axios'
import { Message } from 'element-ui' import { Message } from 'element-ui'
import store from '../store' import store from '../store'
import { getToken } from '@/utils/auth' import { getToken } from '@/utils/auth'
import { MessageBox } from 'element-ui'
// 创建axios实例 // 创建axios实例
const service = axios.create({ const service = axios.create({
...@@ -36,26 +37,28 @@ service.interceptors.response.use( ...@@ -36,26 +37,28 @@ service.interceptors.response.use(
* code为非20000是抛错 可结合自己业务进行修改 * code为非20000是抛错 可结合自己业务进行修改
*/ */
const res = response.data const res = response.data
if ((typeof res.code === 'number' && res.code !== 200000) || (typeof res.code === 'string' && res.code !== '0000')) {
Message({
message: res.message,
type: 'error',
duration: 5 * 1000
})
if ((typeof res.code === 'number' && res.code !== 200000) || (typeof res.code === 'string' && res.code !== '0000')) {
// 500003:Token 过期了; // 500003:Token 过期了;
if (res.code === 500003) { if (res.code === 500003 || res.code === 500006) {
store.dispatch('FedLogOut').then(() => { MessageBox.confirm('你已被登出,可以取消继续留在该页面,或者重新登录', '确定登出', {
location.reload() // 为了重新实例化vue-router对象 避免bug confirmButtonText: '重新登录',
}) cancelButtonText: '取消',
type: 'warning'
}).then(() => {
store.dispatch('FedLogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug
// location.replace(`${location.protocol}//${location.host}/login`)
})
}).catch(() => {})
} else {
Message({ Message({
message: 'token失效,你已被登出', message: res.message,
type: 'warning', type: 'error',
duration: 2000 duration: 5 * 1000
}) })
} }
return Promise.reject('error') return Promise.reject('responseInterceptorsError')
} else { } else {
return response.data return response.data
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</div> </div>
<div class="bullshit__headline">{{ message }}</div> <div class="bullshit__headline">{{ message }}</div>
<div class="bullshit__info">请检查您输入的网址是否正确,请点击以下按钮返回主页或者发送错误报告</div> <div class="bullshit__info">请检查您输入的网址是否正确,请点击以下按钮返回主页或者发送错误报告</div>
<a href="" class="bullshit__return-home">返回首页</a> <a href="/" class="bullshit__return-home">返回首页</a>
</div> </div>
</div> </div>
</div> </div>
......
...@@ -168,6 +168,7 @@ export default { ...@@ -168,6 +168,7 @@ export default {
this.count = res.data.totalElements this.count = res.data.totalElements
this.$refs.myTable.setCurrentRow(this.channels[0]) this.$refs.myTable.setCurrentRow(this.channels[0])
} }
}).catch(() => {
}) })
}, },
......
...@@ -50,7 +50,8 @@ export default { ...@@ -50,7 +50,8 @@ export default {
}, },
logout() { logout() {
this.$store.dispatch('LogOut').then(() => { this.$store.dispatch('LogOut').then(() => {
location.reload() // 为了重新实例化vue-router对象 避免bug // location.reload() // 为了重新实例化vue-router对象 避免bug
this.$router.push({ path: '/login' })
}) })
} }
} }
......
...@@ -67,7 +67,11 @@ ...@@ -67,7 +67,11 @@
<el-table-column label="状态枚举值" prop="callbackStatus" align="center"/> <el-table-column label="状态枚举值" prop="callbackStatus" align="center"/>
<el-table-column label="重试次数" prop="retryTimes" align="center"/> <el-table-column label="重试次数" prop="retryTimes" align="center"/>
<el-table-column label="失败原因" prop="failCode" align="center"/> <el-table-column label="失败原因" prop="failCode" align="center"/>
<el-table-column label="是否活跃" prop="isActive" align="center"/> <el-table-column label="是否活跃" prop="isActive" align="center">
<template slot-scope="scope">
<el-tag >{{ scope.row.isActive | activeFilter }}</el-tag>
</template>
</el-table-column>
<el-table-column <el-table-column
label="其他数据" label="其他数据"
align="center"> align="center">
...@@ -173,6 +177,14 @@ export default { ...@@ -173,6 +177,14 @@ export default {
false: '失败' false: '失败'
} }
return statusMap[status] return statusMap[status]
},
activeFilter(status) {
const activeMap = {
true: '',
false: ''
}
return activeMap[status]
} }
}, },
data() { data() {
...@@ -233,6 +245,7 @@ export default { ...@@ -233,6 +245,7 @@ export default {
// for (const o in this.orders) { // for (const o in this.orders) {
// this.orders[o].opt = o % 2 === 0 ? [{ action: 'audit', name: '审核' }, { action: 'loan', name: '放款' }] : [{ action: 'audit', name: '审核' }] // this.orders[o].opt = o % 2 === 0 ? [{ action: 'audit', name: '审核' }, { action: 'loan', name: '放款' }] : [{ action: 'audit', name: '审核' }]
// } // }
}).catch(() => {
}) })
}, },
......
...@@ -49,11 +49,19 @@ export default { ...@@ -49,11 +49,19 @@ export default {
closeOrder() { closeOrder() {
closeOrder({ mobile: this.closeOrderMobile }).then(res => { closeOrder({ mobile: this.closeOrderMobile }).then(res => {
this.$notify({ if (res.data) {
title: '成功', this.$notify({
type: 'success', message: res.message,
duration: 2000 type: 'success',
}) duration: 2000
})
} else {
this.$notify({
message: res.message,
type: 'error',
duration: 2000
})
}
}) })
}, },
......
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