From b4e86325675725c34dc6c43ab8dd2b3533eb6887 Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期二, 25 七月 2023 10:45:50 +0800 Subject: [PATCH] no message --- uniapp/components/indexPage.vue | 436 +++++++++++++++++++++++++++++++++++++++++++---------- 1 files changed, 349 insertions(+), 87 deletions(-) diff --git a/uniapp/components/indexPage.vue b/uniapp/components/indexPage.vue index b34d14c..b508431 100644 --- a/uniapp/components/indexPage.vue +++ b/uniapp/components/indexPage.vue @@ -24,29 +24,13 @@ <view class="swiper-item defIcon" @click="goUrl(items)"> <image :src="items.image" mode="aspectFit"></image> </view> + + </swiper-item> </swiper> </view> - - <view class="centerSwiper-container colCenCen borderBox" v-if="singleLineList.length>0"> - <swiper class="swiper-box" :autoplay="true" :interval="5000" :duration="300" circular> - <swiper-item v-for="(items,index) in singleLineList" :key='index'> - <view class="swiper-item defIcon" @click="goUrl(items)"> - <image :src="items.image" mode="aspectFit"></image> - </view> - </swiper-item> - </swiper> - </view> - - <view class="cardsList-container rowCenBet borderBox" v-if="doubleLineList.length>0"> - <block v-for="(items,index) in doubleLineList" :key='index'> - <view class="card-items defIcon" @click="goUrl(items)"> - <image :src="items.image" mode="aspectFill" lazy-load="true"></image> - </view> - </block> - </view> - - + + <!-- 閲戝垰鍖� --> <view class="navslider-box" v-if="navbarShowList.length > 0"> <swiper class="swiper-type swiper-nav" @@ -63,11 +47,58 @@ </swiper-item> </swiper> </view> + + <!--鍗曞垪鍥剧墖--> + <!-- <view class="centerSwiper-container colCenCen borderBox" v-if="singleLineList.length>0"> + <swiper class="swiper-box" :autoplay="true" :interval="5000" :duration="300" circular> + <swiper-item v-for="(items,index) in singleLineList" :key='index'> + <view class="swiper-item defIcon" @click="goUrl(items)"> + <image :src="items.image" mode="aspectFit"></image> + </view> + </swiper-item> + </swiper> + </view> --> + <!--蹇嵎鍏ュ彛鍥炬爣--> + <view class="c-loading-img rowCenCen"> + <view class="imgbox defIcon" v-for="(eitem,index) in fastenter" :key="index" @click="goUrl(eitem)"> + <image :src="eitem.image"></image> + </view> + </view> + <!--宸﹁疆鎾紝鍙充袱琛�--> + <view class="centerflex f_contant"> + <view class="f_centerSwiper-container swiper-box swiper-item f_left"> + <swiper class="swiper-box" :autoplay="true" :interval="3000" :duration="300" :indicator-active-color="'#fff'" :indicator-dots="true" circular> + <swiper-item v-for="(items,index) in popBannerSList" :key='index'> + <view class="swiper-item defIcon" @click="goUrl(items)"> + <image :src="items.image" mode="aspectFit"></image> + </view> + </swiper-item> + </swiper> + </view> + <view class="f_right"> + <view class="f_imgcon" v-if='enterTop.length>0' > + <image :src="enterTop[0].image" @click="goUrl(enterTop[0])"></image> + </view> + <view class="f_imgcon" v-if='enterDown.length>0'> + <image :src="enterDown[0].image" @click="goUrl(enterDown[0])"></image> + </view> + </view> + </view> + + <!--鍙屽垪鍥剧墖--> + <view class="cardsList-container rowCenBet borderBox" v-if="doubleLineList.length>0"> + <block v-for="(items,index) in doubleLineList" :key='index'> + <view class="card-items defIcon" @click="goUrl(items)"> + <image :src="items.image" mode="aspectFill" lazy-load="true"></image> + </view> + </block> + </view> + </view> </view> - + <view class="pagebottomBody-container colCen borderBox"> - + <view class="bottomSwiper-container colCenCen borderBox" v-if="bottomBannerList.length>0"> <swiper class="swiper-box" :autoplay="true" :interval="3000" :duration="300" circular> <swiper-item v-for="(items,index) in bottomBannerList" :key='index'> @@ -77,8 +108,8 @@ </swiper-item> </swiper> </view> - - <view class="van-row"> + <!--鍏ㄧ綉鐑攢--> + <!-- <view class="van-row"> <view class="van-col van-col--12" style="padding-right: 10rpx;"> <view class="home-row" @click="gorxb()"> <view class="title"><text class="name">鍏ㄧ綉鐑攢姒�</text> @@ -126,9 +157,9 @@ </view> </view> </view> - </view> + </view> --> <!-- 澶у閮藉湪涔� --> - <view class="everysBuying-container colCen" v-if="zdmList.length>0"> + <!-- <view class="everysBuying-container colCen" v-if="zdmList.length>0"> <view class="box-bar-content rowCen"> <view class="title-text"> 姣忔棩蹇呬拱 @@ -183,11 +214,9 @@ </scroll-view> </view> - <!-- <view class="progress"> - 鍚庨潰澶勭悊 + </view> --> - </view> - <view class="goodsFalling-container colCen" v-if="fallingList.length>0"> + <!-- <view class="goodsFalling-container colCen" v-if="fallingList.length>0"> <view class="box-bar-content rowCen"> <view class="title-text"> 濂借揣鐩撮檷 @@ -253,10 +282,10 @@ </view> </scroll-view> </view> - </view> + </view> --> <!-- 绂忓埄鎶㈣喘 --> - <view class="welfare-container colCen"> + <!-- <view class="welfare-container colCen"> <view class="titlebar-container rowCenBet"> <view class="left-content rowCen"> <view class="titletext"> @@ -330,7 +359,7 @@ </view> </block> </view> - </view> + </view> --> <!-- 瀹炴椂鐤姠姒� --> @@ -363,6 +392,7 @@ v-if="bottomGoodsList.length>0"> <block v-for="(items,index) in bottomGoodsList" :key="index"> <view class="goods-items" @click="goDetails(items)"> + <!-- <colGoodsImg v-if="index==0&&itembannerList&&itembannerList.length>0" :popBannerSList="itembannerList"></colGoodsImg> --> <colGoods :items="items"></colGoods> </view> </block> @@ -382,6 +412,7 @@ import slideTop from './slideTop.vue' import colGoods from './colGoods.vue' import empowerModel from './empowerModel.vue' + import colGoodsImg from '@/components/colGoodsImg.vue' export default { props: { recomendType: { @@ -403,10 +434,12 @@ components: { slideTop, colGoods, - empowerModel + empowerModel, + colGoodsImg }, data() { return { + popBannerSList:[], fallingList: [], pageHeight: '', headerColor: '', @@ -417,21 +450,22 @@ navbarShowList: [], navbarList: [], sliderH: '', - scrollTop: 0, scrollindex: 0, - - zdmList: [], phbList: [], dyList: [], rqList: [], - typedataList: [ { mainTitle: '浜笢', subTitle: '瀹樻柟淇濋殰', type: 2 + }, + { + mainTitle: '鎶栭煶', + subTitle: '濂界墿鎶㈣喘', + type: 6 }, { mainTitle: '鎷煎澶�', @@ -460,9 +494,21 @@ triggeredstate: true, swpidx: 0, canrefresh: true, + fastenter:[], + itembannerList:[], + enterTop:[], + enterDown:[], + tbbanner:[], + jdbanner:[], + dybanner:[], + pddbanner:[], + wphbanner:[], + haspreference:false, + preferData:{}, } }, watch: { + recomendType(nval, oval){ if(nval != oval)this.changeRecommend() }, @@ -486,14 +532,16 @@ }, created() { this._freshing = false; - this.changeRecommend(); + //this.changeRecommend(); + this.checkPreferenceGoods(); uni.$emit('initpage') this.getBannerInfo(); this.getHomeMenuList(); this.getrecommendGoods(); - this.getbottomGoodsList(this.bottomType); + //this.getbottomGoodsList(this.bottomType); this.getGOODSfalling(); this.getRQList(); + //this.getPageImg(); }, mounted() { this.$emit('scrolltoTop') @@ -503,19 +551,69 @@ }, 1500) }, methods: { - changeRecommend(){ + checkPreferenceGoods() + {//鏄惁鏈夋帹鑽� + var that = this; var tmp_1 = { - mainTitle: '鐑帹', - subTitle: '鐑帹鍟嗗搧', + mainTitle: '澶╃尗', + subTitle: '澶╃尗鐑攢', type: 5 }; var tmp_2 = { + mainTitle: '澶╃尗', + subTitle: '涓轰綘鎺ㄨ崘', + type: 1 + }; + var tmp_3= { mainTitle: '鎺ㄨ崘', + subTitle: '鐚滀綘鍠滄', + type: 7 + }; + var open_like_recommend = uni.getStorageSync('open_like_recommend'); + if(this.typedataList.length == 5)this.typedataList.shift() + if(open_like_recommend == 1){ + this.typedataList.unshift(tmp_2); + this.bottomType = tmp_2.type; + }else{ + this.typedataList.unshift(tmp_1); + this.bottomType = tmp_1.type; + } + this.$u.api.checkPreferenceGoods({ + }).then(e => { + console.log(e); + if(e.code != 0) + { + that.currentPage = 1; + that.getbottomGoodsList(that.bottomType); + return; + }; + if(e.data&&e.data.p_cids) + {//鏈夊亸濂� + that.preferData=e.data; + that.typedataList.unshift(tmp_3); + that.bottomType = tmp_3.type; + //鍘婚櫎鍞搧浼� + that.typedataList = that.typedataList.filter(function(item) {return item.type !== 4}); + } + that.currentPage = 1; + that.getbottomGoodsList(that.bottomType); + }).catch(function (err) { + this.changeRecommend(); + }) + }, + changeRecommend(){ + var tmp_1 = { + mainTitle: '澶╃尗', + subTitle: '澶╃尗鐑攢', + type: 5 + }; + var tmp_2 = { + mainTitle: '澶╃尗', subTitle: '涓轰綘鎺ㄨ崘', type: 1 }; var open_like_recommend = uni.getStorageSync('open_like_recommend'); - if(this.typedataList.length == 4)this.typedataList.shift() + if(this.typedataList.length == 5)this.typedataList.shift() if(open_like_recommend == 1){ this.typedataList.unshift(tmp_2); this.bottomType = tmp_2.type; @@ -560,7 +658,6 @@ }, onRestore() { this.swpidx = 0 - console.log('涓嬫媺琚粓姝�'); }, pagescroll(e) { this.$emit('scrollNum', e.detail.scrollTop) @@ -584,26 +681,34 @@ onAbort() { console.log('refushstop'); }, - + getBannerInfo() { // banner鏁版嵁 var that = this; this.$u.api.getBanner({ - type: '1,3,4,5' + type: '1,3,4,5,11,12,13,14' }).then(e => { if (e.code == 1) return that.$alert(e.msg); var res = e.data.info; - this.topBannerList = res.topBannerList; - this.headerColor = this.topBannerList[0].colour; + if(res.topBannerList&&res.topBannerList.length>0) + { + this.topBannerList = res.topBannerList; + this.headerColor = this.topBannerList[0].colour; + } + this.singleLineList = res.singleLineList; this.doubleLineList = res.doubleLineList; this.bottomBannerList = res.bottomBannerList; + this.fastenter=res.indexbanner; + this.popBannerSList=res.popBannerSList; + this.enterTop=res.enterTop; + this.enterDown=res.enterDown; setTimeout(() => { this.triggeredstate = false; this._freshing = false; }, 300) }).catch(function(err) { - + console.log(err) }) }, @@ -613,7 +718,6 @@ }) }, - godydetails(itm) { const info = {} info.nowInfo = itm @@ -646,42 +750,81 @@ that.dyList = e.data.dygoods; }).catch(function(err) {}) }, - + getPageImg() + { + var that=this; + this.$u.api.getBanner({ + type: '11,16,17,18,19,20' + }).then(e => { + if (e.code == 1) return that.$alert(e.msg); + var res = e.data.info; + that.tbbanner=res.tmImg; + that.jdbanner=res.jdImg; + that.dybanner=res.dyImg; + that.pddbanner=res.pddImg; + that.wphbanner=res.wphImg; + that.changeBanner(that.bottomCurrent); + }).catch(function(err) { + console.log(err) + }) + }, + changeBanner(type) + { + switch(type) + { + case 2://浜笢 + this.itembannerList=this.jdbanner; + break; + case 6://鎶栭煶 + this.itembannerList=this.dybanner; + break; + case 3://鎷煎澶� + this.itembannerList=this.pddbanner; + break; + case 4://鍞搧浼� + this.itembannerList=this.wphbanner; + break; + default: + this.itembannerList=[]; + break; + } + if(this.itembannerList&&this.itembannerList>0) + { + that.bottomGoodsList.unshift(this.itembannerList[0]); + } + }, getbottomGoodsList(type) { var that = this; - this.$u.api.getGoodThing({ - deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < 10 ? - 'IMEI' : 'OAID') : 'IDFA', - deviceValue: getApp().globalData.equipmentNumber, - pageId: 1, - pageSize: 10, - type: type - }).then(e => { - if (e.code != 0) return that.$alert(e.msg) - var res = e.data.list; - if (res.length < 10) { - that.loadingState = false - that.loadstatus = 'normal' - } else { - that.currentPage++ - that.loadstatus = 'loading' - that.loadingState = true - } - that.bottomGoodsList = res - }).catch(function(err) {}) - }, - - getNextPage() { - if (this.loadingState) { - this.loadingState = false - var that = this; + if(type==7&&that.preferData) + {//鐚滀綘鍠滄 + this.$u.api.gussessLikeGoods({ + platefrom:that.preferData.p_platefrom, + cids:that.preferData.p_cids, + pageId:1, + pageSize:10 + }).then(e=>{ + console.log(e); + var res = e.data.list; + if (res.length < 10) { + that.loadingState = false + that.loadstatus = 'normal' + } else { + that.currentPage++ + that.loadstatus = 'loading' + that.loadingState = true + } + that.bottomGoodsList = res + }) + } + else + { this.$u.api.getGoodThing({ - deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < - 10 ? 'IMEI' : 'OAID') : 'IDFA', + deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < 10 ? + 'IMEI' : 'OAID') : 'IDFA', deviceValue: getApp().globalData.equipmentNumber, - pageId: this.currentPage, + pageId: 1, pageSize: 10, - type: this.bottomType + type: type }).then(e => { if (e.code != 0) return that.$alert(e.msg) var res = e.data.list; @@ -693,8 +836,60 @@ that.loadstatus = 'loading' that.loadingState = true } - that.bottomGoodsList = that.bottomGoodsList.concat(res) + that.bottomGoodsList = res }).catch(function(err) {}) + } + }, + + getNextPage() { + if (this.loadingState) { + this.loadingState = false + var that = this; + + if(that.bottomType==7&&that.preferData) + {//鐚滀綘鍠滄 + this.$u.api.gussessLikeGoods({ + platefrom:that.preferData.p_platefrom, + cids:that.preferData.p_cids, + pageId:this.currentPage, + pageSize:10 + }).then(e=>{ + console.log(e); + if (e.code != 0) return that.$alert(e.msg) + var res = e.data.list; + if (res.length < 10) { + that.loadingState = false + that.loadstatus = 'normal' + } else { + that.currentPage++ + that.loadstatus = 'loading' + that.loadingState = true + } + that.bottomGoodsList = that.bottomGoodsList.concat(res); + }) + } + else{ + this.$u.api.getGoodThing({ + deviceType: getApp().globalData.platform == 'android' ? (getApp().globalData.systemLevel < + 10 ? 'IMEI' : 'OAID') : 'IDFA', + deviceValue: getApp().globalData.equipmentNumber, + pageId: this.currentPage, + pageSize: 10, + type: this.bottomType + }).then(e => { + if (e.code != 0) return that.$alert(e.msg) + var res = e.data.list; + if (res.length < 10) { + that.loadingState = false + that.loadstatus = 'normal' + } else { + that.currentPage++ + that.loadstatus = 'loading' + that.loadingState = true + } + that.bottomGoodsList = that.bottomGoodsList.concat(res) + }).catch(function(err) {}) + } } }, @@ -702,6 +897,7 @@ if (this.bottomCurrent != idx) { this.currentPage = 1; this.bottomType = info.type; + this.changeBanner(info.type); this.getbottomGoodsList(this.bottomType); this.$nextTick(() => { this.$emit('scrolltoview') @@ -726,10 +922,14 @@ }, goUrl(info) { - console.log(info) utils.goUrl(info, this) }, - + goFUrl(info) + { + uni.navigateTo({ + url: info.url + }); + }, gojgqUrl(info) { if (info.urlType == '0') { uni.navigateTo({ @@ -797,6 +997,68 @@ </script> <style lang="scss"> + .f_contant + { + display: flex; + justify-content: space-between; + width: 96%; + height: 500rpx; + flex-direction: row; + padding: 20rpx 0; + margin: auto; + .f_left{ + width:49%; + border-radius: 12rpx; + background: #fff; + } + .f_right{ + width:49%; + display: flex; + flex-direction: column; + justify-content: space-between; + } + .f_imgcon + { + height: 49%; + border-radius: 12rpx; + image + { + width:100%; + border-radius: 12rpx; + height: 100%; + } + } + .f_centerSwiper-container { + + + .swiper-box { + width: 100%; + height: 100%; + + .swiper-item { + width: 100%; + height: 100%; + } + } + } + } + + .c-loading-img { + width: 96%; + height: 132rpx; + background: #fff; + margin: auto; + margin-top: 20rpx; + border-radius: 12rpx; + justify-content:space-between; + padding:5rpx; + + .imgbox { + width: 158rpx; + height: 105rpx; + // max-height: 72rpx; + } + } .juan { height: 28rpx; background: linear-gradient(90deg, #ff8873 0, #ff4f4f 100%); @@ -861,7 +1123,7 @@ .pageBody-container { width: 100%; //background-color: #FFFFFF; - margin-bottom: 16rpx; + //margin-bottom: 16rpx; .column-container { width: 100%; @@ -869,7 +1131,7 @@ .bannerSwiper-container { width: 100%; - height: 280rpx; + height: 230rpx; padding: 0 16rpx; margin-bottom: 16rpx; -- Gitblit v1.9.3