zhaojs
2023-07-13 70f5b82bc3fceafac2faf470280876b0eca6fac8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
<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 => {
                    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{
                        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>