1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <template>
- <layout-page>
- <view >
- <view style="padding: 0 15px 15px 15px;">
- <uni-segmented-control
- :current="current"
- :values="tabList"
- @clickItem="changeControl"
- styleType="text"
- activeColor="#00B760"
- ></uni-segmented-control>
- </view>
- <!-- 职位推荐 -->
- <view v-if="current === 0">
- <RecommendPage :jobList="jobList" />
- </view>
- <!-- 条件筛选 -->
- <view v-else>条件</view>
- </view>
- </layout-page>
- </template>
- <script setup>
- import layoutPage from '@/layout'
- import { ref } from 'vue'
- import { onShow } from '@dcloudio/uni-app'
- import { getAccessToken } from '@/utils/request'
- import { showAuthModal } from '@/hooks/useModal'
- import { getJobAdvertised } from '@/api/search'
- import { dealDictArrayData } from '@/utils/position'
- import { formatName } from '@/utils/getText'
- import RecommendPage from './components/recommend.vue'
- const current = ref(0)
- const tabList = ['职位推荐', '条件筛选']
- // 职位列表
- const jobList = ref([])
- const getJobList = async () => {
- const { data } = await getJobAdvertised({ status: 0 })
- if (data.length) {
- const list = dealDictArrayData([], data)
- jobList.value = list.map(e => {
- return { text: `${formatName(e.name)}_${e.areaName ? e.area?.str : '全国'}`, value: e.id, data: e }
- })
- }
- }
- onShow(() => {
- // 设置自定义tabbar选中值
- const currentPage = getCurrentPages()[0] // 获取当前页面实例
- const currentTabBar = currentPage?.getTabBar?.()
- // 设置当前tab页的下标index
- currentTabBar?.setData({ selected: 0 })
- if (!getAccessToken()) return showAuthModal()
- getJobList()
- })
- const changeControl = (e) =>{
- current.value = e.currentIndex
- }
- </script>
- <style scoped lang="scss">
- </style>
|