优化页面
This commit is contained in:
@@ -17,15 +17,14 @@
|
||||
import request from "../../components/request.js";
|
||||
import postFile from "../../components/postFile.js";
|
||||
import generateFileName from "../../components/generateFileName.js";
|
||||
import { useCounterStore } from '@/stores/counter'
|
||||
const counter = useCounterStore()
|
||||
import { useCounterStore } from "@/stores/counter";
|
||||
const counter = useCounterStore();
|
||||
|
||||
export default {
|
||||
inject: ["$global"],
|
||||
data() {
|
||||
return {
|
||||
userinfo:
|
||||
"https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0",
|
||||
userinfo:"",
|
||||
name: "",
|
||||
id: "",
|
||||
info: {},
|
||||
@@ -72,55 +71,67 @@ export default {
|
||||
},
|
||||
// 微信登录
|
||||
async wxLogin(e) {
|
||||
uni.showLoading({
|
||||
title: "登录中...",
|
||||
mask: true,
|
||||
});
|
||||
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);
|
||||
counter.$patch({ myitem:res.data.info })
|
||||
uni.hideLoading();
|
||||
//```````````````````````````````````````````````````````````````````````登录成功后跳转回原页面 或 首页
|
||||
uni.reLaunch({
|
||||
url: this.lastPage,
|
||||
});
|
||||
//````````````````````````````````````````````````````````````````````
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
if (
|
||||
this.name !== "" &&
|
||||
this.userinfo !== ""
|
||||
) {
|
||||
uni.showLoading({
|
||||
title: "登录中...",
|
||||
mask: true,
|
||||
});
|
||||
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);
|
||||
counter.$patch({ myitem: res.data.info });
|
||||
uni.hideLoading();
|
||||
//```````````````````````````````````````````````````````````````````````登录成功后跳转回原页面 或 首页
|
||||
uni.reLaunch({
|
||||
url: this.lastPage,
|
||||
});
|
||||
//````````````````````````````````````````````````````````````````````
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
});
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err);
|
||||
});
|
||||
} else {
|
||||
uni.showToast({
|
||||
title: "请填写头像昵称",
|
||||
icon: "success",
|
||||
duration: 3000,
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user