|
@@ -65,13 +65,20 @@
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
uploadFile(options, int) {
|
|
uploadFile(options, int) {
|
|
|
|
|
+ var self = this;
|
|
|
return new Promise((resolve, reject) => {
|
|
return new Promise((resolve, reject) => {
|
|
|
- var self = this;
|
|
|
|
|
var data = {
|
|
var data = {
|
|
|
imageStatus: int
|
|
imageStatus: int
|
|
|
};
|
|
};
|
|
|
- this.$api.aliyunpolicy(data).then(res => {
|
|
|
|
|
|
|
+ self.$api.aliyunpolicy(data).then(res => {
|
|
|
var ossToken = res.data.data.resultContent;
|
|
var ossToken = res.data.data.resultContent;
|
|
|
|
|
+ if(ossToken.host==null||ossToken.host==undefined){
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '上传路径报错'+ossToken,
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
uni.uploadFile({
|
|
uni.uploadFile({
|
|
|
url: ossToken.host,
|
|
url: ossToken.host,
|
|
|
name: 'file',
|
|
name: 'file',
|
|
@@ -92,7 +99,8 @@
|
|
|
if (result.statusCode === 200) {
|
|
if (result.statusCode === 200) {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
title: '成功',
|
|
title: '成功',
|
|
|
- icon: 'none'
|
|
|
|
|
|
|
+ icon: 'none',
|
|
|
|
|
+ duration:2000
|
|
|
});
|
|
});
|
|
|
self.userInfo.avatar = ossToken.dir;
|
|
self.userInfo.avatar = ossToken.dir;
|
|
|
resolve();
|
|
resolve();
|
|
@@ -106,7 +114,7 @@
|
|
|
},
|
|
},
|
|
|
fail: error => {
|
|
fail: error => {
|
|
|
uni.showToast({
|
|
uni.showToast({
|
|
|
- title: '上传接口报错',
|
|
|
|
|
|
|
+ title: '上传接口报错'+error,
|
|
|
icon: 'none'
|
|
icon: 'none'
|
|
|
});
|
|
});
|
|
|
return;
|
|
return;
|
|
@@ -119,10 +127,13 @@
|
|
|
let self = this
|
|
let self = this
|
|
|
this.$api.appuserInfo(this.userInfo).then(res => {
|
|
this.$api.appuserInfo(this.userInfo).then(res => {
|
|
|
if (res.data.code === 200) {
|
|
if (res.data.code === 200) {
|
|
|
- uni.showToast({
|
|
|
|
|
- title: '提交成功',
|
|
|
|
|
- icon: 'none'
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ setTimeout(()=>{
|
|
|
|
|
+ uni.showToast({
|
|
|
|
|
+ title: '提交成功',
|
|
|
|
|
+ icon: 'none'
|
|
|
|
|
+ });
|
|
|
|
|
+ },500);
|
|
|
|
|
+
|
|
|
self.$api.refreshUserInfo()
|
|
self.$api.refreshUserInfo()
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -155,7 +166,7 @@
|
|
|
let that = this
|
|
let that = this
|
|
|
uni.chooseImage({
|
|
uni.chooseImage({
|
|
|
count: 1, //默认9
|
|
count: 1, //默认9
|
|
|
- sizeType: [ 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
|
|
|
|
+ sizeType: [ 'compressed'], //可以指定是原图还是压缩图,默认二者都有
|
|
|
success: function (res) {
|
|
success: function (res) {
|
|
|
that.avatarUrl = res.tempFilePaths[0]
|
|
that.avatarUrl = res.tempFilePaths[0]
|
|
|
}
|
|
}
|