Commit 542c4fe5 authored by 黄奎's avatar 黄奎

页面修改

parent 5591a53a
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -12,11 +12,11 @@ export default { ...@@ -12,11 +12,11 @@ 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.QjGroupId = function(msg) { Vue.prototype.QjGroupId = function (msg) {
let GroupId = 2; let GroupId = 2;
return GroupId; return GroupId;
}, },
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 &&
...@@ -28,7 +28,7 @@ export default { ...@@ -28,7 +28,7 @@ export default {
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") {
...@@ -77,7 +77,7 @@ export default { ...@@ -77,7 +77,7 @@ 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
...@@ -97,7 +97,7 @@ export default { ...@@ -97,7 +97,7 @@ export default {
} catch (error) {} } catch (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,21 +108,19 @@ export default { ...@@ -108,21 +108,19 @@ 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 = '';
//domainUrl = "http://reborn.oytour.com"; let mallUrl = ""; //商城API
domainUrl = "http://localhost:13491";
let locationName = window.location.hostname; let locationName = window.location.hostname;
domainUrl = "http://127.0.0.1";
let javaUrldo = ""; let javaUrldo = "";
javaUrldo = locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://efficient.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.215:9000"; javaUrldo = locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://efficient.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.215:9000";
//商城API //商城API
let mallUrl = "http://192.168.2.214:8200"; mallUrl = "http://192.168.2.214:8200";
if (locationName.indexOf('testerp.oytour') !== -1) { if (locationName.indexOf('testerp.oytour') !== -1) {
domainUrl = "http://testapi.oytour.com"; domainUrl = "http://testapi.oytour.com";
mallUrl = "https://mallapi.oytour.com"; mallUrl = "https://mallapi.oytour.com";
...@@ -157,22 +155,20 @@ export default { ...@@ -157,22 +155,20 @@ export default {
ViittoFileUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? "http://imgfile.oytour.com" : 'http://192.168.2.214:8130', ViittoFileUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? "http://imgfile.oytour.com" : 'http://192.168.2.214:8130',
javaUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://efficient.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.17:8087", javaUrl: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://efficient.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.17:8087",
javaUrlNew: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://property.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.17:8087", javaUrlNew: locationName.indexOf('oytour') !== -1 || locationName.indexOf('viitto') !== -1 ? (locationName.indexOf('oytour') !== -1 ? "http://property.oytour.com" : "http://47.96.12.235:9001") : "http://192.168.2.17:8087",
// javaUrl:"http://192.168.2.215:9000",
//Java接口本站文件流下载地址 //Java接口本站文件流下载地址
JavaLocalFileStreamDownLoadUrl: javaUrldo, JavaLocalFileStreamDownLoadUrl: javaUrldo,
mallUrl: mallUrl, mallUrl: mallUrl,
}; };
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,
...@@ -180,7 +176,7 @@ export default { ...@@ -180,7 +176,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,
...@@ -189,7 +185,7 @@ export default { ...@@ -189,7 +185,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,
...@@ -197,7 +193,7 @@ export default { ...@@ -197,7 +193,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,
...@@ -205,7 +201,7 @@ export default { ...@@ -205,7 +201,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: "取消",
...@@ -221,7 +217,7 @@ export default { ...@@ -221,7 +217,7 @@ export default {
}); });
}, },
//打开新窗口连接 //打开新窗口连接
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);
...@@ -236,7 +232,7 @@ export default { ...@@ -236,7 +232,7 @@ export default {
} }
//HTTP提交数据 //HTTP提交数据
Vue.prototype.apipost = function(cmd, msg, successCall, faildCall, isOnline) { Vue.prototype.apipost = function (cmd, msg, successCall, faildCall, isOnline) {
if (this.$route.name.indexOf('login') === -1 && this.$route.name.indexOf('clientConfirm') === -1 && if (this.$route.name.indexOf('login') === -1 && this.$route.name.indexOf('clientConfirm') === -1 &&
this.$route.name.indexOf('confirmationOrderDownLoad') === -1 && this.$route.name.indexOf('PrintPage') === -1 && this.$route.name.indexOf('confirmationOrderDownLoad') === -1 && this.$route.name.indexOf('PrintPage') === -1 &&
this.$route.name.indexOf('TravelContractConfirm') === -1 && this.$route.name.indexOf('ViittoContractConfirm') === -1 && this.$route.name.indexOf('TravelContractConfirm') === -1 && this.$route.name.indexOf('ViittoContractConfirm') === -1 &&
...@@ -249,7 +245,6 @@ export default { ...@@ -249,7 +245,6 @@ export default {
} }
localStorage.previousPathInfo = JSON.stringify(previousPathInfo); localStorage.previousPathInfo = JSON.stringify(previousPathInfo);
} }
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
...@@ -341,8 +336,7 @@ export default { ...@@ -341,8 +336,7 @@ export default {
}, },
//HTTP提交数据 //HTTP提交数据
Vue.prototype.mallapipost = function(cmd, msg, successCall, faildCall, isOnline) { Vue.prototype.mallapipost = function (cmd, msg, successCall, faildCall, isOnline) {
var apiurl = this.domainManager().mallUrl + cmd; var apiurl = this.domainManager().mallUrl + cmd;
var postData = this.GetPostData(cmd, msg, ""); var postData = this.GetPostData(cmd, msg, "");
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
...@@ -352,11 +346,7 @@ export default { ...@@ -352,11 +346,7 @@ export default {
} }
}) })
.then(res => { .then(res => {
if (res.data.resultCode == 10000 || res.data.resultCode == 10001) { if (res.data.resultCode == 10000 || res.data.resultCode == 10001) {} else if (res.resultCode == 10005) {
// this.$router.push({
// path: '/login'
// });
} else if (res.resultCode == 10005) {
this.$router.go(-1); this.$router.go(-1);
} else { } else {
successCall(res); successCall(res);
...@@ -365,7 +355,7 @@ export default { ...@@ -365,7 +355,7 @@ export default {
} }
//文件下载 //文件下载
Vue.prototype.GetMallLocalFile = function(cmd, msg, fileName, newCmd, successCall) { Vue.prototype.GetMallLocalFile = function (cmd, msg, fileName, newCmd, successCall) {
var apiurl = this.domainManager().mallUrl + cmd; var apiurl = this.domainManager().mallUrl + cmd;
var postData = this.GetPostData(cmd, msg, newCmd); var postData = this.GetPostData(cmd, msg, newCmd);
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
...@@ -381,41 +371,21 @@ export default { ...@@ -381,41 +371,21 @@ 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.GetPostData = function(cmd, msg, newCmd) { Vue.prototype.GetPostData = function (cmd, msg, newCmd) {
if (msg == null || msg == "") { if (msg == null || msg == "") {
msg = {} msg = {}
} }
var timestamp = (new Date()).valueOf(); var timestamp = (new Date()).valueOf();
// if (!localStorage.mall_userInfo && localStorage.mall_userInfo != "" &&
// this.$route.path.toLowerCase() != "/login" &&
// this.$route.path.toLowerCase() != "/register" &&
// this.$route.path.toLowerCase() != "/forgetpassword"
// ) {
// this.$router.push({
// path: '/login'
// })
// }
var token = ""; var token = "";
var key = ""; var key = "";
var MallBaseId = 1; //小程序ID var MallBaseId = 1; //小程序ID
var TenantId = 1; //商户Id var TenantId = 1; //商户Id
// var EmpId = 0; //员工编号【员工登录时使用】
// if (this.getLocalStorage() != null) {
// token = this.getLocalStorage().Token;
// key = this.getLocalStorage().SecretKey;
// MallBaseId = this.getLocalStorage().MallBaseId;
// TenantId = this.getLocalStorage().TenantId;
// EmpId = this.getLocalStorage().EmpId;
// }
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase(); var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`); var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
let tempLanguage = 0; let tempLanguage = 0;
if (localStorage.language && localStorage.language != '') { if (localStorage.language && localStorage.language != '') {
if (localStorage.language == "zh-TW") { if (localStorage.language == "zh-TW") {
...@@ -437,17 +407,12 @@ export default { ...@@ -437,17 +407,12 @@ export default {
cmd: cmdStr, cmd: cmdStr,
MallBaseId: MallBaseId, MallBaseId: MallBaseId,
TenantId: TenantId, TenantId: TenantId,
// EmpId: EmpId,
// MiniAppId:"wxacd9f8cc3480d29e",
// OpenId:"ow_7I5ZQKhAB66yvOTGI35Xk-Kmg",
// UserId:19992,
} }
return postData return postData
}, },
//用户权限验证 //用户权限验证
Vue.prototype.CheckUserAuth = function(authCode, successCall, faildCall) { Vue.prototype.CheckUserAuth = function (authCode, successCall, faildCall) {
let localStorageJson = this.getLocalStorage(); let localStorageJson = this.getLocalStorage();
var newCode = ',' + authCode + ','; var newCode = ',' + authCode + ',';
if (("," + localStorageJson.ActionMenuCode + ",").indexOf(newCode) > -1) { if (("," + localStorageJson.ActionMenuCode + ",").indexOf(newCode) > -1) {
...@@ -466,7 +431,7 @@ export default { ...@@ -466,7 +431,7 @@ export default {
} }
}, },
//供应商版请求接口方法 //供应商版请求接口方法
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 = {}
} }
...@@ -514,7 +479,7 @@ export default { ...@@ -514,7 +479,7 @@ export default {
}, },
//请求Java接口 //请求Java接口
Vue.prototype.apiJavaPost = function(cmd, msg, successCall, faildCall) { 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 = {
...@@ -574,7 +539,7 @@ export default { ...@@ -574,7 +539,7 @@ export default {
}, faildCall) }, faildCall)
}, },
//请求资产管理接口 //请求资产管理接口
Vue.prototype.apiJavaPostZc = function(cmd, msg, successCall, faildCall) { Vue.prototype.apiJavaPostZc = 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 = {
...@@ -635,7 +600,7 @@ export default { ...@@ -635,7 +600,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 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") {
...@@ -671,9 +636,9 @@ export default { ...@@ -671,9 +636,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.userInfo && localStorage.userInfo != "" && this.$route.path.toLowerCase() != "/login") { if (!localStorage.userInfo && localStorage.userInfo != "" && this.$route.path.toLowerCase() != "/login") {
...@@ -691,7 +656,6 @@ export default { ...@@ -691,7 +656,6 @@ export default {
let groupId = userInfo.RB_Group_id ? userInfo.RB_Group_id : 0; let groupId = userInfo.RB_Group_id ? userInfo.RB_Group_id : 0;
let uid = userInfo.EmployeeId ? userInfo.EmployeeId : 0; let uid = userInfo.EmployeeId ? userInfo.EmployeeId : 0;
var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase(); var encodeMsg = encodeURIComponent(JSON.stringify(msg)).toLowerCase();
// var md5Str = md5(`cmd=${cmd}&msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
var md5Str = md5(`msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`); var md5Str = md5(`msg=${encodeMsg}&timestamp=${timestamp}&token=${token}&key=${key}`);
var postData = { var postData = {
"msg": msg, "msg": msg,
...@@ -701,13 +665,6 @@ export default { ...@@ -701,13 +665,6 @@ export default {
"uid": uid, "uid": uid,
"groupId": groupId "groupId": groupId
} }
// var postData = {
// "msg": msg,
// "cmd": cmd,
// "timestamp": timestamp,
// "token": token,
// "sign": md5Str
// }
this.$http.post(apiurl, postData, { this.$http.post(apiurl, postData, {
responseType: 'arraybuffer' responseType: 'arraybuffer'
}).then((res) => { }).then((res) => {
...@@ -721,10 +678,10 @@ export default { ...@@ -721,10 +678,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本地缓存 //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);
...@@ -733,7 +690,7 @@ export default { ...@@ -733,7 +690,7 @@ export default {
} }
}, },
//供应商本地缓存 //供应商本地缓存
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);
...@@ -741,14 +698,12 @@ export default { ...@@ -741,14 +698,12 @@ export default {
return null; return null;
} }
}, },
//PDF预览 //PDF预览
Vue.prototype.previewPDF = function(url) { Vue.prototype.previewPDF = function (url) {
// window.open(this.domainManager().PDFViewUrl + url);
window.open(url); window.open(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({
...@@ -764,7 +719,7 @@ export default { ...@@ -764,7 +719,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');
var oss = new OSS({ var oss = new OSS({
...@@ -806,7 +761,7 @@ export default { ...@@ -806,7 +761,7 @@ export default {
}); });
}, },
//获取文件Blob //获取文件Blob
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({
...@@ -830,7 +785,7 @@ export default { ...@@ -830,7 +785,7 @@ export default {
return getBlob return getBlob
}, },
//文件上传 //文件上传
Vue.prototype.uploadImg = function(path, base64Str, successCall, faildCall) { Vue.prototype.uploadImg = function (path, base64Str, successCall, faildCall) {
var apiurl = this.domainManager().UploadUrl + '/Upload/UploadBase64Two?fileType=1&fileLimit=5&&filePath=' + path; var apiurl = this.domainManager().UploadUrl + '/Upload/UploadBase64Two?fileType=1&fileLimit=5&&filePath=' + path;
this.$http.post(apiurl, { this.$http.post(apiurl, {
MyFile: base64Str MyFile: base64Str
...@@ -838,12 +793,12 @@ export default { ...@@ -838,12 +793,12 @@ export default {
headers: { headers: {
"Content-Type": "application/x-www-form-urlencoded;" "Content-Type": "application/x-www-form-urlencoded;"
}, },
}).then(function(res) { }).then(function (res) {
}) })
}, },
//Blob文件上传 //Blob文件上传
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();
...@@ -858,7 +813,7 @@ export default { ...@@ -858,7 +813,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()
...@@ -874,31 +829,31 @@ export default { ...@@ -874,31 +829,31 @@ export default {
let that = this; let that = this;
let checkpoint = null; let checkpoint = null;
let percentage = 0; let percentage = 0;
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) {
}); });
} }
}, },
//上传文件到本地服务器 //上传文件到本地服务器
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()
...@@ -908,14 +863,14 @@ export default { ...@@ -908,14 +863,14 @@ export default {
that.$http.post(uploadUrl, formData, {}) that.$http.post(uploadUrl, formData, {})
.then(res => { .then(res => {
successCall(res); successCall(res);
}).catch(function(reason) { }).catch(function (reason) {
that.$refs['my-upload'].clearFiles(); that.$refs['my-upload'].clearFiles();
that.$message.error('上传失败!'); that.$message.error('上传失败!');
that.MsgBus.$emit('UploadSelfFileErr') that.MsgBus.$emit('UploadSelfFileErr')
}); });
} }
}).catch(function(err) { }).catch(function (err) {
that.$refs['my-upload'].clearFiles(); that.$refs['my-upload'].clearFiles();
that.$message.error('上传失败!'); that.$message.error('上传失败!');
}); });
...@@ -926,7 +881,7 @@ export default { ...@@ -926,7 +881,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 : ''
...@@ -938,7 +893,7 @@ export default { ...@@ -938,7 +893,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();
...@@ -952,7 +907,7 @@ export default { ...@@ -952,7 +907,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, ""); //清除“数字”和“.”以外的字符
...@@ -970,7 +925,7 @@ export default { ...@@ -970,7 +925,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;
...@@ -985,7 +940,7 @@ export default { ...@@ -985,7 +940,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, "");
...@@ -996,7 +951,7 @@ export default { ...@@ -996,7 +951,7 @@ 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);
...@@ -1041,7 +996,7 @@ export default { ...@@ -1041,7 +996,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('.');
...@@ -1054,7 +1009,7 @@ export default { ...@@ -1054,7 +1009,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",
...@@ -1291,7 +1246,6 @@ export default { ...@@ -1291,7 +1246,6 @@ export default {
}, },
{ {
"name": "\u7f51\u76d8\u89c6\u9891", "name": "\u7f51\u76d8\u89c6\u9891",
"filesType": "*.wmv,*.rmvb,*.mpeg4,*.mpeg2,*.flv,*.avi,*.3gp,*.mpga,*.qt,*.rm,*.wmz,*.wmd,*.wvx,*.wmx,*.wm,*.mpg,*.mp4,*.mkv,*.mpeg,*mov,*.asf,*.m4v,*.m3u8", "filesType": "*.wmv,*.rmvb,*.mpeg4,*.mpeg2,*.flv,*.avi,*.3gp,*.mpga,*.qt,*.rm,*.wmz,*.wmd,*.wvx,*.wmx,*.wm,*.mpg,*.mp4,*.mkv,*.mpeg,*mov,*.asf,*.m4v,*.m3u8",
"filesIcon": { "filesIcon": {
"wmv": ["fileicon-small-video", "fileicon-large-video", "fileicon-middle-video"], "wmv": ["fileicon-small-video", "fileicon-large-video", "fileicon-middle-video"],
......
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