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

379 lines
8.6 KiB

3 months ago
<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>
3 months ago
支持根据姓名公司手机号等维度搜索
</view>
<view class="home-swiper">
3 months ago
<u-swiper :list="bannerList" circular @change="changeSwiper" autoplay @click="toPage">
3 months ago
<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">
3 months ago
<u-tabs :list="typeList" @click="clickTab"
3 months ago
lineWidth="0"
3 months ago
:current="tabIndex"
3 months ago
: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">
3 months ago
<view class="item" v-for="(a,i) in goodsList" :key="i" @click="openPage(2,a.id)">
3 months ago
<view class="name">{{a.title}}</view>
<view class="desc">{{a.content}}</view>
3 months ago
<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>
3 months ago
</view>
3 months ago
<view class="tag" :class="a.type_tag=='善'?'':'tag-on'">{{a.type_tag}}</view>
3 months ago
</view>
3 months ago
<view class="empty" v-if="total == 0">
<image src="https://www.lijkj.cn/static/empty.png"></image>
3 months ago
<view class="txt">暂无数据 ~</view>
3 months ago
</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 {
3 months ago
total: 1,
tabIndex: 0,
3 months ago
current: 0,
3 months ago
typeList: [],
3 months ago
statusBarHeight: 0,
3 months ago
bannerList: [],
bannerAllList: [],
3 months ago
goodsList: [],
bgColor: "transparent",
index: 0,
3 months ago
baserUrl: ''
3 months ago
}
},
3 months ago
onLoad() {
3 months ago
uni.hideTabBar();
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight;
3 months ago
this.getTylelist();
this.queryBannerList();
this.querytContentList();
3 months ago
},
onShow() {
uni.removeStorageSync("goodsList")
uni.removeStorageSync("scanInfo")
2 months ago
this.systembasicInfoopen();
3 months ago
},
methods: {
2 months ago
//事件类型
async systembasicInfoopen() {
const { code, data } = await this.$api.systembasicInfoopen({})
if(code == 1){
uni.setStorageSync("systembasicInfoopen",data)
}
},
3 months ago
clickTab(e) {
this.tabIndex = e.index;
3 months ago
this.total = 1;
3 months ago
this.querytContentList();
},
3 months ago
changeSwiper(e) {
this.current = e.current;
},
3 months ago
toPage(e){
uni.navigateTo({
url: "/pages/view/webview?url="+decodeURIComponent(this.bannerAllList[e].advert_url)
})
},
3 months ago
openPage(index,id){
if(index == 1){
uni.navigateTo({
url: "/pages/index/search"
})
}else if(index == 2){
uni.navigateTo({
url: "/pages/release/detail?id="+id
})
}
},
3 months ago
//事件类型
async getTylelist() {
const { code, data } = await this.$api.getTylelist({})
if(code == 1){
let arr = []
3 months ago
if(data && data.length > 0){
3 months ago
data.map(a=>{
a.name = a.title
})
3 months ago
}
3 months ago
this.typeList = [{name: "全部事件"},...data]
3 months ago
}
},
//获取轮播图
async queryBannerList() {
3 months ago
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
3 months ago
}
3 months ago
},
3 months ago
//获取事件
3 months ago
async querytContentList() {
const that = this;
const { code, data } = await that.$api.getContentList({
offset: 1,
3 months ago
limit: 20,
3 months ago
filter: JSON.stringify({
is_hot: true,
content_type_id: (this.tabIndex==0?0:this.typeList[this.tabIndex].id)
})
})
if(code == 1){
3 months ago
that.goodsList = data.rows
3 months ago
that.total = data.total
3 months ago
}
},
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;
3 months ago
background-size: 100% auto;
padding-bottom: 150rpx;
overflow: hidden;
box-sizing: border-box;
3 months ago
.empty{
padding: 150rpx 0;
text-align: center;
font-size: 26rpx;
color: #666;
image{
width: 460rpx;
height: 400rpx;
margin-bottom: 30rpx;
}
}
3 months ago
&-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;
3 months ago
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;
3 months ago
max-width: 500rpx;
3 months ago
}
.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>