fcfd1c4f by 406803045

添加filters

1 parent 09485e79
1 /*
2 * 隐藏用户手机号中间四位
3 */
4 exports.hidePhone = phone => {
5 return phone.replace(/(\d{3})\d{4}(\d{4})/, '$1****$2')
6 }
...\ No newline at end of file ...\ No newline at end of file
1 import Vue from 'vue'
2 import filter from './filter'
3
4 Object.keys(filter).forEach(k => Vue.filter(k, filter[k]))
5
6 Vue.prototype.$hidePhone = Vue.filter('hidePhone')
...\ No newline at end of file ...\ No newline at end of file
...@@ -7,6 +7,7 @@ import 'lib-flexible/flexible.js' ...@@ -7,6 +7,7 @@ import 'lib-flexible/flexible.js'
7 import App from './App' 7 import App from './App'
8 import store from './store' 8 import store from './store'
9 import router from './router' 9 import router from './router'
10 import filters from './filter'
10 Vue.config.productionTip = false 11 Vue.config.productionTip = false
11 12
12 new Vue({ 13 new Vue({
......
...@@ -34,22 +34,17 @@ service.interceptors.request.use( ...@@ -34,22 +34,17 @@ service.interceptors.request.use(
34 service.interceptors.response.use( 34 service.interceptors.response.use(
35 response => { 35 response => {
36 Toast.clear() 36 Toast.clear()
37 // 如果是数据流 37 const res = response.data
38 if (response.config.responseType === 'arraybuffer') { 38 if (res.status && res.status !== 200) {
39 return response.data 39 // 登录超时,重新登录
40 } else { 40 if (res.status === 401) {
41 const res = response.data 41 store.dispatch('FedLogOut').then(() => {
42 if (res.status !== 200) { 42 location.reload()
43 // 登录超时,重新登录 43 })
44 if (res.status === 401) {
45 store.dispatch('FedLogOut').then(() => {
46 location.reload()
47 })
48 }
49 return Promise.reject(res || 'error')
50 } else {
51 return Promise.resolve(res)
52 } 44 }
45 return Promise.reject(res || 'error')
46 } else {
47 return Promise.resolve(res)
53 } 48 }
54 }, 49 },
55 error => { 50 error => {
......
1 /** 1 /**
2 * Created by PanJiaChen on 16/11/18. 2 * Created by Sunnie on 19/06/04.
3 */ 3 */
4 4
5 /** 5 /**
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!