From 8a55298d7e388113c05bd70a549f17a6e7aacee8 Mon Sep 17 00:00:00 2001 From: zhaojs <349234519@qq.com> Date: 星期一, 26 六月 2023 10:51:37 +0800 Subject: [PATCH] 返利页添加轮播图 --- uniapp/pages/active/pddsearch.vue | 39 ++++++- uniapp/pages/active/dysearch.vue | 38 ++++++- uniapp/pages/active/jdSearch.vue | 38 ++++++- uniapp/App.vue | 2 uniapp/components/colGoods.vue | 2 uniapp/components/indexPage.vue | 2 uniapp/pages/active/vipsearch.vue | 48 +++++++-- uniapp/utils/utils.js | 1 uniapp/components/colGoodsImg.vue | 34 ++++-- uniapp/pages/active/tmsearch.vue | 36 +++--- uniapp/pages/index/index.vue | 2 uniapp/pages/rankinglist/common_act.vue | 1 12 files changed, 175 insertions(+), 68 deletions(-) diff --git a/uniapp/App.vue b/uniapp/App.vue index f276460..0838844 100644 --- a/uniapp/App.vue +++ b/uniapp/App.vue @@ -175,7 +175,6 @@ var route = routes[routes.length - 1].route } // #ifdef APP-PLUS - console.log(this.globalData.canlisten) if (this.globalData.canlisten && route != 'pages/mine/tools/turnChain') { getClipboard() } @@ -210,7 +209,6 @@ var that = this; that.globalData.hasinit=true; this.$u.api.comminInt({}).then(e => { - console.log(e) if (e.code != 0) { that.globalData.hasinit=false; diff --git a/uniapp/components/colGoods.vue b/uniapp/components/colGoods.vue index 238232d..75dcaac 100644 --- a/uniapp/components/colGoods.vue +++ b/uniapp/components/colGoods.vue @@ -55,6 +55,8 @@ props: { items: Object }, + created(){ + }, data() { return { diff --git a/uniapp/components/colGoodsImg.vue b/uniapp/components/colGoodsImg.vue index cd06d93..185742f 100644 --- a/uniapp/components/colGoodsImg.vue +++ b/uniapp/components/colGoodsImg.vue @@ -1,16 +1,18 @@ <template> - <view class="items-container borderBox colCen"> - <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> + <swiper style="height: 100%;" 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" style="width: 100%;height: 100%;" @click="goUrl(items)"> + <image :src="items.image" mode="aspectFit"></image> + </view> + </swiper-item> + </swiper> + <!-- <view class="swiper-container swiper-box swiper-item"> + + </view> --> </template> <script> + import utils from '@/utils/utils.js' export default { props: { popBannerSList: Array @@ -23,14 +25,20 @@ created() { console.log(this.popBannerSList); + }, + methods: + { + goUrl(info) + { + console.log(info); + utils.goUrl(info, this) + } } } </script> <style> - .items-container { - width: 346rpx; - height: 100%; + .swiper-box { width: 100%; height: 100%; @@ -40,5 +48,5 @@ height: 100%; } } - } + </style> \ No newline at end of file diff --git a/uniapp/components/indexPage.vue b/uniapp/components/indexPage.vue index a29517e..02c7e68 100644 --- a/uniapp/components/indexPage.vue +++ b/uniapp/components/indexPage.vue @@ -626,7 +626,6 @@ this.$u.api.getBanner({ type: '1,3,4,5,11,12,13,14' }).then(e => { - console.log(e) if (e.code == 1) return that.$alert(e.msg); var res = e.data.info; if(res.topBannerList&&res.topBannerList.length>0) @@ -700,7 +699,6 @@ pageSize: 10, type: type }).then(e => { - console.log(e) if (e.code != 0) return that.$alert(e.msg) var res = e.data.list; if (res.length < 10) { diff --git a/uniapp/pages/active/dysearch.vue b/uniapp/pages/active/dysearch.vue index c8195f5..f924ddf 100644 --- a/uniapp/pages/active/dysearch.vue +++ b/uniapp/pages/active/dysearch.vue @@ -65,7 +65,8 @@ <view class="goodsList-container colCen borderBox"> <view class="goods-content rowStaBet"> <view class="goods-items borderBox colCen" v-for="(items,index) in goodsList" :key='index' @click="goDetail(items)"> - <colGoods :items="items"></colGoods> + <colGoodsImg v-if="index==0&&popBannerSList&&popBannerSList.length>0" :popBannerSList="popBannerSList"></colGoodsImg> + <colGoods v-else :items="items"></colGoods> </view> <aLoadMore :status="loadstatus" mode="loading3" :showTitle='true' color="#999999"></aLoadMore> </view> @@ -76,12 +77,15 @@ <script> import colGoods from '../../components/colGoods.vue' + import colGoodsImg from '../../components/colGoodsImg.vue' export default { components:{ - colGoods + colGoods, + colGoodsImg }, data() { return { + popBannerSList:[], pageTop: 0, nowCurrent: 0, scrollTop: 0, @@ -96,7 +100,8 @@ } }, onLoad() { - this.getNav() + this.getNav(); + this.getPageImg(); }, onPageScroll(e) { this.scrollTop = e.scrollTop @@ -117,6 +122,24 @@ }).exec(); }, methods: { + getPageImg() + { + var that=this; + this.$u.api.getBanner({ + type: '11,18' + }).then(e => { + console.log(e) + if (e.code == 1) return that.$alert(e.msg); + var res = e.data.info; + this.popBannerSList=res.dyImg; + if(res.dyImg&&res.dyImg.length>0) + { + that.goodsList.unshift(res[0]); + } + }).catch(function(err) { + console.log(err) + }) + }, getNav() { var that = this; this.$u.api.getHdkCategoryList({type:4}).then(e => { @@ -193,9 +216,12 @@ }, goDetail(info) { - uni.navigateTo({ - url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) - }) + if(info&&info!=undefined) + { + uni.navigateTo({ + url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) + }) + } }, goback() { diff --git a/uniapp/pages/active/jdSearch.vue b/uniapp/pages/active/jdSearch.vue index 8a6cde4..adc70f4 100644 --- a/uniapp/pages/active/jdSearch.vue +++ b/uniapp/pages/active/jdSearch.vue @@ -65,7 +65,8 @@ <view class="goodsList-container colCen borderBox"> <view class="goods-content rowStaBet"> <view class="goods-items borderBox colCen" v-for="(items,index) in goodsList" :key='index' @click="goDetail(items)"> - <colGoods :items="items"></colGoods> + <colGoodsImg v-if="index==0&&popBannerSList&&popBannerSList.length>0" :popBannerSList="popBannerSList"></colGoodsImg> + <colGoods v-else :items="items"></colGoods> </view> <aLoadMore :status="loadstatus" mode="loading3" :showTitle='true' color="#999999"></aLoadMore> </view> @@ -77,12 +78,15 @@ <script> import colGoods from '../../components/colGoods.vue' + import colGoodsImg from '../../components/colGoodsImg.vue' export default { components:{ - colGoods + colGoods, + colGoodsImg }, data() { return { + popBannerSList:[], pageTop: 0, nowCurrent: 0, scrollTop: 0, @@ -97,7 +101,8 @@ } }, onLoad() { - this.getNav() + this.getNav(); + this.getPageImg(); }, onPageScroll(e) { this.scrollTop = e.scrollTop @@ -118,6 +123,24 @@ }).exec(); }, methods: { + getPageImg() + { + var that=this; + this.$u.api.getBanner({ + type: '11,17' + }).then(e => { + console.log(e); + if (e.code == 1) return that.$alert(e.msg); + var res = e.data.info; + this.popBannerSList=res.jdImg; + if(res.jdImg&&res.jdImg.length>0) + { + that.goodsList.unshift(res[0]); + } + }).catch(function(err) { + console.log(err) + }) + }, getNav() { var that = this; this.$u.api.getTopCalss({ctype:3}).then(e => { @@ -164,9 +187,12 @@ }, goDetail(info) { - uni.navigateTo({ - url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) - }) + if(info&&info!=undefined) + { + uni.navigateTo({ + url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) + }) + } }, goback() { diff --git a/uniapp/pages/active/pddsearch.vue b/uniapp/pages/active/pddsearch.vue index 1183f26..4bfc7e2 100644 --- a/uniapp/pages/active/pddsearch.vue +++ b/uniapp/pages/active/pddsearch.vue @@ -65,7 +65,8 @@ <view class="goodsList-container colCen borderBox"> <view class="goods-content rowStaBet"> <view class="goods-items borderBox colCen" v-for="(items,index) in goodsList" :key='index' @click="goDetail(items)"> - <colGoods :items="items"></colGoods> + <colGoodsImg v-if="index==0&&popBannerSList&&popBannerSList.length>0" :popBannerSList="popBannerSList"></colGoodsImg> + <colGoods v-else :items="items"></colGoods> </view> <aLoadMore :status="loadstatus" mode="loading3" :showTitle='true' color="#999999"></aLoadMore> </view> @@ -76,17 +77,19 @@ <script> import colGoods from '../../components/colGoods.vue' + import colGoodsImg from '../../components/colGoodsImg.vue' export default { components:{ - colGoods + colGoods, + colGoodsImg }, data() { return { + popBannerSList:[], pageTop: 0, nowCurrent: 0, scrollTop:0, navList: [], - fiexdHeight:'', fiexdtop:'', goodsList: [], @@ -96,7 +99,8 @@ } }, onLoad() { - this.getNav() + this.getNav(); + this.getPageImg(); }, onPageScroll(e) { this.scrollTop = e.scrollTop @@ -117,6 +121,23 @@ }).exec(); }, methods: { + getPageImg() + { + var that=this; + this.$u.api.getBanner({ + type: '11,19' + }).then(e => { + if (e.code == 1) return that.$alert(e.msg); + var res = e.data.info; + this.popBannerSList=res.pddImg; + if(res.pddImg&&res.pddImg.length>0) + { + that.goodsList.unshift(res[0]); + } + }).catch(function(err) { + console.log(err) + }) + }, getNav() { var that = this; this.$u.api.getTopCalss({ctype:2}).then(e => { @@ -180,10 +201,12 @@ }, goDetail(info) { - console.log(info); - uni.navigateTo({ - url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) - }) + if(info&&info!=undefined) + { + uni.navigateTo({ + url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) + }) + } }, goback() { diff --git a/uniapp/pages/active/tmsearch.vue b/uniapp/pages/active/tmsearch.vue index 765f6e1..a95608f 100644 --- a/uniapp/pages/active/tmsearch.vue +++ b/uniapp/pages/active/tmsearch.vue @@ -76,12 +76,12 @@ </block> </scroll-view> </view> - <colGoodsImg :popBannerSList="popBannerSList"></colGoodsImg> + <view class="goodsList-container colCen borderBox"> <view class="goods-content rowStaBet"> - <view class="goods-items borderBox colCen" v-for="(items,index) in goodsList" :key='index' @click="goDetail(items)"> + <view class="goods-items borderBox" v-for="(items,index) in goodsList" :key='index' @click="goDetail(items)"> <!-- <colGoodsImg :popBannerSList="popBannerSList"></colGoodsImg> --> - <colGoodsImg v-if="index==0" :popBannerSList="popBannerSList"></colGoodsImg> + <colGoodsImg v-if="index==0&&popBannerSList&&popBannerSList.length>0" :popBannerSList="popBannerSList"></colGoodsImg> <colGoods v-else :items="items"></colGoods> </view> <aLoadMore :status="loadstatus" mode="loading3" :showTitle='true' color="#999999"></aLoadMore> @@ -161,11 +161,9 @@ }, mounted() { uni.createSelectorQuery().in(this).select('.fixed-container').boundingClientRect(data => { - console.log(data.top); this.fiexdHeight = data.height }).exec(); uni.createSelectorQuery().in(this).select('.rangeList-container').boundingClientRect(data => { - console.log(data.top); this.fiexdtop = data.top - this.fiexdHeight }).exec(); }, @@ -173,7 +171,6 @@ getNav() { var that = this; this.$u.api.getTopCalss({ctype:1,parentId:0}).then(e => { - console.log(e); if(e.code != 0)return that.$alert(e.msg) e.data.list.unshift({cid:"-1",cname:"澶╃尗瓒呭競",ctype:"1"}); e.data.list.unshift({cid:"0",cname:"鍏ㄩ儴",ctype:"1"}); @@ -195,7 +192,6 @@ tchaoshi:tchaoshi, secrend_search:this.nowsec }).then(e => { - console.log(e); if (e.code != 0) return that.$alert(e.msg) var res = e.data; uni.stopPullDownRefresh(); @@ -210,25 +206,27 @@ that.loadstatus = 'loading' that.pageCurrent ++ } - if(!that.isinsert&&res&&res.length>0) + /* if(!that.isinsert&&res&&res.length>0) { that.goodsList.unshift(res[0]); that.isinsert=true; - } + } */ that.goodsList = that.goodsList.concat(res) - console.log(that.goodsList); }).catch(function(err) {}) }, getPageImg() { - var that=this; + var that=this; this.$u.api.getBanner({ - type: '11,12' + type: '11,16' }).then(e => { - console.log(e) if (e.code == 1) return that.$alert(e.msg); var res = e.data.info; - this.popBannerSList=res.popBannerSList; + this.popBannerSList=res.tmImg; + if(res.tmImg&&res.tmImg.length>0) + { + that.goodsList.unshift(res[0]); + } }).catch(function(err) { console.log(err) }) @@ -251,9 +249,13 @@ }, goDetail(info) { - uni.navigateTo({ - url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) - }) + if(info&&info!=undefined) + { + uni.navigateTo({ + url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) + }) + } + }, goback() { diff --git a/uniapp/pages/active/vipsearch.vue b/uniapp/pages/active/vipsearch.vue index f34a2af..d9188f0 100644 --- a/uniapp/pages/active/vipsearch.vue +++ b/uniapp/pages/active/vipsearch.vue @@ -29,7 +29,6 @@ </view> </view> </view> - <view class="searchContent rowCenBet" @tap="gosearch()"> <view class="leftcontent rowCen"> <view class="search-icon iconfont"> @@ -46,7 +45,6 @@ </view> <view class="emptybar" :style="'width:100%;height:'+(scrollTop>fiexdtop?'90':'0')+'rpx;'"> </view> - <view class="rangeList-container rowCen" :class="scrollTop>fiexdtop?'tofixed':''" :style="'top:'+(scrollTop>fiexdtop?fiexdHeight:'0')+'px;'"> <scroll-view class="scrollview-content" scroll-x scroll-with-animation="true"> <block v-for="(items,index) in navList" :key="index"> @@ -61,11 +59,12 @@ </block> </scroll-view> </view> - + <view class="goodsList-container colCen borderBox"> <view class="goods-content rowStaBet"> <view class="goods-items borderBox colCen" v-for="(items,index) in goodsList" :key='index' @click="goDetail(items)"> - <colGoods :items="items"></colGoods> + <colGoodsImg v-if="index==0&&popBannerSList&&popBannerSList.length>0" :popBannerSList="popBannerSList"></colGoodsImg> + <colGoods v-else :items="items"></colGoods> </view> <aLoadMore :status="loadstatus" mode="loading3" :showTitle='true' color="#999999"></aLoadMore> </view> @@ -76,12 +75,15 @@ <script> import colGoods from '../../components/colGoods.vue' + import colGoodsImg from '../../components/colGoodsImg.vue' export default { components:{ - colGoods + colGoods, + colGoodsImg }, data() { return { + popBannerSList:[], pageTop: 0, nowCurrent: 0, scrollTop:0, @@ -96,7 +98,8 @@ } }, onLoad() { - this.getNav() + this.getNav(); + this.getPageImg(); }, onPageScroll(e) { this.scrollTop = e.scrollTop @@ -115,6 +118,24 @@ }).exec(); }, methods: { + getPageImg() + { + var that=this; + this.$u.api.getBanner({ + type: '11,20' + }).then(e => { + if (e.code == 1) return that.$alert(e.msg); + var res = e.data.info; + that.popBannerSList=res.wphImg; + console.log(that.popBannerSList); + if(res.wphImg&&res.wphImg.length>0) + { + that.goodsList.unshift(res[0]); + } + }).catch(function(err) { + console.log(err) + }) + }, getNav() { var that = this; this.$u.api.getTopCalss({ctype:9}).then(e => { @@ -127,12 +148,12 @@ }, getData() { var that = this; + console.log(this.nowCurrent) this.$u.api.wphGoodsList({ cate: this.nowCurrent, pageSize: 10, page: this.pageCurrent, }).then(e => { - console.log(e); if(e.code != 0)return that.$alert(e.msg) var res = e.data; if(res.list==null) @@ -152,7 +173,9 @@ that.pageCurrent ++ } that.goodsList = that.goodsList.concat(res.list) + console.log(that.goodsList) }).catch(function (err) { + console.log(err) }) }, @@ -166,9 +189,12 @@ }, goDetail(info) { - uni.navigateTo({ - url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) - }) + if(info&&info!=undefined) + { + uni.navigateTo({ + url: '../goods/goodsDetail?info=' + encodeURIComponent(JSON.stringify(info)) + }) + } }, goback() { @@ -366,6 +392,8 @@ flex-wrap: wrap; .goods-items{ + width: 350rpx; + height: 546rpx; margin-bottom: 20rpx; } } diff --git a/uniapp/pages/index/index.vue b/uniapp/pages/index/index.vue index b5cf339..477541d 100644 --- a/uniapp/pages/index/index.vue +++ b/uniapp/pages/index/index.vue @@ -175,7 +175,6 @@ }).then(e => { if (e.code == 1) return that.$alert(e.msg); var res = e.data.info; - console.log(res) if(res.length > 0){ this.showBulletFrame = true; this.BulletFrameData = res[0] @@ -311,7 +310,6 @@ getTopheight() { // 鑾峰彇椤堕儴楂樺害 uni.createSelectorQuery().in(this).select('.fixed-container').boundingClientRect(data => { - console.log("寰楀埌甯冨眬浣嶇疆淇℃伅" + JSON.stringify(data)); this.Topheight = data.height }).exec(); }, diff --git a/uniapp/pages/rankinglist/common_act.vue b/uniapp/pages/rankinglist/common_act.vue index 379ddf4..27aba6e 100644 --- a/uniapp/pages/rankinglist/common_act.vue +++ b/uniapp/pages/rankinglist/common_act.vue @@ -1,7 +1,6 @@ <template> <view> <web-view :webview-styles="webviewStyles" :src="webviewUrl" @message='received'></web-view> - </view> </template> diff --git a/uniapp/utils/utils.js b/uniapp/utils/utils.js index eafbf8e..3839885 100644 --- a/uniapp/utils/utils.js +++ b/uniapp/utils/utils.js @@ -56,7 +56,6 @@ url: '/pages/webView/webView?url=' + info.parameter_json.url }) } else if (info.url_type == 1) { - console.log("杩涙潵浜�1路11111111111") let url = info.parameter_json.url == undefined ? '' : info.parameter_json.url; console.log(url) if(url == '') return false; -- Gitblit v1.9.3