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

get_header('BizRoadShow');

//獲取預設info
$home_info = new stdClass;
$index_post = 112;
$home_info = getHomeInfo($index_post);

//print_r('home_info');
//print_r($home_info);

$vueVersion = time();
$doMain = get_template_directory_uri();
//echo $doMain;
?>
<style>
    #app {
        background: #333333;
    }
</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]">

            <!-- 輪播 -->
            <div v-if="a_banner.length > 0" class=" relative w-100 px-[0.3rem]">
                <div @click="toBannerLink()" class=" w-full h-[2.3rem] md:h-[4.6rem]">
                    <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 -->
                    <div class="lg:w-2/3 md:w-1/2 flex items-end justify-start relative">
                        <!--                        overflow-hidden-->
                        <div class="rounded-sm   absolute inset-0">
                            <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 style="background: #3e3e3e;" class="container w-full flex justify-between items-center mt-[5rem] md:mt-2 mb-[1rem] md:mt-0 ">
                            <yq-zone-zone-list :list="zone_list" class="z-20"></yq-zone-zone-list>
                        </div>


                    </div>

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

                        <div style="background: #3e3e3e;" class="m-[0.26rem]">
                            <p style="color: #FF6D00" class="text-BRS-main-color text-[0.36rem] mb-1 font-medium title-font text-center">今期熱門
                                <span class=" mb-[0.2rem] text-white text-[0.2rem]">為您推薦特惠好物</span>
                            </p>

                            <!-- -m-4  -->
                            <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="/food-search">
                                    <button style="background: #FF6D00" 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.6rem] h-[1.65rem] text-center">
                                <p class="text-[0.16rem] text-white">距今期結束: 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-bizroadshow.vue?v=' . $vueVersion); ?>'),

            'yq-zone-zone-list': httpVueLoader('<?php showFoodAppPath('components/yq-zone-zone-BizRoadShow-list.vue?v=' . $vueVersion); ?>'),

            'yq-header': httpVueLoader('<?php showFoodAppPath('components/yq-header-bizroadshow.vue?v='. $vueVersion) ?>'),
            //'yq-footer': httpVueLoader('<?php //showFoodAppPath('components/yq-footer.vue?v=2') ?>//'),
            'yq-footer': httpVueLoader('<?php showFoodAppPath('components/yq-footer-bizroadshow.vue?v=2') ?>'),
        },
        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/BizRoadShow/%E7%BB%84%201012@2x.png",
                    url: ""
                }, {
                    id: 29,
                    title: "電子產品專區",
                    img_url: "<?php echo $doMain; ?>/food-app/img/BizRoadShow/%E7%BB%84%201240@2x.png",
                }, {
                    id: 30,
                    title: "影視專區",
                    img_url: "<?php echo $doMain; ?>/food-app/img/BizRoadShow/%E7%BB%84%201241@2x.png",
                    url: "",
                }, {
                    id: 31,
                    title: "醫藥保健",
                    img_url: "<?php echo $doMain; ?>/food-app/img/BizRoadShow/%E7%BB%84%201242@2x.png",
                    url: "",
                }, {
                    id: 999,
                    title: "醫學媒體頻道",
                    img_url: "<?php echo $doMain; ?>/food-app/img/BizRoadShow/%E7%BB%84%201243@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_url) {
                    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: 2
                    })
                });

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