上传头像
This commit is contained in:
@@ -31,7 +31,6 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
goAdvertisement(){
|
||||
console.log(uni);
|
||||
this.$global.lastPage = getCurrentPages().router;
|
||||
uni.navigateTo({ url: '/pages/login/login' })
|
||||
}
|
||||
|
||||
@@ -30,7 +30,6 @@ export default {
|
||||
key: "userinfo",
|
||||
success: (res) => {
|
||||
this.userinfo = res.data;
|
||||
console.log(this.userinfo);
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
0
pages/NewAddedPk/NewAddedPk.vue
Normal file
0
pages/NewAddedPk/NewAddedPk.vue
Normal file
@@ -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",
|
||||
});
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -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",
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
@@ -19,6 +19,7 @@ export default {
|
||||
return {
|
||||
userInfo: {},
|
||||
info: {},
|
||||
userSig: "",
|
||||
};
|
||||
},
|
||||
onLoad() {
|
||||
@@ -44,27 +45,26 @@ export default {
|
||||
},
|
||||
userInfo: false,
|
||||
});
|
||||
console.log("登录结果:", res);
|
||||
this.info = res;
|
||||
if (this.info.code === 200) {
|
||||
if (this.info.data.newAccount) {
|
||||
const sdkAppID = Number(this.info.data.chatInfo.appId);
|
||||
const sdkAppID = Number(this.info.data.chatInfo.appId);
|
||||
const userID ="administrator";
|
||||
const {userSig} = genTestUserSig({
|
||||
this.userSig = genTestUserSig({
|
||||
SDKAPPID : sdkAppID,
|
||||
SECRETKEY:this.info.data.chatInfo.appKey,
|
||||
userID: userID,
|
||||
})
|
||||
uni.setStorageSync("chatInfo", this.info.data.chatInfo)
|
||||
uni.setStorageSync("userSig", userSig)
|
||||
uni.setStorageSync("userSig", this.userSig)
|
||||
uni.setStorageSync("userinfo", this.info.data.info);
|
||||
if (this.info.code === 200) {
|
||||
if (this.info.data.newAccount) {
|
||||
uni.reLaunch({
|
||||
url: "/pages/UserInformation/UserInformation",
|
||||
});
|
||||
} else {
|
||||
uni.setStorageSync("userinfo", this.info.data.info);
|
||||
uni.hideLoading();
|
||||
TUIlogin(this.info.data.chatInfo.appId, this.info.data.info.userChatId, userSig)
|
||||
TUIlogin(this.info.data.chatInfo.appId, this.info.data.info.id,this.userSig.userSig)
|
||||
//跳转原来页面否则首页
|
||||
uni.reLaunch({
|
||||
url: this.$global.lastPage || "/pages/Home/Home", // 默认页
|
||||
|
||||
Reference in New Issue
Block a user