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

页面修改

parent f226bb3e
......@@ -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) {
newPath += "/" + timestamp1 + "" + suffix;
UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback);
break;
//上传文件到阿里云
//上传文件到阿里云
case 2:
newPath += "/" + timestamp1 + "" + suffix;
UploadFileToALi(uploadConfig, newPath, file, uploadLoadding, callback);
break;
//上传文件到自己文件服务器
//上传文件到自己文件服务器
case 3:
UploadFileToSystem(uploadConfig, newPath, file, uploadLoadding, callback, configObj);
break;
......@@ -67,8 +79,9 @@ export function UploadViittoFile(path, file, callback) {
uploadLoadding.show({
message: '正在上传文件,请稍后...'
})
let viewFileUrl = 'http://192.168.20.214:8130';
let vtUploadUrl = "http://192.168.20.214:8120";
let fileConfig = CommonConfig()
let viewFileUrl = fileConfig.FileConfig.FileUrl;
let vtUploadUrl = fileConfig.FileConfig.UploadUrl;
let locationName = window.location.hostname;
if (locationName.indexOf('testerp.oytour') !== -1) {
vtUploadUrl = "http://upload.oytour.com";
......@@ -216,6 +229,12 @@ export function UploadLocalSystem(configObj, fileObj, successCall) {
* 上传文件到本地文件系统
*/
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;
if (configObj) {
//是否转换图片
......@@ -269,7 +288,7 @@ export function UploadFileToALi(uploadConfig, fileFullPath, fileObj, uploadLoadd
bucket: uploadConfig.Bucket
})
var result = oss.multipartUpload(fileFullPath, fileObj, {
progress: function* (p) { }
progress: function* (p) {}
}).then(res => {
uploadLoadding.hide();
var uploadResult = {
......@@ -298,7 +317,7 @@ export function UploadFileToTencent(uploadConfig, fileFullPath, fileObj, uploadL
Key: fileFullPath, //文件名
StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象
onProgress: function (progressData) { }
onProgress: function (progressData) {}
}, function (err, data) {
uploadLoadding.hide();
if (data && data.statusCode == 200) {
......@@ -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 = {
Region:"ap-chengdu",
SecretId:"AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd",
SecretKey:"PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob",
var uploadConfig = {
Region: "ap-chengdu",
SecretId: "AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd",
SecretKey: "PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob",
Bucket: "viitto-1301420277"
};
};
//获取文件扩展名
var index = file.name.lastIndexOf(".");
var suffix = file.name.substr(index);
......@@ -414,7 +433,7 @@ export function EduDownLoad(cmd, msg, fileName, callBack) {
message: '正在上传文件,请稍后...'
})
if (uploadConfig) {
newPath += "/" + timestamp1 + "" + suffix;
UploadFileToTencent(uploadConfig, newPath, file, uploadLoadding, callback);
newPath += "/" + timestamp1 + "" + suffix;
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