首页优化
|
|
@ -4,7 +4,8 @@
|
|||
{ // 首页
|
||||
"path": "pages/home/home",
|
||||
"style": {
|
||||
"navigationStyle": "custom" // 隐藏系统导航栏
|
||||
"navigationStyle": "custom", // 隐藏系统导航栏
|
||||
"navigationBarTextStyle": "white"
|
||||
}
|
||||
},
|
||||
// #endif
|
||||
|
|
|
|||
|
|
@ -1,62 +1,26 @@
|
|||
<template>
|
||||
<!-- 新鲜事页 -->
|
||||
<view class="news">
|
||||
<!-- 导航栏 -->
|
||||
<!-- <u-navbar placeholder>
|
||||
<view slot="left"></view>
|
||||
<view slot="center" class="nav-center">
|
||||
<view :class="{'active':tabIndex === index}" @click="changeTab(index)" v-for="(item,index) in tabList"
|
||||
:key="index">
|
||||
<view class="nav-title">{{item.name}}</view>
|
||||
<view class="active-line"></view>
|
||||
<view>
|
||||
<u-sticky>
|
||||
<u-swiper :list="topicList.swiper" keyName="image" circular height="470rpx" bgColor="#ffffff"></u-swiper>
|
||||
<view class="search-input">
|
||||
<u-search searchIconColor='#e6e6e6' placeholderColor='#e6e6e6' color='#FFFFFF' placeholder="搜索招聘/课程/技能"
|
||||
v-model="keyword" :showAction="false"></u-search>
|
||||
</view>
|
||||
<view class="tabs-list">
|
||||
<view class="left">
|
||||
<view class="item" @click="btntabs(index)" v-for="(item,index) in tabsList" :key="index">
|
||||
<image class="images" :src="currect==index?item.imgSelect:item.img" mode=""></image>
|
||||
<text :style="{color:currect==index?'#006EEF':'#707070'}" class="text1">{{item.title}}</text>
|
||||
</view>
|
||||
</view>
|
||||
<view class="right">
|
||||
<image class="images1" src="../../static/img/demo/gengduo.png" mode=""></image>
|
||||
</view>
|
||||
</view>
|
||||
</u-navbar> -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<u-navbar placeholder>
|
||||
<view slot="left" @click="btn" class="iconfont iconqiandao" style="visibility: hidden;"></view>
|
||||
<view slot="center" class="nav-center">
|
||||
<u-search placeholder="搜索新鲜事" @click="goSearch()" :showAction="false" disabled></u-search>
|
||||
</view>
|
||||
<!-- <view slot="right" class="iconfont iconPensyumaobi" @click="handlePublish()"></view> -->
|
||||
</u-navbar>
|
||||
<!-- #endif -->
|
||||
<!-- 信息列表 -->
|
||||
<swiper class="bg-white px-20 py-20" :style="{height:swiperHeight + 'px'}" :current="tabIndex"
|
||||
@change="changeSwiper">
|
||||
<!-- <swiper-item>
|
||||
<scroll-view scroll-y class="flow h-full" @scrolltolower="reachBottom">
|
||||
<info-list v-for="(item,index) in followList.list" :key="index" :item="item">
|
||||
</info-list>
|
||||
<u-loadmore :status="followList.loadStatus"></u-loadmore>
|
||||
</scroll-view>
|
||||
</swiper-item> -->
|
||||
<!-- 话题 -->
|
||||
<swiper-item>
|
||||
<scroll-view scroll-y class="topic h-full">
|
||||
<!-- 搜索框 -->
|
||||
<!-- <view class="search-input" @click="goSearch">
|
||||
<u-input type="text" placeholder="请输入搜索内容"
|
||||
placeholderClass="iconfont iconsousuo text-28" border="none" inputAlign="center" clearable
|
||||
confirmType="search" disabled>
|
||||
</u-input>
|
||||
</view> -->
|
||||
<!-- 轮播图 -->
|
||||
<u-swiper :list="topicList.swiper" keyName="image" indicator indicatorMode="line" circular
|
||||
height="320rpx" bgColor="#ffffff"></u-swiper>
|
||||
<news-topic-nav title="招聘公告" url=""></news-topic-nav>
|
||||
<view class="last-update">
|
||||
<topic-list v-if='index<=2' :item="item" v-for="(item,index) in topicList.list"
|
||||
:key="index"></topic-list>
|
||||
</view>
|
||||
<news-topic-nav title="技能培训" url=""></news-topic-nav>
|
||||
<view class="last-update">
|
||||
<topic-list v-if='index<=2' :item="item" v-for="(item,index) in topicList.list"
|
||||
:key="index"></topic-list>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</u-sticky>
|
||||
<view class="last-update">
|
||||
<topic-list v-if='index<=5' :item="item" v-for="(item,index) in topicList.list" :key="index"></topic-list>
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
|
|
@ -76,6 +40,9 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
keyword: "",
|
||||
currect: 0,
|
||||
|
||||
// 导航标签
|
||||
tabIndex: 1,
|
||||
tabList: [{
|
||||
|
|
@ -99,152 +66,122 @@
|
|||
topicList: {
|
||||
swiper: [ // 轮播图
|
||||
{
|
||||
image: '/static/img/demo/winter.png',
|
||||
title: '迷人的春天是令人欢欣鼓舞的。'
|
||||
},
|
||||
{
|
||||
image: '/static/img/demo/winter.png',
|
||||
title: '一道残阳铺水中,半江瑟瑟半江红。'
|
||||
},
|
||||
{
|
||||
image: '/static/img/demo/winter.png',
|
||||
title: '金秋的阳光温馨恬静,金秋的微风和煦轻柔。'
|
||||
},
|
||||
{
|
||||
image: '/static/img/demo/winter.png',
|
||||
title: '风吹过,寒气直侵入骨头。'
|
||||
image: '/static/img/demo/winter1.jpeg',
|
||||
}
|
||||
],
|
||||
|
||||
list: topicList[1].list
|
||||
}
|
||||
},
|
||||
tabsList: [{
|
||||
img: '/static/img/demo/zhaopin.png',
|
||||
imgSelect: '/static/img/demo/zhaopin-select.png',
|
||||
title: '招聘',
|
||||
},
|
||||
{
|
||||
img: '/static/img/demo/jineng.png',
|
||||
imgSelect: '/static/img/demo/jineng-select.png',
|
||||
title: '技能',
|
||||
},
|
||||
{
|
||||
img: '/static/img/demo/kecheng.png',
|
||||
imgSelect: '/static/img/demo/kecheng-select.png',
|
||||
title: '课程',
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 设置swiperHeight
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
// 屏幕高度(screenHeight) = 手机状态栏的高度(statusBarHeight) + 导航栏高度(44px) + 可使用窗口高度(windowHeight)
|
||||
// 可使用窗口高度 = swiper高度 + 自定义导航栏高度
|
||||
this.swiperHeight = res.windowHeight - 44
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
methods: {
|
||||
// tabbar点击
|
||||
changeTab(index) {
|
||||
this.tabIndex = index
|
||||
},
|
||||
// swiper滑动
|
||||
changeSwiper(e) {
|
||||
this.tabIndex = e.detail.current
|
||||
},
|
||||
// scroll-view触底
|
||||
reachBottom() {
|
||||
// 是否可加载
|
||||
if (this.followList.loadStatus !== 'loadmore') return;
|
||||
// 加载更多
|
||||
this.followList.loadStatus = "loading"
|
||||
setTimeout(() => {
|
||||
this.getList()
|
||||
}, 1000);
|
||||
},
|
||||
// 获取列表
|
||||
getList(idx) {
|
||||
// 随机添加5条数据
|
||||
for (let i = 0; i < 5; i++) {
|
||||
let index = this.$u.random(0, this.followList.list.length - 1)
|
||||
let data = JSON.parse(JSON.stringify(this.followList.list[index]))
|
||||
this.followList.list.push(data)
|
||||
}
|
||||
// 更新加载状态
|
||||
this.followList.loadStatus = "nomore"
|
||||
},
|
||||
// 搜索
|
||||
goSearch() {
|
||||
this.$u.route('/pages/home/search', {
|
||||
type: 'topic'
|
||||
})
|
||||
btntabs(index) {
|
||||
this.currect = index
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.news {
|
||||
<style lang="scss">
|
||||
page {
|
||||
background-color: #f7f8ff;
|
||||
}
|
||||
|
||||
// 导航栏
|
||||
/deep/ .u-navbar {
|
||||
.search-input {
|
||||
width: 90%;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
bottom: 270rpx;
|
||||
}
|
||||
|
||||
.iconfont {
|
||||
font-size: 48rpx;
|
||||
color: $uni-color-green;
|
||||
}
|
||||
.tabs-list {
|
||||
// border: solid 1px red;
|
||||
width: 95%;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
background-color: #FFFFFF;
|
||||
border-radius: 20rpx;
|
||||
position: relative;
|
||||
bottom: 200rpx;
|
||||
height: 180rpx;
|
||||
|
||||
.nav-center {
|
||||
text-align: center;
|
||||
.left {
|
||||
width: 80%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
// border: solid 1px red;
|
||||
|
||||
.item {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.nav-title {
|
||||
width: 60rpx;
|
||||
font-size: 30rpx;
|
||||
padding: 0 15rpx;
|
||||
font-weight: bold;
|
||||
color: $uni-text-color-gray;
|
||||
.images {
|
||||
width: 65rpx;
|
||||
height: 65rpx;
|
||||
}
|
||||
|
||||
.active {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.nav-title {
|
||||
color: $uni-color-green;
|
||||
}
|
||||
|
||||
.active-line {
|
||||
border-bottom: 8rpx solid $uni-color-green;
|
||||
border-radius: 20rpx;
|
||||
width: 70rpx;
|
||||
position: absolute;
|
||||
bottom: -10rpx;
|
||||
left: 50%;
|
||||
margin-left: -35rpx;
|
||||
}
|
||||
.text1 {
|
||||
font-size: 28rpx;
|
||||
color: #000000;
|
||||
margin-top: 10rpx;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.u-navbar__content {
|
||||
padding-right: 180rpx !important; // 胶囊按钮
|
||||
}
|
||||
}
|
||||
|
||||
.topic {
|
||||
.search-input {
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
height: 70rpx;
|
||||
background-color: #F4F4F4;
|
||||
border-radius: 10rpx;
|
||||
.right {
|
||||
width: 20%;
|
||||
// border:solid 1px blue;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
/deep/ .u-input {
|
||||
height: 100%;
|
||||
}
|
||||
.images1 {
|
||||
width: 60rpx;
|
||||
height: 60rpx;
|
||||
}
|
||||
|
||||
.last-update {
|
||||
padding: 0 20rpx 20rpx;
|
||||
|
||||
.last-update-name {
|
||||
font-size: 32rpx;
|
||||
padding-bottom: 5rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
.last-update {
|
||||
// border: solid 1px red;
|
||||
position: relative;
|
||||
bottom: 200rpx;
|
||||
width: 95%;
|
||||
margin: 0 auto;
|
||||
|
||||
}
|
||||
|
||||
/deep/.u-search__content {
|
||||
background-color: rgba(255, 255, 255, 0.4) !important;
|
||||
}
|
||||
|
||||
/deep/.u-search__content__input {
|
||||
background-color: rgba(255, 255, 255, 0) !important;
|
||||
}
|
||||
</style>
|
||||
|
|
@ -0,0 +1,250 @@
|
|||
<template>
|
||||
<!-- 新鲜事页 -->
|
||||
<view class="news">
|
||||
<!-- 导航栏 -->
|
||||
<!-- <u-navbar placeholder>
|
||||
<view slot="left"></view>
|
||||
<view slot="center" class="nav-center">
|
||||
<view :class="{'active':tabIndex === index}" @click="changeTab(index)" v-for="(item,index) in tabList"
|
||||
:key="index">
|
||||
<view class="nav-title">{{item.name}}</view>
|
||||
<view class="active-line"></view>
|
||||
</view>
|
||||
</view>
|
||||
</u-navbar> -->
|
||||
<!-- #ifdef MP-WEIXIN -->
|
||||
<u-navbar placeholder>
|
||||
<view slot="left" @click="btn" class="iconfont iconqiandao" style="visibility: hidden;"></view>
|
||||
<view slot="center" class="nav-center">
|
||||
<u-search placeholder="搜索新鲜事" @click="goSearch()" :showAction="false" disabled></u-search>
|
||||
</view>
|
||||
<!-- <view slot="right" class="iconfont iconPensyumaobi" @click="handlePublish()"></view> -->
|
||||
</u-navbar>
|
||||
<!-- #endif -->
|
||||
<!-- 信息列表 -->
|
||||
<swiper class="bg-white px-20 py-20" :style="{height:swiperHeight + 'px'}" :current="tabIndex"
|
||||
@change="changeSwiper">
|
||||
<!-- <swiper-item>
|
||||
<scroll-view scroll-y class="flow h-full" @scrolltolower="reachBottom">
|
||||
<info-list v-for="(item,index) in followList.list" :key="index" :item="item">
|
||||
</info-list>
|
||||
<u-loadmore :status="followList.loadStatus"></u-loadmore>
|
||||
</scroll-view>
|
||||
</swiper-item> -->
|
||||
<!-- 话题 -->
|
||||
<swiper-item>
|
||||
<scroll-view scroll-y class="topic h-full">
|
||||
<!-- 搜索框 -->
|
||||
<!-- <view class="search-input" @click="goSearch">
|
||||
<u-input type="text" placeholder="请输入搜索内容"
|
||||
placeholderClass="iconfont iconsousuo text-28" border="none" inputAlign="center" clearable
|
||||
confirmType="search" disabled>
|
||||
</u-input>
|
||||
</view> -->
|
||||
<!-- 轮播图 -->
|
||||
<u-swiper :list="topicList.swiper" keyName="image" indicator indicatorMode="line" circular
|
||||
height="320rpx" bgColor="#ffffff"></u-swiper>
|
||||
<news-topic-nav title="招聘公告" url=""></news-topic-nav>
|
||||
<view class="last-update">
|
||||
<topic-list v-if='index<=2' :item="item" v-for="(item,index) in topicList.list"
|
||||
:key="index"></topic-list>
|
||||
</view>
|
||||
<news-topic-nav title="技能培训" url=""></news-topic-nav>
|
||||
<view class="last-update">
|
||||
<topic-list v-if='index<=2' :item="item" v-for="(item,index) in topicList.list"
|
||||
:key="index"></topic-list>
|
||||
</view>
|
||||
</scroll-view>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
newsList,
|
||||
topicList
|
||||
} from "@/utils/data/data.js"
|
||||
import InfoList from "@/pages/home/cpns/info-list.vue"
|
||||
import NewsTopicNav from "@/pages/news/cpns/news-topic-nav.vue"
|
||||
import TopicList from "@/pages/news/cpns/topic-list.vue"
|
||||
export default {
|
||||
components: {
|
||||
InfoList,
|
||||
NewsTopicNav,
|
||||
TopicList
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
// 导航标签
|
||||
tabIndex: 1,
|
||||
tabList: [{
|
||||
name: "关注",
|
||||
id: 'follow'
|
||||
},
|
||||
{
|
||||
name: "话题",
|
||||
id: 'topic'
|
||||
}
|
||||
],
|
||||
swiperHeight: 0,
|
||||
// 关注列表
|
||||
followList: {
|
||||
// 加载更多
|
||||
loadStatus: 'loadmore',
|
||||
// 列表数据
|
||||
list: newsList[0].list
|
||||
},
|
||||
// 话题列表
|
||||
topicList: {
|
||||
swiper: [ // 轮播图
|
||||
{
|
||||
image: '/static/img/demo/winter.png',
|
||||
title: '迷人的春天是令人欢欣鼓舞的。'
|
||||
},
|
||||
{
|
||||
image: '/static/img/demo/winter.png',
|
||||
title: '一道残阳铺水中,半江瑟瑟半江红。'
|
||||
},
|
||||
{
|
||||
image: '/static/img/demo/winter.png',
|
||||
title: '金秋的阳光温馨恬静,金秋的微风和煦轻柔。'
|
||||
},
|
||||
{
|
||||
image: '/static/img/demo/winter.png',
|
||||
title: '风吹过,寒气直侵入骨头。'
|
||||
}
|
||||
],
|
||||
|
||||
list: topicList[1].list
|
||||
}
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
// 设置swiperHeight
|
||||
uni.getSystemInfo({
|
||||
success: (res) => {
|
||||
// 屏幕高度(screenHeight) = 手机状态栏的高度(statusBarHeight) + 导航栏高度(44px) + 可使用窗口高度(windowHeight)
|
||||
// 可使用窗口高度 = swiper高度 + 自定义导航栏高度
|
||||
this.swiperHeight = res.windowHeight - 44
|
||||
}
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
// tabbar点击
|
||||
changeTab(index) {
|
||||
this.tabIndex = index
|
||||
},
|
||||
// swiper滑动
|
||||
changeSwiper(e) {
|
||||
this.tabIndex = e.detail.current
|
||||
},
|
||||
// scroll-view触底
|
||||
reachBottom() {
|
||||
// 是否可加载
|
||||
if (this.followList.loadStatus !== 'loadmore') return;
|
||||
// 加载更多
|
||||
this.followList.loadStatus = "loading"
|
||||
setTimeout(() => {
|
||||
this.getList()
|
||||
}, 1000);
|
||||
},
|
||||
// 获取列表
|
||||
getList(idx) {
|
||||
// 随机添加5条数据
|
||||
for (let i = 0; i < 5; i++) {
|
||||
let index = this.$u.random(0, this.followList.list.length - 1)
|
||||
let data = JSON.parse(JSON.stringify(this.followList.list[index]))
|
||||
this.followList.list.push(data)
|
||||
}
|
||||
// 更新加载状态
|
||||
this.followList.loadStatus = "nomore"
|
||||
},
|
||||
// 搜索
|
||||
goSearch() {
|
||||
this.$u.route('/pages/home/search', {
|
||||
type: 'topic'
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.news {
|
||||
|
||||
// 导航栏
|
||||
/deep/ .u-navbar {
|
||||
|
||||
.iconfont {
|
||||
font-size: 48rpx;
|
||||
color: $uni-color-green;
|
||||
}
|
||||
|
||||
.nav-center {
|
||||
text-align: center;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.nav-title {
|
||||
width: 60rpx;
|
||||
font-size: 30rpx;
|
||||
padding: 0 15rpx;
|
||||
font-weight: bold;
|
||||
color: $uni-text-color-gray;
|
||||
}
|
||||
|
||||
.active {
|
||||
position: relative;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
|
||||
.nav-title {
|
||||
color: $uni-color-green;
|
||||
}
|
||||
|
||||
.active-line {
|
||||
border-bottom: 8rpx solid $uni-color-green;
|
||||
border-radius: 20rpx;
|
||||
width: 70rpx;
|
||||
position: absolute;
|
||||
bottom: -10rpx;
|
||||
left: 50%;
|
||||
margin-left: -35rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
.u-navbar__content {
|
||||
padding-right: 180rpx !important; // 胶囊按钮
|
||||
}
|
||||
}
|
||||
|
||||
.topic {
|
||||
.search-input {
|
||||
margin-top: 20rpx;
|
||||
margin-bottom: 20rpx;
|
||||
height: 70rpx;
|
||||
background-color: #F4F4F4;
|
||||
border-radius: 10rpx;
|
||||
|
||||
/deep/ .u-input {
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
.last-update {
|
||||
padding: 0 20rpx 20rpx;
|
||||
|
||||
.last-update-name {
|
||||
font-size: 32rpx;
|
||||
padding-bottom: 5rpx;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
@ -65,6 +65,10 @@
|
|||
|
||||
<style lang="scss" scoped>
|
||||
.topic-list {
|
||||
background-color: #FFFFFF;
|
||||
margin-top: 20rpx;
|
||||
border-radius: 10rpx;
|
||||
padding:15rpx 10rpx;
|
||||
image {
|
||||
width: 150rpx;
|
||||
height: 150rpx;
|
||||
|
|
|
|||
|
After Width: | Height: | Size: 578 B |
|
After Width: | Height: | Size: 975 B |
|
After Width: | Height: | Size: 966 B |
|
After Width: | Height: | Size: 700 B |
|
After Width: | Height: | Size: 681 B |
|
After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 861 B |