报名招聘会添加loading状态

This commit is contained in:
xuchao
2026-01-12 17:32:06 +08:00
parent d7d8ed4e49
commit 9315d0c371

View File

@@ -105,9 +105,9 @@
</view> </view>
<template #footer> <template #footer>
<view class="footer" v-if="hasnext"> <view class="footer" v-if="hasnext">
<view class="btn-wq button-click" :class="{ 'btn-desbel': fairInfo.isSignUp==1 }" <view class="btn-wq button-click" :class="{ 'btn-desbel': fairInfo.isSignUp==1 || isLoading }"
@click="applyExhibitors"> @click="applyExhibitors" :disabled="isLoading">
{{ fairInfo.isSignUp==1 ? '已报名' : '报名招聘会' }} {{ isLoading ? '报名中...' : fairInfo.isSignUp==1 ? '已报名' : '报名招聘会' }}
</view> </view>
</view> </view>
</template> </template>
@@ -161,6 +161,8 @@
// person个人 ent企业 // person个人 ent企业
const signRole = ref('ent'); const signRole = ref('ent');
const CompanySignPopup = ref(null) const CompanySignPopup = ref(null)
// 报名loading状态
const isLoading = ref(false)
const jobFairId = ref(null) const jobFairId = ref(null)
@@ -253,6 +255,7 @@
// 报名招聘会 // 报名招聘会
function applyExhibitors() { function applyExhibitors() {
if (isLoading.value) return
if (fairInfo.value.isSignUp == 1) { if (fairInfo.value.isSignUp == 1) {
$api.msg('请勿重复报名'); $api.msg('请勿重复报名');
return return
@@ -262,6 +265,7 @@
const headers = token ? { const headers = token ? {
Authorization: raw.startsWith("Bearer ") ? raw : `Bearer ${token}` Authorization: raw.startsWith("Bearer ") ? raw : `Bearer ${token}`
} : {}; } : {};
isLoading.value = true
$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 (resData.code == 200) {
@@ -271,6 +275,7 @@
signRole.value = userInfo.userType; signRole.value = userInfo.userType;
signDialogisshow.value = true signDialogisshow.value = true
CompanySignPopup.value.open() CompanySignPopup.value.open()
isLoading.value = false
}else{ }else{
$api.myRequest("/jobfair/public/job-fair-sign-up-person/sign-up", { $api.myRequest("/jobfair/public/job-fair-sign-up-person/sign-up", {
personId: userInfo.value.info.userId, personId: userInfo.value.info.userId,
@@ -289,6 +294,7 @@
icon: 'none' icon: 'none'
}); });
} }
isLoading.value = false
}) })
} }
@@ -299,7 +305,10 @@
// url: '/packageB/login' // url: '/packageB/login'
// }) // })
// }, 1000) // }, 1000)
isLoading.value = false
} }
}).catch(() => {
isLoading.value = false
}); });
} }