zhaojs
2023-08-11 83e49ed8b1ab05dd332def0fba6c3703d1e91373
uniapp/pages/index/index.vue
@@ -1,9 +1,11 @@
<template>
    <view v-if="isshowtype">
      <indexnewPage :Topheight="Topheight" :recomendType="recomendType" :canrefush='canrefush' :fixedClass='fixedClass'></indexnewPage>
      <indexnewPage :Topheight="Topheight" :recomendType="recomendType" :canrefush='canrefush'
         :fixedClass='fixedClass'></indexnewPage>
   </view>
   <view v-else class="index-wrapper wrapperLayer borderBox">
      <view class="fixed-container colCen borderBox" :style="'background:'+ (categoryCurrent>0?'#EE1B14':(scrollTop>30?'#EE1B14;':bannerColor) +';')">
      <view class="fixed-container colCen borderBox"
         :style="'background:'+ (categoryCurrent>0?'#EE1B14':(scrollTop>30?'#EE1B14;':bannerColor) +';')">
         <view class="topbarbox"></view>
         <view class="headerSearch-container rowCenBet borderBox">
            <view class="leftgoSearchbox rowCen borderBox" @click="goPath('search')">
@@ -24,10 +26,13 @@
         </view>
         <view class="categoryNavbar-container rowCenBet">
            <scroll-view class="categoryScroll" scroll-x scroll-with-animation @scroll="rowscroll" :scroll-into-view="nowcurrentid" :scroll-left="scrollleftnum">
            <scroll-view class="categoryScroll" scroll-x scroll-with-animation @scroll="rowscroll"
               :scroll-into-view="nowcurrentid" :scroll-left="scrollleftnum">
               <block v-for="(items,index) in categoryList" :key='index'>
                  <view class="category-container">
                     <view class="category-items colCenCen" @click="cateChange(index)" :id="categoryCurrent==index?'category-items-active':''" :class="categoryCurrent==index?'category-items-active':''">
                     <view class="category-items colCenCen" @click="cateChange(index)"
                        :id="categoryCurrent==index?'category-items-active':''"
                        :class="categoryCurrent==index?'category-items-active':''">
                        <view class="categoryname">
                           {{items.cname}}
                        </view>
@@ -68,15 +73,20 @@
      </view>
      <view class="body-container colCen borderBox">
         <swiper class="pageSwiper" :disable-touch='canswiper' duration="200" :current='categoryCurrent' @change='changeCatepage' @transition='swipering' @animationfinish='stopswiper'>
         <swiper class="pageSwiper" :disable-touch='canswiper' duration="200" :current='categoryCurrent'
            @change='changeCatepage' @transition='swipering' @animationfinish='stopswiper'>
            <swiper-item v-for="(items,index) in categoryList" :key='index' :current-item-id='items.cid'>
               <view v-if='index==0'>
                  <indexPage ref='indexPage' :recomendType="recomendType" :canrefush='canrefush' :fixedClass='fixedClass' @scrolltoTop='scrolltoTop' @scrolltoview='scrolltoview'
                   @pushfixed='getfixed' @scrollNum='getScroll' :Topheight='Topheight' @passColor='getColor'></indexPage>
                  <indexPage ref='indexPage' :recomendType="recomendType" :canrefush='canrefush'
                     :fixedClass='fixedClass' @scrolltoTop='scrolltoTop' @scrolltoview='scrolltoview'
                     @pushfixed='getfixed' @scrollNum='getScroll' :Topheight='Topheight' @passColor='getColor'>
                  </indexPage>
               </view>
               <view v-else>
                  <categoryPage v-if="index==categoryCurrent+1 || index==categoryCurrent-1 || index==categoryCurrent" :parentId='items.cid'
                   :Topheight='Topheight' :canrefush='canrefush' :canload='index==categoryCurrent'>
                  <categoryPage
                     v-if="index==categoryCurrent+1 || index==categoryCurrent-1 || index==categoryCurrent"
                     :parentId='items.cid' :Topheight='Topheight' :canrefush='canrefush'
                     :canload='index==categoryCurrent'>
                  </categoryPage>
               </view>
            </swiper-item>
@@ -86,7 +96,8 @@
      <u-mask :show="showBulletFrame">
          <view class="warp">
              <!-- <view @tap.stop> -->
                  <image class="pic" :src="BulletFrameData.image" mode="aspectFit"  @tap.stop="goToShowBulletFrame(BulletFrameData)"/>
            <image class="pic" :src="BulletFrameData.image" mode="aspectFit"
               @tap.stop="goToShowBulletFrame(BulletFrameData)" />
              <!-- </view> -->
              <view class="clone" @click="showBulletFrame = false">
                  <image class="image" width="64rpx" height="64rpx" src="/static/images/app/close.png"></image>
@@ -133,12 +144,11 @@
      },
      onLoad() {
         this.getCategoryList();
         this.getPopBannerInfo();
         this.getCusPopupInfo();
         this.getArgument();
      },
      onShow() {
         if(!this.hasshow)
         {
         if (!this.hasshow) {
            this.shShow();
         } 
         if(this.categoryList){
@@ -154,9 +164,16 @@
      },
      watch: {},
      methods: {
         shShow()
         getArgument()
         {
            var arg=getApp().globalData.argumentStr;
            if(arg&&arg.length>0)
            {
               getApp().targetArgument(arg);
               getApp().globalData.argumentStr="";
            }
         },
         shShow() {
            var that=this;
            var istoLogin=true;
            this.$u.api.comminInt({}).then(e => {
@@ -170,8 +187,7 @@
                     that.isshowtype=false;
                  }
               }
               if(istoLogin)
               {
               if (istoLogin) {
                  if(!that.hasLogin){
                     setTimeout(() => {
                        uni.reLaunch({
@@ -202,6 +218,23 @@
             this.showBulletFrame = false
            utils.goUrl(info, this)
         },
         getCusPopupInfo() { //获取自定义弹窗数据
            var that = this;
            this.$u.api.getCustomizePopup({}).then(e => {
               if (e.code == 0) {
                  var res = e.data;
                  if (res.haspop) { //有自定义弹窗
                     this.showBulletFrame = true;
                     this.BulletFrameData = res.info;
                  } else {
                     this.getPopBannerInfo();
                  }
               }
            }).catch(function(err) {
               this.getPopBannerInfo();
            })
         },
         getPopBannerInfo() {
            // banner数据
            var that = this;
@@ -214,8 +247,7 @@
                  this.showBulletFrame = true;
                  this.BulletFrameData = res[0]
               }
            }).catch(function(err) {
            })
            }).catch(function(err) {})
         },
         getNewMessage(){
            var that = this;
@@ -225,8 +257,7 @@
                  let oldId = uni.getStorageSync('topMessageId');
                  if(oldId != e.data.id)that.isNewMessage = true;
               }
            }).catch(function (err) {
            })
            }).catch(function(err) {})
         },
         rowscroll(e){
            this.rowLeft = e.scrollLeft
@@ -240,7 +271,10 @@
         },
         getCategoryList() {
            var that = this;
            this.$u.api.getTopCalss({ctype:1,parentId:0}).then(e => {
            this.$u.api.getTopCalss({
               ctype: 1,
               parentId: 0
            }).then(e => {
               if(e.code != 0)return that.$alert(e.msg)
               var obj = {}
               obj.cname = '推荐';
@@ -248,8 +282,7 @@
               obj.ctype = 0;
               that.categoryList = e.data.list;
               that.categoryList.unshift(obj);
            }).catch(function (err) {
            })
            }).catch(function(err) {})
         },
         // 页面样式处理
@@ -301,9 +334,7 @@
               uni.navigateTo({
                  url: './officialNotice'
               })
            }
            else if(url=='turnChain')
            {
            } else if (url == 'turnChain') {
               uni.navigateTo({
                  url: '../mine/tools/turnChain'
               })
@@ -369,11 +400,11 @@
</script>
<style lang="scss">
   uni-image
   {
   uni-image {
      width:30rem;
      height:25rem
   }
   .index-wrapper {
      height: 100vh;
      overflow: hidden;
@@ -440,6 +471,7 @@
               color: #FFFFFF;
            }
         }
         .searchImg{
            image{
               width: 40rpx;
@@ -576,6 +608,7 @@
         }
      }
   }
   .warp{
       position: relative;
       top:50%;
@@ -585,6 +618,7 @@
       align-items: center;
       justify-content: center;
      width: 100%;
       .pic{
     //       width: 86.6%;
         // height: 100vw;
@@ -595,6 +629,7 @@
       position:absolute;
       bottom: -30rpx;
       transform: translate(calc(50% - 32rpx));
       .image {
           width: 64rpx;
           margin: 0 auto;