Commit e53a37fa authored by 黄奎's avatar 黄奎

页面修改

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