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,12 +34,8 @@ service.interceptors.request.use( ...@@ -34,12 +34,8 @@ 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 // 如果是数据流
38 if (response.config.responseType === 'arraybuffer') {
39 return response.data
40 } else {
41 const res = response.data 37 const res = response.data
42 if (res.status !== 200) { 38 if (res.status && res.status !== 200) {
43 // 登录超时,重新登录 39 // 登录超时,重新登录
44 if (res.status === 401) { 40 if (res.status === 401) {
45 store.dispatch('FedLogOut').then(() => { 41 store.dispatch('FedLogOut').then(() => {
...@@ -50,7 +46,6 @@ service.interceptors.response.use( ...@@ -50,7 +46,6 @@ service.interceptors.response.use(
50 } else { 46 } else {
51 return Promise.resolve(res) 47 return Promise.resolve(res)
52 } 48 }
53 }
54 }, 49 },
55 error => { 50 error => {
56 Toast.clear() 51 Toast.clear()
......
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!