Commit e3b56bcc authored by 吴春's avatar 吴春

没有什么提交的

parent 891d1e21
......@@ -11,7 +11,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 &&
......@@ -77,27 +77,27 @@ export default {
return source;
}
},
Vue.prototype.calcPageSize=function(itemHeight){
let yuHeight=itemHeight
Vue.prototype.calcPageSize = function(itemHeight) {
let yuHeight = itemHeight
try {
let obj=null
document.querySelectorAll('.frame-box').forEach(x=>{
if(x.style.display!='none'){
obj=x
let obj = null
document.querySelectorAll('.frame-box').forEach(x => {
if (x.style.display != 'none') {
obj = x
}
})
let dom=obj.offsetHeight
yuHeight=dom-(obj.querySelector('.v-table-header')?obj.querySelector('.v-table-header').offsetHeight:39)-50//减去面包屑,减去表格头部,减去分页,减去偏量
let dom = obj.offsetHeight
yuHeight = dom - (obj.querySelector('.v-table-header') ? obj.querySelector('.v-table-header').offsetHeight : 39) - 50 //减去面包屑,减去表格头部,减去分页,减去偏量
//减去其它同级元素
obj.childNodes[0].childNodes.forEach(x=>{
if(x.className && x.className.indexOf('v-table-views')==-1){
yuHeight-=x.offsetHeight?x.offsetHeight:0
obj.childNodes[0].childNodes.forEach(x => {
if (x.className && x.className.indexOf('v-table-views') == -1) {
yuHeight -= x.offsetHeight ? x.offsetHeight : 0
}
})
} catch (error) {console.log(error)}
return Math.floor(yuHeight/itemHeight)
} catch (error) { console.log(error) }
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;
......@@ -108,24 +108,24 @@ 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://127.0.0.1"; //214主域名
// domainUrl = "http://127.0.0.1"; //214主域名
// 127.0.0.12
// domainUrl = "http://192.168.2.88"; //王悦主域名
// domainUrl = "http://127.0.0.1"; //214主域名
// domainUrl = "http://192.168.2.16:8083"; //王悦主域名
// domainUrl = "http://127.0.0.1"; //214主域名
// domainUrl = "http://192.168.2.65:8025"; //吴春主域名
domainUrl = "http://192.168.2.65:8025"; //吴春主域名
// domainUrl = "http://192.168.2.106:8082"; //罗超主域名
if (locationName.indexOf('oytour')!==-1) {
if (locationName.indexOf('oytour') !== -1) {
domainUrl = "https://reborn.oytour.com";
}else if (locationName.indexOf('viitto')!==-1) {
} else if (locationName.indexOf('viitto') !== -1) {
domainUrl = "https://test.viitto.com";
}
var obj = {
......@@ -150,19 +150,19 @@ export default {
//google地图图片地址
GoogleMapImageUrl: "http://super.oytour.com",
// "http://upload.oytour.com"
UploadUrl: locationName.indexOf('oytour')!==-1 ? "http://upload.oytour.com" : "http://127.0.0.1:8120"
UploadUrl: locationName.indexOf('oytour') !== -1 ? "http://upload.oytour.com" : "http://127.0.0.1:8120"
// UploadUrl: "http://upload.oytour.com"
};
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,
......@@ -170,7 +170,7 @@ export default {
});
},
//错误提示
Vue.prototype.Error = function (msg) {
Vue.prototype.Error = function(msg) {
this.$message({
message: msg,
duration: 2000,
......@@ -179,7 +179,7 @@ export default {
},
//一般提示
Vue.prototype.Info = function (msg) {
Vue.prototype.Info = function(msg) {
this.$message({
message: msg,
duration: 2000,
......@@ -187,7 +187,7 @@ export default {
});
},
//警告提示
Vue.prototype.Warning = function (msg) {
Vue.prototype.Warning = function(msg) {
this.$message({
message: msg,
duration: 2000,
......@@ -195,7 +195,7 @@ export default {
});
},
//Confirm
Vue.prototype.Confirm = function (msg, callback) {
Vue.prototype.Confirm = function(msg, callback) {
this.$confirm(msg, "提示", {
confirmButtonText: "确定",
cancelButtonText: "取消",
......@@ -212,22 +212,22 @@ export default {
},
//打开新窗口连接
Vue.prototype.OpenNewUrl = function (URL) {
Vue.prototype.OpenNewUrl = function(URL) {
if (URL != '') {
window.open('http://' + URL, '_blank');
}
}
Vue.prototype.uploadImg = function (tcID, msg, successCall, faildCall) {
Vue.prototype.uploadImg = function(tcID, msg, successCall, faildCall) {
var apiurl = this.domainManager().Upload + '/Upload/UploadBase64?fileType=1&fileLimit=5&&filePath=Freature/TCID' + tcID;
this.$http.post(apiurl, msg, {
datatype:"jsonP",
datatype: "jsonP",
}).then(res => {
successCall(res);
}, faildCall)
}
//HTTP提交数据
Vue.prototype.apipost = function (cmd, msg, successCall, faildCall) {
Vue.prototype.apipost = function(cmd, msg, successCall, faildCall) {
if (msg == null || msg == "") {
msg = {}
}
......@@ -280,7 +280,7 @@ export default {
},
//下载文件
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") {
......@@ -316,20 +316,20 @@ export default {
document.body.appendChild(link);
link.click();
successCall(res);
}).catch(function (res) {});
}).catch(function(res) {});
},
Vue.prototype.getCookieItem = function () {
Vue.prototype.getCookieItem = function() {
return JSON.parse(this.getCookie("userInfo"))
},
Vue.prototype.getLocalStorage = function () {
Vue.prototype.getLocalStorage = function() {
var localStorageData = window.localStorage["userInfo"];
if (localStorageData !== undefined && localStorageData!='undefined') {
if (localStorageData !== undefined && localStorageData != 'undefined') {
return JSON.parse(localStorageData);
} else {
return null;
}
},
Vue.prototype.getCookie = function (cookieName) {
Vue.prototype.getCookie = function(cookieName) {
var strCookie = document.cookie;
var arrCookie = strCookie.split("; ");
for (var i = 0; i < arrCookie.length; i++) {
......@@ -340,19 +340,19 @@ export default {
}
return "";
},
Vue.prototype.getLoginUser = function () {
Vue.prototype.getLoginUser = function() {
return this.loginUser
},
Vue.prototype.setLoginUser = function (user) {
Vue.prototype.setLoginUser = function(user) {
this.loginUser = user
}
//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({
......@@ -368,7 +368,7 @@ export default {
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');
......@@ -380,7 +380,7 @@ export default {
})
let url = '';
if(fileurl)
if (fileurl)
url = fileurl
else
url = oss.signatureUrl(objectKey);
......@@ -412,7 +412,7 @@ export default {
});
},
Vue.prototype.getFileBlob = function (objectKey, filename) {
Vue.prototype.getFileBlob = function(objectKey, filename) {
var co = require('co');
var OSS = require('ali-oss');
var oss = new OSS({
......@@ -439,7 +439,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++) {
......@@ -452,24 +452,24 @@ export default {
bucket: 'reborndev'
})
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()
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.uploadBlob = function (path, files, successCall) {
Vue.prototype.uploadBlob = function(path, files, successCall) {
if (files && files.length > 0) {
var oss = new OSS({
region: 'oss-cn-hangzhou',
......@@ -478,22 +478,22 @@ export default {
bucket: 'reborndev'
})
let that = this
co(function* () {
co(function*() {
for (let index = 0; index < files.length; index++) {
var result = yield oss.multipartUpload(path, files[index], {
progress: function* (p) {},
progress: function*(p) {},
mime: 'application/octet-stream'
})
successCall(result);
}
}).catch(function (err) {
}).catch(function(err) {
console.log(err);
});
}
},
//验证只能输入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, ""); //清除“数字”和“.”以外的字符
......@@ -511,7 +511,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;
......@@ -526,7 +526,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, "");
......@@ -538,7 +538,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('.');
......@@ -551,7 +551,7 @@ 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