杨豪 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> <image src="../../../static/images/fabu-close.png" class="toadd" @tap="toAuthentication"></image>
</view> </view>
<view class="service-top acea-row row-between"> <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 line1">{{supplyList[0].title}}</view>
<view class="tips-item line1">{{supplyList[0].detailedDescription}}</view> <view class="tips-item line1">{{supplyList[0].detailedDescription}}</view>
<image :src="supplyList[0].resourceImgs[0]" mode="aspectFill"></image> <image :src="supplyList[0].resourceImgs[0]" mode="aspectFill"></image>
</view> </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="acea-row row-center-wrapper module-nub">
<view class="tips line1">{{supplyList[1].title}}</view> <view class="tips line1">{{supplyList[1].title}}</view>
<view class="tips-item line1">{{supplyList[1].detailedDescription}}</view> <view class="tips-item line1">{{supplyList[1].detailedDescription}}</view>
</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">{{supplyList[2].title || '广告位招租'}}</view>
<view class="tips-item">{{supplyList[2].detailedDescription}}</view> <view class="tips-item">{{supplyList[2].detailedDescription}}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="service-bottom acea-row row-between"> <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="module-box bg-red acea-row row-center-wrapper" v-if="index <= 2 ">
<view class="tips">{{item.cagetoryName}}</view> <view class="tips">{{item.cagetoryName}}</view>
<!-- <view class="tips-item">房屋装修</view> --> <!-- <view class="tips-item">房屋装修</view> -->
@ -152,8 +152,11 @@
}) })
}, },
toArticleDetail(id){ toArticleDetail(id){
uni.navigateTo({ this.$yrouter.push({
url:"/pages/life/articleDetail/index?id=" + id path: '/pages/life/articleDetail/index',
query: {
id: id
}
}) })
}, },
// //
@ -162,6 +165,19 @@
this.supplyList = res.data 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(){ getCagetoryList(){
listResourcesCagetory().then((res)=>{ listResourcesCagetory().then((res)=>{
@ -177,7 +193,7 @@
}, },
toCompanyDetail(id){ toCompanyDetail(id){
uni.navigateTo({ 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({ uni.navigateTo({
url:"/pages/demandHall/supplyHall/index" url:"/pages/demandHall/supplyHall/index"
}) })
}, },
// //
toEnterpriseServer(e){ toEnterpriseServer(id){
uni.navigateTo({ 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>
<view> <view>
<sSwiper :imgs="detail.resourceImgs"></sSwiper> <sSwiper :imgs="detail.resourceImgs"></sSwiper>
<vSwiper :imgs="detail.resourceImgs"></vSwiper> <!-- <vSwiper :imgs="detail.resourceImgs"></vSwiper> -->
</view> </view>
<view class="btn-box"> <view class="btn-box">
<view class="contact-btn" @tap="toResourcesContact">立即沟通</view> <view class="contact-btn" @tap="toResourcesContact">立即沟通</view>

4
pages/home/index.vue

@ -1,7 +1,7 @@
<template> <template>
<view class="productSort"> <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> bgcolor="#FFF"></skeleton>
<view class="pageTitle-box" :class="isFixed ? 'showPageTitle' : ''" <view class="pageTitle-box" :class="isFixed ? 'showPageTitle' : ''"
:style="{'padding-top':navTopHeight + 'px',height:navHeight*2+ 'px'}"> :style="{'padding-top':navTopHeight + 'px',height:navHeight*2+ 'px'}">
@ -224,7 +224,7 @@
onReady: function() { onReady: function() {
const that = this; const that = this;
// that.$refs.skeleton.attachedAction(); that.$refs.skeleton.attachedAction();
that.$refs.skeleton.readyAction(); that.$refs.skeleton.readyAction();
}, },

136
pages/information/index.vue

@ -6,50 +6,28 @@
<view class="search acea-row row-center-wrapper">搜一下</view> <view class="search acea-row row-center-wrapper">搜一下</view>
</view> </view>
<swiper class="vote-box"> <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> <image :src="item.imageInput" mode="aspectFill" class="vote-img"></image>
<view class="news"> <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 class="news-title-s line1">{{item.title}}</view>
</view> </view>
</swiper-item> </swiper-item>
</swiper> </swiper>
<scroll-view class="scroll-view_N" scroll-x="true"> <scroll-view class="scroll-view_N" scroll-x="true">
<view class="rotaion-box" @click="toTodayEvent"> <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/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="acea-row rotaion row-center"> <view class="acea-row rotaion row-center">
<image src="../../static/images/details2.png" mode="aspectFill"></image> <image :src="item.img" mode="aspectFill"></image>
<view class="rotaion-h">商业资讯</view> <view class="rotaion-h">{{item.name}}</view>
<view class="rotaion-s">商业资讯抢先知</view> <view class="rotaion-s">{{item.description}}</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>
</view> </view>
</view> </view>
</scroll-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> <image src="../../static/images/newInfo.png" mode="" class="newInfo-title-img"></image>
<view class="newInfo"> <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)"> @click="toDetail(item.id)">
<view class="acea-row title"> <view class="acea-row title">
<view class="modular-h line2">{{item.title}}</view> <view class="modular-h line2">{{item.title}}</view>
@ -69,11 +47,11 @@
<view class="hotspot-box"> <view class="hotspot-box">
<image src="../../static/images/user/hotspot.png" mode="" class="title-h-img"></image> <image src="../../static/images/user/hotspot.png" mode="" class="title-h-img"></image>
<scroll-view class="scroll-view_H acea-row" scroll-x="true"> <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> <image :src="item.imageInput" mode="aspectFill"></image>
<view class="hotspot-con"> <view class="hotspot-con">
<view class="hotspot-icon">热点</view> <view class="hotspot-icon">热点</view>
<view class="hotspot-title-h">{{item.title}}</view> <view class="hotspot-title-h line2">{{item.title}}</view>
</view> </view>
</view> </view>
</scroll-view> </scroll-view>
@ -81,14 +59,15 @@
<!-- 值得关注 --> <!-- 值得关注 -->
<view class="follow-box"> <view class="follow-box">
<image src="../../static/images/follow-title.png" mode="" class="title-h-img"></image> <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="follow-top acea-row row-between">
<view class="acea-row follow-title"> <view class="acea-row follow-title">
<view class="follow-h line2">{{item.title}}</view> <view class="follow-h line2">{{item.title}}</view>
<view class="follow-title-l acea-row row-between"> <view class="follow-title-l acea-row row-between">
<view>{{item.author}}</view> <view>{{item.author}}</view>
<view>{{item.createTime.split(' ')[0]}}</view> <view>{{item.createTime}}</view>
<view class="acea-row row-middle">203 <view class="acea-row row-middle">
<text>{{item.visit}}</text>
<image src="../../static/images/eye.png" mode="aspectFill"></image> <image src="../../static/images/eye.png" mode="aspectFill"></image>
</view> </view>
</view> </view>
@ -101,7 +80,7 @@
<view class="title-s">{{item.author}}</view> <view class="title-s">{{item.author}}</view>
<view class="title-con line1">{{item.title}}</view> <view class="title-con line1">{{item.title}}</view>
</view> </view>
<view class="follow-btn">关注+</view> <!-- <view class="follow-btn">关注+</view> -->
</view> </view>
</view> </view>
</view> </view>
@ -109,25 +88,40 @@
</template> </template>
<script> <script>
import { import { getArticle } from "@/api/home";
getArticle import { articleIndex } from "@/api/article"
} from "@/api/home";
export default { export default {
data() { data() {
return { return {
categoryList: [],
newList: [],
hotList: [],
concernList: [],
articleList: [], articleList: [],
page: 0, page: 0,
size: 10, size: 10,
} }
}, },
mounted() { mounted() {
this.getArticleList() // this.getArticleList()
this.getArticleIndex()
}, },
onReachBottom() { onReachBottom() {
this.page = this.page + 1 this.page = this.page + 1
this.getArticleList() this.getArticleList()
},
computed:{
}, },
methods: { 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() { getArticleList() {
getArticle({ getArticle({
page: this.page, page: this.page,
@ -145,31 +139,12 @@
} }
}) })
}, },
// toCategoryList(id){
toTodayEvent() { console.log('id',id)
uni.navigateTo({
url: '/pages/life/articleList/index?active=1'
});
},
//
toBusinessInfo() {
uni.navigateTo({
url: '/pages/life/articleList/index?active=2'
});
},
//
toGovernmentPolicy() {
uni.navigateTo({
url: '/pages/life/articleList/index?active=3'
});
},
//
toLifeInfo() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/life/articleList/index?active=4' url: '/pages/life/articleList/index?active=' + id
}); });
}, },
} }
} }
</script> </script>
@ -212,7 +187,6 @@
.vote-box { .vote-box {
width: 670rpx; width: 670rpx;
height: 358rpx; height: 358rpx;
/* background: #FFFFFF; */
box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16); box-shadow: 0px 6rpx 12rpx rgba(0, 0, 0, 0.16);
border-radius: 16rpx; border-radius: 16rpx;
margin: 0 auto; margin: 0 auto;
@ -227,26 +201,24 @@
} }
.news { .news {
width: 100%; width: 590rpx;
height: 358rpx; height: 94rpx;
border-radius: 16rpx 16rpx 0 0; background: rgba(0, 0, 0, 0.2);
color: #FFF; border-radius: 14rpx;
position: absolute; position: absolute;
padding: 0 40rpx; bottom: 6rpx;
left: 50%;
margin-left: -295rpx;
color: #fff;
padding: 14rpx;
} }
.news-title-h { .news-title-h {
width: 590rpx;
font-size: 28rpx; font-size: 28rpx;
position: absolute;
bottom: 65rpx;
} }
.news-title-s { .news-title-s {
width: 590rpx;
font-size: 20rpx; font-size: 20rpx;
position: absolute;
bottom: 25rpx;
} }
/* .vote { /* .vote {
@ -393,11 +365,14 @@
} }
.hotspot-con { .hotspot-con {
width: 588rpx; width: 670rpx;
height: 130rpx; height: 94rpx;
bottom: 34rpx; background: rgba(0, 0, 0, 0.2);
left: 24rpx; border-radius: 0px 0px 8rpx 8rpx;
padding: 8rpx 32rpx;
color: #fff;
position: absolute; position: absolute;
bottom: 0;
} }
.hotspot-icon { .hotspot-icon {
@ -406,6 +381,7 @@
background: #FE3737; background: #FE3737;
border-radius: 12rpx 2rpx 12rpx 0; border-radius: 12rpx 2rpx 12rpx 0;
position: absolute; position: absolute;
top:-46rpx;
font-size: 22rpx; font-size: 22rpx;
color: #fff; color: #fff;
text-align: center; text-align: center;
@ -414,12 +390,8 @@
.hotspot-title-h { .hotspot-title-h {
width: 588rpx; width: 588rpx;
height: 80rpx;
font-size: 28rpx; font-size: 28rpx;
color: #FFFFFF; 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 class="search-btn">搜一下</view>
</view> </view>
<view class="resource-tabs acea-row row-between-wrapper"> <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 == item.id ? 'tab-a' : '')" @tap="tabClick(item.id)" v-for="item in categortList" :key="item.id">{{item.name}}</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> </view>
</view> </view>
<view class="content-box"> <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" <view class="list-item acea-row row-between row-middle" v-for="(item,index) in articleList" :key="index"
@click="toDetail(item.id)"> @click="toDetail(item.id)">
<view class="item-l"> <view class="item-l">
@ -29,7 +26,7 @@
<view class="auth">{{item.author}}</view> <view class="auth">{{item.author}}</view>
<view class="auth time">{{item.createTime.split(' ')[0]}}</view> <view class="auth time">{{item.createTime.split(' ')[0]}}</view>
<view class="see acea-row row-middle"> <view class="see acea-row row-middle">
<text>200</text> <text>{{item.visit}}</text>
<image src="../../../static/images/eye.png"></image> <image src="../../../static/images/eye.png"></image>
</view> </view>
</view> </view>
@ -39,21 +36,13 @@
</view> </view>
</view> </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> </view>
<LoadStatus :loadStatus="loadStatus"></LoadStatus> <LoadStatus :loadStatus="loadStatus"></LoadStatus>
</view> </view>
</template> </template>
<script> <script>
import { articleCategory, getArticleList } from "@/api/article";
import { getArticle } from "@/api/home"; import { getArticle } from "@/api/home";
import LoadStatus from '@/components/LoadStatus.vue' import LoadStatus from '@/components/LoadStatus.vue'
export default{ export default{
@ -62,39 +51,52 @@
}, },
data(){ data(){
return{ return{
categortList: [],
articleList: [], articleList: [],
page: 0, page: 0,
size: 10, size: 10,
isLoading: true, isLoading: true,
active: null,
loadStatus: '没有更多了...' loadStatus: '没有更多了...'
} }
}, },
onLoad(option) { onLoad(option) {
this.active=option.active;
}, },
mounted() { mounted() {
this.getArticleList() this.getArticleCategort().then(()=>{
this.active= this.$yroute.query.active;
this.getArticleList()
})
}, },
onReachBottom() { onReachBottom() {
this.page = this.page + 1 this.page = this.page + 1
this.getArticleList() this.getArticleList()
}, },
methods: { methods: {
getArticleCategort(){
return new Promise((reslove)=>{
articleCategory().then((res)=>{
this.categortList = res.data
this.active = this.categortList[0].id
reslove()
})
})
},
getArticleList() { getArticleList() {
if (!this.isLoading) return if(!this.isLoading) return
uni.showLoading({ uni.showLoading({
title: '加载中...' title: '加载中...'
}) })
this.loadStatus = '加载中...' this.loadStatus = '加载中...'
getArticle({ getArticleList({
page: this.page, page: this.page,
size: this.size, size: this.size,
isHot: 0 cid: this.active
}).then((res) => { }).then((res) => {
if (res.data.content.length < this.size) { if(res.data.content.length < this.size){
this.loadStatus = '没有更多了...'
this.isLoading = false this.isLoading = false
} else { this.loadStatus = '没有更多了...'
} else{
this.isLoading = true this.isLoading = true
this.loadStatus = '上拉加载更多...' this.loadStatus = '上拉加载更多...'
} }
@ -110,10 +112,11 @@
} }
}) })
}, },
tabClick(e) { tabClick(id) {
this.setData({ this.active = id
active: e.currentTarget.dataset.i, this.isLoading = true
}) this.articleList = []
this.getArticleList()
}, },
} }
} }

Loading…
Cancel
Save