Browse Source

// 修改主页 公告页 添加房子详情页

master
xjw123456 1 year ago
parent
commit
60616b8c1f
5 changed files with 119 additions and 36 deletions
  1. +6
    -1
      common/api.js
  2. +9
    -1
      pages.json
  3. +27
    -0
      pages/homeDetails/homeDetails.vue
  4. +36
    -28
      pages/index/index.vue
  5. +41
    -6
      pages/notice/notice.vue

+ 6
- 1
common/api.js View File

@ -30,4 +30,9 @@ export const getHotList = (params, succCallback, errorCallback) => {
// 请求接口获得后台列表数据信息 = 推荐房源 // 请求接口获得后台列表数据信息 = 推荐房源
export const getHouseListPage = (params, succCallback, errorCallback) => { export const getHouseListPage = (params, succCallback, errorCallback) => {
return request('/job-dev/house/applet/indexListPage', params,'GET',true, succCallback,errorCallback) return request('/job-dev/house/applet/indexListPage', params,'GET',true, succCallback,errorCallback)
};
};
// 获取公告通知
export const getNiceInfo = (params, succCallback, errorCallback) => {
return request('/job-dev/house/applet/notice', params,'GET',true, succCallback,errorCallback)
};

+ 9
- 1
pages.json View File

@ -24,7 +24,7 @@
"path" : "pages/search/search", "path" : "pages/search/search",
"style" : "style" :
{ {
"navigationBarTitleText" : "",
"navigationBarTitleText" : "搜索",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
}, },
@ -35,6 +35,14 @@
"navigationBarTitleText" : "公告", "navigationBarTitleText" : "公告",
"enablePullDownRefresh" : false "enablePullDownRefresh" : false
} }
},
{
"path" : "pages/homeDetails/homeDetails",
"style" :
{
"navigationBarTitleText" : "详情",
"enablePullDownRefresh" : false
}
} }
], ],
"globalStyle": { "globalStyle": {


+ 27
- 0
pages/homeDetails/homeDetails.vue View File

@ -0,0 +1,27 @@
<template>
<view>
这是房子详情
</view>
</template>
<script>
export default {
data() {
return {
id: ''
}
},
onLoad(options) {
this.id = options.id;
},
methods: {
getHomeDetails(id){
console.log(id);
},
}
}
</script>
<style>
</style>

+ 36
- 28
pages/index/index.vue View File

@ -1,6 +1,16 @@
<template> <template>
<view class="container"> <view class="container">
<!-- 吸顶搜索地址栏 -->
<u-sticky enable bgColor="#fff" offset-top="0">
<view class="sticky">
<view class="city">
长沙
</view>
<view class="search_btn">
<u-search placeholder="请输入您要搜索的城市" v-model="keyword" @search="toSearch" @focus="toSearch"></u-search>
</view>
</view>
</u-sticky>
<!-- </view> --> <!-- </view> -->
<view class="ant-banner-box"> <view class="ant-banner-box">
<!-- banner 部分 --> <!-- banner 部分 -->
@ -12,17 +22,7 @@
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<!-- <image class="ant-banner" mode="scaleToFill" :src="bannerList[3].image" /> -->
<!-- <view class="">
<p>一个有温度的家</p>
<p class="ant-font-24">超多房源等你来挑</p>
</view> -->
</view> </view>
<!-- <view class="ant-float">
<view class="ant-flex-line">
<view class="ant-select">江华</view>
</view>
</view> -->
<view class="card_box"> <view class="card_box">
<view class="ant-menu-card"> <view class="ant-menu-card">
<view class="ant-flex-line"> <view class="ant-flex-line">
@ -54,21 +54,11 @@
</view> </view>
</view> </view>
</view> </view>
<!-- 吸顶搜索地址栏 -->
<u-sticky enable h5-nav-height="44" offset-top="88">
<view class="sticky">
<view class="city">
长沙
</view>
<view class="search_btn">
<u-search placeholder="请输入您要搜索的城市" v-model="keyword" @search="toSearch" @focus="toSearch"></u-search>
</view>
</view>
</u-sticky>
<!-- 滚动公告 --> <!-- 滚动公告 -->
<view class="notice"> <view class="notice">
<u-notice-bar :volume-icon="false" autoplay is-circular more-icon :speed="200" mode="horizontal" :text="noticeList" url="/pages/notice/notice"></u-notice-bar>
<u-notice-bar :volume-icon="false" autoplay is-circular more-icon :speed="200" mode="horizontal" :text="noticeList" :url="'/pages/notice/notice?state='+notice_id"></u-notice-bar>
</view> </view>
<view class="ant-content"> <view class="ant-content">
@ -82,7 +72,7 @@
<view class="ant-flex-line scroll-view_H_x"> <view class="ant-flex-line scroll-view_H_x">
<scroll-view class="scroll-view_H" scroll-x="true" lower-threshold="51" <scroll-view class="scroll-view_H" scroll-x="true" lower-threshold="51"
@scrolltolower="scrollTolowerHotList"> @scrolltolower="scrollTolowerHotList">
<view class="ant-page-image-item" v-for="(item,index) in hotList">
<view class="ant-page-image-item" v-for="(item,index) in hotList" @click="toHomeDetails(item.id)">
<image class="ant-page-image-item" mode="aspectFill" <image class="ant-page-image-item" mode="aspectFill"
:src="item.image ? item.image :image" /> :src="item.image ? item.image :image" />
<view class="ant-img-tags"> <view class="ant-img-tags">
@ -100,7 +90,7 @@
<view class="ant-page-title">推荐房源</view> <view class="ant-page-title">推荐房源</view>
</view> </view>
<view class="ant-item-box" v-for="(item,index) in list">
<view class="ant-item-box" v-for="(item,index) in list" @click="toHomeDetails(item.id)">
<view> <view>
<image class="ant-item-image" mode="aspectFill" :src="item.image? item.image : image" /> <image class="ant-item-image" mode="aspectFill" :src="item.image? item.image : image" />
</view> </view>
@ -145,6 +135,7 @@
scrollPage: 1, // scrollPage: 1, //
scrollSize: 20, scrollSize: 20,
scrollTotal: null, scrollTotal: null,
notice_id: '',
} }
}, },
onLoad() { onLoad() {
@ -153,6 +144,7 @@
this.getClassList(); this.getClassList();
this.getHotList(); this.getHotList();
this.getHouseListPage(); this.getHouseListPage();
this.getNiceInfo();
// //
}, },
// //
@ -306,9 +298,22 @@
// //
//
getNiceInfo(){
this.$api.getNiceInfo().then(res => {
console.log(res,"tonggaos")
this.noticeList = res.result[0].title;
this.notice_id = res.result[0].id;
}).catch(err => {
console.log(err)
})
},
//
toHomeDetails(id){
uni.navigateTo({
url: '/pages/homeDetails/homeDetails?id='+id
})
},
// //
toSearch(){ toSearch(){
uni.navigateTo({ uni.navigateTo({
@ -331,6 +336,9 @@
/deep/ .u-sticky{ /deep/ .u-sticky{
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center;
height: 90rpx;
border-bottom: 1px solid #aaa9a5 ;
.sticky{ .sticky{
display: flex; display: flex;
align-items: center; align-items: center;
@ -433,7 +441,7 @@
// position: absolute; // position: absolute;
width: 100%; width: 100%;
margin-top: 24rpx; margin-top: 24rpx;
height: 140rpx;
height: 210rpx;
.ant-menu-card { .ant-menu-card {
// position: absolute; // position: absolute;
// top: -40rpx; // top: -40rpx;


+ 41
- 6
pages/notice/notice.vue View File

@ -1,7 +1,13 @@
<template> <template>
<view>
<view class="content_box">
<!-- 公告页面 --> <!-- 公告页面 -->
这是一个公告页面
<view class="title">
<text>{{title}}</text>
</view>
<!-- 富文本 -->
<view class="parse_box">
<u-parse :content="content"></u-parse>
</view>
</view> </view>
</template> </template>
@ -9,15 +15,44 @@
export default { export default {
data() { data() {
return { return {
state: '',
content: "",
title: "",
} }
}, },
onLoad(options) {
console.log(options)
this.state = options.state;
this.getNoticeInfo(options.state);
},
methods: { methods: {
getNoticeInfo(state) {
this.$api.getNiceInfo({state}).then( res => {
this.title = res.result[0].title;
this.content = res.result[0].content;
}).catch(err => {
console.log(err)
})
},
} }
} }
</script> </script>
<style>
<style lang="scss" scoped>
.content_box{
background-color: rgba(255, 0, 0, .5) ;
min-height: 100vh;
.title{
display: flex;
justify-content: center;
align-items: center;
height: 80rpx;
font-size: 46rpx;
font-weight: 700;
}
.parse_box{
margin: 0 30rpx;
}
}
</style> </style>

Loading…
Cancel
Save