|
@@ -60,28 +60,38 @@
|
|
</template>
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
<script setup>
|
|
-import { getPositionTreeClick } from '@/api/common/index'
|
|
|
|
|
|
+// import { getPositionTreeClick } from '@/api/common/index'
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
import { getDict } from '@/hooks/web/useDictionaries'
|
|
-
|
|
|
|
-import { reactive, ref } from 'vue';
|
|
|
|
-
|
|
|
|
|
|
+import { reactive, ref, defineEmits } from 'vue';
|
|
|
|
+import { useRoute, useRouter } from 'vue-router'
|
|
defineOptions({ name:'common-components-jobTypeCard'})
|
|
defineOptions({ name:'common-components-jobTypeCard'})
|
|
|
|
|
|
|
|
+const route = useRoute(); const router = useRouter()
|
|
|
|
+const emits = defineEmits(['handleJobClick'])// 定义一个或多个自定义事件
|
|
|
|
+
|
|
const props = defineProps({
|
|
const props = defineProps({
|
|
- page: { // 是否分页
|
|
|
|
|
|
+ page: { // 左侧数据是否分页(首页有分页)
|
|
type: Boolean,
|
|
type: Boolean,
|
|
default: false
|
|
default: false
|
|
},
|
|
},
|
|
})
|
|
})
|
|
const isPage = props.page
|
|
const isPage = props.page
|
|
|
|
|
|
|
|
+// 职位点击
|
|
|
|
+const handleJobClick = async (val) => {
|
|
|
|
+ const path = '/recruit/position'
|
|
|
|
+ if (path === route.path) emits('jobClick', val)
|
|
|
|
+ else router.push({ path, query: { ...val, jumpType: 1 } })
|
|
|
|
+ // await getPositionTreeClick({ id: val.id })
|
|
|
|
+}
|
|
|
|
+
|
|
// 翻页数据
|
|
// 翻页数据
|
|
const pageInfo = reactive({ current: 1, size: 8 })
|
|
const pageInfo = reactive({ current: 1, size: 8 })
|
|
let pageCount = ref(0)
|
|
let pageCount = ref(0)
|
|
let defaultItems = ref()
|
|
let defaultItems = ref()
|
|
|
|
|
|
let items = ref()
|
|
let items = ref()
|
|
-// 翻页数据
|
|
|
|
|
|
+// 翻页
|
|
const getPageItems = () => {
|
|
const getPageItems = () => {
|
|
const startIndex = (pageInfo.current - 1) * pageInfo.size
|
|
const startIndex = (pageInfo.current - 1) * pageInfo.size
|
|
const endIndex = Math.min(startIndex + pageInfo.size, defaultItems.value.length)
|
|
const endIndex = Math.min(startIndex + pageInfo.size, defaultItems.value.length)
|
|
@@ -89,8 +99,7 @@ const getPageItems = () => {
|
|
}
|
|
}
|
|
getDict('positionTreeData', null, 'positionTreeData').then(({ data }) => {
|
|
getDict('positionTreeData', null, 'positionTreeData').then(({ data }) => {
|
|
data = data?.length && data || []
|
|
data = data?.length && data || []
|
|
- if (isPage) {
|
|
|
|
- // 翻页数据
|
|
|
|
|
|
+ if (isPage) { // 有翻页
|
|
defaultItems.value = data
|
|
defaultItems.value = data
|
|
if (defaultItems.value?.length) {
|
|
if (defaultItems.value?.length) {
|
|
pageCount.value = Math.ceil(defaultItems.value.length / pageInfo.size)
|
|
pageCount.value = Math.ceil(defaultItems.value.length / pageInfo.size)
|
|
@@ -101,12 +110,11 @@ getDict('positionTreeData', null, 'positionTreeData').then(({ data }) => {
|
|
}
|
|
}
|
|
})
|
|
})
|
|
|
|
|
|
-
|
|
|
|
-// 翻页数据
|
|
|
|
|
|
+// 翻页按钮
|
|
const previous = () => { if (pageInfo.current > 1) pageInfo.current--; getPageItems() }
|
|
const previous = () => { if (pageInfo.current > 1) pageInfo.current--; getPageItems() }
|
|
const nextPage = () => { if (pageInfo.current < pageCount.value) pageInfo.current++; getPageItems() }
|
|
const nextPage = () => { if (pageInfo.current < pageCount.value) pageInfo.current++; getPageItems() }
|
|
|
|
|
|
-// card2
|
|
|
|
|
|
+// 右侧职位信息
|
|
const leftIndex = ref(null)
|
|
const leftIndex = ref(null)
|
|
const rightObj = reactive({ show: false, data: {} })
|
|
const rightObj = reactive({ show: false, data: {} })
|
|
|
|
|
|
@@ -125,10 +133,6 @@ const carouselList = ref([
|
|
{ src: 'https://img0.baidu.com/it/u=3769341087,3426515789&fm=253&fmt=auto&app=138&f=JPEG?w=1180&h=472', },
|
|
{ src: 'https://img0.baidu.com/it/u=3769341087,3426515789&fm=253&fmt=auto&app=138&f=JPEG?w=1180&h=472', },
|
|
])
|
|
])
|
|
|
|
|
|
-// 职位点击事件
|
|
|
|
-const handleJobClick = async (val) => {
|
|
|
|
- await getPositionTreeClick({ id: val.id })
|
|
|
|
-}
|
|
|
|
</script>
|
|
</script>
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
<style lang="scss" scoped>
|