登录
This commit is contained in:
@@ -13,6 +13,7 @@ import request from "../../components/request.js";
|
||||
import genTestUserSig from "../../components/debug/GenerateTestUserSig.js";
|
||||
// const genTestUserSig = require('../../components/debug/GenerateTestUserSig.js');
|
||||
export default {
|
||||
inject: ['$global'],
|
||||
data() {
|
||||
return {
|
||||
userInfo: {},
|
||||
@@ -34,9 +35,8 @@ export default {
|
||||
title: "登录中...",
|
||||
mask: true,
|
||||
});
|
||||
try {
|
||||
const res = await request({
|
||||
url: "/user/loginWithPhoneNumber",
|
||||
url: "user/loginWithPhoneNumber",
|
||||
method: "POST",
|
||||
data: {
|
||||
code: e.detail.code,
|
||||
@@ -62,20 +62,10 @@ export default {
|
||||
} else {
|
||||
uni.setStorageSync("userinfo", this.info.data.info);
|
||||
uni.hideLoading();
|
||||
// `
|
||||
uni.navigateBack({
|
||||
delta: 1, // 返回层级(默认值为 1)
|
||||
});
|
||||
// `································································登录成功后跳转回原页面 或 首页
|
||||
// const fromPage = decodeURIComponent(options.from || "");
|
||||
// if (fromPage) {
|
||||
// uni.redirectTo({
|
||||
// url: fromPage,
|
||||
// });
|
||||
// } else {
|
||||
// uni.switchTab({ url: "/pages/index/index" }); // 默认首页
|
||||
// }
|
||||
// `·································································
|
||||
//跳转原来页面否则首页
|
||||
uni.reLaunch({
|
||||
url: this.$global.lastPage || "/pages/Home/Home", // 默认页
|
||||
});
|
||||
}
|
||||
} else {
|
||||
uni.showToast({
|
||||
@@ -83,15 +73,6 @@ export default {
|
||||
icon: "none",
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("登录错误:", err);
|
||||
uni.showToast({
|
||||
title: "请检查网络连接",
|
||||
icon: "none",
|
||||
});
|
||||
} finally {
|
||||
uni.hideLoading();
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user