Commit c8b52fa4 authored by 黄奎's avatar 黄奎

111

parent 5aa13183
...@@ -14,7 +14,7 @@ module.exports = { ...@@ -14,7 +14,7 @@ module.exports = {
}, },
// Various Dev Server settings // Various Dev Server settings
host: 'www.test.com', // can be overwritten by process.env.HOST host: 'localhost', // can be overwritten by process.env.HOST
port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined port: 8080, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
autoOpenBrowser: false, autoOpenBrowser: false,
errorOverlay: true, errorOverlay: true,
......
...@@ -6,21 +6,16 @@ export default { ...@@ -6,21 +6,16 @@ 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 () {
// var domainUrl = "http://test_reborn.oytour.com";//主域名
var domainUrl = "http://reborn.oytour.com"; //主域名 var domainUrl = "http://reborn.oytour.com"; //主域名
// var domainUrl = "http://192.168.2.16:8087"; //主域名
let locationName = window.location.hostname; let locationName = window.location.hostname;
let javaUrldo = ""; let javaUrldo = "";
javaUrldo = locationName.indexOf('zcyx') !== -1 || locationName.indexOf('viitto') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://property.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.65:8018"; javaUrldo = locationName.indexOf('zcyx') !== -1 || locationName.indexOf('viitto') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://property.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.65:8018";
if (this.isOnline()) { if (this.isOnline()) {
if (window.location.host.indexOf('testb2b.oytour.com') != -1)
domainUrl = "http://testapi.oytour.com"
else if (window.location.host.indexOf('oytour.com') != -1)
domainUrl = "http://property.oytour.com" domainUrl = "http://property.oytour.com"
} }
var obj = { var obj = {
...@@ -31,19 +26,16 @@ export default { ...@@ -31,19 +26,16 @@ export default {
LocalTemplateFileDownLoadUrl: domainUrl, LocalTemplateFileDownLoadUrl: domainUrl,
//常用提交数据URL //常用提交数据URL
PostUrl: domainUrl + "/api/common/post", PostUrl: domainUrl + "/api/common/post",
// javaUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('testb2b.oytour.com') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://efficient.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.215:9000", javaUrl: locationName.indexOf('zcyx') !== -1 ? "http://property.oytour.com" : locationName.indexOf('zcyx.oytour.com') !== -1 ? "http://property.oytour.com" : "http://192.168.5.46:5001",
javaUrl: locationName.indexOf('zcyx') !== -1 ? "http://property.oytour.com" : locationName.indexOf('zcyx.oytour.com') !== -1 ? "http://property.oytour.com" : "http://192.168.1.13:8087",
ViittoFileUrl: locationName.indexOf('zcyx') !== -1 || locationName.indexOf('zcyx.oytour.com') !== -1 ? "http://staticfile.oytour.com" : 'http://192.168.2.214:8130', ViittoFileUrl: locationName.indexOf('zcyx') !== -1 || locationName.indexOf('zcyx.oytour.com') !== -1 ? "http://staticfile.oytour.com" : 'http://192.168.2.214:8130',
UploadUrl: locationName.indexOf('zcyx') !== -1 || locationName.indexOf('zcyx.oytour.com') !== -1 ? "http://uploadfile.oytour.com" : "http://192.168.2.214:8120", UploadUrl: locationName.indexOf('zcyx') !== -1 || locationName.indexOf('zcyx.oytour.com') !== -1 ? "http://uploadfile.oytour.com" : "http://192.168.2.214:8120",
// UploadUrl: "http://uploadfile.oytour.com",
LocalFileStreamDownLoadUrl: domainUrl + "/api/file/GetFileFromWebApi", LocalFileStreamDownLoadUrl: domainUrl + "/api/file/GetFileFromWebApi",
JavaLocalFileStreamDownLoadUrl: javaUrldo, JavaLocalFileStreamDownLoadUrl: javaUrldo,
}; };
console.log(locationName.indexOf('zcyx')) console.log(locationName.indexOf('zcyx'))
return obj; return obj;
}, },
Vue.prototype.GetLocalFile = function(cmd, msg, fileName, successCall) { Vue.prototype.GetLocalFile = function (cmd, msg, fileName, successCall) {
var apiurl = this.domainManager().LocalFileStreamDownLoadUrl; var apiurl = this.domainManager().LocalFileStreamDownLoadUrl;
var timestamp = (new Date()).valueOf(); var timestamp = (new Date()).valueOf();
if (!localStorage.zcuserInfo && localStorage.zcuserInfo != "" && this.$route.path.toLowerCase() != "/login") { if (!localStorage.zcuserInfo && localStorage.zcuserInfo != "" && this.$route.path.toLowerCase() != "/login") {
...@@ -79,9 +71,9 @@ export default { ...@@ -79,9 +71,9 @@ export default {
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
successCall(res); successCall(res);
}).catch(function(res) {}); }).catch(function (res) {});
}, },
Vue.prototype.JavaGetLocalFile = function(cmd, msg, fileName, successCall) { Vue.prototype.JavaGetLocalFile = function (cmd, msg, fileName, successCall) {
var apiurl = this.domainManager().JavaLocalFileStreamDownLoadUrl + cmd; var apiurl = this.domainManager().JavaLocalFileStreamDownLoadUrl + cmd;
var timestamp = (new Date()).valueOf(); var timestamp = (new Date()).valueOf();
if (!localStorage.zcuserInfo && localStorage.zcuserInfo != "" && this.$route.path.toLowerCase() != "/login") { if (!localStorage.zcuserInfo && localStorage.zcuserInfo != "" && this.$route.path.toLowerCase() != "/login") {
...@@ -129,10 +121,10 @@ export default { ...@@ -129,10 +121,10 @@ export default {
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
successCall(res); successCall(res);
}).catch(function(res) {}); }).catch(function (res) {});
}, },
//价钱格式化,三位数逗号分隔,保留两位小数 duanjun //价钱格式化,三位数逗号分隔,保留两位小数 duanjun
Vue.prototype.moneyFormat = function(value) { Vue.prototype.moneyFormat = function (value) {
let nStr = Number(value).toFixed(2) let nStr = Number(value).toFixed(2)
nStr += ''; nStr += '';
let x = nStr.split('.'); let x = nStr.split('.');
...@@ -145,7 +137,7 @@ export default { ...@@ -145,7 +137,7 @@ export default {
return x1 + x2; return x1 + x2;
}, },
//消息成功提示 //消息成功提示
Vue.prototype.Success = function(msg) { Vue.prototype.Success = function (msg) {
this.$message({ this.$message({
message: msg, message: msg,
duration: 2000, duration: 2000,
...@@ -153,7 +145,7 @@ export default { ...@@ -153,7 +145,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,
...@@ -162,7 +154,7 @@ export default { ...@@ -162,7 +154,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,
...@@ -170,7 +162,7 @@ export default { ...@@ -170,7 +162,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,
...@@ -178,7 +170,7 @@ export default { ...@@ -178,7 +170,7 @@ 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: "取消",
...@@ -198,7 +190,7 @@ export default { ...@@ -198,7 +190,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 : ''
...@@ -211,12 +203,12 @@ export default { ...@@ -211,12 +203,12 @@ export default {
return path.split('?')[0] + '?width=' + w; return path.split('?')[0] + '?width=' + w;
} }
//打开新窗口连接 //打开新窗口连接
Vue.prototype.OpenNewUrl = function(URL) { Vue.prototype.OpenNewUrl = function (URL) {
if (URL != '') { if (URL != '') {
window.open('http://' + URL, '_blank'); window.open('http://' + URL, '_blank');
} }
} }
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 = {}
} }
...@@ -262,7 +254,7 @@ export default { ...@@ -262,7 +254,7 @@ export default {
} }
}, faildCall) }, faildCall)
}, },
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 = {}
} }
...@@ -308,7 +300,7 @@ export default { ...@@ -308,7 +300,7 @@ export default {
} }
}, faildCall) }, faildCall)
}, },
Vue.prototype.getLocalStorage = function() { Vue.prototype.getLocalStorage = function () {
var localStorageData = window.localStorage["zcuserInfo"]; var localStorageData = window.localStorage["zcuserInfo"];
if (localStorageData !== undefined && localStorageData != 'undefined') { if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData); return JSON.parse(localStorageData);
...@@ -317,14 +309,14 @@ export default { ...@@ -317,14 +309,14 @@ export default {
} }
}, },
//上传文件到本地服务器 //上传文件到本地服务器
Vue.prototype.UploadSelfFileT = function(path, files, successCall, ocr) { Vue.prototype.UploadSelfFileT = function (path, files, successCall, ocr) {
if (files && files.length > 0) { if (files && files.length > 0) {
let nameList = new Array() let nameList = new Array()
for (let index = 0; index < files.length; index++) { for (let index = 0; index < files.length; index++) {
nameList.push(this.random_string()); nameList.push(this.random_string());
} }
let that = this; let that = this;
co(function*() { co(function* () {
for (let index = 0; index < files.length; index++) { for (let index = 0; index < files.length; index++) {
let fileName = nameList[index] let fileName = nameList[index]
fileName = path + fileName + "." + files[index].name.split('.').pop() fileName = path + fileName + "." + files[index].name.split('.').pop()
...@@ -336,12 +328,12 @@ export default { ...@@ -336,12 +328,12 @@ export default {
successCall(res); successCall(res);
}) })
} }
}).catch(function(err) { }).catch(function (err) {
}); });
} }
} }
Vue.prototype.random_string = function(len) { Vue.prototype.random_string = function (len) {
len = len || 32; len = len || 32;
var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678'; var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz2345678';
var maxPos = chars.length; var maxPos = chars.length;
...@@ -352,7 +344,7 @@ export default { ...@@ -352,7 +344,7 @@ export default {
return pwd; return pwd;
}, },
//验证只能输入2位小数 //验证只能输入2位小数
Vue.prototype.checkPrice = function(item, filed) { Vue.prototype.checkPrice = function (item, filed) {
var value = ""; var value = "";
if (typeof item[filed] == "string") { if (typeof item[filed] == "string") {
value = item[filed]; value = item[filed];
...@@ -373,7 +365,7 @@ export default { ...@@ -373,7 +365,7 @@ export default {
item[filed] = value; item[filed] = value;
} }
//验证只能输入整数 //验证只能输入整数
Vue.prototype.checkInteger = function(item, filed) { Vue.prototype.checkInteger = function (item, filed) {
var value = ""; var value = "";
if (typeof item[filed] == "string") { if (typeof item[filed] == "string") {
value = item[filed]; value = item[filed];
......
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