Commit 3b9e4c6b authored by 黄奎's avatar 黄奎

配置文件修改

parent 4092eba9
...@@ -12,7 +12,7 @@ export default { ...@@ -12,7 +12,7 @@ export default {
install(Vue, options) { install(Vue, options) {
Vue.prototype.MsgBus = MsgBus; Vue.prototype.MsgBus = MsgBus;
Vue.prototype.md5 = md5; Vue.prototype.md5 = md5;
Vue.prototype.orderBy = function(source, orders, type) { Vue.prototype.orderBy = function (source, orders, type) {
if ( if (
source instanceof Array && source instanceof Array &&
orders instanceof Array && orders instanceof Array &&
...@@ -22,9 +22,8 @@ export default { ...@@ -22,9 +22,8 @@ export default {
var sorttype = type || "asc"; var sorttype = type || "asc";
var results = []; var results = [];
var totalSum = {}; var totalSum = {};
function grouporder(source, orders, totalSum) { function grouporder(source, orders, totalSum) {
source.sort(function(a, b) { source.sort(function (a, b) {
var convertA = a[orders[0]]; var convertA = a[orders[0]];
var convertB = b[orders[0]]; var convertB = b[orders[0]];
if (typeof convertA == "string" && typeof convertB == "string") { if (typeof convertA == "string" && typeof convertB == "string") {
...@@ -41,7 +40,6 @@ export default { ...@@ -41,7 +40,6 @@ export default {
} }
} }
}); });
var groupmap = new Map(); var groupmap = new Map();
source.forEach(item => { source.forEach(item => {
if (groupmap.has(item[orders[0]])) { if (groupmap.has(item[orders[0]])) {
...@@ -51,9 +49,7 @@ export default { ...@@ -51,9 +49,7 @@ export default {
groupmap.get(item[orders[0]]).push(item); groupmap.get(item[orders[0]]).push(item);
} }
}); });
orders.shift(); orders.shift();
for (let [key, val] of groupmap) { for (let [key, val] of groupmap) {
totalSum[key] = {}; totalSum[key] = {};
totalSum[key].name = key; totalSum[key].name = key;
...@@ -67,9 +63,7 @@ export default { ...@@ -67,9 +63,7 @@ export default {
} }
} }
} }
grouporder(source, ordersc, totalSum); grouporder(source, ordersc, totalSum);
return { return {
results: results, results: results,
totalSum: totalSum totalSum: totalSum
...@@ -78,7 +72,8 @@ export default { ...@@ -78,7 +72,8 @@ export default {
return source; return source;
} }
}, },
Vue.prototype.calcPageSize = function(itemHeight) {
Vue.prototype.calcPageSize = function (itemHeight) {
let yuHeight = itemHeight let yuHeight = itemHeight
try { try {
let obj = null let obj = null
...@@ -100,7 +95,7 @@ export default { ...@@ -100,7 +95,7 @@ export default {
} }
return Math.floor(yuHeight / itemHeight) return Math.floor(yuHeight / itemHeight)
} }
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;
...@@ -111,18 +106,14 @@ export default { ...@@ -111,18 +106,14 @@ export default {
return pwd; return pwd;
}, },
//是否是线上环境【发布时修改为true】 //是否是线上环境【发布时修改为true】
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 () {
let domainUrl = ''; let domainUrl = '';
let locationName = window.location.hostname; let locationName = window.location.hostname;
//domainUrl = "http://192.168.2.214:8082"; domainUrl = "http://192.168.2.214:8082";
domainUrl = "http://localhost:13491";
//domainUrl = "http://192.168.2.16:8083";
//domainUrl = "http://192.168.0.110";
if (locationName.indexOf('oytour') !== -1) { if (locationName.indexOf('oytour') !== -1) {
domainUrl = "http://reborn.oytour.com"; domainUrl = "http://reborn.oytour.com";
} else if (locationName.indexOf('viitto') !== -1) { } else if (locationName.indexOf('viitto') !== -1) {
...@@ -157,14 +148,14 @@ export default { ...@@ -157,14 +148,14 @@ export default {
}; };
return obj; return obj;
}, },
Vue.prototype.yinyanFn = function(url, successCall, faildCall) { Vue.prototype.yinyanFn = function (url, successCall, faildCall) {
this.$http.jsonp(url, ) this.$http.jsonp(url, )
.then(res => { .then(res => {
successCall(res) successCall(res)
}, faildCall) }, faildCall)
}, },
//消息成功提示 //消息成功提示
Vue.prototype.Success = function(msg) { Vue.prototype.Success = function (msg) {
this.$message({ this.$message({
message: msg, message: msg,
duration: 2000, duration: 2000,
...@@ -172,7 +163,7 @@ export default { ...@@ -172,7 +163,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,
...@@ -181,7 +172,7 @@ export default { ...@@ -181,7 +172,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,
...@@ -189,7 +180,7 @@ export default { ...@@ -189,7 +180,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,
...@@ -197,7 +188,7 @@ export default { ...@@ -197,7 +188,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: "取消",
...@@ -212,9 +203,8 @@ export default { ...@@ -212,9 +203,8 @@ export default {
this.Info("已取消操作"); this.Info("已取消操作");
}); });
}, },
//打开新窗口连接 //打开新窗口连接
Vue.prototype.OpenNewUrl = function(URL) { Vue.prototype.OpenNewUrl = function (URL) {
if (URL != '') { if (URL != '') {
if (URL.indexOf("https") != -1) { if (URL.indexOf("https") != -1) {
var str = 'http://' + URL.substring(8); var str = 'http://' + URL.substring(8);
...@@ -228,24 +218,8 @@ export default { ...@@ -228,24 +218,8 @@ export default {
} }
} }
Vue.prototype.uploadImg = function(tcID, msg, successCall, faildCall) {
var apiurl = this.domainManager().UploadUrl + '/Upload/UploadBase64Two?fileType=1&fileLimit=5&&filePath=Freature/' + tcID;
this.$http.post(apiurl, {
FileIndex: msg.FileIndex,
MyFile: msg.MyFile
}, {
headers: {
"Content-Type": "application/x-www-form-urlencoded;"
},
}).then(function(res) {
console.log(res)
})
}
//HTTP提交数据 //HTTP提交数据
Vue.prototype.apipost = function(cmd, msg, successCall, faildCall) { Vue.prototype.apipost = function (cmd, msg, successCall, faildCall, isOnline) {
if (this.$route.name.indexOf('login') === -1 && this.$route.name.indexOf('confirmationOrderDownLoad') === -1 && this.$route.name.indexOf('PrintPage') === -1) { if (this.$route.name.indexOf('login') === -1 && this.$route.name.indexOf('confirmationOrderDownLoad') === -1 && this.$route.name.indexOf('PrintPage') === -1) {
let previousPathInfo = { let previousPathInfo = {
path: this.$route.name, path: this.$route.name,
...@@ -257,6 +231,10 @@ export default { ...@@ -257,6 +231,10 @@ export default {
msg = {} msg = {}
} }
var apiurl = this.domainManager().PostUrl; var apiurl = this.domainManager().PostUrl;
//酒店接口
if (isOnline) {
apiurl = this.domainManager().HotelApi;
}
var timestamp = (new Date()).valueOf(); var timestamp = (new Date()).valueOf();
this.apiurl = apiurl; this.apiurl = apiurl;
if (this.$route.path.toLowerCase() == "/signature") { if (this.$route.path.toLowerCase() == "/signature") {
...@@ -304,8 +282,8 @@ export default { ...@@ -304,8 +282,8 @@ export default {
}, faildCall) }, faildCall)
}, },
//供应商版请求接口方法
Vue.prototype.ApiPost2 = function(cmd, msg, successCall, faildCall) { Vue.prototype.ApiPost2 = function (cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
...@@ -319,7 +297,6 @@ export default { ...@@ -319,7 +297,6 @@ export default {
path: '/SupplierLogin' path: '/SupplierLogin'
}) })
} }
var token = ""; var token = "";
var key = ""; var key = "";
if (this.getLocalStorageSupplier() != null) { if (this.getLocalStorageSupplier() != null) {
...@@ -336,7 +313,6 @@ export default { ...@@ -336,7 +313,6 @@ export default {
"sign": md5Str, "sign": md5Str,
"uid": uid "uid": uid
} }
this.$http.post(apiNewurl, postData, { this.$http.post(apiNewurl, postData, {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
...@@ -354,7 +330,8 @@ export default { ...@@ -354,7 +330,8 @@ export default {
}, faildCall) }, faildCall)
}, },
Vue.prototype.apiJavaPost = function(cmd, msg, successCall, faildCall) { //请求Java接口
Vue.prototype.apiJavaPost = function (cmd, msg, successCall, faildCall) {
if (this.$route.name.indexOf('login') === -1 && this.$route.name.indexOf('confirmationOrderDownLoad') === -1 && this.$route.name.indexOf('PrintPage') === -1 && this.$route.name.indexOf('clientConfirm') === -1) { if (this.$route.name.indexOf('login') === -1 && this.$route.name.indexOf('confirmationOrderDownLoad') === -1 && this.$route.name.indexOf('PrintPage') === -1 && this.$route.name.indexOf('clientConfirm') === -1) {
let previousPathInfo = { let previousPathInfo = {
path: this.$route.name, path: this.$route.name,
...@@ -412,8 +389,9 @@ export default { ...@@ -412,8 +389,9 @@ export default {
} }
}, faildCall) }, faildCall)
}, },
//下载文件 //下载文件
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.userInfo && localStorage.userInfo != "" && this.$route.path.toLowerCase() != "/login") { if (!localStorage.userInfo && localStorage.userInfo != "" && this.$route.path.toLowerCase() != "/login") {
...@@ -449,10 +427,10 @@ export default { ...@@ -449,10 +427,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) {});
}, },
//ERP本地缓存
Vue.prototype.getLocalStorage = function() { Vue.prototype.getLocalStorage = function () {
var localStorageData = window.localStorage["userInfo"]; var localStorageData = window.localStorage["userInfo"];
if (localStorageData !== undefined && localStorageData != 'undefined') { if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData); return JSON.parse(localStorageData);
...@@ -460,8 +438,8 @@ export default { ...@@ -460,8 +438,8 @@ export default {
return null; return null;
} }
}, },
//供应商本地缓存
Vue.prototype.getLocalStorageSupplier = function() { Vue.prototype.getLocalStorageSupplier = function () {
var localStorageData = window.localStorage["userInfo"]; var localStorageData = window.localStorage["userInfo"];
if (localStorageData !== undefined && localStorageData != 'userInfo') { if (localStorageData !== undefined && localStorageData != 'userInfo') {
return JSON.parse(localStorageData); return JSON.parse(localStorageData);
...@@ -471,11 +449,11 @@ export default { ...@@ -471,11 +449,11 @@ export default {
}, },
//PDF预览 //PDF预览
Vue.prototype.previewPDF = function(url) { Vue.prototype.previewPDF = function (url) {
window.open(this.domainManager().PDFViewUrl + url); window.open(this.domainManager().PDFViewUrl + url);
}, },
//文件下载
Vue.prototype.downloadFile = function(objectKey) { Vue.prototype.downloadFile = function (objectKey) {
var co = require('co'); var co = require('co');
var OSS = require('ali-oss'); var OSS = require('ali-oss');
var oss = new OSS({ var oss = new OSS({
...@@ -489,10 +467,9 @@ export default { ...@@ -489,10 +467,9 @@ export default {
link.href = url; link.href = url;
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
}, },
Vue.prototype.downloadFileRename = function(objectKey, filename, fileurl) { //文件重命名下载
Vue.prototype.downloadFileRename = function (objectKey, filename, fileurl) {
var co = require('co'); var co = require('co');
var OSS = require('ali-oss'); var OSS = require('ali-oss');
var oss = new OSS({ var oss = new OSS({
...@@ -501,7 +478,6 @@ export default { ...@@ -501,7 +478,6 @@ export default {
accessKeySecret: 'j47Ajn0d0WzUCIX8Biyj3P2r8QDltI', accessKeySecret: 'j47Ajn0d0WzUCIX8Biyj3P2r8QDltI',
bucket: 'reborndev' bucket: 'reborndev'
}) })
let url = ''; let url = '';
if (fileurl) if (fileurl)
url = fileurl url = fileurl
...@@ -533,9 +509,9 @@ export default { ...@@ -533,9 +509,9 @@ export default {
window.URL.revokeObjectURL(link.href); window.URL.revokeObjectURL(link.href);
} }
}); });
}, },
Vue.prototype.getFileBlob = function(objectKey, filename) { //获取文件Blob
Vue.prototype.getFileBlob = function (objectKey, filename) {
var co = require('co'); var co = require('co');
var OSS = require('ali-oss'); var OSS = require('ali-oss');
var oss = new OSS({ var oss = new OSS({
...@@ -558,7 +534,22 @@ export default { ...@@ -558,7 +534,22 @@ export default {
}); });
return getBlob return getBlob
}, },
Vue.prototype.uploadSelfBlob = function(path, files, successCall) { //文件上传
Vue.prototype.uploadImg = function (tcID, msg, successCall, faildCall) {
var apiurl = this.domainManager().UploadUrl + '/Upload/UploadBase64Two?fileType=1&fileLimit=5&&filePath=Freature/' + tcID;
this.$http.post(apiurl, {
FileIndex: msg.FileIndex,
MyFile: msg.MyFile
}, {
headers: {
"Content-Type": "application/x-www-form-urlencoded;"
},
}).then(function (res) {
})
},
//Blob文件上传
Vue.prototype.uploadSelfBlob = function (path, files, successCall) {
let that = this; let that = this;
var uploadUrl = that.domainManager().UploadUrl + "/Upload/UploadBlob?fileType=1&fileLimit=5&&filePath=" + path; var uploadUrl = that.domainManager().UploadUrl + "/Upload/UploadBlob?fileType=1&fileLimit=5&&filePath=" + path;
var formData = new FormData(); var formData = new FormData();
...@@ -573,7 +564,7 @@ export default { ...@@ -573,7 +564,7 @@ export default {
//path 请按照"/模块名称/用户ID/自定义文件夹/" /谁搞错一次5块红包 //path 请按照"/模块名称/用户ID/自定义文件夹/" /谁搞错一次5块红包
//files 文件数组 //files 文件数组
//p 进度回调函数 //p 进度回调函数
Vue.prototype.uploadFile = function(path, files, successCall) { Vue.prototype.uploadFile = function (path, files, successCall) {
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++) {
...@@ -586,31 +577,30 @@ export default { ...@@ -586,31 +577,30 @@ export default {
bucket: 'reborndev' bucket: 'reborndev'
}) })
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 = "/New" + path + fileName + "." + files[index].name.split('.').pop() fileName = "/New" + path + fileName + "." + files[index].name.split('.').pop()
var result = yield oss.multipartUpload(fileName, files[index], { var result = yield oss.multipartUpload(fileName, files[index], {
progress: function*(p) {}, progress: function* (p) {},
mime: 'application/octet-stream' mime: 'application/octet-stream'
}) })
successCall(result); successCall(result);
} }
}).catch(function(err) { }).catch(function (err) {
console.log(err); console.log(err);
}); });
} }
}, },
//上传文件到本地服务器 //上传文件到本地服务器
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()
...@@ -622,7 +612,7 @@ export default { ...@@ -622,7 +612,7 @@ export default {
successCall(res); successCall(res);
}) })
} }
}).catch(function(err) { }).catch(function (err) {
console.log("上传文件出错" + err); console.log("上传文件出错" + err);
}); });
} }
...@@ -632,7 +622,7 @@ export default { ...@@ -632,7 +622,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 = 'm_filt'; let poise = 'm_filt';
w = w ? w : '' w = w ? w : ''
...@@ -644,7 +634,7 @@ export default { ...@@ -644,7 +634,7 @@ export default {
} }
return url + '/image/index?filePath=' + path.replace('http://192.168.2.214:8130', '').replace('http://imgfile.oytour.com', '').split('?')[0] + '&process=resize,' + poise + ',w_' + w + ',h_' + h; return url + '/image/index?filePath=' + path.replace('http://192.168.2.214:8130', '').replace('http://imgfile.oytour.com', '').split('?')[0] + '&process=resize,' + poise + ',w_' + w + ',h_' + h;
} }
Vue.prototype.uploadSelfBlob = function(path, files, successCall) { Vue.prototype.uploadSelfBlob = function (path, files, successCall) {
let that = this; let that = this;
var uploadUrl = that.domainManager().UploadUrl + "/Upload/UploadBlob?fileType=1&fileLimit=5&&filePath=" + path; var uploadUrl = that.domainManager().UploadUrl + "/Upload/UploadBlob?fileType=1&fileLimit=5&&filePath=" + path;
var formData = new FormData(); var formData = new FormData();
...@@ -658,7 +648,7 @@ export default { ...@@ -658,7 +648,7 @@ export default {
}, },
//验证只能输入2位小数【负数:isMinus传true】 //验证只能输入2位小数【负数:isMinus传true】
Vue.prototype.checkPrice = function(item, filed, isMinus) { Vue.prototype.checkPrice = function (item, filed, isMinus) {
var value = "" + item[filed]; //转字符串 var value = "" + item[filed]; //转字符串
var t = value.charAt(0); var t = value.charAt(0);
value = value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符 value = value.replace(/[^\d.]/g, ""); //清除“数字”和“.”以外的字符
...@@ -676,7 +666,7 @@ export default { ...@@ -676,7 +666,7 @@ export default {
item[filed] = value; item[filed] = value;
} }
//验证输入6位小数汇率 //验证输入6位小数汇率
Vue.prototype.checkRate = function(item, filed) { Vue.prototype.checkRate = function (item, filed) {
var value = "" + item[filed]; //转字符串 var value = "" + item[filed]; //转字符串
var p1 = /[^\d\.]/g; // 过滤非数字及小数点 /g :所有范围中过滤 var p1 = /[^\d\.]/g; // 过滤非数字及小数点 /g :所有范围中过滤
var p2 = /(\.\d{6})\d*$/g; var p2 = /(\.\d{6})\d*$/g;
...@@ -691,7 +681,7 @@ export default { ...@@ -691,7 +681,7 @@ export default {
} }
//验证只能输入整数【负数:isMinus传true】 //验证只能输入整数【负数:isMinus传true】
Vue.prototype.checkInteger = function(item, filed, isMinus) { Vue.prototype.checkInteger = function (item, filed, isMinus) {
var value = "" + item[filed]; //转字符串 var value = "" + item[filed]; //转字符串
var t = value.charAt(0); var t = value.charAt(0);
value = value.replace(this.$commonUtils.Regex.isInteger, ""); value = value.replace(this.$commonUtils.Regex.isInteger, "");
...@@ -701,7 +691,8 @@ export default { ...@@ -701,7 +691,8 @@ export default {
} }
item[filed] = value; item[filed] = value;
} }
Vue.prototype.checkTime = function(item, filed) { //时间验证
Vue.prototype.checkTime = function (item, filed) {
var date = item[filed]; var date = item[filed];
if (date.length == 1) { if (date.length == 1) {
var v1 = date.substring(0, 1); var v1 = date.substring(0, 1);
...@@ -746,7 +737,7 @@ export default { ...@@ -746,7 +737,7 @@ export default {
} }
//价钱格式化,三位数逗号分隔,保留两位小数 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('.');
...@@ -758,8 +749,8 @@ export default { ...@@ -758,8 +749,8 @@ export default {
} }
return x1 + x2; return x1 + x2;
}, },
//文件图标
Vue.prototype.loadFileICON = function(suffix) { Vue.prototype.loadFileICON = function (suffix) {
let icons = [{ let icons = [{
"name": "\u7f51\u76d8BT\u79bb\u7ebf\u4e0b\u8f7d", "name": "\u7f51\u76d8BT\u79bb\u7ebf\u4e0b\u8f7d",
......
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