<template>
    <section class="rank-container">
        <Header
			:is-scroll="isScroll"
			:share-title1="shareTitle1"
			:share-title2="shareTitle2"
		/>
        <!-- 我的排名 -->
        <div class="rank-info">
            <div class="info-text">
                <div class="info-detail">
                    <img src="../../static/images/task-four.png" />
                    <div class="info-name">
                        <span class="ft">用户昵称</span>
                        <span><span class="cl">22451</span>勤奋分</span>
                    </div>
                </div>
                <div class="info-score">
                    <p>45</p>
                    <span>我的排名</span>
                </div>
            </div>
            <div class="rank-detail">
                <div class="rank-num">
                    <span class="dlot"></span>
                    <span class="num">前一名：<span class="score">21956</span>勤奋分</span>
                </div>
                <div class="line"></div>
                <div class="rank-num">
                    <span class="dlot"></span>
                    <span class="num">后一名：<span class="score">21956</span>勤奋分</span>
                </div>
            </div>
        </div>
        <!-- 排行榜 -->
        <div class="main-content">
            <div class="description"><span>排行榜</span>排名每5分钟更新1次 最后更新时间 7-15 12:05</div>
            <div class="ranking-title">
                <span>TOP10</span>
                <span class="marginL">用户名称</span>
                <span class="marginAuto">勤奋分</span>
            </div>
            <div class="ranking-list">
                <div class="item" v-for="(item,index) in topRankList" :key="index">
                    <img v-if="index<=2" :src="dealRankIcon(index)" alt="" class="ranking-icon">
                    <p v-else class="icon-num" >{{index+1}}</p>
                    <p class="doctor-name">{{item.name}}</p>
                    <p class="num">{{item.score}}</p>
                </div>
            </div>
        </div>
        <!-- 奖品 -->
        <div class="award-container">
            <div class="award-title">
                <div>排名前10名奖品</div>
                <span @click="allAward">全部奖品 ></span>
            </div>
            <div class="awards"><img src="../../static/images/all-award.png" /></div>
        </div>
        <DetailBtn 
        v-show="true" 
        :needBT="needBT" 
        @btnClick="goBack" />
    </section>
</template>
<script>
import Header from '../../components/header';
import DetailBtn from '../../components/bussiness/detail-btn';
export default {
    components: {
       Header,
       DetailBtn
    },
    data() {
        return {
            needBT: false,
            shareTitle1: '我的排名',
            shareTitle2: '',
            isScroll: true,
            topRankList: [
                {
                    name: '张**生',
                    score: 23455
                },
                {
                    name: '张**生',
                    score: 23455
                },
                {
                    name: '张**生',
                    score: 23455
                },
                {
                    name: '张**生',
                    score: 23455
                }
            ]
        }
    },
    methods: {
        dealRankIcon(index) {
            if(index == 0) {
                return require('../../static/images/icon-gold.png')
            } else if(index == 1) {
                return require('../../static/images/icon-silver.png')
            } else if(index == 2) {
                return require('../../static/images/icon-copper.png')
            }
        },
        // 全部奖品
        allAward(){

        },
        goBack() {
            if(this.$rocNative.isWeb) {
                this.$router.go(-1);
            } else {
                this.$rocNative.goBack();
            }
        },
    }
}
</script>
<style lang="less" scoped>
.rank-container {
    .rank-info {
        padding-top: 70px;
        height: 150px;
        background-image:url('../../static/images/rank_head.png');
        background-size: 100% 100%;
        .info-text {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            padding: 15px 30px 13px 15px;
            .info-detail {
                img {
                    float: left;
                    width: 50px;
                    height: 50px;
                }
                .info-name {
                    display: inline-block;
                    padding: 9px;
                    font-size: 14px;
                    color: #fff;
                    span {
                        display: block;
                    }
                    span.ft {
                        font-weight: 700;
                        padding-bottom: 3px;
                    }
                    span.cl {
                        display: inline-block;
                        color: #FFE8A5;
                    }
                }
            }
            .info-score {
                color: #FFE8A5;
                p {
                    font-size: 26px;
                    text-align: center;
                }
                span {
                    display: inline-block;
                    width: 68px;
                    height: 18px;
                    text-align: center;
                    border-radius: 9px;
                    border:1PX solid rgba(255,232,165,1);
                }
            }
        }
        .rank-detail {
            display: flex;
            flex-direction: row;
            justify-content: center;
            margin: 0 15px 15px;
            height: 30px;
            background: rgba(153,31,51,1);
            border-radius: 15px;
            .rank-num{
                padding: 0px 16px;
                line-height: 30px;
                font-size: 13px;
                color: #fff;
                span.num {
                    padding-left: 5px;
                }
                span.dlot {
                    float: left;
                    width: 4px;
                    height: 4px;
                    margin-top: 14px;
                    border-radius: 50%;
                    background: #fff;
                }
                span.score {
                    color: #FFE8A5;
                }
            }
            .line {
                margin-top: 10px;
                background: #fff;
                width: 1PX;
                height: 15px;
            }
        }
    }
    .main-content {
        margin: -20px 10px 30px;
        border-radius: 12px;
        background: #fff;
        box-shadow:0px 2px 20px 0px rgba(0,0,0,0.15);
        .description {
            border-radius: 12px 12px 0px 0px;
            padding-left: 15px;
            height: 48px;
            line-height: 48px;
            color: #979899;
            font-size: 12px;
            background: #FFF7F2;
            span {
                font-size: 16px;
                color: #373839;
                padding-right: 6px;
                font-weight: 700;
            }
        }
        .ranking-title {
            display: flex;
            align-items: center;
            color: #373839;
            font-size: 12px;
            padding: 10px 40px 8px 30px;
            border-bottom: 1px solid #F8F9FA;
            .marginL {
                margin-left: 40px;
            }
            .marginAuto {
                margin-left: auto;
            }
        }
        .ranking-list {
            padding: 0 15px;
            .item {
                display: flex;
                font-size: 12px;
                align-items: center;
                padding: 10px 26px;
                border-bottom: 1px solid #F8F9FA;
                .ranking-icon {
                    width: 15px;
                    height: 15px;
                }
                .icon-num {
                    width: 15px;
                    color: #373839;
                }
                .doctor-name {
                    color: #373839;
                    font-size: 12px;
                    margin-left: 55px;
                    // width: 130px;
                }
                .num {
                    color:#FD5A2F;
                    font-size: 12px;
                    margin-left: auto;
                }
            }
        }
    }
    .award-container {
        margin: 0px 0px 60px 0px;
        .award-title {
            display: flex;
            flex-direction: row;
            justify-content: space-between;
            padding: 0px 15px 10px;
            div {
                font-size: 18px;
                color: #28344C;
                font-weight: 700;
            }
            span {
                font-size: 12px;
                color: #979899;
            }
        }
        .awards {
            img {
                width: 100%;
            }
        }
    }
}
</style>