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

bug修改

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