Commit b77c969f authored by 吴春's avatar 吴春

没有提交的

parent e1b8859d
...@@ -11,7 +11,7 @@ export default { ...@@ -11,7 +11,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 &&
...@@ -77,27 +77,27 @@ export default { ...@@ -77,27 +77,27 @@ 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
document.querySelectorAll('.frame-box').forEach(x=>{ document.querySelectorAll('.frame-box').forEach(x => {
if(x.style.display!='none'){ if (x.style.display != 'none') {
obj=x obj = x
} }
}) })
let dom=obj.offsetHeight let dom = obj.offsetHeight
yuHeight=dom-(obj.querySelector('.v-table-header')?obj.querySelector('.v-table-header').offsetHeight:39)-50//减去面包屑,减去表格头部,减去分页,减去偏量 yuHeight = dom - (obj.querySelector('.v-table-header') ? obj.querySelector('.v-table-header').offsetHeight : 39) - 50 //减去面包屑,减去表格头部,减去分页,减去偏量
//减去其它同级元素 //减去其它同级元素
obj.childNodes[0].childNodes.forEach(x=>{ obj.childNodes[0].childNodes.forEach(x => {
if(x.className && x.className.indexOf('v-table-views')==-1){ if (x.className && x.className.indexOf('v-table-views') == -1) {
yuHeight-=x.offsetHeight?x.offsetHeight:0 yuHeight -= x.offsetHeight ? x.offsetHeight : 0
} }
}) })
} catch (error) {console.log(error)} } catch (error) { console.log(error) }
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;
...@@ -108,11 +108,11 @@ export default { ...@@ -108,11 +108,11 @@ 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"; //214主域名 // domainUrl = "http://192.168.2.214:8082"; //214主域名
...@@ -120,11 +120,11 @@ export default { ...@@ -120,11 +120,11 @@ export default {
// domainUrl = "http://127.0.0.1"; //214主域名 // domainUrl = "http://127.0.0.1"; //214主域名
// domainUrl = "http://192.168.2.16:8083"; //王悦主域名 // domainUrl = "http://192.168.2.16:8083"; //王悦主域名
// domainUrl = "http://127.0.0.1"; //214主域名 // 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.214:8082"; //罗超主域名 domainUrl = "http://192.168.2.214:8082"; //罗超主域名
if (locationName.indexOf('oytour')!==-1) { if (locationName.indexOf('oytour') !== -1) {
domainUrl = "https://reborn.oytour.com"; domainUrl = "https://reborn.oytour.com";
}else if (locationName.indexOf('viitto')!==-1) { } else if (locationName.indexOf('viitto') !== -1) {
domainUrl = "https://test.viitto.com"; domainUrl = "https://test.viitto.com";
} }
var obj = { var obj = {
...@@ -151,14 +151,14 @@ export default { ...@@ -151,14 +151,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,
...@@ -166,7 +166,7 @@ export default { ...@@ -166,7 +166,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,
...@@ -175,7 +175,7 @@ export default { ...@@ -175,7 +175,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,
...@@ -183,7 +183,7 @@ export default { ...@@ -183,7 +183,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,
...@@ -191,7 +191,7 @@ export default { ...@@ -191,7 +191,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: "取消",
...@@ -208,13 +208,13 @@ export default { ...@@ -208,13 +208,13 @@ export default {
}, },
//打开新窗口连接 //打开新窗口连接
Vue.prototype.OpenNewUrl = function (URL) { Vue.prototype.OpenNewUrl = function(URL) {
if (URL != '') { if (URL != '') {
window.open('http://' + URL, '_blank'); window.open('http://' + URL, '_blank');
} }
} }
//HTTP提交数据 //HTTP提交数据
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 = {}
} }
...@@ -267,7 +267,7 @@ export default { ...@@ -267,7 +267,7 @@ export default {
}, },
//下载文件 //下载文件
Vue.prototype.GetLocalFile = function (cmd, msg, fileName) { Vue.prototype.GetLocalFile = function(cmd, msg, fileName) {
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") {
...@@ -302,20 +302,20 @@ export default { ...@@ -302,20 +302,20 @@ export default {
link.setAttribute("download", fileName); link.setAttribute("download", fileName);
document.body.appendChild(link); document.body.appendChild(link);
link.click(); link.click();
}).catch(function (res) {}); }).catch(function(res) {});
}, },
Vue.prototype.getCookieItem = function () { Vue.prototype.getCookieItem = function() {
return JSON.parse(this.getCookie("userInfo")) return JSON.parse(this.getCookie("userInfo"))
}, },
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);
} else { } else {
return null; return null;
} }
}, },
Vue.prototype.getCookie = function (cookieName) { Vue.prototype.getCookie = function(cookieName) {
var strCookie = document.cookie; var strCookie = document.cookie;
var arrCookie = strCookie.split("; "); var arrCookie = strCookie.split("; ");
for (var i = 0; i < arrCookie.length; i++) { for (var i = 0; i < arrCookie.length; i++) {
...@@ -326,19 +326,19 @@ export default { ...@@ -326,19 +326,19 @@ export default {
} }
return ""; return "";
}, },
Vue.prototype.getLoginUser = function () { Vue.prototype.getLoginUser = function() {
return this.loginUser return this.loginUser
}, },
Vue.prototype.setLoginUser = function (user) { Vue.prototype.setLoginUser = function(user) {
this.loginUser = user this.loginUser = user
} }
//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({
...@@ -354,7 +354,7 @@ export default { ...@@ -354,7 +354,7 @@ export default {
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');
...@@ -366,7 +366,7 @@ export default { ...@@ -366,7 +366,7 @@ export default {
}) })
let url = ''; let url = '';
if(fileurl) if (fileurl)
url = fileurl url = fileurl
else else
url = oss.signatureUrl(objectKey); url = oss.signatureUrl(objectKey);
...@@ -398,7 +398,7 @@ export default { ...@@ -398,7 +398,7 @@ export default {
}); });
}, },
Vue.prototype.getFileBlob = function (objectKey, filename) { 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({
...@@ -425,7 +425,7 @@ export default { ...@@ -425,7 +425,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++) {
...@@ -438,24 +438,24 @@ export default { ...@@ -438,24 +438,24 @@ 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 = path + fileName + "." + files[index].name.split('.').pop() fileName = 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.uploadBlob = function (path, files, successCall) { Vue.prototype.uploadBlob = function(path, files, successCall) {
if (files && files.length > 0) { if (files && files.length > 0) {
var oss = new OSS({ var oss = new OSS({
region: 'oss-cn-hangzhou', region: 'oss-cn-hangzhou',
...@@ -464,22 +464,22 @@ export default { ...@@ -464,22 +464,22 @@ 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++) {
var result = yield oss.multipartUpload(path, files[index], { var result = yield oss.multipartUpload(path, 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);
}); });
} }
}, },
//验证只能输入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, ""); //清除“数字”和“.”以外的字符
...@@ -497,7 +497,7 @@ export default { ...@@ -497,7 +497,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;
...@@ -512,7 +512,7 @@ export default { ...@@ -512,7 +512,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, "");
...@@ -524,7 +524,7 @@ export default { ...@@ -524,7 +524,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('.');
...@@ -537,7 +537,7 @@ export default { ...@@ -537,7 +537,7 @@ 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