Commit 60522ff0 authored by 黄奎's avatar 黄奎

页面修改

parent f226bb3e
...@@ -19,6 +19,18 @@ export function getFontConfig() { ...@@ -19,6 +19,18 @@ export function getFontConfig() {
}; };
} }
/**
* 配置相关
*/
export function CommonConfig() {
return {
FileConfig: {
FileUrl: 'http://192.168.20.214:8130', //本地服务器文件预览地址
UploadUrl: "http://192.168.20.214:8120", //本地上传文件地址
}
}
}
/** /**
* 上传文件 * 上传文件
...@@ -48,12 +60,12 @@ export function UploadSelfFile(path, file, callback, configObj) { ...@@ -48,12 +60,12 @@ export function UploadSelfFile(path, file, callback, configObj) {
newPath += "/" + timestamp1 + "" + suffix; newPath += "/" + timestamp1 + "" + suffix;
UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback); UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback);
break; break;
//上传文件到阿里云 //上传文件到阿里云
case 2: case 2:
newPath += "/" + timestamp1 + "" + suffix; newPath += "/" + timestamp1 + "" + suffix;
UploadFileToALi(uploadConfig, newPath, file, uploadLoadding, callback); UploadFileToALi(uploadConfig, newPath, file, uploadLoadding, callback);
break; break;
//上传文件到自己文件服务器 //上传文件到自己文件服务器
case 3: case 3:
UploadFileToSystem(uploadConfig, newPath, file, uploadLoadding, callback, configObj); UploadFileToSystem(uploadConfig, newPath, file, uploadLoadding, callback, configObj);
break; break;
...@@ -67,8 +79,9 @@ export function UploadViittoFile(path, file, callback) { ...@@ -67,8 +79,9 @@ export function UploadViittoFile(path, file, callback) {
uploadLoadding.show({ uploadLoadding.show({
message: '正在上传文件,请稍后...' message: '正在上传文件,请稍后...'
}) })
let viewFileUrl = 'http://192.168.20.214:8130'; let fileConfig = CommonConfig()
let vtUploadUrl = "http://192.168.20.214:8120"; let viewFileUrl = fileConfig.FileConfig.FileUrl;
let vtUploadUrl = fileConfig.FileConfig.UploadUrl;
let locationName = window.location.hostname; let locationName = window.location.hostname;
if (locationName.indexOf('testerp.oytour') !== -1) { if (locationName.indexOf('testerp.oytour') !== -1) {
vtUploadUrl = "http://upload.oytour.com"; vtUploadUrl = "http://upload.oytour.com";
...@@ -216,6 +229,12 @@ export function UploadLocalSystem(configObj, fileObj, successCall) { ...@@ -216,6 +229,12 @@ export function UploadLocalSystem(configObj, fileObj, successCall) {
* 上传文件到本地文件系统 * 上传文件到本地文件系统
*/ */
export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLoadding, successCall, configObj) { export function UploadFileToSystem(uploadConfig, fileFullPath, fileObj, uploadLoadding, successCall, configObj) {
let fileConfig = CommonConfig();
let locationName = window.location.hostname;
if (locationName.indexOf('localhost') !== -1) {
uploadConfig.UploadDomain = fileConfig.FileConfig.UploadUrl;
uploadConfig.CustomDomain = fileConfig.FileConfig.FileUrl;
}
let url = uploadConfig.UploadDomain + "/Upload?filePath=" + fileFullPath; let url = uploadConfig.UploadDomain + "/Upload?filePath=" + fileFullPath;
if (configObj) { if (configObj) {
//是否转换图片 //是否转换图片
...@@ -269,7 +288,7 @@ export function UploadFileToALi(uploadConfig, fileFullPath, fileObj, uploadLoadd ...@@ -269,7 +288,7 @@ export function UploadFileToALi(uploadConfig, fileFullPath, fileObj, uploadLoadd
bucket: uploadConfig.Bucket bucket: uploadConfig.Bucket
}) })
var result = oss.multipartUpload(fileFullPath, fileObj, { var result = oss.multipartUpload(fileFullPath, fileObj, {
progress: function* (p) { } progress: function* (p) {}
}).then(res => { }).then(res => {
uploadLoadding.hide(); uploadLoadding.hide();
var uploadResult = { var uploadResult = {
...@@ -298,7 +317,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL ...@@ -298,7 +317,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL
Key: fileFullPath, //文件名 Key: fileFullPath, //文件名
StorageClass: 'STANDARD', StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象 Body: fileObj, // 上传文件对象
onProgress: function (progressData) { } onProgress: function (progressData) {}
}, function (err, data) { }, function (err, data) {
uploadLoadding.hide(); uploadLoadding.hide();
if (data && data.statusCode == 200) { if (data && data.statusCode == 200) {
...@@ -394,15 +413,15 @@ export function EduDownLoad(cmd, msg, fileName, callBack) { ...@@ -394,15 +413,15 @@ export function EduDownLoad(cmd, msg, fileName, callBack) {
/** /**
* 上传文件 企微写死阿里云 * 上传文件 企微写死阿里云
*/ */
export function wechatUploadSelfFile(path, file, callback, configObj) { export function wechatUploadSelfFile(path, file, callback, configObj) {
//用户登录缓存 //用户登录缓存
//配置写死的 腾讯云 //配置写死的 腾讯云
var uploadConfig = { var uploadConfig = {
Region:"ap-chengdu", Region: "ap-chengdu",
SecretId:"AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd", SecretId: "AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd",
SecretKey:"PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob", SecretKey: "PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob",
Bucket: "viitto-1301420277" Bucket: "viitto-1301420277"
}; };
//获取文件扩展名 //获取文件扩展名
var index = file.name.lastIndexOf("."); var index = file.name.lastIndexOf(".");
var suffix = file.name.substr(index); var suffix = file.name.substr(index);
...@@ -414,7 +433,7 @@ export function EduDownLoad(cmd, msg, fileName, callBack) { ...@@ -414,7 +433,7 @@ export function EduDownLoad(cmd, msg, fileName, callBack) {
message: '正在上传文件,请稍后...' message: '正在上传文件,请稍后...'
}) })
if (uploadConfig) { if (uploadConfig) {
newPath += "/" + timestamp1 + "" + suffix; newPath += "/" + timestamp1 + "" + suffix;
UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback); UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback);
} }
} }
\ No newline at end of file
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