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

配置文件修改

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