上传头像
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'],
|
||||
@@ -64,12 +66,18 @@ export default {
|
||||
provider: "weixin",
|
||||
onlyAuthorize: true,
|
||||
});
|
||||
console.log("code", code);
|
||||
console.log("code", this.name);
|
||||
console.log("code", this.userinfo);
|
||||
console.log("code", this.id);
|
||||
console.log("code", this.userSig);
|
||||
const res = await request({
|
||||
|
||||
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/inputUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
@@ -77,17 +85,15 @@ export default {
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
code,
|
||||
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();
|
||||
|
||||
@@ -102,6 +108,15 @@ export default {
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
}else{
|
||||
uni.showToast({
|
||||
title: "上传失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user