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_player_vote_page.php
<?php
/* Template Name: competition_player_vote_page */

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

$vueVersion = time();

$user = wp_get_current_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;
    }
}

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

$aid = CheckFunc::checkInputInt2('aid');
$id = CheckFunc::checkInputInt2('id');

?>
<style>
    .search-list {
        background-color: white;
    }

    /*#topBanner {*/
    /*    width: 100%;*/
    /*    height: 400px;*/
    /*    background: linear-gradient(315deg, #00839B 0%, #1ABFBA 100%);*/
    /*    opacity: 1;*/
    /*}*/

    .list_item {
        /*width: 500px;*/
        /*height: 740px;*/
        background: rgba(255, 255, 255, 0.39);
        box-shadow: 0 0 20px rgba(0, 155, 150, 0.2);
        opacity: 1;
    }

    /*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;
    }

    @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 {
        box-sizing: border-box;

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

        /*margin-left: 20px;*/
        /*margin-right: 20px;*/

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

    /* mobile banner end */

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

        float: left;
        padding: 10px;
    }

    .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: 506px;
    }

    .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: 40px;
    }

    .current_player_zan_btn {
        /*width: 100px;*/
        height: 40px;
        background: rgba(255, 109, 0, 1);
        box-shadow: 0 10px 10px rgba(255, 109, 0, 0.2);
        border-radius: 20px;
        /*padding-top: 8px;*/
        line-height: 40px;
    }

    .current_player_zan_btn:hover {
        background: rgba(255, 109, 0, 0.2);
    }

    .current_player_unlike_btn {
        height: 40px;
        background: #999999;
        /*box-shadow: 0 10px 10px #333333;*/
        border-radius: 20px;
        line-height: 40px;
    }

    .current_player_unlike_btn:hover {
        background: #666666;
    }

    .current_player_info .current_player_info_declaration {
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 5;
        /*(两行文字)*/
        -webkit-box-orient: vertical;
    }


</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="competition_banner bg-white flex flex-col w-full mx-auto px-0.5">
            <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 v-if="-->
                <?php //echo $user_id ?><!-- == current_player.user_id" class="top_node_banner_btn cursor-pointer" @click="creatingActivityPlayer(-->
                <?php //echo $user_id == 0 ?><!--)">編輯</div>-->
            </div>
        </div>

        <!--        用户信息模块-->
        <section class="text-gray-600 body-font">
            <div class="container mx-auto flex px-1 pb-1 items-center justify-center flex-col">
                <!--                <img class="lg:w-2/6 md:w-3/6 w-5/6 mb-10 object-cover object-center rounded" alt="hero" src="https://dummyimage.com/720x600">-->
<!--                md:w-5/6 lg:w-4/6-->
                <video id="video_source" class=" w-full  object-cover object-center "
                       :poster="current_player.avatar" controls>
                    <!--                    <source id="video_source" :src="current_player.video_url">-->
                    <!--                            type="video/mp4">-->
                    您的浏览器不支持 HTML5 video 标签。
                </video>
                <div class="text-left w-full current_player_info mt-[0.1rem]">

                    <div class="flex flex-col sm:flex-row justify-between">
                        <div class="flex-grow text-333" style="margin-right: 20px">
                            <h2 class="title-font font-bold text-[0.28rem] ">{{current_player.title}}</h2>
                            <div class=" rounded flex h-1 items-center my-[0.2rem]">
                                <img class=" w-[0.4rem] h-[0.4rem] flex-shrink-0  mr-[0.1rem] rounded"
                                     :src="current_player.wp_user_avatar_url"/>
                                <span class="title-font text-[0.20rem] text-333">{{current_player.wp_user_display_name}}</span>
                            </div>
                            <div class="current_player_info_declaration text-[0.16rem] mb-1 " style="height:100px">
                                簡介 {{current_player.declaration}}
                            </div>

                            <!--                            <div class="title-font font-medium text-[0.20rem] text-333">-->
                            <!--                                <img class=" w-[0.32rem] h-[0.32rem] "-->
                            <!--                                     :src="current_player.wp_user_avatar_url"/>{{current_player.nickname}}</div>-->


                        </div>
                        <div class="flex-shrink-0 flex ant-row-flex-end">
                            <button v-if="competition_have_vote"
                                    class="current_player_zan_btn inline-flex border-0 px-1 rounded text-[0.16rem] text-white"
                                    v-on:click="vote(current_player.aid,current_player.id)"
                            >
                                <img class=" w-[0.32rem] h-[0.32rem] mr-[0.1rem]"
                                     src="<?php showFoodAppPath('/img/mmc/click_zan.png') ?>" style="margin-top: 8px"/>
                                已點讚
                            </button>

                            <button v-if="!competition_have_vote"
                                    class="current_player_unlike_btn inline-flex border-0 px-1 rounded text-[0.16rem] text-white"
                                    v-on:click="vote(current_player.aid,current_player.id)"
                            >
                                <img class=" w-[0.32rem] h-[0.32rem] mr-[0.1rem]"
                                     src="<?php showFoodAppPath('/img/mmc/zan.webp') ?>" style="margin-top: 8px"/>
                                點讚
                            </button>
                        </div>
                    </div>

                </div>
            </div>
        </section>
        <!--        用户信息模块 end-->

        <!-- 用户列表模块-->

        <player-list :list="product_list" :themes_url="local_url"></player-list>
        <!-- 用户列表模块 end-->

    </main>

    <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) ?>'),

            'player-list': httpVueLoader('<?php showFoodAppPath('components/ranking/yq-competition_player_vote_page_player_list.vue?v=' . $vueVersion) ?>'),
        },
        data: {
            product_list: [],
            submit_info: {
                price_pre: '0',
                price_next: '0',
                order_name: '日期',
                search_text: ''
            },
            // filter_arr: [
            //     {
            //         title: "分類:",
            //         value: [
            //             "全部", ...product_cat
            //         ]
            //     }
            // ],
            page_num: 1,
            current_player: {
                add_time: '',
                aid: '',
                avatar: '',
                declaration: '',
                id: '',
                img_id: '',
                nickname: '',
                ref: '',
                score: '',
                status: '',
                update_time: '',
                video_file_id: '',
                video_url: '',
            },

            scrollFlag: true,
            competition_have_vote: false,

            ///比赛
            id: '0',
            aid: '0',
            start_date: '',
            end_date: '',
            content: '',

            competition_name: '',
            competition_user_name: '',
            competition_img_url: "",
        },
        created() {
            <?php
            $id = CheckFunc::checkInputInt2('id');
            $aid = CheckFunc::checkInputInt2('aid');
            ?>
            this.id = '<?php echo $id ?>';
            this.aid = '<?php echo $aid ?>';

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

            this.get_current_player()

            this.get_same_ranking_player_list()
        },
        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()
            },

            searchSubmit() {
                this.page_num = 1
                this.get_product()
            },
            hdSearch(e) {
                this.submit_info.search_text = e
                this.searchSubmit()
            },
            async CheckVote(isVote = false) {
                let res = await axios({
                    method: 'post',
                    url: '/api/',

                    data: Qs.stringify({
                        module: 'ranking',
                        action: 'index',
                        a: 'CheckVote',
                        activity_id: this.aid,
                        user_id: '<?php echo $user_id; ?>',
                        player_id: this.current_player.id,
                    })
                });
                // console.log('CheckVote ', res)
                if (res.status == 200) {
                    let data = res.data;

                    console.log('CheckVote ', data)
                    if (data.rc == 2201) {
                        this.competition_have_vote = true
                        if (isVote) {
                            antd.notification.success({
                                message: '投票成功',
                            });
                        }
                    } else {
                        this.competition_have_vote = false
                        if (isVote) {
                            antd.notification.success({
                                message: '取消 投票成功',
                            });
                        }

                    }
                }
            },

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

                let res = await axios({
                    method: 'post',
                    url: '/api/',

                    data: Qs.stringify({
                        module: 'ranking',
                        action: 'index',
                        a: 'playerlist',
                        limit: 1,
                        pageNum: 1,
                        aid: this.aid,
                        id: this.id,
                    })
                });
                hide();
                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        // console.log(data.data)
                        if (data.data.length > 0) {
                            this.current_player = data.data[0]
                            console.log('current_player ', this.current_player)

                            this.$nextTick(() => {
                                let video_source = document.querySelector('#video_source')
                                video_source.poster = this.current_player.video_url.img_url
                                video_source.src = this.current_player.video_url
                                // video_source.play()
                            })

                            // if (this.page_num == 1) {
                            //     this.product_list = data.data
                            // } else {
                            //     this.product_list = this.product_list.concat(data.data)
                            // }

                        } else {
                            // antd.message.info('已顯示所有產品');
                            this.is_end = true
                        }
                    }
                }

                await this.CheckVote()
            },

            async get_same_ranking_player_list() {
                // 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: 'playerlist',
                        pageSize: 6,
                        pageNum: this.page_num,
                        aid: this.aid,
                        status: 1,
                    })
                });
                // hide();
                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        console.log(data.data)
                        if (data.data.length > 0) {
                            this.product_list = data.data
                            // console.log(this.product_list)
                        } else {
                            // antd.message.info('已顯示所有產品');
                            this.is_end = true
                        }
                    }
                }
            },

            vote(aid, id) {
                //投票
                var uid = <?php echo $user_id; ?> // localStorage.getItem('uid')
                if (uid == null) {
                    this.$refs.test.showLoginModel()
                    // alert("请先登录")
                    // window.location.href = "https://store.jmwebseo.cn/gin-ranking-html/login.html";
                    return false;
                }
                if (uid == "") {
                    this.$refs.test.showLoginModel()
                    // alert("请先登录")
                    // window.location.href = "https://store.jmwebseo.cn/gin-ranking-html/login.html";
                    return false;
                }
                if (id == "") {
                    // alert("请选择要操作的选手")
                    return false;
                }

                console.log('uid => ', uid);
                axios({
                    method: 'post',
                    headers: {'content-type': 'application/x-www-form-urlencoded'},
                    // url: '/api/vote/add',
                    url: '/api',
                    // url: 'https://store.jmwebseo.cn/no_auth_server',
                    data: {
                        'module': 'ranking',
                        'action': 'index',
                        'a': 'UpdatePlayerScore',
                        'activity_id': aid,
                        'user_id': uid,
                        'player_id': id,

                        // userId: uid,
                        // playerId: id,
                    }
                }).then((res) => {

                    if (res.data.rc == 0) {
                        // this.getPlayers()
                        // alert("投票成功")
                        this.CheckVote(true)
                    } else {
                        // alert("投票失败," + res.data.msg)
                        antd.notification.error({
                            message: "投票失败," + res.data.msg,
                        });
                        return false;
                    }
                })
            },

            //creatingActivityPlayer(noLogin = false) {
            //    console.log('creatingActivityPlayer => 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=<?php //echo $id; ?>//&action=update', '_blank')
            //    }
            //
            //},
            goBackPage() {
                console.log('goBackPage')
                // history.back();
                window.open('/competition_index?aid=<?php echo $aid; ?>', '_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() {},
                    });
                // }
            },
        }
    })
</script>

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