This commit is contained in:
hanguangpu01
2025-12-18 18:02:26 +08:00
parent 4e5fa2a39b
commit 38313ee63b

View File

@@ -153,9 +153,9 @@
async function thirdLogin(){
async function thirdLogin(needToast){
let form={}
if (uni.getStorageSync('userInfo').isCompanyUser=='1') {
if (uni.getStorageSync('userInfo') && uni.getStorageSync('userInfo').isCompanyUser=='1') {
form={
usertype: '1',
idno: uni.getStorageSync('userInfo').idCard,
@@ -165,7 +165,7 @@
contactperson: "",
contactphone: "",
}
}else if (uni.getStorageSync('userInfo').isCompanyUser=='0') {
}else if (uni.getStorageSync('userInfo') && uni.getStorageSync('userInfo').isCompanyUser=='0') {
form={
usertype: "2",
enterprisecode: uni.getStorageSync('userInfo').idCard,
@@ -176,10 +176,12 @@
name: ""
}
}else{
uni.showToast({
icon: 'none',
title: '请先登录'
})
if(needToast){
uni.showToast({
icon: 'none',
title: '请先登录'
})
}
return false;
}
var resLogin = await $api.myRequest('/auth/login2/ks',form,'post',10100);
@@ -213,7 +215,7 @@
};
async function goDetail(jobFairId){
if(await thirdLogin()){
if(await thirdLogin('1')){
if(state.current != 3){
navTo('/packageA/pages/exhibitors/exhibitors?jobFairId=' + jobFairId)
}else{
@@ -256,23 +258,28 @@
state.current = currented;
}
function seemsg(index) {
async function seemsg(index) {
state.current = index;
if (index != 3) {
getFair("refresh");
} else {
if (!isLogin.value) {
getHeart();
return;
}
// 确保获取到用户信息后再请求“我参与的”列表
if (!userInfo.value?.info?.userId) {
getUser().then(() => {
if(await thirdLogin('1')){
if (!isLogin.value) {
getHeart();
return;
}
// 确保获取到用户信息后再请求“我参与的”列表
if (!userInfo.value?.info?.userId) {
getUser().then(() => {
getMyFair("refresh");
});
} else {
getMyFair("refresh");
});
} else {
getMyFair("refresh");
}
}
}
}
@@ -290,15 +297,21 @@
}
};
function getHeart() {
async function getHeart() {
const raw = uni.getStorageSync("Padmin-Token");
const token = typeof raw === "string" ? raw.trim() : "";
var isLogins = await thirdLogin();
const headers = token ? {
Authorization: raw.startsWith("Bearer ") ? raw : `Bearer ${token}`
} : {};
$api.myRequest("/dashboard/auth/heart", {}, "POST", 10100, headers).then((resData) => {
if (resData.code == 200) {
if (isLogins) {
isLogin.value = true;
getUser();
} else {