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

get_header('MedicalMediaChannel');

//獲取預設info
//$home_info = new stdClass;
global $MMC_index_post_id; //114;
$home_info = getHomeInfo($MMC_index_post_id);

//print_r('home_info');
//print_r($home_info);
$debug = true;
$vueVersion = $debug ? time() : '1';
$doMain = get_template_directory_uri();
//echo $doMain;

$videoHTML = '';
if ($home_info->zone_video_url != '') {
    if (strYoutubeContains($home_info->zone_video_url)) {
        $videoHTML = '<iframe  class="w-full "  src="' . $home_info->zone_video_url . '" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>';
    } else {
        $videoHTML = '<video class="zone_video" controls>
    <source src="' . $home_info->zone_video_url . '" type="video/mp4">
    您的浏览器不支持Video标签。
    </video>';
    }
}

?>
<style>
    #app {
        background-color: #1DBAFF;
    }

    .menu_a_div a:hover {
        color: #FAEE00;
        /*color: #1dffff;*/
    }

    @media only screen and (min-width: 600px) {
        .zone_video {
            height: 60%;
        }
    }

    @media only screen and (max-width: 600px) {
        .zone_video {
            height: auto;
        }
    }
</style>
<app id="app">
    <yq-header></yq-header>

    <div id="main_bg">
        <main class=" w-100 py-[0.2rem] md:w-[768px] md:mx-auto xl:w-[1280px]">

            <!-- 輪播 h-[2.3rem] md:h-[6.6rem] -->
            <div v-if="a_banner.length > 0" class=" relative w-100 px-[0.3rem]">
                <div @click="toBannerLink()" class=" w-full " id="banner">
                    <img v-for="(item, key) in a_banner" :key="'bannerimg'+item.id" v-show="banner_current == key"
                         :class="banner_show?' opacity-100':' opacity-0'"
                         class=" transition-opacity duration-700 cursor-pointer rounded-[0.2rem] w-full h-full bg-main"
                         :src="item.banner_url">
                </div>

                <!-- 指示點 -->
                <div class=" absolute bottom-[0.1rem] left-1/2 -translate-x-1/2 flex justify-center">
                    <div v-for="(item, key) in a_banner" :key="'banner'+item.id"
                         :class="banner_current==key?'bg-white':'bg-sub-white'"
                         class=" ml-[0.2rem] first:ml-0 w-[0.33rem] h-[0.04rem]"></div>
                </div>

                <img @click="preBanner()"
                     class=" cursor-pointer w-[0.66rem] h-[0.66rem] md:w-[1rem] md:h-[1rem] absolute left-[-0.04rem] md:left-[-0.16rem] top-1/2 -translate-y-1/2"
                     src="<?php showFoodAppPath('img/scroll-left.png') ?>">
                <img @click="nextBanner()"
                     class=" cursor-pointer w-[0.66rem] h-[0.66rem] md:w-[1rem] md:h-[1rem] absolute right-[-0.04rem] md:right-[-0.16rem] top-1/2 -translate-y-1/2"
                     src="<?php showFoodAppPath('img/scroll-right.png') ?>">
            </div>
            <!-- 輪播 end -->

            <!--  relative-->
            <section class="">
                <div class="container px-1 py-1 mx-auto flex sm:flex-nowrap flex-wrap">
                    <!--                    overflow-hidden -->
                    <!--                    md:w-1/2-->
                    <div class="md:w-2/3 flex items-end justify-start relative">
                        <!--                        overflow-hidden-->
                        <div class="rounded-sm   absolute inset-0">
                            <?php echo $videoHTML; ?>

                            <!--                            <video controls>-->
                            <!-- https://ossvideo.tangcn.com.cn/res/ggc/wp-content/uploads/2022/11/%E7%AC%AC%E4%B8%89%E8%AF%BE%E2%80%94%E2%80%94%E7%BB%93%E8%B4%A6.mp4-->
                            <!--                                <source src="-->
                            <?php //echo get_template_directory_uri(); ?><!--/food-app/img/清明节测试.mp4"-->
                            <!--                                        type="video/mp4">-->

                            <!--                                <source src="-->
                            <?php //echo $home_info->zone_video_url; ?><!--" type="video/mp4">-->
                            <!--                                您的浏览器不支持Video标签。-->
                            <!--                            </video>-->
                        </div>

                        <div class="container w-full flex justify-between items-center mt-[5rem] md:mt-2 mb-[0.3rem] md:mt-0 bg-white">
                            <yq-zone-zone-list :list="zone_list" class="z-20"></yq-zone-zone-list>
                        </div>

                    </div>

                    <!--                    md:w-1/2-->
                    <div class="md:w-1/3 flex flex-col w-full ml-0 md:ml-[0.2rem] mt-0 ">

                        <div style="background-color: #FFFFFF;"
                             class="ml-0 mr-0 md:ml-[0.26rem] mb-[0.3rem] md:mr-[0.26rem]">
                            <div style="color: #333333"
                                 class="text-[0.36rem] mb-1 font-bold title-font ml-1 mt-1 text-left ">所有產品
                                <span class=" mb-[0.2rem] text-333 text-[0.2rem]">為您推薦特惠好物</span>
                            </div>

                            <yq-zone-hot-list :list="product_list_one"></yq-zone-hot-list>

                            <div class=" mt-[0.3rem] h-[0.32rem] w-full  text-center">
                                <a href="/products_search">
                                    <button style="background: #1DBAFF"
                                            class="py-[0.2rem] px-[1rem] text-white BRS-main-color hover:bg-green-500 text-[0.2rem] rounded-[0.05rem] ">
                                        所有產品
                                    </button>
                                </a>
                            </div>

                            <div class=" mt-[0.6rem] md:mb-[0.1rem] h-[0.1rem] text-center">
                                <!--                                <p class="text-[0.16rem] text-333">距今期結束: 00:00:00</p>-->
                            </div>
                        </div>

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

    <yq-footer></yq-footer>
</app>

<script>
    const local_url = '<?php echo $local_url ?>'
    const home_info = JSON.parse('<?php echo json_encode($home_info) ?>')
    new Vue({
        el: "#app",
        components: {
            'yq-zone-hot-list': httpVueLoader('<?php showFoodAppPath('components/yq-zone-hot-list-MMC.vue?v=' . $vueVersion); ?>'),
            'yq-zone-zone-list': httpVueLoader('<?php showFoodAppPath('components/yq-zone-zone-list-MMC.vue?v=' . $vueVersion); ?>'),
            'yq-header': httpVueLoader('<?php showFoodAppPath('components/yq-header-MMC.vue?v=' . $vueVersion) ?>'),
            'yq-footer': httpVueLoader('<?php showFoodAppPath('components/yq-footer-MMC.vue?v=' . $vueVersion) ?>'),
        },
        created() {
            this.get_banner()
            this.get_product_list_one()
            // this.get_product_list_two()

            this.linkBanner()
        },
        data: {
            banner_show: true,
            zone_list: [
                {
                    id: 28,
                    title: "電子產品專區",
                    img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1012@2x.png",
                    url: "/products_search/?cat=電子產品"
                }, {
                    id: 29,
                    title: "健康產品專區",
                    img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1257@2x.png",
                    url: "/products_search/?cat=健康產品"
                }, {
                    id: 30,
                    title: "醫藥保健",
                    img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1258@2x.png",
                    url: "/products_search/?cat=醫藥保健",
                }, {
                    // 健康專欄(影視專區)
                    id: 31,
                    title: "健康專欄",
                    img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1259@2x.png",
                    url: "#",
                }, {
                    id: 999,
                    title: "醫學媒體頻道",
                    img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1260@2x.png",
                    url: "/medicine-zone"
                },
            ],
            product_list_one: [],

            a_banner: [],
            banner_current: 0,
            a_cate: [],
            a_cate_product: [],
            current_cate: 0,
            scrollFlag: true,
            bannerObj: null
        },
        methods: {
            linkBanner() {
                this.bannerObj = setInterval(() => {
                    this.nextBanner()
                }, 8000);
            },
            toBannerLink() {
                if (this.a_banner[this.banner_current].banner_link) {
                    window.open(this.a_banner[this.banner_current].banner_link, '_blank')
                    // window.open(this.a_banner[this.banner_current].banner_url, '_blank')
                }
            },
            preBanner() {
                clearInterval(this.bannerObj)
                this.bannerObj = null

                this.banner_show = false

                setTimeout(() => {
                    let temp = this.banner_current - 1
                    this.banner_current = temp < 0 ? this.a_banner.length - 1 : temp

                    this.banner_show = true

                    this.linkBanner()
                }, 700);

            },
            nextBanner() {
                clearInterval(this.bannerObj)
                this.bannerObj = null

                this.banner_show = false

                setTimeout(() => {
                    let temp = this.banner_current + 1
                    this.banner_current = temp > this.a_banner.length - 1 ? 0 : temp

                    this.banner_show = true

                    this.linkBanner()
                }, 700);
            },
            async get_banner() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'banner',
                        action: 'get_banner',
                        banner_type: 4
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.a_banner = data.res
                    }
                }
            },

            async get_product_list_one() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'product',
                        action: 'get_product_by_cate',
                        cate: [home_info.cate1],
                        limit: 4
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.product_list_one = data.res
                    }
                }

            },

            async get_cate() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'cate',
                        action: 'r_cate'
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.a_cate = data.res.cate_list
                        this.a_cate_product = data.res.product_list
                    }
                }

                if (this.scrollFlag) {
                    this.scrollFlag = false
                    setTimeout(() => {
                        this.$nextTick(() => {
                            if (window.location.href.indexOf('#') > -1) {
                                window.scrollTo({
                                    top: document.getElementById(window.location.href.split('#')[1]).offsetTop,
                                    behavior: 'smooth'
                                })
                            }
                        })
                    }, 0);
                }
            },
            async get_cate_product(key) {
                this.current_cate = key
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'product',
                        action: 'get_product_by_cate',
                        cate: [this.a_cate[this.current_cate]],
                        limit: 6
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.a_cate_product = data.res
                    }
                }
            },


            async get_product_list_two() {
                let res = await axios({
                    method: 'post',
                    url: '/api/',
                    data: Qs.stringify({
                        module: 'product',
                        action: 'get_product_by_date',
                        limit: 4
                    })
                });

                if (res.status == 200) {
                    let data = res.data;
                    if (data.rc == 0) {
                        this.product_list_two = data.res
                    }
                }
            }
        }
    })
</script>
<?php get_footer('food'); ?>