兼兼街公众号代码
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

188 lines
3.9 KiB

<template>
<view class="home-pages">
<u-swiper
:list="swpList"
keyName="image"
indicator
height="150"
indicatorActiveColor="#FFFFFF"
indicatorMode="dot"
circular
></u-swiper>
<view style="color: #707070;
font-size: 28rpx;">
</view>
<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" @scrolltolower="lower">
<template >
<new-card v-for="(item,i) in houseList" :key="i" :item="item" @seeDetail="newDetail"></new-card>
</template>
</scroll-view>
</view>
</view>
</template>
<script>
import newCard from '@/components/new-card/index.vue'
export default{
components:{
newCard
},
data(){
return{
current:0,
swpList:[],
tabList: [],
houseList:[],
params:{
classId:'1616491855729131521',//默认未岳麓区租房信息
pageNo:1,
pageSize:10,
total: null,
isLock: true
},
}
},
onLoad() {
this.getbannerList();
this.getHouseClassList();
this.getHouseList();
},
// 隐藏微信h5的标题栏
onReady() {
this.$com.displayNav()
},
methods:{
onPullDownRefresh() {
// TODO: 下拉刷新的回调函数
this.houseList=[];
this.getHouseList();
uni.stopPullDownRefresh();
},
//获取租房信息
getbannerList(){
this.$api('bannerList',{state:'2'})
.then(res=>{
if(res.code == 200){
this.swpList = res.result
}
})
},
//获取分类列表信息
getHouseClassList(){
this.$api('getHouseClassList',{state:"0"})
.then(res=>{
if(res.code == 200){
this.tabList = res.result
}
})
},
//获取
getHouseList(){
uni.showLoading()
this.$api('getHouseList',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.houseList = this.houseList.concat(res.result.records);
this.params.isLock = true;
}else {
if(this.params.pageNo>1){
uni.hideLoading();
}
this.params.isLock = true;
}
})
},
//点击切换
tabClick(e){
this.params.classId=e.id;
this.houseList=[];
this.current = e.index;
this.params.pageNo = 1;
this.getHouseList()
},
//查看详情
newDetail(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)
//如果不是会员请开通会员
if(this.userInfo.isPay == 1){
uni.navigateTo({
url:`/pages/home/new-detail?id=${item.id}`
})
}else{
this.$Toast("开通会员即可查看")
//跳转到实名认证页面进行实名认证
setTimeout(()=>{ //设置延迟执行
uni.navigateTo({
url:'/pages/my/list-renzhen'
})
},2000);
}
}else{
this.$Toast('请先登录!')
setTimeout(()=>{
uni.navigateTo({
url:'/pages/my/login-kehu'
})
},1000)
return
this.userInfo = null
}
})
},
lower(){
if(this.params.pageNo >= this.pages) return;
this.params.pageNo ++;
this.getHouseList()
},
}
}
</script>
<style lang="scss" scoped>
.home-pages {
padding: 18rpx 29rpx 0;
background-color: #F7F7F7;
.scroll-Y {
height: calc(100vh - 210rpx);
padding-top: 20rpx;
}
}
</style>