<template>
|
|
<view class="home-pages">
|
|
<u-swiper
|
|
:list="swpList"
|
|
keyName="image"
|
|
indicator
|
|
height="250"
|
|
indicatorActiveColor="#FFFFFF"
|
|
indicatorMode="dot"
|
|
circular
|
|
@click="swpClick"
|
|
></u-swiper>
|
|
<view class="home-content">
|
|
<u-tabs
|
|
:list="tabList"
|
|
lineWidth="70"
|
|
lineHeight="3"
|
|
lineColor= "#00CCCC"
|
|
:activeStyle="{
|
|
color: '#000000',
|
|
fontWeight: 'bold',
|
|
transform: 'scale(1.35)'
|
|
}"
|
|
:inactiveStyle="{
|
|
color: '#000000',
|
|
transform: 'scale(1)'
|
|
}"
|
|
itemStyle="padding-left: 15px; padding-right: 15px; height: 34px;"
|
|
@click="tabClick"
|
|
>
|
|
</u-tabs>
|
|
<scroll-view scroll-y="true" class="scroll-y"
|
|
<template>
|
|
<active-card v-for="(item,i) in studyList" :item="item" :key="i" :i="i" @seeDetail="seeDetail"></active-card>
|
|
</template>
|
|
</scroll-view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
import activeCard from '@/components/active-card/index.vue'
|
|
import newCard from '@/components/new-card/index.vue'
|
|
export default{
|
|
components:{
|
|
activeCard,
|
|
newCard
|
|
},
|
|
data(){
|
|
return{
|
|
params:{
|
|
pageNo:1,
|
|
labelClass:'1636755993901731841',
|
|
pageSize:10,
|
|
total: null,
|
|
isLock: true
|
|
},
|
|
current:0,
|
|
studyList:[],
|
|
swpList: [],
|
|
tabList: []
|
|
}
|
|
},
|
|
onLoad() {
|
|
this.studyList = [];
|
|
this.params.pageNo = 1;
|
|
this.params.total = null;
|
|
this.params.isLock = true;
|
|
this.getstudy();
|
|
// this.getknowledge();
|
|
this.getbannerList()
|
|
this.getJobAddressList();
|
|
},
|
|
// 隐藏微信h5的标题栏
|
|
onReady() {
|
|
this.$com.displayNav()
|
|
},
|
|
onPullDownRefresh() {
|
|
this.studyList = [];
|
|
this.params.pageNo = 1;
|
|
this.params.total = null;
|
|
this.params.isLock = true;
|
|
this.getstudy();
|
|
uni.stopPullDownRefresh();
|
|
},
|
|
onReachBottom() {
|
|
if(this.params.isLock){
|
|
this.params.isLock = false;
|
|
if(this.params.total !== null && this.params.pageNo * this.params.pageSize >= this.params.total){
|
|
this.$Toast('没有更多数据了哦!');
|
|
setTimeout(()=>{
|
|
this.params.isLock = true;
|
|
},3000)
|
|
return
|
|
}
|
|
this.params.pageNo+=1;
|
|
//this.$Toast('数据加载成功!');
|
|
this.getstudy();
|
|
}
|
|
},
|
|
methods:{
|
|
lower(){
|
|
|
|
},
|
|
getbannerList(){
|
|
this.$api('bannerList',{state:'0'})
|
|
.then(res=>{
|
|
if(res.code == 200){
|
|
this.swpList = res.result
|
|
}
|
|
})
|
|
},
|
|
//得到兼职地区分类
|
|
getJobAddressList(){
|
|
this.$api('IndexJobAddress').then(res=>{
|
|
if(res.code == 200){
|
|
this.tabList = res.result;
|
|
}
|
|
})
|
|
},
|
|
getstudy(){//学习列表
|
|
|
|
uni.showLoading()
|
|
|
|
this.$api('JobList',this.params)
|
|
.then(res=>{
|
|
uni.hideLoading();
|
|
if(res.code == 200){
|
|
if(this.params.total== null) {
|
|
this.params.total = res.result.total
|
|
}
|
|
|
|
if(this.params.pageNo>1){
|
|
uni.hideLoading();
|
|
}
|
|
this.studyList = this.studyList.concat(res.result.records);
|
|
this.params.isLock = true;
|
|
}else {
|
|
if(this.params.pageNo>1){
|
|
uni.hideLoading();
|
|
}
|
|
this.params.isLock = true;
|
|
}
|
|
})
|
|
},
|
|
swpClick(){
|
|
|
|
},
|
|
tabClick(e){
|
|
this.params.labelClass = e.id;
|
|
this.params.pageNo =1;
|
|
console.log(this.params.labelClass)
|
|
this.studyList = [];
|
|
this.getstudy();
|
|
},
|
|
seeDetail(item){//查看详情
|
|
this.$api('myInfo')
|
|
.then(res=>{
|
|
if(res.code == 200){
|
|
this.role = res.result.role;
|
|
this.userInfo = res.result;
|
|
this.$store.commit('set_userInfo',res.result)
|
|
uni.navigateTo({
|
|
url:`/pages/home/course-detial?id=${item.id}`
|
|
})
|
|
}else{
|
|
this.$Toast('请先登录!')
|
|
setTimeout(()=>{
|
|
uni.navigateTo({
|
|
url:'/pages/my/login-kehu'
|
|
})
|
|
},1000)
|
|
return
|
|
this.userInfo = null
|
|
}
|
|
})
|
|
},
|
|
newDetail(item){//知识查看详情
|
|
uni.navigateTo({
|
|
url:`/pages/home/new-detail?id=${item.id}`
|
|
})
|
|
}
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss" scoped>
|
|
.home-pages {
|
|
padding: 28rpx 29rpx 0;
|
|
background-color: #F7F7F7;
|
|
|
|
.swiper{
|
|
position: relative;
|
|
height: calc(100% -7vh);
|
|
width: 100%;
|
|
height: 1800px;
|
|
}
|
|
.scroll-Y {
|
|
height: calc(300vh - 660rpx);
|
|
padding-top: 20rpx;
|
|
|
|
}
|
|
|
|
.home-content {
|
|
.active-card{
|
|
margin-top: 20rpx;;
|
|
border-radius: 0;
|
|
border: none;
|
|
border-style: none;
|
|
box-shadow: none;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|