zhaojs
2023-06-28 9ea0383c303620cd019d0776ecbb47f52bcef805
uniapp/pages/index/launchPage.vue
对比新文件
@@ -0,0 +1,77 @@
<template>
   <view v-if="list&&list.length>0">
       <m-start-ad :list="list" v-on:pgoUrl="goUrl" :time="time" url="/pages/index/index" />
   </view>
</template>
<script>
 import utils from "../../utils/utils.js"
    export default {
        data() {
            return {
                list:[],
            time:5
            };
        },
        onShow: function () {
            var first = getApp().globalData.isLaunch;
            if(first){
                uni.reLaunch({
                    url: "/pages/index/index"
                });
            } else {
                getApp().globalData.isLaunch=true;
               var that = this;
               this.$u.api.getBanner({
                  type: '1,15'
               }).then(e => {
                  console.log(e)
                  if (e.code == 1)
                  {//杩斿洖澶辫触锛岀洿鎺ヨ烦棣栭〉
                     this.t_index();
                  return;
                  }
                  var res = e.data.info;
                  if(res&&res.launchpic&&res.launchpic.length>0)
                  {
                     that.list=res.launchpic;
                  }
                  else{
                  console.log("璺宠浆")
                     this.t_index();
                  }
               }).catch(function(err) {
                  console.log(err);
                  this.t_index();
               })
               }
        },
        methods: {
         goUrl(info) {
            if (info.url_type == 1&&info.parameter_json.url=="/pages/index/index")
            {
               uni.reLaunch({
                  url: './index'
               })
            }
            else{
               utils.goUrl(info, this)
            }
         },
         t_index()
         {
             setTimeout(()=>{
               uni.reLaunch({
                   url: "/pages/index/index"
               });
            }, 500);
         }
        }
    }
</script>