import {FunctionTrigger} from '$mixins/trigger/class/index';

import popup, {PopupExportComponent} from "$utils/tool/popup";
import socket from "$utils/socket";
import {NoticeType} from "$utils/socket/const";

export default <LibDataArray>[
    {
        label:'排行榜',
        icon:require('../images/ranking.png'),
        defaultIcon: require('../images/ranking-default.png'),
        trigger: new FunctionTrigger(function (){
            return popup.$open(PopupExportComponent.ranking);
        })
    },
    {
        label:'找陪玩',
        icon:require('../images/game.png'),
        defaultIcon: require('../images/game-default.png'),
        trigger: new FunctionTrigger(function (){
            return popup.$confirm({
                title:'你确定要退出语聊房吗？',
                confirm:()=>{
                    socket.triggerNotice(NoticeType.home, {
                        select:0
                    });
                    this.$router.replace({
                        name:'home',
                        params:{
                            select:0
                        }
                    });
                    // if (this.$params.back) {
                    //     socket.triggerNotice(NoticeType.home, {
                    //         select:0
                    //     });
                    //     return this.$router.back();
                    // } else {
                    //     return this.$router.replace({
                    //         name:'home',
                    //         params:{
                    //             select:0
                    //         }
                    //     });
                    // }

                }
            })
        })
    },
    {
        label:'语聊大厅',
        icon:require('../images/microphone.png'),
        defaultIcon: require('../images/microphone-default.png'),
        trigger: new FunctionTrigger(function (){
            return popup.$confirm({
                title:'你确定要退出语聊房吗？',
                confirm:()=>{
                    socket.triggerNotice(NoticeType.home, {
                        select:1
                    });
                    this.$router.replace({
                        name:'home',
                        params:{
                            select:1
                        }
                    });
                    // if (this.$params.back) {
                    //     socket.triggerNotice(NoticeType.home, {
                    //         select:1
                    //     });
                    //     return this.$router.back();
                    // } else {
                    //     return this.$router.replace({
                    //         name:'home',
                    //         params:{
                    //             select:1
                    //         }
                    //     });
                    // }

                }
            })
        })
    },
    {
        label:'消息',
        icon:require('../images/message.png'),
        defaultIcon: require('../images/message-default.png'),
        trigger: new FunctionTrigger(function (){
            popup.$open(PopupExportComponent.chat);
        })
    },
    {
        label:'回到首页',
        icon:require('../images/home.png'),
        defaultIcon: require('../images/home-default.png'),
        trigger: new FunctionTrigger(function (){
            return popup.$confirm({
                title:'你确定要退出语聊房吗？',
                confirm:()=>{

                    this.$router.replace({
                        name:'home'
                    });
                    // if (this.$params.back) {
                    //     return this.$router.back();
                    // } else {
                    //     return this.$router.replace({
                    //         name:'home'
                    //     });
                    // }

                }
            })
        })
    },
]
