征信小程序
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.
 
 
 

378 lines
8.6 KiB

<template>
<view class="home">
<view class="home-navbar" :style="{'height': (statusBarHeight+44)+'px'}">
<u-navbar :bgColor="bgColor" :fixed="false" title="首页">
<view class="u-nav-slot" slot="left"></view>
<view class="u-nav-slot" slot="content">
<view class="nav"></view>
</view>
</u-navbar>
</view>
<view class="blank" :style="{'height': (statusBarHeight+44)+'px'}"></view>
<view class="home-title">
<text>共享经历 鹰眼计划</text>让恶行无处遁形让善举更有价值
</view>
<view class="home-search" @click="openPage(1)">
<image src="https://www.lijkj.cn/static/icon-search.png"></image>
支持根据姓名公司手机号等维度搜索
</view>
<view class="home-swiper">
<u-swiper :list="bannerList" circular @change="changeSwiper" autoplay @click="toPage">
<view slot="indicator" class="indicator">
<view class="indicator__dot" v-for="(item, idx) in bannerList" :key="idx"
:class="[idx === current && 'indicator__dot--active']"></view>
</view>
</u-swiper>
</view>
<view class="home-list">
<view class="title">热门推荐</view>
<view class="tab">
<u-tabs :list="typeList" @click="clickTab"
lineWidth="0"
:current="tabIndex"
:activeStyle="{
color: '#00C6A9',
border: '1px solid #00C6A9',
borderRadius: '5px',
width: '150rpx',
textAlign: 'center',
padding: '10rpx 0',
display: 'block',
}"
:inactiveStyle="{
color: '#999999',
border: '1px solid #999999',
width: '150rpx',
display: 'block',
padding: '10rpx 0',
textAlign: 'center',
borderRadius: '5px'
}"
></u-tabs>
</view>
<view class="list">
<view class="item" v-for="(a,i) in goodsList" :key="i" @click="openPage(2,a.id)">
<view class="name">{{a.title}}</view>
<view class="desc">{{a.content}}</view>
<view class="do">
<view class="fl"><image class="img1" src="https://www.lijkj.cn/static/icon-view.png"></image>{{a.readnum}}</view>
<view class="fl"><image class="img2" src="https://www.lijkj.cn/static/dianzan.png"></image>{{a.likenum}}</view>
</view>
<view class="tag" :class="a.type_tag=='善'?'':'tag-on'">{{a.type_tag}}</view>
</view>
<view class="empty" v-if="total == 0">
<image src="https://www.lijkj.cn/static/empty.png"></image>
<view class="txt">暂无数据 ~</view>
</view>
</view>
</view>
<foo-bar @toIndex="toIndex" :home="0"></foo-bar>
</view>
</template>
<script>
import fooBar from '@/components/fooBar/fooBar.vue'
export default {
components: {
fooBar
},
data() {
return {
total: 1,
tabIndex: 0,
current: 0,
typeList: [],
statusBarHeight: 0,
bannerList: [],
bannerAllList: [],
goodsList: [],
bgColor: "transparent",
index: 0,
baserUrl: ''
}
},
onLoad() {
uni.hideTabBar();
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
this.getTylelist();
this.queryBannerList();
this.querytContentList();
},
onShow() {
uni.removeStorageSync("goodsList")
uni.removeStorageSync("scanInfo")
this.systembasicInfoopen();
},
methods: {
//事件类型
async systembasicInfoopen() {
const { code, data } = await this.$api.systembasicInfoopen({})
if(code == 1){
uni.setStorageSync("systembasicInfoopen",data)
}
},
clickTab(e) {
this.tabIndex = e.index;
this.total = 1;
this.querytContentList();
},
changeSwiper(e) {
this.current = e.current;
},
toPage(e){
uni.navigateTo({
url: "/pages/view/webview?url="+decodeURIComponent(this.bannerAllList[e].advert_url)
})
},
openPage(index,id){
if(index == 1){
uni.navigateTo({
url: "/pages/index/search"
})
}else if(index == 2){
uni.navigateTo({
url: "/pages/release/detail?id="+id
})
}
},
//事件类型
async getTylelist() {
const { code, data } = await this.$api.getTylelist({})
if(code == 1){
let arr = []
if(data && data.length > 0){
data.map(a=>{
a.name = a.title
})
}
this.typeList = [{name: "全部事件"},...data]
}
},
//获取轮播图
async queryBannerList() {
const that = this;
const { code, data } = await that.$api.getadvert({})
if(code == 1){
let arr = []
if(data && data.length > 0){
data.map(a=>{
arr.push((that.$baseUrl+a.image))
})
}
that.bannerList = arr
that.bannerAllList = data
}
},
//获取事件
async querytContentList() {
const that = this;
const { code, data } = await that.$api.getContentList({
offset: 1,
limit: 20,
filter: JSON.stringify({
is_hot: true,
content_type_id: (this.tabIndex==0?0:this.typeList[this.tabIndex].id)
})
})
if(code == 1){
that.goodsList = data.rows
that.total = data.total
}
},
async toIndex(index) {
let that = this
that.index = index
if (index == 0) {
uni.switchTab({
url: '/pages/index/index'
})
}else if (index == 2) {
uni.switchTab({
url: '/pages/release/index'
})
} else if (index == 3) {
uni.switchTab({
url: '/pages/user/index'
})
}
},
}
}
</script>
<style lang="scss" scoped>
.home {
min-height: 100vh;
background: url(https://www.lijkj.cn/static/bg.png) center top no-repeat;
background-size: 100% auto;
padding-bottom: 150rpx;
overflow: hidden;
box-sizing: border-box;
.empty{
padding: 150rpx 0;
text-align: center;
font-size: 26rpx;
color: #666;
image{
width: 460rpx;
height: 400rpx;
margin-bottom: 30rpx;
}
}
&-navbar{
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 12;
width: 100%;
background: url(https://www.lijkj.cn/static/bg.png) center top no-repeat;
background-size: 100% auto;
}
&-title{
text-align: center;
padding: 38rpx;
font-weight: 500;
font-size: 26rpx;
color: #333333;
text{
display: block;
font-weight: bold;
font-size: 36rpx;
color: #333333;
margin-bottom: 25rpx;
}
}
&-search{
width: 702rpx;
height: 100rpx;
background: #FFFFFF;
border-radius: 20rpx;
margin: 0 auto;
display: flex;
align-items: center;
padding: 30rpx;
box-sizing: border-box;
margin-top: 20rpx;
image{
width: 31rpx;
height: 35rpx;
margin-right: 14rpx;
}
color: #808080;
font-weight: 500;
font-size: 26rpx;
}
&-swiper {
padding: 0 30rpx;
overflow: hidden;
margin-top: 30rpx;
.indicator {
@include flex(row);
justify-content: center;
&__dot {
width: 16rpx;
height: 8rpx;
border-radius: 16rpx;
background-color: rgba(255, 255, 255, 0.35);
margin: 0 3px;
transition: background-color 0.3s;
&--active {
width: 30rpx;
height: 8rpx;
background-color: #ffffff;
}
}
}
}
&-list{
overflow: hidden;
margin-top: 30rpx;
.title{
font-weight: bold;
font-size: 36rpx;
color: #333333;
padding: 0 25rpx;
max-width: 500rpx;
}
.tab{
margin-top: 10rpx;
}
.list{
padding: 0 25rpx 0;
overflow: hidden;
.item{
width: 100%;
height: 180rpx;
background: #FFFFFF;
box-shadow: 0px 3rpx 10rpx 0px rgba(9,44,39,0.05);
border-radius: 20rpx;
padding: 30rpx;
box-sizing: border-box;
position: relative;
margin-top: 25rpx;
.tag{
width: 80rpx;
height: 56rpx;
text-align: center;
line-height: 56rpx;
background: #00C6A9;
border-radius: 0px 20rpx 0px 20rpx;
font-size: 32rpx;
color: #FFFFFF;
position: absolute;
right: 0;
top: 0;
z-index: 2;
&-on{
background: #333333;
}
}
.name{
font-weight: 500;
font-size: 30rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
color: #333333;
}
.desc{
font-weight: 500;
font-size: 24rpx;
color: #999999;
margin-top: 18rpx;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
.do{
display: flex;
align-items: center;
margin-top: 10rpx;
.fl{
width: 130rpx;
display: flex;
align-items: center;
font-weight: 500;
font-size: 24rpx;
color: #999999;
.img1{
width: 30rpx;
height: 20rpx;
margin-right: 10rpx;
margin-top: 5rpx;
}
.img2{
width: 24rpx;
height: 24rpx;
margin-right: 10rpx;
}
}
}
}
}
}
}
</style>