File: /var/www/dk/wp-content/themes/food/food-app/components/yq-header-competition.vue
<template>
<div>
<div class=" p-[0.2rem] main-footer w-100 md:w-[768px] md:mx-auto xl:w-[1280px]">
<!-- <div class=" hidden md:flex h-[0.62rem]"></div>-->
<div class=" container mx-auto flex flex-wrap flex-row items-center">
<div class="flex ">
<a href="/competition_search/" class="flex order-first title-font font-medium items-center lg:items-center lg:justify-center">
<img class="logo_img" :src="local_url+'/img/mmc/title_logo.webp'" alt="user"/>
</a>
<!-- <div class='topLink_center_slider'>-->
<!-- <button-->
<!-- class="topLink_center_slider_btn inline-flex items-center bg-gray-100 border-0 focus:outline-none hover:bg-gray-200 rounded text-[0.16rem] ">-->
<!-- 深水埗區-->
<!-- <img class="header_location_img" :src="local_url+'/img/mmc/location.webp'" alt="user"/>-->
<!-- </button>-->
<!-- </div>-->
</div>
<div class="flex-auto inline-flex justify-end ">
<!-- <div class="hdSearch ml-auto flex pl-[0.2rem] items-center w-full bg-f5 rounded-full relative">-->
<!-- <img style="height: 28px;width: 28px" class=" flex-shrink-0 cursor-pointer"-->
<!-- :src="local_url+'img/search.png'" alt="search">-->
<!-- <input v-model="search" @keyup.enter="hdSearch" placeholder="Search"-->
<!-- class="hdSearch_input leading-2 outline-none w-full h-full bg-white" type="text">-->
<!-- <button @click="hdSearch" class="hdSearch_btn bg-main-color text-white cursor-pointer">搜寻</button>-->
<!-- </div>-->
<div v-if="user_info.ID > 0" class="text-center mt-0.5 mr-[0.1rem]">
<!-- <a href="/mmc-user/">-->
<a href="/competition_user_info/">
<!-- <img-->
<!-- :src="local_url+'img/user.png'"-->
<!-- class="w-[0.46rem] h-[0.46rem]">-->
<img
:src="user_info.wp_user_avatar_url"
class="w-[0.46rem] h-[0.46rem] rounded">
</a>
</div>
<a-dropdown v-if="user_info.ID > 0" class=" mt-0.5 " :trigger="['click']">
<div class=" flex items-center cursor-pointer">
<!-- <img class="w-[0.46rem] h-[0.46rem]" :src="local_url+'img/user.png'" alt="user"/>-->
<div class=" ml-[0.16rem] text-black text-[0.2rem] leading-[0.2rem]">{{user_info.user_name.substring(0, 20)}}</div>
</div>
<a-menu slot="overlay">
<a-menu-item key="0">
<a @click="loginOut">退出</a>
</a-menu-item>
</a-menu>
</a-dropdown>
<div v-if="user_info.ID == 0" @click="showLoginModel()"
class=" cursor-pointer text-[0.2rem] leading-[0.2rem] mt-0.5">登入/註冊
</div>
</div>
</div>
<!-- <header class=" w-100 md:w-[768px] md:mx-auto h-[1rem] flex xl:hidden items-center px-[0.3rem]">-->
<!-- <a href="/" class=" flex ml-[0.08rem] items-center flex-1">-->
<!-- <img class="flex md:hidden w-[1.87rem]" :src="local_url+'/img/mmc/title_logo.webp'" alt="logo"/>-->
<!-- <div class=" text-[0.35rem] leading-[0.48rem] font-bold text-black ml-[0.1rem]"></div>-->
<!-- </a>-->
<!-- <a-dropdown :trigger="['click']">-->
<!-- <img class=" w-[0.48rem] h-[0.48rem] ml-[0.2rem] flex-shrink-0" :src="local_url+'img/mmc/menu.webp'"-->
<!-- alt="menu"/>-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item v-for="item in menu_list" :key="item.id">-->
<!-- <a :href="item.path">{{ item.title }}</a>-->
<!-- </a-menu-item>-->
<!-- </a-menu>-->
<!-- </a-dropdown>-->
<!-- </header>-->
<!-- hidden xl:flex hidden xl:inline-->
<!-- <div class="flex items-center text-1E2B5C mt-[0.4rem] text-[0.2rem]">-->
<!-- <div class=" hidden xl:flex">-->
<!-- <div class="w-auto mx-1 menu_a_div " v-for="item in menu_list" :key="item.id">-->
<!-- <a :href="item.path" class="text-black ">{{ item.title }}</a>-->
<!-- </div>-->
<!-- </div>-->
<!-- <div class=" flex ml-auto">-->
<!-- <div v-if="user_info.ID > 0" class="text-center mt-0.5 mr-[0.26rem] relative">-->
<!-- <a href="/mmc-shop-car"-->
<!-- class=" ml-[0.04rem] text-black text-[0.18rem] leading-[0.2rem]"><img-->
<!-- :src="local_url+'img/mmc/cart.webp'" class="w-[0.46rem] h-[0.46rem]">-->
<!-- <div style="background: #EA6908;"-->
<!-- class=" text-black text-[0.18rem] absolute w-[0.36rem] h-[0.26rem] rounded-[0.13rem] left-[-0.18rem] top-[0.1rem]">-->
<!-- <span class="mb-[0.1rem]">{{ user_info.cart_num }}</span>-->
<!-- </div>-->
<!-- </a>-->
<!-- </div>-->
<!-- <div v-if="user_info.ID > 0" class="text-center mt-0.5 mr-[0.26rem]"><img-->
<!-- :src="local_url+'img/mmc/ring.webp'"-->
<!-- class="w-[0.46rem] h-[0.46rem]">-->
<!-- </div>-->
<!-- <div v-if="user_info.ID > 0" class="text-center mt-0.5 mr-[0.26rem]">-->
<!-- <a href="/mmc-user/">-->
<!-- <img-->
<!-- :src="local_url+'img/user.png'"-->
<!-- class="w-[0.46rem] h-[0.46rem]">-->
<!-- </a>-->
<!-- </div>-->
<!-- <a-dropdown v-if="user_info.ID > 0" class=" mt-0.5 " :trigger="['click']">-->
<!-- <div class=" flex items-center cursor-pointer">-->
<!--<!– <img class="w-[0.46rem] h-[0.46rem]" :src="local_url+'img/user.png'" alt="user"/>–>-->
<!-- <div class=" ml-[0.16rem] text-black text-[0.2rem] leading-[0.2rem]">{{user_info.user_name.substring(0, 20)}}</div>-->
<!-- </div>-->
<!-- <a-menu slot="overlay">-->
<!-- <a-menu-item key="0">-->
<!-- <a @click="loginOut">退出</a>-->
<!-- </a-menu-item>-->
<!-- </a-menu>-->
<!-- </a-dropdown>-->
<!-- <div v-if="user_info.ID == 0" @click="showLoginModel()"-->
<!-- class=" cursor-pointer text-[0.2rem] leading-[0.2rem] mt-0.5">登入/註冊-->
<!-- </div>-->
<!-- </div>-->
<!-- </div>-->
</div>
<yq-model ref="login"></yq-model>
</div>
</template>
<script>
module.exports = {
props: {
search_text: {
type: String,
default: ""
}
},
components: {
'yq-model': httpVueLoader(local_url + 'components/yq-modal.vue?v=1'),
// 'yq-model': httpVueLoader(local_url + 'components/yq-login_modal_mmc.vue?v=3'),
},
data() {
return {
search: "",
menu_list: [
{
id: 28,
title: "首頁",
path: "/zone_medicalmediachannel",
img_url: "",
}, {
id: 29,
title: "所有產品",
img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1257@2x.png",
path: "/products_search/",
}, {
id: 31,
title: "聯繫我們",
img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1259@2x.png",
path: "/contact_form_medicalmediachannel/",
}, {
id: 999,
title: "醫學媒體頻道",
img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1260@2x.png",
path: "/medicine-zone"
}, {
id: 32,
title: "比賽",
// img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1260@2x.png",
path: "/competition_search"
}, {
id: 33,
title: "用户信息",
// img_url: "<?php echo $doMain; ?>/food-app/img/MedicalMediaChannel/组 1260@2x.png",
path: "/competition_user_info"
},
],
}
},
created() {
this.search = this.search_text
},
methods: {
toUserInfo(key) {
sessionStorage.user_active_nav = key
// window.location.href = "/mmc-user"
window.location.href = "/competition_user_info"
},
hdSearch() {
if (window.location.href.indexOf("products_search") > -1) {
this.$emit('search', this.search)
} else {
sessionStorage.search_text = this.search
window.location.href = "/products_search"
}
},
showLoginModel() {
this.$refs.login.changeShow()
},
loginOut() {
let postForm = document.createElement("form");
postForm.method = "post";
postForm.action = "";
postForm.style = "display:none";
let actionInput = document.createElement("input");
actionInput.setAttribute("name", 'action');
actionInput.setAttribute("value", 'loginout');
postForm.appendChild(actionInput);
document.body.appendChild(postForm);
postForm.submit();
},
},
watch(){
}
}
</script>