杨豪 3 years ago
parent
commit
ceb42b24c0
  1. 22
      api/article.js
  2. 36
      pages/demandHall/business/index.vue
  3. 2
      pages/demandHall/resourcesDetail/index.vue
  4. 4
      pages/home/index.vue
  5. 136
      pages/information/index.vue
  6. 57
      pages/life/articleList/index.vue

22
api/article.js

@ -0,0 +1,22 @@
import request from '@/utils/request'
// 资讯主页
export function articleIndex(data){
return request.get('/article/index', data, {
login: false,
})
}
// 资讯分类
export function articleCategory(data){
return request.get('/article/listArticleCategory', data, {
login: false,
})
}
// 资讯分类查询
export function getArticleList(data){
return request.get('/article/list', data, {
login: false,
})
}

36
pages/demandHall/business/index.vue

@ -69,24 +69,24 @@
<image src="../../../static/images/fabu-close.png" class="toadd" @tap="toAuthentication"></image>
</view>
<view class="service-top acea-row row-between">
<view class="service-nub-left acea-row row-column-between">
<view class="service-nub-left acea-row row-column-between" @click="toResourcesDetail(supplyList[0].id)">
<view class="tips line1">{{supplyList[0].title}}</view>
<view class="tips-item line1">{{supplyList[0].detailedDescription}}</view>
<image :src="supplyList[0].resourceImgs[0]" mode="aspectFill"></image>
</view>
<view class="acea-row row-between service-nub-right">
<view class="acea-row row-between service-nub-right" @click="toResourcesDetail(supplyList[1].id)">
<view class="acea-row row-center-wrapper module-nub">
<view class="tips line1">{{supplyList[1].title}}</view>
<view class="tips-item line1">{{supplyList[1].detailedDescription}}</view>
</view>
<view class="acea-row row-center-wrapper module-nub">
<view class="acea-row row-center-wrapper module-nub" @click="toResourcesDetail(supplyList[2].id)">
<view class="tips">{{supplyList[2].title || '广告位招租'}}</view>
<view class="tips-item">{{supplyList[2].detailedDescription}}</view>
</view>
</view>
</view>
<view class="service-bottom acea-row row-between">
<view v-for="(item,index) in cagetoryList" :key="index">
<view v-for="(item,index) in cagetoryList" :key="index" @click="toEnterpriseServer(item.id)">
<view class="module-box bg-red acea-row row-center-wrapper" v-if="index <= 2 ">
<view class="tips">{{item.cagetoryName}}</view>
<!-- <view class="tips-item">房屋装修</view> -->
@ -152,8 +152,11 @@
})
},
toArticleDetail(id){
uni.navigateTo({
url:"/pages/life/articleDetail/index?id=" + id
this.$yrouter.push({
path: '/pages/life/articleDetail/index',
query: {
id: id
}
})
},
//
@ -162,6 +165,19 @@
this.supplyList = res.data
})
},
toResourcesDetail(id){
console.log(id,'id')
return
if(id){
this.$yrouter.push({
path: '/pages/demandHall/resourcesDetail/index',
query: {
id: id
}
})
}
},
//
getCagetoryList(){
listResourcesCagetory().then((res)=>{
@ -177,7 +193,7 @@
},
toCompanyDetail(id){
uni.navigateTo({
url:"/pages/life/articleDetail/index?id=" + id
url:"/pages/demandHall/companyDetail/index?id=" + id
})
},
//
@ -188,15 +204,15 @@
}
},
//
toSupplyHall(e){
toSupplyHall(id){
uni.navigateTo({
url:"/pages/demandHall/supplyHall/index"
})
},
//
toEnterpriseServer(e){
toEnterpriseServer(id){
uni.navigateTo({
url:"/pages/demandHall/enterpriseServer/index"
url:"/pages/demandHall/enterpriseServer/index?typeId="+ id
})
},
//

2
pages/demandHall/resourcesDetail/index.vue

@ -50,7 +50,7 @@
</view>
<view>
<sSwiper :imgs="detail.resourceImgs"></sSwiper>
<vSwiper :imgs="detail.resourceImgs"></vSwiper>
<!-- <vSwiper :imgs="detail.resourceImgs"></vSwiper> -->
</view>
<view class="btn-box">
<view class="contact-btn" @tap="toResourcesContact">立即沟通</view>

4
pages/home/index.vue

@ -1,7 +1,7 @@
<template>
<view class="productSort">
<!-- 顶部主页 -->
<skeleton v-if="showSkeleton" ref="<strong>skeleton</strong>" loading="chiaroscuro" selector="skeleton"
<skeleton v-if="showSkeleton" ref="skeleton" loading="chiaroscuro" selector="skeleton"
bgcolor="#FFF"></skeleton>
<view class="pageTitle-box" :class="isFixed ? 'showPageTitle' : ''"
:style="{'padding-top':navTopHeight + 'px',height:navHeight*2+ 'px'}">
@ -224,7 +224,7 @@
onReady: function() {
const that = this;
// that.$refs.skeleton.attachedAction();
that.$refs.skeleton.attachedAction();
that.$refs.skeleton.readyAction();
},

136
pages/information/index.vue

@ -6,50 +6,28 @@
<view class="search acea-row row-center-wrapper">搜一下</view>
</view>
<swiper class="vote-box">
<swiper-item v-for="(item,index) in articleList" :key="index">
<swiper-item v-for="(item,index) in hotList" :key="index">
<image :src="item.imageInput" mode="aspectFill" class="vote-img"></image>
<view class="news">
<view class="news-title-h line2">{{item.title}}</view>
<view class="news-title-h line1">{{item.title}}</view>
<view class="news-title-s line1">{{item.title}}</view>
</view>
</swiper-item>
</swiper>
<scroll-view class="scroll-view_N" scroll-x="true">
<view class="rotaion-box" @click="toTodayEvent">
<view class="acea-row rotaion row-center">
<image src="../../static/images/details1.png" mode="aspectFill"></image>
<view class="rotaion-h">今日大事</view>
<view class="rotaion-s">每日热点资讯</view>
</view>
</view>
<view class="rotaion-box" @click="toBusinessInfo">
<view class="rotaion-box" @click="toCategoryList(item.id)" v-for="(item,index) in categoryList" :key="index">
<view class="acea-row rotaion row-center">
<image src="../../static/images/details2.png" mode="aspectFill"></image>
<view class="rotaion-h">商业资讯</view>
<view class="rotaion-s">商业资讯抢先知</view>
</view>
</view>
<view class="rotaion-box" @click="toGovernmentPolicy">
<view class="acea-row rotaion row-center">
<image src="../../static/images/details3.png" mode="aspectFill"></image>
<view class="rotaion-h">政府政策</view>
<view class="rotaion-s">了解政府政策</view>
</view>
</view>
<view class="rotaion-box" @click="toLifeInfo">
<view class="acea-row rotaion row-center">
<image src="../../static/images/details4.png" mode="aspectFill"></image>
<view class="rotaion-h">生活资讯</view>
<view class="rotaion-s">有趣好玩</view>
<image :src="item.img" mode="aspectFill"></image>
<view class="rotaion-h">{{item.name}}</view>
<view class="rotaion-s">{{item.description}}</view>
</view>
</view>
</scroll-view>
<!-- 最新资讯 -->
<view class="newInfo-box">
<view class="newInfo-box" v-if="newList.length > 0">
<image src="../../static/images/newInfo.png" mode="" class="newInfo-title-img"></image>
<view class="newInfo">
<view class="modular acea-row row-between" v-for="(item,index) in articleList" :key="index"
<view class="modular acea-row row-between" v-for="(item,index) in newList" :key="index"
@click="toDetail(item.id)">
<view class="acea-row title">
<view class="modular-h line2">{{item.title}}</view>
@ -69,11 +47,11 @@
<view class="hotspot-box">
<image src="../../static/images/user/hotspot.png" mode="" class="title-h-img"></image>
<scroll-view class="scroll-view_H acea-row" scroll-x="true">
<view class="slide-box" v-for="(item,index) in articleList" :key="index">
<view class="slide-box" v-for="(item,index) in hotList" :key="index">
<image :src="item.imageInput" mode="aspectFill"></image>
<view class="hotspot-con">
<view class="hotspot-icon">热点</view>
<view class="hotspot-title-h">{{item.title}}</view>
<view class="hotspot-title-h line2">{{item.title}}</view>
</view>
</view>
</scroll-view>
@ -81,14 +59,15 @@
<!-- 值得关注 -->
<view class="follow-box">
<image src="../../static/images/follow-title.png" mode="" class="title-h-img"></image>
<view class="follow-con" v-for="(item,index) in articleList" :key="index">
<view class="follow-con" v-for="(item,index) in concernList" :key="index">
<view class="follow-top acea-row row-between">
<view class="acea-row follow-title">
<view class="follow-h line2">{{item.title}}</view>
<view class="follow-title-l acea-row row-between">
<view>{{item.author}}</view>
<view>{{item.createTime.split(' ')[0]}}</view>
<view class="acea-row row-middle">203
<view>{{item.createTime}}</view>
<view class="acea-row row-middle">
<text>{{item.visit}}</text>
<image src="../../static/images/eye.png" mode="aspectFill"></image>
</view>
</view>
@ -101,7 +80,7 @@
<view class="title-s">{{item.author}}</view>
<view class="title-con line1">{{item.title}}</view>
</view>
<view class="follow-btn">关注+</view>
<!-- <view class="follow-btn">关注+</view> -->
</view>
</view>
</view>
@ -109,25 +88,40 @@
</template>
<script>
import {
getArticle
} from "@/api/home";
import { getArticle } from "@/api/home";
import { articleIndex } from "@/api/article"
export default {
data() {
return {
categoryList: [],
newList: [],
hotList: [],
concernList: [],
articleList: [],
page: 0,
size: 10,
}
},
mounted() {
this.getArticleList()
// this.getArticleList()
this.getArticleIndex()
},
onReachBottom() {
this.page = this.page + 1
this.getArticleList()
},
computed:{
},
methods: {
getArticleIndex(){
articleIndex().then((res)=>{
this.categoryList = res.data.categoryList
this.concernList = res.data.concernList
this.hotList = res.data.hotList
this.newList = res.data.newList
})
},
getArticleList() {
getArticle({
page: this.page,
@ -145,31 +139,12 @@
}
})
},
//
toTodayEvent() {
toCategoryList(id){
console.log('id',id)
uni.navigateTo({
url: '/pages/life/articleList/index?active=1'
url: '/pages/life/articleList/index?active=' + id
});
},
//
toBusinessInfo() {
uni.navigateTo({
url: '/pages/life/articleList/index?active=2'
});
},
//
toGovernmentPolicy() {
uni.navigateTo({
url: '/pages/life/articleList/index?active=3'
});
},
//
toLifeInfo() {
uni.navigateTo({
url: '/pages/life/articleList/index?active=4'
});
},
}
}
</script>
@ -212,7 +187,6 @@
.vote-box {
width: 670rpx;
height: 358rpx;
/* background: #FFFFFF; */
box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16);
border-radius: 16rpx;
margin: 0 auto;
@ -227,26 +201,24 @@
}
.news {
width: 100%;
height: 358rpx;
border-radius: 16rpx 16rpx 0 0;
color: #FFF;
width: 590rpx;
height: 94rpx;
background: rgba(0, 0, 0, 0.2);
border-radius: 14rpx;
position: absolute;
padding: 0 40rpx;
bottom: 6rpx;
left: 50%;
margin-left: -295rpx;
color: #fff;
padding: 14rpx;
}
.news-title-h {
width: 590rpx;
font-size: 28rpx;
position: absolute;
bottom: 65rpx;
}
.news-title-s {
width: 590rpx;
font-size: 20rpx;
position: absolute;
bottom: 25rpx;
}
/* .vote {
@ -393,11 +365,14 @@
}
.hotspot-con {
width: 588rpx;
height: 130rpx;
bottom: 34rpx;
left: 24rpx;
width: 670rpx;
height: 94rpx;
background: rgba(0, 0, 0, 0.2);
border-radius: 0px 0px 8rpx 8rpx;
padding: 8rpx 32rpx;
color: #fff;
position: absolute;
bottom: 0;
}
.hotspot-icon {
@ -406,6 +381,7 @@
background: #FE3737;
border-radius: 12rpx 2rpx 12rpx 0;
position: absolute;
top:-46rpx;
font-size: 22rpx;
color: #fff;
text-align: center;
@ -414,12 +390,8 @@
.hotspot-title-h {
width: 588rpx;
height: 80rpx;
font-size: 28rpx;
color: #FFFFFF;
position: absolute;
bottom: 0;
white-space: pre-wrap;
}
/* 值得关注 */

57
pages/life/articleList/index.vue

@ -10,14 +10,11 @@
<view class="search-btn">搜一下</view>
</view>
<view class="resource-tabs acea-row row-between-wrapper">
<view :class="'tab ' + (active == 1 ? 'tab-a' : '')" data-i="1" @tap="tabClick">今日大事</view>
<view :class="'tab ' + (active == 2 ? 'tab-a' : '')" data-i="2" @tap="tabClick">商业资讯</view>
<view :class="'tab ' + (active == 3 ? 'tab-a' : '')" data-i="3" @tap="tabClick">政府政策</view>
<view :class="'tab ' + (active == 4 ? 'tab-a' : '')" data-i="4" @tap="tabClick">生活资讯</view>
<view :class="'tab ' + (active == item.id ? 'tab-a' : '')" @tap="tabClick(item.id)" v-for="item in categortList" :key="item.id">{{item.name}}</view>
</view>
</view>
<view class="content-box">
<view class="list-box" v-if="active == 1">
<view class="list-box">
<view class="list-item acea-row row-between row-middle" v-for="(item,index) in articleList" :key="index"
@click="toDetail(item.id)">
<view class="item-l">
@ -29,7 +26,7 @@
<view class="auth">{{item.author}}</view>
<view class="auth time">{{item.createTime.split(' ')[0]}}</view>
<view class="see acea-row row-middle">
<text>200</text>
<text>{{item.visit}}</text>
<image src="../../../static/images/eye.png"></image>
</view>
</view>
@ -39,21 +36,13 @@
</view>
</view>
</view>
<view class="list-box" v-if="active == 2">
<view>2</view>
</view>
<view class="list-box" v-if="active == 3">
<view>3</view>
</view>
<view class="list-box" v-if="active == 4">
<view>4</view>
</view>
</view>
<LoadStatus :loadStatus="loadStatus"></LoadStatus>
</view>
</template>
<script>
import { articleCategory, getArticleList } from "@/api/article";
import { getArticle } from "@/api/home";
import LoadStatus from '@/components/LoadStatus.vue'
export default{
@ -62,39 +51,52 @@
},
data(){
return{
categortList: [],
articleList: [],
page: 0,
size: 10,
isLoading: true,
active: null,
loadStatus: '没有更多了...'
}
},
onLoad(option) {
this.active=option.active;
},
mounted() {
this.getArticleList()
this.getArticleCategort().then(()=>{
this.active= this.$yroute.query.active;
this.getArticleList()
})
},
onReachBottom() {
this.page = this.page + 1
this.getArticleList()
},
methods: {
getArticleCategort(){
return new Promise((reslove)=>{
articleCategory().then((res)=>{
this.categortList = res.data
this.active = this.categortList[0].id
reslove()
})
})
},
getArticleList() {
if (!this.isLoading) return
if(!this.isLoading) return
uni.showLoading({
title: '加载中...'
})
this.loadStatus = '加载中...'
getArticle({
getArticleList({
page: this.page,
size: this.size,
isHot: 0
cid: this.active
}).then((res) => {
if (res.data.content.length < this.size) {
this.loadStatus = '没有更多了...'
if(res.data.content.length < this.size){
this.isLoading = false
} else {
this.loadStatus = '没有更多了...'
} else{
this.isLoading = true
this.loadStatus = '上拉加载更多...'
}
@ -110,10 +112,11 @@
}
})
},
tabClick(e) {
this.setData({
active: e.currentTarget.dataset.i,
})
tabClick(id) {
this.active = id
this.isLoading = true
this.articleList = []
this.getArticleList()
},
}
}

Loading…
Cancel
Save