<template>
    <section class="point-container">
        <div class="point-bg">
            <div class="point-status">
                <img v-if="status == 1 || status == 3" src="../../static/images/point-success-nobg.png" />
                <img v-if="status == 2" src="../../static/images/point-fail.png" />
            </div>
            <div class="status-text">
                <p class="fw">{{pointText1}}</p>
                <p class="fw">{{pointText2}}</p>
            </div>
            <div class="point-award">
                <div v-if="status != 3" class="award-con">
                    <img src="../../static/images/point-award-new.png" />
                </div>
            </div>
            <div class="btn">
                <button @click="openApp" v-bp="{ component_tag: '361#3600010'}">{{btnText}}</button>
                <button @click="downloadApp">下载APP</button>
            </div>
        </div>
    </section>
</template>
<script>
import { ENV_CONFIG } from '@/utils/enumerate';
export default {
    data() {
        return {
            pointText1: "",
            pointText2: "",
            btnText: "",
            code: '',
            status: 1
        }
    },
    created() {
        this.code = this.$route.query.code;
        if(this.code == '900002'){
            this.status = 1;
            this.pointText1 = "点赞成功";
            this.pointText2 = "登陆云鹊医APP，您也可获得75勤奋分";
            this.btnText = "打开APP参与瓜分云鹊豆";
        }else if(this.code == '900008') {
            this.status = 1;
            this.pointText1 = "点赞成功";
            this.pointText2 = "登陆云鹊医APP，参加活动瓜分云鹊豆";
            this.btnText = "打开APP参与瓜分云鹊豆";
        }else if(this.code == '900004') {
            this.status = 1;
            this.pointText1 = "点赞成功，感谢您为TA拿下5勤奋分";
            this.pointText2 = "登陆云鹊医APP，您也可获得75勤奋分";
            this.btnText = "打开APP参与瓜分云鹊豆";
        }else if(this.code == '900005') {
            this.status = 2;
            this.pointText1 = "抱歉！您的点赞次数已达3次上限！";
            this.pointText2 = "登陆云鹊医APP，您也可获得75勤奋分";
            this.btnText = "打开APP参与瓜分云鹊豆";
        }else if(this.code == '900006') {
            this.status = 3;
            this.pointText1 = "该活动已结束";
            this.pointText2 = "登陆云鹊医APP，查看更多精彩内容";
            this.btnText = "打开APP";
        }else if(this.code == '900007') {
            this.status = 2;
            this.pointText1 = "抱歉！您的点赞次数已达3次上限！";
            this.pointText2 = "登陆云鹊医APP，参加活动瓜分云鹊豆";
            this.btnText = "打开APP参与瓜分云鹊豆";
        }else {
            this.status = 1;
            this.pointText1 = "点赞成功";
            this.pointText2 = "登陆云鹊医APP，参加活动瓜分云鹊豆";
            this.btnText = "打开APP参与瓜分云鹊豆";
        }
    },
    methods: {
        openApp() {
            // let path = window.location.origin + window.location.hash;
            const { NUXT_ENV_APP } = process.env;
            let path = ENV_CONFIG[NUXT_ENV_APP]['shareUrl']  + `/compaign_ssr/`;
            this.$callApp(path);
        },
        downloadApp() {
            window.location.href = 'https://a.app.qq.com/o/simple.jsp?pkgname=com.picahealth.yunque';    
        }
    }
}
</script>
<style lang="less" scoped>
.point-container {
    .point-bg {
        width: 100%;
        height: 100vh;
        background-image:url('../../static/images/result-bg.png');
        background-size: 100% 100%;
    }
    .point-status {
        padding: 45px 0 25px;
        text-align: center;
        img {
            width: 50px;
            height: 50px;
        }
    }
    .status-text {
        padding: 0px 0px 30px;
        text-align: center;
        p {
            font-size: 18px;
            font-weight: 700;
            color:#373839
        }
        p.fw {
            color: #fff;
        }
    }
    .point-award {
        .award-con {
            // background: #fff;
            border-radius: 20px 20px 0px 0px;
            padding: 0px 18px;
            // div {
            //     padding: 14px;
            //     font-size: 15px;
            //     color: #DD364F;
            //     text-align: center;
            //     font-weight: 700;
            // }
            img {
                width: 100%;
            }
        }
    }
    .btn {
        text-align: center;
        // background: #fff;
        padding: 40px 0px 91px;
        margin-top: -1px;
        button {
            display: inline-block;
            width: 335px;
            height: 40px;
            border-radius: 23px;
            background: none;
            color: gba(255,255,255,1);
            font-size: 14px;
            border: none;
            font-weight: 700;
        }
        button:first-child {
            background: linear-gradient(180deg,#FFD4A7 0%,#FF6B24 100%);
            color: #900822;
            margin-bottom: 12px;
        }
        button:last-child {
            color: #fff;
            border: 1px solid #fff;
        }
    }
}
</style>