优化页面

This commit is contained in:
pengxiaolong
2025-05-27 13:06:24 +08:00
parent 728dfd501f
commit cf8728f0d7
29 changed files with 357 additions and 137 deletions

View File

@@ -15,11 +15,11 @@
<script>
import request from "../../components/request.js";
import postFile from "../../components/postFile.js";
import generateFileName from "../../components/generateFileName.js";
import postFile from "../../components/postFile.js";
import generateFileName from "../../components/generateFileName.js";
export default {
inject: ['$global'],
inject: ["$global"],
data() {
return {
userinfo:
@@ -29,6 +29,8 @@ export default {
info: {},
userSig: "",
lastPage: "",
picture: "",
Filename: generateFileName(),
};
},
onLoad(option) {
@@ -47,12 +49,12 @@ export default {
uni.getStorage({
key: "lastPage",
success: (res) => {
this.lastPage = "/"+res.data;
this.lastPage = "/" + res.data;
},
fail: () => {
this.lastPage = "/pages/Home/Home";
},
})
});
// const { info } = option;
// this.id = JSON.parse(info).id
},
@@ -72,61 +74,51 @@ export default {
title: "登录中...",
mask: true,
});
const { code } = await uni.login({
provider: "weixin",
onlyAuthorize: true,
});
postFile({
path: this.userinfo,
name:generateFileName(),
}).then((res) => {
this.userinfo = res;
}).catch((err) => {
const { code } = await uni.login({
provider: "weixin",
onlyAuthorize: true,
});
postFile({
path: this.userinfo,
name: this.Filename,
})
.then((ress) => {
this.picture = ress;
const res = request({
url: "user/inputUserInfo",
method: "POST",
data: {
id: this.id,
headerIcon: this.Filename,
nickName: this.name,
code,
usersig: this.userSig.userSig,
},
userInfo: false,
}).then((res) => {
if (res.code === 200) {
uni.showToast({
title: "登录成功",
icon: "success",
});
uni.setStorageSync("userinfo", res.data.info);
uni.hideLoading();
//```````````````````````````````````````````````````````````````````````登录成功后跳转回原页面 或 首页
uni.reLaunch({
url: this.lastPage,
});
//````````````````````````````````````````````````````````````````````
} else {
uni.showToast({
title: "登录失败",
icon: "none",
});
}
});
})
.catch((err) => {
console.log(err);
});
if (this.userinfo) {
const res = await request({
url: "user/inputUserInfo",
method: "POST",
data: {
id: this.id,
headerIcon: this.userinfo,
nickName: this.name,
code,
usersig: this.userSig.userSig,
},
userInfo: false,
});
if (res.code === 200) {
uni.showToast({
title: "登录成功",
icon: "success",
});
uni.setStorageSync("userinfo", res.data.info);
uni.hideLoading();
//```````````````````````````````````````````````````````````````````````登录成功后跳转回原页面 或 首页
uni.reLaunch({
url: this.lastPage,
});
//````````````````````````````````````````````````````````````````````
} else {
uni.showToast({
title: "登录失败",
icon: "none",
});
}
}else{
uni.showToast({
title: "上传失败",
icon: "none",
});
}
},
},
};