Commit e53a37fa authored by 黄奎's avatar 黄奎

页面修改

parent 8f2d6e84
......@@ -258,11 +258,9 @@
var userData = res.data.data;
var userJson = JSON.stringify(userData);
localStorage.mall_userInfo = userJson;
console.log("111")
this.$router.push({
path: "/index"
});
console.log("222")
}
else
{
......
......@@ -468,11 +468,8 @@
//传正面
UploadImage(file){
console.log(file);
var fileName=file.file.name;
this.UploadFileToTencent(fileName,file.file,res=>{
console.log("aaaaa");
this.UploadFileToTencent(this.FileType().UserImg,file.file,res=>{
console.log("aaaaa",res);
})
},
//传反面
......
......@@ -55,7 +55,7 @@ export default {
Vue.prototype.domainManager = function () {
let domainUrl = '';
domainUrl = "http://192.168.2.214:8200";
domainUrl="https://localhost:5001";
domainUrl = "https://localhost:5001";
let locationName = window.location.hostname;
if (locationName.indexOf('testerp.oytour') !== -1) {
domainUrl = "http://testapi.oytour.com";
......@@ -113,35 +113,56 @@ export default {
Vue.prototype.isOnline = function () {
return process.env.NODE_ENV !== 'development';
},
//文件类型数组
Vue.prototype.FileType = function () {
var fileTypeJson = {
//主地址npm
UserImg: "User", //用户相图片
//常用提交数据URL
GoodsImg: "Goods", //商品相关文件
};
return fileTypeJson;
},
//上传文件到云存储
Vue.prototype.UploadFileToTencent=function(fileName,fileObj,callback)
{
var uploadMsg={
Bucket:"viitto-1301420277",
Region:"ap-chengdu",/* 存储桶所在地域,必须字段 */
SecretId:"AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd",
SecretKey:"PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob",
AppId:"1301420277"
};
var COS = require('cos-js-sdk-v5');
var cos = new COS({
SecretId: uploadMsg.SecretId,
SecretKey: uploadMsg.SecretKey,
});
cos.putObject({
Bucket: uploadMsg.Bucket, /* 必须 */
Region: uploadMsg.Region, /* 存储桶所在地域,必须字段 */
Key: fileName, /* 必须 */
StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象
onProgress: function(progressData) {
console.log(JSON.stringify(progressData));
Vue.prototype.UploadFileToTencent = function (path, fileObj, callback) {
//获取文件扩展名
var filename = fileObj.name;
var index = filename.lastIndexOf(".");
var suffix = filename.substr(index);
var timestamp1 = Date.parse(new Date());
var newFileName = '/Upload/' + path +"/"+ timestamp1 + "" + suffix;
var uploadMsg = {
Bucket: "viitto-1301420277",
Region: "ap-chengdu",
/* 存储桶所在地域,必须字段 */
SecretId: "AKIDDPnbIzi8C1eqEOPP8dw6MNAg9H9ldDKd",
SecretKey: "PdcLtOjslUzNFYdU4OSI1fKtdHpFT2Ob",
};
var COS = require('cos-js-sdk-v5');
var cos = new COS({
SecretId: uploadMsg.SecretId,
SecretKey: uploadMsg.SecretKey,
});
cos.putObject({
Bucket: uploadMsg.Bucket,
Region: uploadMsg.Region, //存储桶所在地域,必须字段
Key: newFileName, //文件名
StorageClass: 'STANDARD',
Body: fileObj, // 上传文件对象
onProgress: function (progressData) {}
}, function (err, data) {
if (data && data.statusCode == 200) {
var uploadResult = {
FileName: fileObj.name,
FileUrl: data.Location
}
}, function(err, data) {
if (callback) {
callback(uploadResult);
}
} else {
/*上传文件异常*/
console.log(err || data);
}
});
},
//HTTP提交数据
......@@ -149,7 +170,7 @@ export default {
if (msg == null || msg == "") {
msg = {}
}
var apiurl = this.domainManager().DomainUrl+cmd;
var apiurl = this.domainManager().DomainUrl + cmd;
var timestamp = (new Date()).valueOf();
this.apiurl = apiurl;
if (!localStorage.mall_userInfo && localStorage.mall_userInfo != "" && this.$route.path.toLowerCase() != "/login") {
......
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