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={} let form={}
if (uni.getStorageSync('userInfo').isCompanyUser=='1') { if (uni.getStorageSync('userInfo') && uni.getStorageSync('userInfo').isCompanyUser=='1') {
form={ form={
usertype: '1', usertype: '1',
idno: uni.getStorageSync('userInfo').idCard, idno: uni.getStorageSync('userInfo').idCard,
@@ -165,7 +165,7 @@
contactperson: "", contactperson: "",
contactphone: "", contactphone: "",
} }
}else if (uni.getStorageSync('userInfo').isCompanyUser=='0') { }else if (uni.getStorageSync('userInfo') && uni.getStorageSync('userInfo').isCompanyUser=='0') {
form={ form={
usertype: "2", usertype: "2",
enterprisecode: uni.getStorageSync('userInfo').idCard, enterprisecode: uni.getStorageSync('userInfo').idCard,
@@ -176,10 +176,12 @@
name: "" name: ""
} }
}else{ }else{
if(needToast){
uni.showToast({ uni.showToast({
icon: 'none', icon: 'none',
title: '请先登录' title: '请先登录'
}) })
}
return false; return false;
} }
var resLogin = await $api.myRequest('/auth/login2/ks',form,'post',10100); var resLogin = await $api.myRequest('/auth/login2/ks',form,'post',10100);
@@ -213,7 +215,7 @@
}; };
async function goDetail(jobFairId){ async function goDetail(jobFairId){
if(await thirdLogin()){ if(await thirdLogin('1')){
if(state.current != 3){ if(state.current != 3){
navTo('/packageA/pages/exhibitors/exhibitors?jobFairId=' + jobFairId) navTo('/packageA/pages/exhibitors/exhibitors?jobFairId=' + jobFairId)
}else{ }else{
@@ -256,11 +258,14 @@
state.current = currented; state.current = currented;
} }
function seemsg(index) { async function seemsg(index) {
state.current = index; state.current = index;
if (index != 3) { if (index != 3) {
getFair("refresh"); getFair("refresh");
} else { } else {
if(await thirdLogin('1')){
if (!isLogin.value) { if (!isLogin.value) {
getHeart(); getHeart();
return; return;
@@ -274,6 +279,8 @@
getMyFair("refresh"); getMyFair("refresh");
} }
} }
}
} }
const handleScrollToLower = () => { const handleScrollToLower = () => {
@@ -290,15 +297,21 @@
} }
}; };
function getHeart() { async function getHeart() {
const raw = uni.getStorageSync("Padmin-Token"); const raw = uni.getStorageSync("Padmin-Token");
const token = typeof raw === "string" ? raw.trim() : ""; const token = typeof raw === "string" ? raw.trim() : "";
var isLogins = await thirdLogin();
const headers = token ? { const headers = token ? {
Authorization: raw.startsWith("Bearer ") ? raw : `Bearer ${token}` Authorization: raw.startsWith("Bearer ") ? raw : `Bearer ${token}`
} : {}; } : {};
$api.myRequest("/dashboard/auth/heart", {}, "POST", 10100, headers).then((resData) => { $api.myRequest("/dashboard/auth/heart", {}, "POST", 10100, headers).then((resData) => {
if (resData.code == 200) { if (isLogins) {
isLogin.value = true; isLogin.value = true;
getUser(); getUser();
} else { } else {