|
|
@@ -38,6 +38,7 @@ const baseUrl = process.env.NODE_ENV === 'production' ? '../' : `http://${locati
|
|
|
Vue.prototype.$baseUrl = baseUrl;
|
|
|
axios.defaults.withCredentials = true;
|
|
|
axios.defaults.baseURL = baseUrl;
|
|
|
+axios.defaults.headers.common['token'] = "0eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2M2MzZjI2MC0yNGJiLTQxNTctYTQ5Yy0yNThhN2Q3NTgyNWUiLCJpc3MiOiJhZG1pbiIsImlhdCI6MTUzNjgwOTM4Niwic3ViIjoiZ3Vlc3QiLCJleHAiOjE1MzY4MTI5ODZ9.O7yhHcMt0QWqAg_Ev9lNwMlwgxZtKEu8rUpynrVyqV8"
|
|
|
Vue.prototype.$http = {
|
|
|
get(params) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
@@ -71,14 +72,14 @@ Vue.prototype.$http = {
|
|
|
reject(res);
|
|
|
}
|
|
|
try {
|
|
|
- if (res.data.code === 10001) {
|
|
|
- axios({
|
|
|
- method: 'post',
|
|
|
- url: '/auth/logout'
|
|
|
- });
|
|
|
- store.commit('updateUserInfo', null);
|
|
|
- router.replace('/login');
|
|
|
- }
|
|
|
+ // if (res.data.code === 10001) {
|
|
|
+ // axios({
|
|
|
+ // method: 'post',
|
|
|
+ // url: '/auth/logout'
|
|
|
+ // });
|
|
|
+ // store.commit('updateUserInfo', null);
|
|
|
+ // router.replace('/login');
|
|
|
+ // }
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
@@ -138,14 +139,14 @@ Vue.prototype.$http = {
|
|
|
reject(res);
|
|
|
}
|
|
|
try {
|
|
|
- if (res.data.code === 10001) {
|
|
|
- axios({
|
|
|
- method: 'post',
|
|
|
- url: '/auth/logout'
|
|
|
- });
|
|
|
- store.commit('updateUserInfo', null);
|
|
|
- router.replace('/login');
|
|
|
- }
|
|
|
+ // if (res.data.code === 10001) {
|
|
|
+ // axios({
|
|
|
+ // method: 'post',
|
|
|
+ // url: '/auth/logout'
|
|
|
+ // });
|
|
|
+ // store.commit('updateUserInfo', null);
|
|
|
+ // router.replace('/login');
|
|
|
+ // }
|
|
|
} catch (e) {
|
|
|
|
|
|
}
|
|
|
@@ -158,7 +159,7 @@ Vue.prototype.$http = {
|
|
|
};
|
|
|
|
|
|
|
|
|
-Vue.prototype.getTime = function(str) {
|
|
|
+Vue.prototype.getTime = function (str) {
|
|
|
if (str) {
|
|
|
return moment(str).format('YYYY-MM-DD HH:mm')
|
|
|
} else {
|
|
|
@@ -166,7 +167,7 @@ Vue.prototype.getTime = function(str) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-Vue.prototype.getPhone = function(phone) {
|
|
|
+Vue.prototype.getPhone = function (phone) {
|
|
|
if (phone) {
|
|
|
if (phone.length == 11) {
|
|
|
var str = phone.substr(0, 3)
|
|
|
@@ -182,7 +183,7 @@ Vue.prototype.getPhone = function(phone) {
|
|
|
|
|
|
|
|
|
}
|
|
|
-Vue.prototype.getMail = function(mail) {
|
|
|
+Vue.prototype.getMail = function (mail) {
|
|
|
if (mail) {
|
|
|
var list = mail.split('@')
|
|
|
var str = list[0].substr(0, 3)
|
|
|
@@ -197,7 +198,7 @@ Vue.prototype.getMail = function(mail) {
|
|
|
}
|
|
|
|
|
|
|
|
|
-Vue.prototype.sendMeg = function(phone) {
|
|
|
+Vue.prototype.sendMeg = function (phone) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$http.get({
|
|
|
url: '/rong/sendCode',
|
|
|
@@ -219,7 +220,7 @@ Vue.prototype.sendMeg = function(phone) {
|
|
|
}
|
|
|
|
|
|
//检查是否存在
|
|
|
-Vue.prototype.checkHas = function(data) {
|
|
|
+Vue.prototype.checkHas = function (data) {
|
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$http.get({
|
|
|
url: '/userInfo/getOne',
|
|
|
@@ -272,7 +273,7 @@ const updateTableHeight = () => {
|
|
|
|
|
|
|
|
|
//校验手机号是否正确
|
|
|
-Vue.prototype.checkPhone = function(phone) {
|
|
|
+Vue.prototype.checkPhone = function (phone) {
|
|
|
var result = false
|
|
|
if ((/^1[3|4|5|8|7|6|9][0-9]\d{8}$/.test(phone))) {
|
|
|
result = true
|