支付宝下单和其他细节优化

This commit is contained in:
2026-05-21 15:10:02 +08:00
parent 39bf8548df
commit 1637ee5bbc
33 changed files with 1511 additions and 232 deletions
+63 -2
View File
@@ -2,6 +2,18 @@
<div class="jobs-page dflex">
<SideNav />
<div class="jobs-page__content">
<div v-if="false" class="fs18 p20 bgeee">
支付
<iframe
v-if="paymentFormHtml"
:srcdoc="paymentFormHtml"
frameborder="0"
style="width: 100%; height: 600px;"
scrolling="auto"
></iframe>
</div>
<!-- 页面标题 + Tab 切换 -->
<JobPageHeader v-model:activeTab="activeTab" :favoriteCount="favoriteTotal" :applyCount="applyTotal" />
<!-- 收藏统计栏 -->
@@ -43,7 +55,7 @@
:categoryIds="selectedCategoryIds"
:maxSelect="3"
:level="3"
:allowParentSelect="false"
:allowParentSelect="true"
@update:categoryIds="onCategoryChange"
/>
<!-- 行业筛选使用行业选择组件 -->
@@ -52,7 +64,7 @@
:industryIds="selectedIndustryIds"
:maxSelect="3"
:level="2"
:allowParentSelect="false"
:allowParentSelect="true"
@update:industryIds="onIndustryChange"
/>
<!-- 其他筛选条件 -->
@@ -246,6 +258,9 @@
<!-- 职位问题反馈弹窗 -->
<JobFeedbackDialog ref="feedbackDialogRef" v-model="showFeedbackDialog" :job-id="feedbackJobId" />
<!-- 欢迎上传简历弹窗 -->
<ProfileWelcomeDialog v-model="showWelcomeDialog" />
</div>
</template>
@@ -261,9 +276,21 @@ import JobFeedbackDialog from '@/components/JobFeedbackDialog.vue'
import IndustrySelector from '@/components/tools/IndustrySelector.vue'
import JobCategorySelector from '@/components/tools/JobCategorySelector.vue'
import RegionSelector from '@/components/tools/RegionSelector.vue'
import ProfileWelcomeDialog from '@/components/ProfileWelcomeDialog.vue'
import { fetchProfile } from '@/api/profile'
import { fetchJobList, fetchFavoriteList, toggleJobFavorite, removeJobFavorite, fetchFavoriteCount, fetchApplyList, fetchApplyCount, removeJobFromList } from '@/api/jobs'
import type { JobListItem, JobListParams, FavoriteListParams, ApplyListParams, ApplyCountData } from '@/api/jobs'
// 2. 注意:这里的字符串不需要再手动转义双引号了
const paymentFormHtml = ref(`
<form name="punchout_form" method="post" action="https://openapi-sandbox.dl.alipaydev.com/gateway.do?charset=UTF-8&method=alipay.trade.page.pay&sign=o8MQ7cEAh4yrf6ri5iT9gXbtR%2BTncX36p9JNZf8nmXxEp1WKO6dF1HDC6DPF8nxJbus6OG9E5UPSoiHgqrEiu3aeOs4LMcYzXXZP0UQzG%2F6pXyZrvlL70G8uwpnV6MgQojzhKheG0vYIJgSPaGsHKjwcp%2BT8yOZg3eEDIgFYEBf2a3c7kANc7%2FuOOGCSD9Ip9zqwX9LQ3b433NPH3AbGQkFSLsdGOTY62I7yI8hEF7EM7nNm%2BYryieqju21yN76JrV4k%2BgIGHn83I5oT3y7zurzdTqHLD4UawpPWdJ5B7p6wnJ4cN4uzO8JgRpNqogYqqKBPcHIlB9o4uax3bcRqhg%3D%3D&notify_url=http%3A%2F%2F39.108.134.218%3A10106%2Fapi%2F%2Fpublic%2FalipayNotify%2Fpay&version=1.0&app_id=2018062160374941&sign_type=RSA2&timestamp=2026-05-20+15%3A29%3A21&alipay_sdk=alipay-sdk-java-4.40.791.ALL&format=json">
<input type="hidden" name="biz_content" value='{"out_trade_no":"OP2057000709638877186","product_code":"FAST_INSTANT_TRADE_PAY","qr_pay_mode":"4","qrcode_width":200,"subject":"周会员","total_amount":"0.10"}'>
<input type="submit" value="立即支付" style="display:none">
</form>
<script>document.forms[0].submit();<\/script>
`)
// ==================== 路由相关 ====================
const router = useRouter()
@@ -273,6 +300,9 @@ const store = useStore()
/** 登录状态 — 从 store 读取 */
const isAuthenticated = computed(() => store.state.isAuthenticated)
/** 用户昵称 — 从全局 store 读取 */
const nickName = computed(() => store.state.userInfo?.nick || '')
// ==================== 页面状态 ====================
/** 当前激活的 Tab,从 URL query 参数读取,默认"推荐" */
@@ -302,6 +332,9 @@ const feedbackJobId = ref<string | null>(null)
/** 当前问助手的岗位 ID(传给 AiChat 组件) */
const currentAskJobId = ref<string>('')
/** 欢迎弹窗的显示状态 */
const showWelcomeDialog = ref(false)
/** 点击"问助手"按钮,传入岗位 ID 给 AiChat */
function askAssistant(job: JobItem) {
currentAskJobId.value = job.id
@@ -516,6 +549,19 @@ onMounted(async () => {
// 仅登录状态下才加载需要鉴权的数据
if (isAuthenticated.value) {
// 加载用户个人信息到全局 store
store.dispatch('loadUserInfo')
// 检查个人资料是否存在,不存在则弹出欢迎弹窗
try {
const profileRes = await fetchProfile()
if (profileRes.code === '0' && (!profileRes.data || profileRes.data === null)) {
showWelcomeDialog.value = true
}
} catch {
// 接口异常不阻塞页面加载
}
// 加载收藏统计(用于 Tab 标签显示)
loadFavoriteCount()
@@ -861,6 +907,21 @@ watch(
{ deep: true },
)
// 监听登录状态变化 — 登录成功后检查个人资料是否存在
watch(isAuthenticated, async (newVal, oldVal) => {
if (newVal && !oldVal) {
// 从未登录变为已登录,检查个人资料
try {
const profileRes = await fetchProfile()
if (profileRes.code === '0' && (!profileRes.data || profileRes.data === null)) {
showWelcomeDialog.value = true
}
} catch {
// 接口异常不阻塞
}
}
})
// 监听 Tab 切换,重置列表状态并加载对应数据
watch(activeTab, (newTab, oldTab) => {
if (initializing) return