Commit 332402f4 authored by 张伯涛's avatar 张伯涛

bug修改

parent ef674b0f
......@@ -6,6 +6,7 @@
<view class="cardtitle" @click="toDetail(item.businessId)">
<view class="cardtitle1">{{item.title}}</view>
<view class="cardtitle2">{{item.details.replace(/<[^>]*>/g, '')}}</view>
<view class="cardtitle2">推广量:{{item.readNum || '-'}}</view>
<!-- <view class="cardtitle3">{{formatPrice(item.price)}}</view>-->
</view>
</view>
......@@ -14,7 +15,7 @@
<view v-else style="margin-top: 200rpx;">
<u-empty
mode="data"
>
</u-empty>
</view>
......@@ -25,6 +26,9 @@
export default {
data() {
return {
unitList: [],
unitId: '',
userId: '',
hotList: [],
page: 1,
rows: 10,
......@@ -51,8 +55,15 @@
init(){
this.articleStatus = this.page*this.rows >= this.total ?
'nomore' : 'loadmore'
const unitList = this.vuex_unit
this.$u.get('cmsnews/miniProgram/listByClassification?page='+this.page+'&rows='+this.rows+'&unitId='+unitList[0].businessId).then(res => {
this.unitList = this.vuex_unit
if(this.unitList && this.unitList.length >0) {
this.unitId = this.unitList[0].businessId
this.userId = this.unitList[0].userId
}else {
this.unitId = ''
this.userId = ''
}
this.$u.get('cmsnews/miniProgram/listByClassification?page='+this.page+'&rows='+this.rows+'&unitId='+this.unitId+'&userId='+this.userId +'&source=2').then(res => {
if (this.page === 1) {
let list = res.records;
this.hotList = list;
......@@ -77,7 +88,7 @@
console.log("触底加载");
// 加判断: 页码数 * 每一页获取数据的条数 >= 总条数,如果符合条件说明数据已经全部加载完毕
let that = this
if (that.page*that.rows >= that.total) {
that.articleStatus = "nomore"
return
......@@ -88,7 +99,7 @@
}
}
}
</script>
<style>
......@@ -139,4 +150,4 @@
display: -webkit-box;
-webkit-box-orient: vertical;
}
</style>
\ No newline at end of file
</style>
......@@ -5,6 +5,7 @@
<image class="cardimage" :src="item.path" @click="toDetail(item.businessId)"></image>
<view class="cardtitle" @click="toDetail(item.businessId)">
<view class="cardtitle1">{{item.videoTitle}}</view>
<view class="cardtitle1">推广量:{{item.readNum || '-'}}</view>
<!-- <view class="cardtitle2">{{item.details.replace(/<[^>]*>/g, '')}}</view> -->
<!-- <view class="cardtitle3">{{formatPrice(item.price)}}</view>-->
</view>
......@@ -14,11 +15,11 @@
<view v-else style="margin-top: 200rpx;">
<u-empty
mode="data"
>
</u-empty>
</view>
</view>
</template>
......@@ -32,7 +33,7 @@
total: 0,
status: "loadmore"
}
},
onLoad() {
this.noToken()
......@@ -58,8 +59,15 @@
init(){
this.status = this.page*this.rows >= this.total ?
'nomore' : 'loadmore'
const unitList = this.vuex_unit
this.$u.get('cmsvideo/miniProgram/listByClassification?page=1&rows=10&unitId='+unitList[0].businessId).then(res => {
this.unitList = this.vuex_unit
if(this.unitList && this.unitList.length >0) {
this.unitId = this.unitList[0].businessId
this.userId = this.unitList[0].userId
}else {
this.unitId = ''
this.userId = ''
}
this.$u.get('cmsvideo/miniProgram/listByClassification?page=1&rows=10&unitId='+this.unitId+'&userId='+this.userId).then(res => {
if (this.page === 1) {
let list = res.records;
this.hotList = list;
......@@ -68,7 +76,7 @@
let list1 = res.records;
this.hotList = [...this.hotList, ...list1]
}
})
},
toDetail(id){
......@@ -85,7 +93,7 @@
console.log("触底加载");
// 加判断: 页码数 * 每一页获取数据的条数 >= 总条数,如果符合条件说明数据已经全部加载完毕
let that = this
if (that.page*that.rows >= that.total) {
that.status = "nomore"
return
......@@ -95,9 +103,9 @@
that.init()
}
}
}
</script>
<style>
......@@ -148,4 +156,4 @@
display: -webkit-box;
-webkit-box-orient: vertical;
}
</style>
\ No newline at end of file
</style>
......@@ -2,18 +2,26 @@
<view class="top">
<!-- <u-tabs :list="navList" :is-scroll="false" :current="activeNav" @change="changeNav"></u-tabs> -->
<u-row gutter="16">
<u-col style="padding:0px;" v-for="(topic,index) in topicList" :key="index" :span="(index+3)%3===0?12:6">
<view class="topimage">
<!-- <u-image width="100%" height="274rpx" :src="topic.img" @click="toTopic(topic.id)"></u-image> -->
<image :src="topic.url" class="imagedeatil"></image>
</view>
</u-col>
<!-- <u-col style="padding:0px;" v-for="(topic,index) in topicList" :key="index" :span="(index+3)%3===0?12:6">-->
<!-- <view class="topimage">-->
<!-- &lt;!&ndash; <u-image width="100%" height="274rpx" :src="topic.img" @click="toTopic(topic.id)"></u-image> &ndash;&gt;-->
<!-- <image :src="topic.url" class="imagedeatil"></image>-->
<!-- </view>-->
<!-- </u-col>-->
<u-col>
<u-swiper
:list="topicList"
indicator
indicatorMode="line"
circular
></u-swiper>
</u-col>
</u-row>
<view style="padding-bottom: 30rpx;">
<view class="gl-title">
<view style="height: 35px;display: flex;align-items: center;">
<image src="../../static/img/image/home_icon_remen@2x.png" class="smallicon"></image>
<span>热门推荐</span>
<span>推荐</span>
</view>
<view style="width: 40%;">
<u-subsection :list="list" :current="curNow" @change="sectionChange"></u-subsection>
......@@ -25,6 +33,7 @@
<view class="cardtitle" @click="toDetail(item.businessId)">
<view class="cardtitle1">{{item.title}}</view>
<view class="cardtitle2">{{item.details.replace(/<[^>]*>/g, '')}}</view>
<view class="cardtitle2">总推广量:{{item.readNum || '-'}}</view>
<!-- <view class="cardtitle3">{{formatPrice(item.price)}}</view>-->
</view>
</view>
......@@ -40,9 +49,10 @@
</view>
<view v-else-if="curNow === 1 && newList.length > 0">
<view v-for="(item,index) in newList" :key="index" class="indexcard">
<image class="cardimage" :src="item.path" @click="toDetail(item.businessId)"></image>
<image class="cardimage" :src="item.defaultUrl" @click="toDetail(item.businessId)"></image>
<view class="cardtitle" @click="toDetail(item.businessId)">
<view class="cardtitle1">{{item.videoTitle}}</view>
<view class="cardtitle1">总推广量:{{item.readNum || '-'}}</view>
<!-- <view class="cardtitle2">{{item.details.replace(/<[^>]*>/g, '')}}</view> -->
<!-- <view class="cardtitle3">{{formatPrice(item.price)}}</view>-->
</view>
......@@ -81,16 +91,24 @@
<script>
import pic1 from '../../static/image/pic1.png'
import pic2 from '../../static/image/pic2.png'
import UCol from "../../uview-ui/components/u-col/u-col.vue";
import USwiper from "../../uview-ui/components/u-swiper/u-swiper.vue";
export default {
components: {USwiper, UCol},
data() {
return {
unitId: '',
pic1,
pic2,
navList: [],
activeNav: 0,
newList: [],
hotList: [],
topicList: [],
topicList: [
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
// 'https://cdn.uviewui.com/uview/swiper/swiper3.png',
],
list: ['文章','视频'],
curNow: 0,
infoShow: 0,
......@@ -105,6 +123,11 @@ import pic2 from '../../static/image/pic2.png'
}
},
onLoad() {
if(this.vuex_unit && this.vuex_unit.length > 0) {
this.unitId = this.vuex_unit[0].businessId
}else {
this.unitId = ''
}
this.init()
},
onShow(){
......@@ -139,7 +162,7 @@ import pic2 from '../../static/image/pic2.png'
'nomore' : 'loadmore'
const baseApi = this.baseApi;
this.$u.get('/cmsnews/miniProgram/listByTop?page='+this.articlePage+ '&rows='+this.articleRows).then(res => {
this.$u.get('/cmsnews/miniProgram/listByTop?page='+this.articlePage+ '&rows='+this.articleRows+ '&source=1'+ '&unitId='+this.unitId).then(res => {
if (this.articlePage === 1) {
let list = res.records;
this.hotList = list;
......@@ -156,7 +179,7 @@ import pic2 from '../../static/image/pic2.png'
queryVideo() {
this.videoStatus = this.videoPage*this.videoRows >= this.videoTotal ?
'nomore' : 'loadmore'
this.$u.get('/cmsnews/miniProgram/listByTopVideo?page='+this.videoPage+ '&rows='+this.videoRows).then(res => {
this.$u.get('/cmsnews/miniProgram/listByTopVideo?page='+this.videoPage+ '&rows='+this.videoRows+ '&unitId='+this.unitId).then(res => {
if (this.videoPage === 1) {
let list = res.records;
this.newList = list;
......@@ -176,7 +199,11 @@ import pic2 from '../../static/image/pic2.png'
// const item = list[index];
// item.img = baseApi + '/file/getImgStream?idFile=' + item.article.img;
// }
this.topicList = list.records;
if(list.records && list.records.length > 0) {
this.topicList = list.records.map(item => item.url)
} else {
this.topicList = []
}
})
},
toDetail(id) {
......
......@@ -8,6 +8,7 @@
<view class="cardtitle" @click="toDetail(item.businessId)">
<view class="cardtitle1">{{item.title}}</view>
<view class="cardtitle2">{{item.details.replace(/<[^>]*>/g, '')}}</view>
<view class="cardtitle2">推广量:{{item.readNum || '-'}}</view>
<!-- <view class="cardtitle3">{{formatPrice(item.price)}}</view>-->
</view>
</view>
......@@ -16,16 +17,17 @@
<view v-else-if="curNow === 0 && hotList.length<=0" style="margin-top: 200rpx;">
<u-empty
mode="data"
>
</u-empty>
</view>
<view v-else-if="curNow===1 && videoList.length>0">
<view v-for="(item,index) in videoList" :key="index" class="indexcard">
<image class="cardimage" :src="item.path" @click="toDetail(item.businessId)"></image>
<view class="cardtitle" @click="toDetail(item.businessId)">
<view class="cardtitle1">{{item.videoTitle}}</view>
<view class="cardtitle1">推广量:{{item.readNum || '-'}}</view>
<!-- <view class="cardtitle2">{{item.details.replace(/<[^>]*>/g, '')}}</view> -->
<!-- <view class="cardtitle3">{{formatPrice(item.price)}}</view>-->
</view>
......@@ -35,20 +37,23 @@
<view v-else-if="curNow === 1 && videoList.length<=0" style="margin-top: 200rpx;">
<u-empty
mode="data"
>
</u-empty>
</view>
</view>
</view>
</template>
<script>
export default {
data() {
return {
unitList: [],
unitId: '',
userId: '',
list: ['文章', '视频'],
curNow: 0,
hotList: [],
......@@ -86,8 +91,15 @@
init() {
this.articleStatus = this.articlePage*this.articleRows >= this.articleTotal ?
'nomore' : 'loadmore'
const unitList = this.vuex_unit
this.$u.get('cmsnews/miniProgram/listByClassification?page='+this.articlePage+'&rows='+this.articleRows+'&unitId='+unitList[0].businessId).then(res => {
this.unitList = this.vuex_unit
if(this.unitList && this.unitList.length >0) {
this.unitId = this.unitList[0].businessId
this.userId = this.unitList[0].userId
}else {
this.unitId = ''
this.userId = ''
}
this.$u.get('cmsnews/miniProgram/listByClassification?page='+this.articlePage+'&rows='+this.articleRows+'&unitId='+this.unitId+'&userId='+this.userId +'&source=2').then(res => {
if (this.articlePage === 1) {
let list = res.records;
this.hotList = list;
......@@ -102,7 +114,7 @@
this.videoStatus = this.videoPage*this.videoRows >= this.videoTotal ?
'nomore' : 'loadmore'
const unitList = this.vuex_unit
this.$u.get('cmsvideo/miniProgram/listByClassification?page='+this.videoPage+'&rows='+this.videoRows+'&unitId='+unitList[0].businessId).then(res => {
this.$u.get('cmsvideo/miniProgram/listByClassification?page='+this.videoPage+'&rows='+this.videoRows+'&unitId='+this.unitId+'&userId='+this.userId).then(res => {
if (this.videoPage === 1) {
let list = res.records;
this.videoList = list;
......@@ -111,7 +123,7 @@
let list1 = res.records;
this.videoList = [...this.videoList, ...list1]
}
})
},
toDetail(id){
......@@ -130,9 +142,9 @@
}
})
}
}
},
// 触底事件 - 上拉加载
onReachBottom() {
......@@ -159,8 +171,8 @@
that.queryVideo()
}
}
}
}
</script>
......@@ -223,4 +235,4 @@
font-weight: 500;
color: #D94343;
}
</style>
\ No newline at end of file
</style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment