<template>
  	<section class="font-style">
        <section class="home-header">
            <mt-header>
                <router-link to="/" slot="left">
                    <mt-button icon="back"></mt-button>
                </router-link>
                <mt-button icon="more" slot="right"></mt-button>
            </mt-header>
            <article style="width: 100%;text-align:center;">
                <img class="logo_img" src='../../images/header-bg-2.png' />
            </article>
        </section>
        <section class="home-body">
            <span @click="pushView('http://10.177.10.121:8080/yqy/index.html?1')"> pushView 1</span>
            <span @click="goBack"> goBack 2</span>
            <span @click="toast('Hi, 你好，宾宾！')"> toast 3</span>
        </section>
        <section class="home-bottom">
            <yqyTest/>
        </section>
    </section>
</template>

<script>
import { Header } from 'mint-ui';
import yqyTest from '@/components/common/yqy/yqyTest'

export default {
    data(){
        return {
            
        }
    },
    components:{
        Header,
        yqyTest
    },
	mounted(){
        this.init()
    },

    computed:{
    },

    methods:{
        init() {

            this.API_GET('contents/homeButton/msg', {}).then( res => {
                logger.debug(res)
                this.$log.debug(res)
            })

            let para = {
                sysCode: 27, 
                token: this.token,
                setEntry: 'headers'
            }
            this.GET('analysis/activityDetail', para).then( res => {
                logger.debug(res)
            })
            para = {
                sysCode: 27, 
                rankingType: 27,
                flag: 1,
                token: this.token,
                setEntry: 'headers'
            }
            this.GET('exams/rankings', para).then( res => {
                logger.debug(res)
            })
         
        },
        pushView : function(page){
            console.log('pushView');
            rocNative.pushView({
                url : page
            }).then(function(res) {
                console.log('pushView then' + JSON.stringify(res));
            }).catch(function(res){
                console.log('pushView catch' + JSON.stringify(res));
            });
        },
        goBack: function (msg) {
            console.log('goBack');
            rocNative.goBack()
            .then(function(res) {
                console.log('goBack then' + JSON.stringify(res));
            }).catch(function(res){
                console.log('goBack catch' + JSON.stringify(res));
            });
        },
        toast : function(msg){
            console.log('toast');
            rocNative.toast({
                msg: msg
            }).then(function(res) {
                console.log('toast then' + JSON.stringify(res));
            }).catch(function(res){
                console.log('toast catch' + JSON.stringify(res));
            });
        },
    },
}

</script>

<style lang="scss" scoped>
    @import '../../style/mixin';
    .mint-header {
        background-color: rgba($color: #000000, $alpha: 0)
    }
    .font-style {
        @include sc(0.6rem, #666);
    }

    .home-header {
        height: px2rem(202px);
        @include bis('../../images/552064153@2x.png');

        .logo_img{
            height: px2rem(85px);
            width: px2rem(345px);
            text-align: center;
        }
    }
</style>
