u
This commit is contained in:
1 parent
07e0001b87
commit
46cbb2f50d
543 files changed
+32576
-4231
No files matched your search
@@ -0,0 +1,68 @@
|
||||
<script lang="ts" setup>
|
||||
import { ElMessage } from 'element-plus'
|
||||
import { onBeforeUnmount, onMounted } from 'vue'
|
||||
import { useCommonStore } from '@/store/common'
|
||||
import { listAreasApi, listIndustriesApi } from './request/api/company'
|
||||
import { listPostTagApi } from './request/api/post'
|
||||
import { useWebSocket } from './store/websocket'
|
||||
|
||||
const websocket = useWebSocket()
|
||||
const commonOptions = useCommonStore()
|
||||
|
||||
onMounted(() => {
|
||||
websocket.connect()
|
||||
|
||||
handleInitData()
|
||||
})
|
||||
|
||||
onBeforeUnmount(() => {
|
||||
websocket.logout()
|
||||
|
||||
websocket.close()
|
||||
})
|
||||
async function handleInitData(): Promise<void> {
|
||||
try {
|
||||
const [areaRes, industryRes, postTagRes] = await Promise.all([
|
||||
listAreasApi(),
|
||||
listIndustriesApi(),
|
||||
listPostTagApi(),
|
||||
])
|
||||
|
||||
// 处理区域数据
|
||||
if (areaRes.isSuccess) {
|
||||
commonOptions.setAreaOptions(areaRes.data)
|
||||
}
|
||||
else {
|
||||
ElMessage.error(areaRes.message || '初始化失败,请刷新页面后重试')
|
||||
}
|
||||
|
||||
// 处理行业数据
|
||||
if (industryRes.isSuccess) {
|
||||
commonOptions.setIndustryOptions(industryRes.data)
|
||||
}
|
||||
else {
|
||||
ElMessage.error(industryRes.message || '初始化失败,请刷新页面后重试')
|
||||
}
|
||||
|
||||
// 处理岗位标签数据
|
||||
if (postTagRes.isSuccess) {
|
||||
commonOptions.setPostTagOptions(postTagRes.data)
|
||||
}
|
||||
else {
|
||||
ElMessage.error(postTagRes.message || '初始化失败,请刷新页面后重试')
|
||||
}
|
||||
}
|
||||
catch (err) {
|
||||
console.error(err)
|
||||
ElMessage.error('初始化失败,请刷新页面后重试')
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<RouterView />
|
||||
</template>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
//
|
||||
</style>
|
||||
Reference in new issue
Block a user