HEX
Server: Apache/2.4.59 (Debian)
System: Linux keymana 4.19.0-21-cloud-amd64 #1 SMP Debian 4.19.249-2 (2022-06-30) x86_64
User: lijunjie (1003)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/dk/wp-content/themes/food/food-app/page-competition_index.php
<?php
/* Template Name: competition_index */

get_header('competition');
//get_header('food');

$vueVersion = time();

$user = wp_get_current_user();
//print_r($user);
$user_id = $user->ID;
$username = '';
if ($user_id != 0) {
    // 获取当前用户的显示名称
    $display_name = $user->display_name;
//    echo '$display_name ';
//    print_r($display_name);

    $user_nicename = $user->user_nicename;
//    echo 'user_nicename ';
//    print_r($user_nicename);

    if ($display_name != '') {
        $username = $display_name;
    } elseif ($user_nicename != '') {
        $username = $user_nicename;
    }

//    $username = $user->data->display_name;
//    if (isset($user->data->user_nicename)) {
//        $username = $user->data->user_nicename;
//    }
}

$user_info = get_login_user();
//print_r($user_info);
$user_id = $user_info['ID'];
//print_r($user_id);

$aid = CheckFunc::checkInputInt2('aid');
?>
<style>
    .search-list {
        background-color: white;
    }

    /*banner横幅start*/
    .pc_banner {
        display: none;
    }

    .banner {
        width: 100%;
        height: 400px;
        /*background: url(*/
    <?php //showFoodAppPath('/ranking/images/banner_bg_mobile.webp') ?> /*) no-repeat right center,linear-gradient(315deg, #00839B 0%, #1ABFBA 100%);  */
        background: linear-gradient(315deg, #00839B 0%, #1ABFBA 100%);
        /*padding: 20px;*/
        padding-top: 20px;
        padding-bottom: 20px;
    }

    @media screen and (min-width: 1280px ) {
        .banner {
            width: 100%;
            height: 400px;
            background: linear-gradient(315deg, #00839B 0%, #1ABFBA 100%);
            padding: 20px;
        }
    }

    .banner .banner_content {
        height: 100%;
        width: 1400px;
        margin: 0 auto;
        position: relative;
        float: left;
    }

    .banner .banner_content .banner_title {
        color: white;
        float: left;
        text-indent: 6px;

        width: 160px;
        height: 20px;
        font-size: 20px;
        font-family: Source Han Sans CN;
        font-weight: 500;
    }

    .banner .banner_content .banner_text {

        color: white;
        /*float: left;*/
        width: 130px;
        text-indent: 6px;

        margin-top: 35px;
        background: rgba(255, 255, 255, 0.39);

        font-size: 18px;
        /*font-family: Source Han Sans CN;*/
        font-weight: 400;

    }

    .banner .banner_content .banner_bottom_title {
        font-size: 18px;
        line-height: 18px;
        height: 18px;
        color: white;
        float: left;
        width: 100%;
        font-weight: 500;
        text-indent: 6px;
        margin-top: 30px;
    }

    .banner .banner_content .banner_bottom_text {
        font-size: 16px;
        color: white;
        line-height: 24px;

        width: 245px;
        float: left;
        margin-left: 6px;
        margin-top: 10px;
    }

    @media screen and (min-width: 640px ) {
        .banner .banner_content .banner_bottom_text {
            font-size: 16px;
            color: white;
            line-height: 24px;
            width: 445px;
            float: left;
            margin-left: 6px;
            margin-top: 10px;
        }

        .mobile_banner {
            display: none;
        }

        .pc_banner {
            display: block;
        }
    }

    @media screen and (min-width: 1280px ) {
        .banner .banner_content .banner_bottom_text {
            font-size: 16px;
            color: white;
            line-height: 32px;
            width: 745px;
            float: left;
            margin-left: 6px;
            margin-top: 10px;
        }

        .banner .banner_content .banner_title {

            color: white;
            float: left;
            text-indent: 6px;

            width: 160px;
            height: 36px;
            font-size: 36px;
            /*font-family: Source Han Sans CN;*/
            font-weight: 500;

            opacity: 1;
        }

        .banner .banner_content .banner_text {

            color: white;
            /*float: left;*/
            width: 130px;
            text-indent: 6px;

            margin-top: 70px;
            background: rgba(255, 255, 255, 0.39);

            font-size: 18px;
            /*font-family: Source Han Sans CN;*/
            font-weight: 400;

        }

        .banner .banner_content .banner_btn_outNode {
            width: 100%;
            float: left;
            height: 70px;
            margin-top: 35px;
            margin-left: 4px;
        }

        .banner .banner_content .banner_btn_outNode .banner_btn {
            /*width: 213px;*/
            height: 100%;
            float: left;
            /*border-radius: 107px;*/
            /*background: url(img/btn_bg.png) repeat-y;*/
            font-size: 23px;
            line-height: 70px;
            text-align: center;
            cursor: pointer;
            margin-right: 27px;

            width: 180px;
            color: #009B96;
            background: rgba(255, 255, 255, 1);
            box-shadow: 0 10px 10px rgba(255, 255, 255, 0.2);
            opacity: 1;
            border-radius: 20px;
        }

        .banner .banner_content .banner_btn_outNode .banner_btn img {
            float: right;
            margin-top: 23px;
            margin-right: 10px;
        }
    }

    .banner .banner_content .banner_btn_outNode {
        width: 100%;
        float: left;
        height: 35px;
        margin-top: 20px;
        margin-left: 4px;
    }

    .banner .banner_content .banner_btn_outNode .banner_btn {
        /*width: 213px;*/
        height: 100%;
        float: left;
        /*border-radius: 107px;*/
        /*background: url(img/btn_bg.png) repeat-y;*/
        font-size: 23px;
        line-height: 35px;
        text-align: center;
        cursor: pointer;
        margin-right: 27px;

        width: 180px;
        color: #009B96;
        background: rgba(255, 255, 255, 1);
        box-shadow: 0 10px 10px rgba(255, 255, 255, 0.2);
        opacity: 1;
        border-radius: 20px;
    }

    .banner .banner_content .banner_btn_outNode .banner_btn img {
        float: right;
        margin-top: 6px;
        margin-right: 10px
    }

    .banner .banner_content .banner_btn_outNode .btn_one {
        margin-left: 4px;
    }

    .banner .banner_content .banner_lists {
        width: 100%;
        float: left;
        height: 27px;
        margin-top: 69px;
        text-indent: -1px;
    }

    .banner .banner_content .banner_lists li {
        float: left;
        height: 20px;
        line-height: 20px;
        font-size: 20px;
        color: white;
        margin-right: 43px;
        cursor: pointer;
        position: relative;
        top: 4px;
    }

    .banner .banner_content .banner_lists .active {
        font-size: 27px;
        line-height: 27px;
        color: #fdc235;
        height: 27px;
        top: 0;
    }

    .banner .banner_content .banner_position {
        width: 80px;
        height: 10px;
        position: absolute;
        left: 50%;
        bottom: 29px;
        margin-left: -40px;
    }

    .banner .banner_content .banner_position li {
        width: 10px;
        height: 10px;
        float: left;
        background: #f0f0f0;
        border-radius: 50%;
        margin-right: 13px;
        cursor: pointer;
    }

    /*banner横幅end*/


    /* mobile banner */
    .competition_banner,.empty_item {
        box-sizing: border-box;

        box-shadow: 0 0 20px rgba(0, 155, 150, 0.2);

        /*width: calc(100% - 40px);*/
        margin-left: 20px;
        /*margin-top: 20px;*/
        margin-right: 20px;

        padding-left: 30px;
        padding-right: 30px;
    }

    /* mobile banner end */

    .competition_banner .top_node {
        width: 100%;
        height: 70px;

        float: left;
        padding-top: 20px;
        padding-bottom: 20px;
    }

    .competition_banner .top_node img {
        width: 32px;
        height: 32px;


    }

    /*.competition_banner  .competition_img{*/
    /*    margin-left: 20px;*/
    /*    margin-right: 20px;*/
    /*}*/


    .competition_banner .top_node button {
        float: left;
    }

    .competition_banner .top_node .top_node_banner_btn {
        width: 80px;
        height: 32px;
        border: 2px solid #009B96;
        opacity: 1;
        border-radius: 24px;
        float: right;


        background: #f3f3f3;
        color: #009B96;
        text-align: center;
        line-height: 28px;
        /*font-size: 2.7rem;*/
        /*font-weight: bold;*/

    }


    .pc_banner .competition_banner {
        height: 800px;
    }

    @media screen and (min-width: 780px ) {
        .pc_banner .competition_banner {
            height: 570px;
        }
    }

    @media screen and (min-width: 1024px ) {
        .pc_banner .competition_banner {
            height: 430px;
        }
    }

    @media screen and (min-width: 1280px ) {
        .pc_banner .competition_banner {
            height: 500px;
        }
    }

    .pc_banner .pc_banner_img {
        padding-right: 40px;
        height: 250px;
    }

    @media screen and (min-width: 1024px ) {
        .pc_banner .pc_banner_img {
            padding-right: 40px;
        }
    }

    .pc_banner .competition_user_name {
        margin-top: 13px;
        margin-bottom: 25px;

    }

    .pc_banner .competition_date {
        margin-bottom: 18px;
    }

    .pc_banner .competition_banner_search {
        margin-top: 20px;
        text-indent: 20px;
    }

</style>

<app id="app">
    <yq-header ref="test" :search_text="submit_info.search_text" @search="hdSearch"></yq-header>

    <main class=" pb-[0.2rem] md:w-[768px] md:mx-auto xl:w-[1280px]" style="background: white">

        <div class='banner mobile_banner'>
            <div class="competition_banner bg-white flex flex-col ">
                <div class="top_node">
                    <button v-on:click="goBackPage()"><img src="<?php showFoodAppPath('/img/arrow.png') ?>"/></button>
                    <button class='share_btn top_node_banner_btn  cursor-pointer ml-[0.1rem]'
                            @click="showShareModal(<?php echo $user_id == 0 ?>)">分享
                    </button>
                    <div class='top_node_banner_btn  cursor-pointer ml-[0.1rem]'
                         @click="creatingActivityPlayer(<?php echo $user_id == 0 ?>)">投稿
                    </div>
<!--                    <div v-if="--><?php //echo $user_id ?><!-- == competition_user_id" class="top_node_banner_btn cursor-pointer"-->
<!--                         @click="updateActivity(--><?php //echo $user_id == 0 ?><!--)">編輯-->
<!--                    </div>-->
                </div>
                <img class="competition_img " :src="competition_img_url" style="object-fit: contain;height: 200px;"/>

                <div class="h-[1rem]">
                    <div class="mt-[0.1rem] w-full overflow-ellipsis-2 text-[0.25rem] leading-[0.33rem]" style="display:inline-block;display: -webkit-box;
  overflow: hidden;">
                        {{ competition_name }}
                    </div>
                    <div class=" mt-[0.1rem] w-full h-[0.33rem] text-[0.2rem] leading-[0.33rem] truncate overflow-ellipsis-1">
                        {{ competition_user_name }} <span class="text-main-color">發起</span>
                    </div>
                </div>

                <div class="flex items-center my-[0.1rem]">
                    <div
                            class="w-[0.20rem] h-[0.20rem] mr-[0.03rem] inline-flex items-center justify-center  text-white flex-shrink-0">
                        <img class="w-[0.20rem] h-[0.20rem]" :src="local_url+ '/img/mmc/hourglass.png'">
                    </div>
                    <h2 class="text-333 text-[0.20rem] title-font font-medium">期限:{{ start_date }} -
                        {{end_date}}</h2>
                </div>

                <div class="flex my-[0.1rem] h-[1.75rem] text-333 ">
                    <div
                            class="w-[0.20rem] h-[0.20rem] mr-[0.03rem] mt-[0.05rem] inline-flex items-center justify-center  text-white flex-shrink-0">
                        <img class="w-[0.20rem] h-[0.20rem]" :src="local_url+ '/img/mmc/introduce.png'">
                    </div>
                    <span class="text-[0.20rem] title-font font-medium">介紹:  {{ content }} </span>
                </div>

                <div class="flex items-center my-[0.1rem]">
                    <div
                            class="w-[0.20rem] h-[0.20rem] mr-[0.03rem] inline-flex items-center justify-center text-white flex-shrink-0">
                        <img class="w-[0.20rem] h-[0.20rem]" :src="local_url+ '/img/mmc/hourglass.png'">
                    </div>
                    <h2 class="text-333 text-[0.20rem] title-font font-medium">點讚 : {{ competition_info.score }} - 分享 :
                        {{competition_info.share_num}}</h2>
                </div>

                <div class="flex items-center my-[0.1rem] text-[0.20rem] justify-center">
                    <span class="text-333 title-font font-medium">·投稿前請務必查看:</span>
                    <a href="/competition_legal" class="text-main-color">《參賽條件》</a>
                    <span>和</span>
                    <a href="/competition_legal" class="text-main-color">《法律責任》</a>
                </div>

                <div class="competition_banner_search hdSearch flex pl-[0.2rem] items-center w-full bg-f5 rounded-full relative"
                     style="margin-bottom: 10px;text-indent: 20px;">
                    <input placeholder="Search" type="text" v-model="search_competition_title"
                           class="hdSearch_input outline-none w-full h-full bg-white"
                           style="margin-left: 5px;text-indent: 20px;">
                    <button class="hdSearch_btn bg-main-color text-white cursor-pointer"
                            v-on:click="search_competition_player">搜寻
                    </button>
                </div>


            </div>

        </div>
        <!-- banner 横幅模块end-->

        <!-- pc_banner banner 横幅模块start-->
        <div class='banner pc_banner'>
            <div class="competition_banner bg-white flex flex-col ">
                <div class="top_node">
                    <button v-on:click="goBackPage()"><img src="<?php showFoodAppPath('/img/arrow.png') ?>"/></button>
                    <button class='share_btn top_node_banner_btn  cursor-pointer ml-[0.1rem]'
                            @click="showShareModal(<?php echo $user_id == 0 ?>)">分享
                    </button>
                    <!--                    <a-button @click="showConfirm"> 分享 </a-button>-->
                    <div class='top_node_banner_btn cursor-pointer ml-[0.1rem]'
                         @click="creatingActivityPlayer(<?php echo $user_id == 0 ?>)">投稿
                    </div>
<!--                    <div v-if="--><?php //echo $user_id ?><!-- == competition_user_id" class="top_node_banner_btn cursor-pointer"-->
<!--                         @click="updateActivity(--><?php //echo $user_id == 0 ?><!--)">編輯-->
<!--                    </div>-->
                </div>
                <section class="body-font overflow-hidden">
                    <div class="container">
                        <div class=" mx-auto flex flex-wrap">
                            <!--                            <img alt="ecommerce"-->
                            <!--                                 class="mx-auto pc_banner_img md:w-2/3 lg:w-1/2 w-full lg:h-auto object-cover object-center"-->
                            <!--                                 :src="competition_info.img_url" style="height: 300px;">-->

                            <div class="lg:w-1/3 w-full lg:h-auto lg:pl-1 lg:py-1 mt-1 lg:mt-0">
                                <img class="mx-auto lg:h-auto pc_banner_img object-cover object-center"
                                     :src="competition_info.img_url"
                                     style="object-fit: contain;width: 100%;"
                                >
                            </div>
                            <div class="lg:w-2/3 w-full lg:pl-1 lg:py-1 mt-1 lg:mt-0 relative ">
                                <h1 class="text-333 title-font font-medium mb-[0.1rem] overflow-ellipsis-2 text-[0.25rem] leading-[0.33rem]"
                                    style="display:inline-block;display: -webkit-box;
  overflow: hidden;">{{ competition_name }}</h1>
<!--                                <h2 class="competition_user_name title-font truncate overflow-ellipsis-1">-->
<!--                                    {{ competition_user_name }} <span class="text-main-color">發起</span></h2>-->
                                <div class="flex items-center my-[0.1rem]">
                                    <div
                                            class="w-[0.20rem] h-[0.20rem] mr-[0.03rem] inline-flex items-center justify-center  text-white flex-shrink-0">
                                        <img class="w-[0.20rem] h-[0.20rem]" :src="local_url+ '/img/mmc/hourglass.png'">
                                    </div>
                                    <h2 class="text-333 text-[0.20rem] title-font font-medium">期限:{{ start_date }} -
                                        {{end_date}}</h2>
                                </div>
                                <div class="flex my-[0.1rem] h-[1.75rem] text-333 ">
                                    <div
                                            class="w-[0.20rem] h-[0.20rem] mr-[0.03rem] mt-[0.05rem] inline-flex items-center justify-center  text-white flex-shrink-0">
                                        <img class="w-[0.20rem] h-[0.20rem]" :src="local_url+ '/img/mmc/introduce.png'">
                                    </div>
                                    <span class="text-[0.20rem] title-font font-medium">介紹:  {{ content }} </span>
                                </div>

                                <div class="flex items-center my-[0.1rem]">
                                    <div
                                            class="w-[0.20rem] h-[0.20rem] mr-[0.03rem] inline-flex items-center justify-center  text-white flex-shrink-0">
                                        <img class="w-[0.20rem] h-[0.20rem]" :src="local_url+ '/img/mmc/hourglass.png'">
                                    </div>
                                    <h2 class="text-333 text-[0.20rem] title-font font-medium">點讚 : {{
                                        competition_info.score }} - 分享 :
                                        {{competition_info.share_num}}</h2>
                                </div>

                                <div class="flex items-center my-[0.1rem] text-[0.20rem] justify-end absolute bottom-[0.1rem] right-[0.1rem]">
                                    <span class="text-333 title-font font-medium">·投稿前請務必查看:</span>
                                    <a href="/competition_legal" class="text-main-color">《參賽條件》</a>
                                    <span>和</span>
                                    <a href="/competition_legal" class="text-main-color">《法律責任》</a>
                                </div>
                            </div>

                        </div>
                    </div>
                </section>

                <div class="competition_banner_search hdSearch flex pl-[0.2rem] items-center w-full bg-f5 rounded-full relative"
                     style="margin-bottom: 10px;text-indent: 20px;">
                    <input placeholder="Search" type="text" v-model="search_competition_title"
                           class="hdSearch_input outline-none w-full h-full bg-white"
                           style="margin-left: 5px;text-indent: 20px;">
                    <button class="hdSearch_btn bg-main-color text-white" v-on:click="search_competition_player">搜寻
                    </button>
                </div>


            </div>
        </div>
        <!-- banner 横幅模块end-->

        <!-- 比赛item 列表模块-->
        <competition-index-player-list class="search-list mt-[4.3rem] md:mt-[4.1rem] lg:mt-[2.1rem]"
                                       :list="product_list"
                                       :themes_url="local_url"
                                       :user_id="<?php echo $user_id; ?>"></competition-index-player-list>


        <div v-if="product_list.length == 0" class="empty_item flex flex-col px-[0.15rem] static p-1 lg:w-1/4 md:w-1/2 ">
            <div class=" flex flex-col cursor-pointer w-full ">
                <div class="h-[0.3rem] mt-[0.1rem]">
                    <div class="text-center w-full overflow-ellipsis-1 text-[0.24rem] font-bold leading-[0.33rem]" style="display:inline-block;display: -webkit-box;
  overflow: hidden;">
                        暫無投稿
                    </div>

                    <div class="flex items-center flex-wrap mt-[0.1rem] w-full">
                        <span class="text-gray-400  inline-flex items-center ml-auto leading-none "></span>
                    </div>
                </div>

            </div>

        </div>
        <!-- 比赛item 列表模块 end-->


    </main>

    <div class="h-[1rem]"></div>

    <yq-footer></yq-footer>
</app>
<!--<script src="https://cdn.bootcdn.net/ajax/libs/clipboard.js/2.0.11/clipboard.js"></script>-->
<script src="<?php showFoodAppPath('/js/clipboard.js') ?>"></script>
<script>
    const local_url = '<?php echo $local_url ?>'
    const domain = '<?php echo esc_url(home_url('/')); ?>'

    //const product_cat = JSON.parse('<?php //echo json_encode($productCat) ?>//')
    new Vue({
        el: "#app",
        components: {
            'yq-header': httpVueLoader('<?php showFoodAppPath('components/yq-header-competition.vue?v=' . $vueVersion) ?>'),
            'yq-footer': httpVueLoader('<?php showFoodAppPath('components/yq-footer-competition.vue?v=' . $vueVersion) ?>'),

            'competition-index-player-list': httpVueLoader('<?php showFoodAppPath('components/ranking/yq-competition-index-player-list.vue?v=1'.$vueVersion); //$vueVersion ?>'),
        },
        data: {
            product_list: [],
            submit_info: {
                price_pre: '0',
                price_next: '0',
                order_name: '日期',
                //filter_cate: [<?php //echo $initCate; ?>//],
                search_text: ''
            },
            // filter_arr: [
            //     {
            //         title: "分類:",
            //         value: [
            //             "全部", ...product_cat
            //         ]
            //     }
            // ],
            page_num: 1,
            is_end: false,

            banner_show: true,

            a_banner: [],
            banner_current: 0,
            a_cate: [],
            a_cate_product: [],
            current_cate: 0,
            scrollFlag: true,
            bannerObj: null,


            ///比赛
            search_competition_title: '',

            aid: '0',
            start_date: '',
            end_date: '',
            content: '',

            competition_user_id: '0',

            competition_name: '',
            competition_user_name: '',
            competition_img_url: "",

            competition_info: {
                add_time: '',
                content: "",
                end_date: "",
                id: "0",
                img_id: "",
                img_url: "",
                name: "",
                score: "0",
                share_num: "0",
                start_date: "",
                status: "1",
                update_time: "",
                user_id: "0",
                user_name: ""
            },


        },
        created() {
            this.aid = '<?php echo $aid ?>';

            if (sessionStorage.search_text) {
                this.submit_info.search_text = sessionStorage.search_text
                sessionStorage.search_text = ''
            }

            this.get_competition_player()

            this.getCompetitionListInfo()
        },
        mounted() {
            window.addEventListener('scroll', this.handleScroll)

            //if (window.localStorage) {
            //    console.log("This browser supports localStorage");
            //    // alert('This browser supports localStorage');
            //} else {
            //    // alert('This browser does NOT support localStorage');
            //}
            //
            //localStorage.user_id = '<?php //echo $user_id; ?>//'; // this.user_id;
            //localStorage.user_name = '<?php //echo $username; ?>//';
            //console.log('user_id => ' + localStorage.user_id + ' username => ' + localStorage.username);
            // window.open(domain + '/creating_activity_page?id=0&action=add', '_blank')
        },
        destroyed() {
            window.removeEventListener('scroll', this.handleScroll)
        },

        methods: {
            moment,
            clearFilter() {
                this.submit_info = {
                    price_pre: '0',
                    price_next: '0',
                    order_name: '日期',
                    filter_cate: [],
                    search_text: ''
                };
                this.searchSubmit()
            },

            //creatingActivity() {
            //    if (window.localStorage) {
            //        console.log("This browser supports localStorage");
            //        // alert('This browser supports localStorage');
            //    } else {
            //        alert('This browser does NOT support localStorage');
            //    }
            //
            //    localStorage.user_id = '<?php //echo $user_id; ?>//'; // this.user_id;
            //    localStorage.user_name = '<?php //echo $username; ?>//';
            //    console.log('user_id => ' + localStorage.user_id + ' username => ' + localStorage.username);
            //    window.open(domain + '/creating_competition_page?id=0&action=add', '_blank')
            //},


            handleScroll() {
                let scrollTop = document.documentElement.scrollTop || document.body.scrollTop
                let windowHeight = document.documentElement.clientHeight || document.body.clientHeight
                let scrollHeight = document.documentElement.scrollHeight || document.body.scrollHeight
                if (scrollTop + windowHeight == scrollHeight && !this.is_end) {
                    this.page_num = this.page_num + 1
                    this.get_competition_player()
                }
            },
            searchSubmit() {
                this.page_num = 1
                this.get_competition_player()
            },
            hdSearch(e) {
                this.submit_info.search_text = e
                this.searchSubmit()
            },

            search_competition_player() {
                this.page_num = 1;
                this.get_competition_player();
            },

            async get_competition_player() {
                const hide = antd.message.loading('加載中...');

                // let res = await axios({
                //     method: 'post',
                //     url: '/api/',
                //     data: Qs.stringify({
                //         module: 'product',
                //         action: 'get_product_by_search',
                //         web_type: 'MedicalMediaChannel',
                //         limit: 24,
                //         page_num: this.page_num,
                //         ...this.submit_info
                //     })
                // });

                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    // data: Qs.stringify({
                    //     module: 'ranking',
                    //     action: 'index',
                    //     a: 'getActivityListInfoByPage',
                    //     limit: 24,
                    //     pageNum: this.page_num,
                    //     ...this.submit_info
                    // })

                    data: Qs.stringify({
                        module: 'ranking',
                        action: 'index',
                        a: 'playerlist',
                        pageSize: 24,
                        pageNum: this.page_num,
                        aid: this.aid,
                        status: '1',
                        title: this.search_competition_title,
                    })
                });
                hide();
                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        console.log(data.data)
                        if (data.data.length > 0) {
                            if (this.page_num == 1) {
                                this.product_list = data.data
                            } else {
                                this.product_list = this.product_list.concat(data.data)
                            }
                            // console.log(this.product_list)
                        } else {
                            // antd.message.info('已顯示所有產品');
                            this.is_end = true
                        }
                    }
                }
            },

            getCompetitionListInfo() {
                axios({
                    method: 'post',
                    // url: '//dk.smart1space.site/api',
                    url: '/api',
                    data: Qs.stringify({
                        'module': 'ranking',
                        'action': 'index',
                        'a': 'getActivityListInfoByPage',
                        id: this.aid,

                        pageNum: 1,
                        pageSize: 1,
                    })
                    // , headers: {
                    //     'Authorization': 'Bearer ' + this.token,
                    // }
                })
                    .then((response) => {
                        // console.log(response);
                        let data = response.data
                        // console.log(data);
                        // console.log("getCompetitionListInfo data => ", data);

                        if (data.rc === 0) {
                            console.log("Competition  => ", data.data[0]);
                            var post_data = data.data[0];

                            this.competition_info = post_data;

                            this.id = post_data.id;
                            this.competition_user_id = post_data.user_id;

                            this.competition_name = post_data.name;
                            this.competition_user_name = post_data.user_name;
                            this.content = post_data.content;

                            this.start_date = post_data.start_date;

                            this.end_date = post_data.end_date;// post_data.end_date;


                            // this.status = post_data.status;

                            // this.radioValue = parseInt(this.status);
                            // console.log("status => ", this.status);

                            this.img_id = post_data.img_id;
                            this.competition_img_url = post_data.img_url;

                            // this.video_file_id = post_data.video_file_id;
                            // this.video_url = post_data.video_url;

                            // this.videoFileList = [this.video_file_id];
                        }
                    })
                    .catch(function (error) {
                        console.log(error);
                    });
            },

            // 创建活动用戶
            creatingActivityPlayer(noLogin = false) {
                console.log('showShareModal => noLogin ' + noLogin)

                if (noLogin) {
                    this.$refs.test.showLoginModel()
                } else {
                    if (window.localStorage) {
                        console.log("This browser supports localStorage");
                        // alert('This browser supports localStorage');
                    } else {
                        // alert('This browser does NOT support localStorage');
                    }

                    localStorage.user_id = '<?php echo $user_id; ?>'; // this.user_id;
                    localStorage.user_name = '<?php echo $username; ?>';
                    console.log('user_id => ' + localStorage.user_id + ' username => ' + localStorage.username);
                    // window.open(domain + '/creating_activity_player_page?aid=1&id=0&action=add', '_blank')
                    window.open(domain + '/creating_competition_item_page?aid=<?php echo $aid; ?>&id=0&action=add', '_self')
                }
            },

            // 編輯活動
            //updateActivity(noLogin = false) {
            //    console.log('showShareModal => noLogin ' + noLogin)
            //
            //    if (noLogin) {
            //        this.$refs.test.showLoginModel()
            //    } else {
            //        if (window.localStorage) {
            //            console.log("This browser supports localStorage");
            //            // alert('This browser supports localStorage');
            //        } else {
            //            alert('This browser does NOT support localStorage');
            //        }
            //
            //        localStorage.user_id = '<?php //echo $user_id; ?>//'; // this.user_id;
            //        localStorage.user_name = '<?php //echo $username; ?>//';
            //        console.log('user_id => ' + localStorage.user_id + ' username => ' + localStorage.username);
            //        // window.open(domain + '/creating_activity_player_page?aid=1&id=0&action=add', '_blank')
            //        window.open(domain + '/creating_competition_page?id=<?php //echo $aid; ?>//&action=update', '_self')
            //    }
            //},
            goBackPage() {
                console.log('goBackPage')
                // history.back();
                window.open('/competition_search', '_self');
            },


            // 分享
            showShareModal(noLogin = false) {
                console.log('showShareModal => noLogin ' + noLogin)

                if (noLogin) {
                    this.$refs.test.showLoginModel()
                } else {
                    const goUrl = window.location.href;
                    console.log(goUrl);

                    /* 复制内容到文本域 */
                    // navigator.clipboard.writeText(goUrl);
                    new ClipboardJS('.share_btn', {
                        text: function (trigger) {
                            // return document.getElementById("myInput").value;
                            return goUrl;
                        }
                    }).on('success', function (e) {
                        // alert("复制成功!!!");
                        // e.clearSelection();
                    }).on('error', function (e) {
                        // alert('Error!');
                    });

                    /* 弹出已复制的内容 */
                    // alert("分享 : " + goUrl);

                    this.$info({
                        title: '分享',
                        content: "比賽網址已複製 : " + goUrl,
                        onOk() {},
                    });

                    // this.$confirm({
                    //     title: '分享',
                    //     content: '分享 URL',
                    //     // onOk() {
                    //     //     const goUrl = window.location.href;
                    //     //     console.log(goUrl);
                    //     //
                    //     //     /* 复制内容到文本域 */
                    //     //     navigator.clipboard.writeText(goUrl);
                    //     //
                    //     //     /* 弹出已复制的内容 */
                    //     //     alert("分享 : " + goUrl);
                    //     //
                    //     //     // return new Promise((resolve, reject) => {
                    //     //     //     setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);
                    //     //     // }).catch(() => console.log('Oops errors!'));
                    //     // },
                    //     onCancel() {},
                    // });
                }

            },

        }
    })
</script>

<?php get_footer('food'); ?>