|
@@ -38,7 +38,11 @@ const baseUrl = process.env.NODE_ENV === 'production' ? '../' : `http://${locati
|
|
|
Vue.prototype.$baseUrl = baseUrl;
|
|
Vue.prototype.$baseUrl = baseUrl;
|
|
|
axios.defaults.withCredentials = true;
|
|
axios.defaults.withCredentials = true;
|
|
|
axios.defaults.baseURL = baseUrl;
|
|
axios.defaults.baseURL = baseUrl;
|
|
|
-axios.defaults.headers.common['token'] = "0eyJhbGciOiJIUzI1NiJ9.eyJqdGkiOiI2M2MzZjI2MC0yNGJiLTQxNTctYTQ5Yy0yNThhN2Q3NTgyNWUiLCJpc3MiOiJhZG1pbiIsImlhdCI6MTUzNjgwOTM4Niwic3ViIjoiZ3Vlc3QiLCJleHAiOjE1MzY4MTI5ODZ9.O7yhHcMt0QWqAg_Ev9lNwMlwgxZtKEu8rUpynrVyqV8"
|
|
|
|
|
|
|
+axios.post('/auth/loginGuest').then(res => {
|
|
|
|
|
+ if (res.data.success) {
|
|
|
|
|
+ axios.defaults.headers.common['token'] = res.data.data
|
|
|
|
|
+ }
|
|
|
|
|
+})
|
|
|
Vue.prototype.$http = {
|
|
Vue.prototype.$http = {
|
|
|
get(params) {
|
|
get(params) {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
@@ -159,7 +163,8 @@ Vue.prototype.$http = {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
-Vue.prototype.getTime = function (str) {
|
|
|
|
|
|
|
+
|
|
|
|
|
+Vue.prototype.getTime = function(str) {
|
|
|
if (str) {
|
|
if (str) {
|
|
|
return moment(str).format('YYYY-MM-DD HH:mm')
|
|
return moment(str).format('YYYY-MM-DD HH:mm')
|
|
|
} else {
|
|
} else {
|
|
@@ -167,7 +172,7 @@ Vue.prototype.getTime = function (str) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-Vue.prototype.getPhone = function (phone) {
|
|
|
|
|
|
|
+Vue.prototype.getPhone = function(phone) {
|
|
|
if (phone) {
|
|
if (phone) {
|
|
|
if (phone.length == 11) {
|
|
if (phone.length == 11) {
|
|
|
var str = phone.substr(0, 3)
|
|
var str = phone.substr(0, 3)
|
|
@@ -183,7 +188,7 @@ Vue.prototype.getPhone = function (phone) {
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
-Vue.prototype.getMail = function (mail) {
|
|
|
|
|
|
|
+Vue.prototype.getMail = function(mail) {
|
|
|
if (mail) {
|
|
if (mail) {
|
|
|
var list = mail.split('@')
|
|
var list = mail.split('@')
|
|
|
var str = list[0].substr(0, 3)
|
|
var str = list[0].substr(0, 3)
|
|
@@ -198,7 +203,7 @@ Vue.prototype.getMail = function (mail) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
-Vue.prototype.sendMeg = function (phone) {
|
|
|
|
|
|
|
+Vue.prototype.sendMeg = function(phone) {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$http.get({
|
|
this.$http.get({
|
|
|
url: '/rong/sendCode',
|
|
url: '/rong/sendCode',
|
|
@@ -220,7 +225,7 @@ Vue.prototype.sendMeg = function (phone) {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
//检查是否存在
|
|
//检查是否存在
|
|
|
-Vue.prototype.checkHas = function (data) {
|
|
|
|
|
|
|
+Vue.prototype.checkHas = function(data) {
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
this.$http.get({
|
|
this.$http.get({
|
|
|
url: '/userInfo/getOne',
|
|
url: '/userInfo/getOne',
|
|
@@ -273,7 +278,7 @@ const updateTableHeight = () => {
|
|
|
|
|
|
|
|
|
|
|
|
|
//校验手机号是否正确
|
|
//校验手机号是否正确
|
|
|
-Vue.prototype.checkPhone = function (phone) {
|
|
|
|
|
|
|
+Vue.prototype.checkPhone = function(phone) {
|
|
|
var result = false
|
|
var result = false
|
|
|
if ((/^1[3|4|5|8|7|6|9][0-9]\d{8}$/.test(phone))) {
|
|
if ((/^1[3|4|5|8|7|6|9][0-9]\d{8}$/.test(phone))) {
|
|
|
result = true
|
|
result = true
|