上传头像
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
<script>
|
||||
import request from "../../components/request.js";
|
||||
import postFile from "../../components/postFile.js";
|
||||
import generateFileName from "../../components/generateFileName.js";
|
||||
|
||||
export default {
|
||||
inject: ["$global"],
|
||||
@@ -59,11 +61,17 @@ export default {
|
||||
title: "登录中...",
|
||||
mask: true,
|
||||
});
|
||||
console.log("userinfo", this.userinfo);
|
||||
console.log("name", this.name);
|
||||
console.log("id", this.id);
|
||||
console.log("userSig", this.userSig);
|
||||
|
||||
postFile({
|
||||
path: this.userinfo,
|
||||
name:generateFileName(),
|
||||
}).then((res) => {
|
||||
this.userinfo = res;
|
||||
}).catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
|
||||
if(this.userinfo){
|
||||
const res = await request({
|
||||
url: "user/updateUserInfo",
|
||||
method: "POST",
|
||||
@@ -71,17 +79,15 @@ export default {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
usersig: this.userSig,
|
||||
usersig: this.userSig.userSig,
|
||||
},
|
||||
userInfo: false,
|
||||
});
|
||||
console.log("res", res);
|
||||
if (res.code === 200) {
|
||||
uni.showToast({
|
||||
title: "修改成功",
|
||||
icon: "success",
|
||||
});
|
||||
console.log("修改成功", res.data);
|
||||
uni.setStorageSync("userinfo", res.data.info);
|
||||
uni.hideLoading();
|
||||
//```````````````````````````````````````````````````````````````````````登录成功后跳转回原页面 或 首页
|
||||
@@ -95,6 +101,7 @@ export default {
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user