zhaojs
2023-07-07 55803b1a7b478aade9b6e59ca6675777375e2a92
uniapp/pages/index/index.vue
@@ -1,8 +1,8 @@
<template>
  <!--  <view v-if="isshowtype">
      <indexnewPage></indexnewPage>
   </view> -->
   <view class="index-wrapper wrapperLayer borderBox">
    <view v-if="isshowtype">
      <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="topbarbox"></view>
         <view class="headerSearch-container rowCenBet borderBox">
@@ -132,37 +132,15 @@
         }
      },
      onLoad() {
         this.getCategoryList();
         this.getPopBannerInfo();
         this.updateCid();
      },
      onShow() {
         if(!this.hasLogin){
            setTimeout(function(){
               uni.reLaunch({
                  url:"/pages/login/wxlogin"
               })
            },1000);
            return;
         }
         if(!this.hasshow)
         {
            this.shShow();
         }
         var user= uni.getStorageSync('userInfo');
         console.log(user);
         if(!user.invitation_code)
         {
            setTimeout(function(){
               uni.reLaunch({
                  url:"/pages/login/wxlogin"
               })
            },1000);
            return;
         }
         }
         if(this.categoryList){
            this.getCategoryList();
         }
@@ -172,24 +150,61 @@
         this.recomendType = open_like_recommend == "" ? 1 : open_like_recommend;
      },
      onReady() {
         console.log("获取高低")
         this.getTopheight()
      },
      watch: {},
      methods: {
         updateCid()
         {
            //从缓存获取cid
            let clientInfo = uni.getStorageSync('clientInfo');
            console.log(clientInfo);
            if(clientInfo&&clientInfo.clientid)
            {
               this.$u.api.updateCid({
                  pushcid:clientInfo.clientid
               }).then(e => {
                  console.log(e);
               }).catch(function (err) {
               })
            }
         },
         shShow()
         {
            var that=this;
            var istoLogin=true;
            this.$u.api.comminInt({}).then(e => {
               that.hasshow=true;
               // #ifdef APP-PLUS
               if (plus.os.name == 'iOS') {
                  if (e.data.basic.iosExamine && plus.runtime.version == e.data.basic.IosExamineV) {
                     that.isshowtype=true;
                     istoLogin=false;
                  } else {
                     that.isshowtype=false;
                  }
                  console.log(that.isshowtype);
               }
               if(istoLogin)
               {
                  if(!that.hasLogin){
                     uni.reLaunch({
                        url:"/pages/login/wxlogin"
                     })
                  }
                  /* var user= uni.getStorageSync('userInfo');
                  if(!user.invitation_code)
                  {
                     setTimeout(function(){
                        uni.reLaunch({
                           url:"/pages/login/wxlogin"
                        })
                     },1000);
                     return;
                  } */
               }
               // #endif
            }).catch(function(err) {
               console.log(err);
@@ -288,7 +303,6 @@
         stopswiper(){
            this.canrefush = true
         },
         // 路由跳转
         goPath(url) {
            if (url == 'search') {
@@ -342,6 +356,7 @@
         getTopheight() {
            // 获取顶部高度
            uni.createSelectorQuery().in(this).select('.fixed-container').boundingClientRect(data => {
               console.log(data.height+":----------------");
               this.Topheight = data.height
            }).exec();
         },