Commit 423d1863 authored by 罗超's avatar 罗超

提交URL

parent 8d8042a3
...@@ -6,20 +6,20 @@ export default { ...@@ -6,20 +6,20 @@ export default {
apiurl: '' apiurl: ''
}, },
install(Vue, options) { install(Vue, options) {
Vue.prototype.isOnline = function() { Vue.prototype.isOnline = function () {
return process.env.NODE_ENV !== 'development'; return process.env.NODE_ENV !== 'development';
}, },
//域名管理对象 //域名管理对象
Vue.prototype.domainManager = function() { Vue.prototype.domainManager = function () {
//CRM API //CRM API
let domainUrl = ""; let domainUrl = "";
domainUrl = "http://192.168.10.36:8098"; domainUrl = "http://192.168.10.46:8500";
//domainUrl = "http://localhost:5003"; //domainUrl = "http://localhost:5003";
let locationName = window.location.hostname; let locationName = window.location.hostname;
//旅游ERPApi //旅游ERPApi
let domainPostUrl = "" let domainPostUrl = ""
domainPostUrl = "http://192.168.10.36:8083"; //domainPostUrl = "http://192.168.10.36:8083";
//domainPostUrl = "http://192.168.10.46"; domainPostUrl = "http://192.168.10.46";
if (this.isOnline()) { if (this.isOnline()) {
if (window.location.host.indexOf('fcrmyx.oytour.com') != -1) { if (window.location.host.indexOf('fcrmyx.oytour.com') != -1) {
domainUrl = "http://crm.oytour.com" domainUrl = "http://crm.oytour.com"
...@@ -48,7 +48,7 @@ export default { ...@@ -48,7 +48,7 @@ export default {
}, },
//消息成功提示 //消息成功提示
Vue.prototype.Success = function(msg) { Vue.prototype.Success = function (msg) {
this.$message({ this.$message({
message: msg, message: msg,
duration: 2000, duration: 2000,
...@@ -56,7 +56,7 @@ export default { ...@@ -56,7 +56,7 @@ export default {
}); });
}, },
//错误提示 //错误提示
Vue.prototype.Error = function(msg) { Vue.prototype.Error = function (msg) {
this.$message({ this.$message({
message: msg, message: msg,
duration: 2000, duration: 2000,
...@@ -65,7 +65,7 @@ export default { ...@@ -65,7 +65,7 @@ export default {
}, },
//一般提示 //一般提示
Vue.prototype.Info = function(msg) { Vue.prototype.Info = function (msg) {
this.$message({ this.$message({
message: msg, message: msg,
duration: 2000, duration: 2000,
...@@ -73,7 +73,7 @@ export default { ...@@ -73,7 +73,7 @@ export default {
}); });
}, },
//警告提示 //警告提示
Vue.prototype.Warning = function(msg) { Vue.prototype.Warning = function (msg) {
this.$message({ this.$message({
message: msg, message: msg,
duration: 2000, duration: 2000,
...@@ -81,12 +81,12 @@ export default { ...@@ -81,12 +81,12 @@ export default {
}); });
}, },
//Confirm //Confirm
Vue.prototype.Confirm = function(msg, callback) { Vue.prototype.Confirm = function (msg, callback) {
this.$confirm(msg, "提示", { this.$confirm(msg, "提示", {
confirmButtonText: "确定", confirmButtonText: "确定",
cancelButtonText: "取消", cancelButtonText: "取消",
type: "warning" type: "warning"
}) })
.then(() => { .then(() => {
if (typeof callback === 'function') { if (typeof callback === 'function') {
callback(); callback();
...@@ -101,7 +101,7 @@ export default { ...@@ -101,7 +101,7 @@ export default {
//type : m_filt 填充 m_w 宽度固定 高度不固定 m_h 高度固定 宽度不固定 //type : m_filt 填充 m_w 宽度固定 高度不固定 m_h 高度固定 宽度不固定
// w : 宽 // w : 宽
// h : 高 // h : 高
Vue.prototype.compressImg = function(path, type, w, h) { Vue.prototype.compressImg = function (path, type, w, h) {
let url = this.domainManager().UploadUrl; let url = this.domainManager().UploadUrl;
let poise = 'width='; let poise = 'width=';
w = w ? w : '' w = w ? w : ''
...@@ -116,7 +116,7 @@ export default { ...@@ -116,7 +116,7 @@ export default {
//旅游ERP接口 //旅游ERP接口
Vue.prototype.apipost2 = function(cmd, msg, successCall, faildCall, isOnline) { Vue.prototype.apipost2 = function (cmd, msg, successCall, faildCall, isOnline) {
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
...@@ -146,11 +146,11 @@ export default { ...@@ -146,11 +146,11 @@ export default {
"languageId": tempLanguage "languageId": tempLanguage
} }
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path 'Referer-Viitto': this.$route.path
} }
}) })
.then(res => { .then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) { if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
this.$router.push({ this.$router.push({
...@@ -165,50 +165,50 @@ export default { ...@@ -165,50 +165,50 @@ export default {
} }
//CRM接口 //CRM接口
Vue.prototype.apipost = function(cmd, msg, successCall, faildCall) { Vue.prototype.apipost = function (cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
var apiurl = this.domainManager().PostUrl + cmd; var apiurl = this.domainManager().PostUrl + cmd;
var timestamp = (new Date()).valueOf(); var timestamp = (new Date()).valueOf();
var token = ""; var token = "";
var key = ""; var key = "";
if (this.getLocalStorage() != null) { if (this.getLocalStorage() != null) {
token = this.getLocalStorage().token; token = this.getLocalStorage().token;
key = this.getLocalStorage().secretKey; key = this.getLocalStorage().secretKey;
} }
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase(); var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`); var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
var postData = { var postData = {
"msg": msg, "msg": msg,
"timestamp": timestamp, "timestamp": timestamp,
"token": token, "token": token,
"sign": md5Str "sign": md5Str
} }
if (localStorage.g && localStorage.g != 'undefined') { if (localStorage.g && localStorage.g != 'undefined') {
postData.groupId = 2; postData.groupId = 2;
}
this.$http.post(apiurl, postData, {
headers: {
'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path
} }
this.$http.post(apiurl, postData, { })
headers: { .then(res => {
'Content-Type': 'application/json', if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
'Referer-Viitto': this.$route.path this.$router.push({
} path: '/login'
}) })
.then(res => { } else if (res.data.resultCode == 10005) {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) { this.$router.go(-1)
this.$router.push({ } else {
path: '/login' successCall(res)
}) }
} else if (res.data.resultCode == 10005) { }, faildCall)
this.$router.go(-1) },
} else {
successCall(res)
}
}, faildCall)
},
// 自动登录HTTP提交数据 // 自动登录HTTP提交数据
Vue.prototype.apipostLogin = function(cmd, msg, successCall, faildCall) { Vue.prototype.apipostLogin = function (cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
...@@ -232,11 +232,11 @@ export default { ...@@ -232,11 +232,11 @@ export default {
postData.groupId = 2; postData.groupId = 2;
} }
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path 'Referer-Viitto': this.$route.path
} }
}) })
.then(res => { .then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) { if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
this.$router.push({ this.$router.push({
...@@ -251,7 +251,7 @@ export default { ...@@ -251,7 +251,7 @@ export default {
}, },
//Java接口 //Java接口
Vue.prototype.apiJavaPost = function(cmd, msg, successCall, faildCall) { Vue.prototype.apiJavaPost = function (cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
...@@ -279,11 +279,11 @@ export default { ...@@ -279,11 +279,11 @@ export default {
postData.groupId = 2; postData.groupId = 2;
} }
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Referer-Viitto': this.$route.path 'Referer-Viitto': this.$route.path
} }
}) })
.then(res => { .then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) { if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {
...@@ -303,7 +303,7 @@ export default { ...@@ -303,7 +303,7 @@ export default {
}, },
//下载文件 //下载文件
Vue.prototype.GetLocalFile = function(cmd, msg, fileName, callBack) { Vue.prototype.GetLocalFile = function (cmd, msg, fileName, callBack) {
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
...@@ -345,7 +345,7 @@ export default { ...@@ -345,7 +345,7 @@ export default {
}; };
callBack(result); callBack(result);
} }
}).catch(function(res) { }).catch(function (res) {
console.log("GetLocalFile", res); console.log("GetLocalFile", res);
}); });
} }
......
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