登录
This commit is contained in:
@@ -6,6 +6,7 @@ const Advertisement = () => "../../components/Advertisement/Advertisement.js";
|
||||
const contentList = () => "../../components/contentList/contentList.js";
|
||||
const tabBar = () => "../../components/tabBar/tabBar.js";
|
||||
const _sfc_main = {
|
||||
inject: ["$global"],
|
||||
data() {
|
||||
return {};
|
||||
},
|
||||
@@ -13,6 +14,8 @@ const _sfc_main = {
|
||||
},
|
||||
methods: {
|
||||
goAdvertisement() {
|
||||
common_vendor.index.__f__("log", "at pages/Home/Home.vue:34", common_vendor.index);
|
||||
this.$global.lastPage = getCurrentPages().router;
|
||||
common_vendor.index.navigateTo({ url: "/pages/login/login" });
|
||||
}
|
||||
},
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
const common_vendor = require("../../common/vendor.js");
|
||||
const components_request = require("../../components/request.js");
|
||||
const _sfc_main = {
|
||||
inject: ["$global"],
|
||||
data() {
|
||||
return {
|
||||
userinfo: "https://mmbiz.qpic.cn/mmbiz/icTdbqWNOwNRna42FI242Lcia07jQodd2FJGIYQfG0LAJGFxM4FbnQP6yfMxBgJ0F3YRqJCJ1aPAK2dQagdusBZg/0",
|
||||
@@ -41,50 +42,45 @@ const _sfc_main = {
|
||||
title: "登录中...",
|
||||
mask: true
|
||||
});
|
||||
try {
|
||||
const { code } = await common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
onlyAuthorize: true
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:68", "code", code);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:69", "code", this.name);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:70", "code", this.userinfo);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:71", "code", this.id);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:72", "code", this.userSig);
|
||||
const res = await components_request.request({
|
||||
url: "/user/inputUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
code,
|
||||
usersig: this.userSig
|
||||
},
|
||||
userInfo: false
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:86", "res", res);
|
||||
if (res.data.code === 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录成功",
|
||||
icon: "success"
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:92", "登录成功", res.data);
|
||||
common_vendor.index.setStorageSync("userinfo", res.data.info);
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none"
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
common_vendor.index.__f__("error", "at pages/UserInformation/UserInformation.vue:115", "登录错误:", err);
|
||||
const { code } = await common_vendor.index.login({
|
||||
provider: "weixin",
|
||||
onlyAuthorize: true
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:67", "code", code);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:68", "code", this.name);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:69", "code", this.userinfo);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:70", "code", this.id);
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:71", "code", this.userSig);
|
||||
const res = await components_request.request({
|
||||
url: "user/inputUserInfo",
|
||||
method: "POST",
|
||||
data: {
|
||||
id: this.id,
|
||||
headerIcon: this.userinfo,
|
||||
nickName: this.name,
|
||||
code,
|
||||
usersig: this.userSig
|
||||
},
|
||||
userInfo: false
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:84", "res", res);
|
||||
if (res.code === 200) {
|
||||
common_vendor.index.showToast({
|
||||
title: "请检查网络连接",
|
||||
title: "登录成功",
|
||||
icon: "success"
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/UserInformation/UserInformation.vue:90", "登录成功", res.data);
|
||||
common_vendor.index.setStorageSync("userinfo", res.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.reLaunch({
|
||||
url: this.$global.lastPage || "/pages/Home/Home"
|
||||
// 默认页
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none"
|
||||
});
|
||||
} finally {
|
||||
common_vendor.index.hideLoading();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ const common_vendor = require("../../common/vendor.js");
|
||||
const components_request = require("../../components/request.js");
|
||||
const components_debug_GenerateTestUserSig = require("../../components/debug/GenerateTestUserSig.js");
|
||||
const _sfc_main = {
|
||||
inject: ["$global"],
|
||||
data() {
|
||||
return {
|
||||
userInfo: {},
|
||||
@@ -24,53 +25,43 @@ const _sfc_main = {
|
||||
title: "登录中...",
|
||||
mask: true
|
||||
});
|
||||
try {
|
||||
const res = await components_request.request({
|
||||
url: "/user/loginWithPhoneNumber",
|
||||
method: "POST",
|
||||
data: {
|
||||
code: e.detail.code
|
||||
},
|
||||
userInfo: false
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:46", "登录结果:", res);
|
||||
this.info = res;
|
||||
if (this.info.code === 200) {
|
||||
if (this.info.data.newAccount) {
|
||||
const sdkAppID = Number(this.info.data.chatInfo.appId);
|
||||
const userID = "administrator";
|
||||
const { userSig } = components_debug_GenerateTestUserSig.genTestUserSig({
|
||||
SDKAPPID: sdkAppID,
|
||||
SECRETKEY: this.info.data.chatInfo.appKey,
|
||||
userID
|
||||
});
|
||||
common_vendor.index.setStorageSync("userSig", userSig);
|
||||
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
|
||||
common_vendor.index.reLaunch({
|
||||
url: "/pages/UserInformation/UserInformation"
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.navigateBack({
|
||||
delta: 1
|
||||
// 返回层级(默认值为 1)
|
||||
});
|
||||
}
|
||||
const res = await components_request.request({
|
||||
url: "user/loginWithPhoneNumber",
|
||||
method: "POST",
|
||||
data: {
|
||||
code: e.detail.code
|
||||
},
|
||||
userInfo: false
|
||||
});
|
||||
common_vendor.index.__f__("log", "at pages/login/login.vue:46", "登录结果:", res);
|
||||
this.info = res;
|
||||
if (this.info.code === 200) {
|
||||
if (this.info.data.newAccount) {
|
||||
const sdkAppID = Number(this.info.data.chatInfo.appId);
|
||||
const userID = "administrator";
|
||||
const { userSig } = components_debug_GenerateTestUserSig.genTestUserSig({
|
||||
SDKAPPID: sdkAppID,
|
||||
SECRETKEY: this.info.data.chatInfo.appKey,
|
||||
userID
|
||||
});
|
||||
common_vendor.index.setStorageSync("userSig", userSig);
|
||||
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
|
||||
common_vendor.index.reLaunch({
|
||||
url: "/pages/UserInformation/UserInformation"
|
||||
});
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "登录失败",
|
||||
icon: "none"
|
||||
common_vendor.index.setStorageSync("userinfo", this.info.data.info);
|
||||
common_vendor.index.hideLoading();
|
||||
common_vendor.index.reLaunch({
|
||||
url: this.$global.lastPage || "/pages/Home/Home"
|
||||
// 默认页
|
||||
});
|
||||
}
|
||||
} catch (err) {
|
||||
common_vendor.index.__f__("error", "at pages/login/login.vue:87", "登录错误:", err);
|
||||
} else {
|
||||
common_vendor.index.showToast({
|
||||
title: "请检查网络连接",
|
||||
title: "登录失败",
|
||||
icon: "none"
|
||||
});
|
||||
} finally {
|
||||
common_vendor.index.hideLoading();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user