提交 1094e866 authored 作者: matian's avatar matian

导师新增职位任职机构

上级 fae7a0c3
<script setup lang="ts">
import { useRouter } from 'vue-router'
// import { useRouter } from 'vue-router'
import { Notify } from 'vant'
// import { Swiper, SwiperSlide } from 'swiper/vue'
// import 'swiper/css'
......@@ -9,7 +9,7 @@ import { Notify } from 'vant'
// defineProps<{ docs: IDocItem[]; videos: IVideoItem[] }>()
const router = useRouter()
// const router = useRouter()
const docs = [
{
......@@ -30,7 +30,8 @@ const docs = [
}
]
function handleViewDoc(data: any) {
window.open(data.url)
// window.open(data.url)
location.href = data.url
}
function showTips() {
Notify({ type: 'primary', message: '尚未开放' })
......
......@@ -32,7 +32,6 @@ const data = ref<HomeInfo>({
const fetchHomeData = () => {
api.getHomeData().then(res => {
data.value = res.data
console.log(res.data)
})
}
onMounted(() => {
......
<script setup lang="ts">
import type { ITeacherList } from '@/types'
defineProps<{ teacherList: ITeacherList[] }>()
</script>
<template>
<div class="teacher_list" v-if="teacherList.length > 0">
<div class="list_item" v-for="(item, index) in teacherList" :key="index">
<div>
<img :src="item.avatar" alt="" />
<div class="item_bottom">
<div class="name">{{ item.name }}</div>
<div class="desc" v-html="item.title"></div>
<div class="desc" v-html="item.office"></div>
</div>
</div>
</div>
</div>
<van-empty v-else description="暂无" />
</template>
<style lang="scss" scoped>
.teacher_list {
margin-top: 0.7rem;
display: flex;
justify-content: space-between;
flex-wrap: wrap;
.list_item {
width: 3.35rem;
margin-bottom: 0.2rem;
img {
width: 100%;
height: 3rem;
object-fit: cover;
border-top-left-radius: 0.2rem;
border-top-right-radius: 0.2rem;
}
.item_bottom {
background: url(https://webapp-pub.ezijing.com/project/prp-h5/teacher_bg.png) no-repeat;
background-size: cover;
width: 100%;
height: 2.24rem;
border-bottom-left-radius: 0.2rem;
border-bottom-right-radius: 0.2rem;
padding: 0.13rem 0 0 0.16rem;
box-sizing: border-box;
.name {
font-size: 0.3rem;
font-weight: 500;
color: #333333;
}
.desc {
font-size: 0.24rem;
font-weight: 400;
line-height: 0.32rem;
color: #666666;
margin-top: 0.07rem;
}
}
}
}
</style>
<script setup lang="ts">
import { useInfiniteScroll } from '@vueuse/core'
import { getTeacherList } from '@/api/base'
import type { ITeacherList } from '@/types'
import TeacherList from '../components/TeacherList.vue'
interface ITeacherAllList {
loading: boolean
......@@ -17,66 +17,42 @@ const teacherList = reactive<ITeacherAllList>({
list: []
})
const tabIndex = $ref(0)
let tabIndex = $ref(0)
const handleGetTeacherList = () => {
const params: any = { page_size: 10, page: teacherList.page }
const params: any = { page_size: 20, page: teacherList.page, type: (tabIndex + 1).toString() }
teacherList.loading = true
getTeacherList(params)
.then(res => {
const { total, list } = res.data
teacherList.total = total
teacherList.list = teacherList.list.concat(list)
if (teacherList.list.length <= total) {
teacherList.page++
}
teacherList.list = list
})
.finally(() => {
teacherList.loading = false
})
}
// 滚动加载
const el = ref<HTMLElement>()
useInfiniteScroll(
document,
() => {
// load more
!teacherList.loading && handleGetTeacherList()
},
{ distance: 10 }
)
onMounted(() => {
handleGetTeacherList()
})
const handleTabClick = (val: number) => {
tabIndex = val
handleGetTeacherList()
}
</script>
<template>
<img src="https://webapp-pub.ezijing.com/project/prp-h5/teacher_banner.png" style="width: 100%" />
<div class="teacher_tab">
<div class="tab_name" :class="tabIndex === 0 ? 'active_tab' : 'inactive_tab'" @click="tabIndex = 0">
<div class="tab_name" :class="tabIndex === 0 ? 'active_tab' : 'inactive_tab'" @click="handleTabClick(0)">
清华硕导教授团
</div>
<div class="tab_line"></div>
<div class="tab_name" :class="tabIndex === 1 ? 'active_tab' : 'inactive_tab'" @click="tabIndex = 1">
<div class="tab_name" :class="tabIndex === 1 ? 'active_tab' : 'inactive_tab'" @click="handleTabClick(1)">
紫荆实战导师团
</div>
</div>
<div
class="teacher_list"
ref="el"
v-if="teacherList.list.filter(item => item.type === (tabIndex + 1).toString()).length > 0"
>
<div class="list_item" v-for="(item, index) in teacherList.list" :key="index">
<div v-if="(tabIndex + 1).toString() === item.type">
<img :src="item.avatar" alt="" />
<div class="item_bottom">
<div class="name">{{ item.name }}</div>
<div class="desc" v-html="item.desc_type_name"></div>
</div>
</div>
</div>
</div>
<van-empty v-else description="暂无" />
<TeacherList :teacherList="teacherList.list" />
</template>
<style lang="scss" scoped>
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论