Commit cb6b2b14 authored by 黄奎's avatar 黄奎

开团修改jquery

parent df220b11
......@@ -374,7 +374,7 @@
} else {
basicData.TeamType = 0;
}
this.apipost(
this.JueryPost(
"travel_post_SetTravelConfigInfo",
basicData,
res => {
......
......@@ -115,7 +115,7 @@ export default {
Vue.prototype.domainManager = function () {
let domainUrl = '';
let locationName = window.location.hostname;
domainUrl = "http://127.0.0.1"; //214主域名
domainUrl = "https://reborn.oytour.com"; //214主域名
if (locationName.indexOf('oytour')!==-1) {
domainUrl = "https://reborn.oytour.com";
}else if (locationName.indexOf('viitto')!==-1) {
......@@ -290,6 +290,80 @@ export default {
}
}, faildCall)
},
Vue.prototype.JueryPost=function (cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") {
msg = {}
}
var apiurl = this.domainManager().PostUrl;
var timestamp = (new Date()).valueOf();
this.apiurl = apiurl;
if (this.$route.path.toLowerCase() == "/signature") {
this.$router.push({
path: '/signature'
})
} else {
if (!localStorage.userInfo && localStorage.userInfo != "" && this.$route.path.toLowerCase() != "/login") {
this.$router.push({
path: '/login'
})
}
}
var token = "";
var key = "";
if (this.getLocalStorage() != null) {
token = this.getLocalStorage().token;
key = this.getLocalStorage().SecretKey;
}
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
var postData = {
"msg": msg,
"cmd": cmd,
"timestamp": timestamp,
"token": token,
"sign": md5Str
}
$.ajax({
url: apiurl,
type: "POST",
data: msg,
datatype: "jsonP",
success: function (res) {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
this.$router.push({
path: '/login'
});
} else if (res.resultCode == 10005) {
this.$router.go(-1);
} else {
successCall(res);
}
},
faildCall
});
this.$http.post(apiurl, postData, {
headers: {
'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path
}
})
.then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
this.$router.push({
path: '/login'
});
} else if (res.resultCode == 10005) {
this.$router.go(-1);
} else {
successCall(res);
}
}, faildCall)
},
Vue.prototype.apiJavaPost = function(cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") {
msg = {}
......
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