File: /var/www/dk/wp-content/themes/food/page-competition_user_info.php
<?php
/* Template Name: competition_user_info */
//$tangDomain = "https://app.tangchinese.org/wp-content/themes/classapp/";
get_header('competition');
if (!is_user_logged_in()) {
//auth_redirect(); //跳转到登录页面
// $HOMEURL = esc_url(home_url('login')) ;
$HOMEURL = esc_url(home_url('/competition_search'));
echo "<script>setTimeout(window.location='" . $HOMEURL . "',50)</script>";
exit();
}
$current_user = wp_get_current_user();
global $user_id;
// 获取当前用户的ID
$user_id = $current_user->ID;
// 获取当前用户的用户名
$user_login = $current_user->user_login;
// 获取当前用户的邮箱
$user_email = $current_user->user_email;
// 获取当前用户的显示名称
$display_name = $current_user->display_name;
//电话
$phone = get_user_meta($user_id, 'phone', true);
//年龄
$birthday = get_user_meta($user_id, 'birthday', true);
$declaration = get_user_meta($user_id, 'declaration', true);
//echo $birthday . ' ' . $declaration;
$wpuseravatarID = get_user_meta($user_id, 'wp_user_avatar_id', true); //用户头像id
$wpuseravatar = wp_get_attachment_url($wpuseravatarID);
$wp_user_avatar_url = get_user_meta($user_id, 'wp_user_avatar_url', true); //用户头像id
if ($wp_user_avatar_url == '') {
// $wp_user_avatar_url = get_template_directory_uri() . '/food-app/img/mmc/img_cover.png';
$wp_user_avatar_url = get_template_directory_uri() . '/food-app/img/user.png';
}
$vueVersion = time();
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>用户信息</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0,user-scalable=no">
<script src="<?php echo get_template_directory_uri(); ?>/food-app/ranking/creating_page_js/vue.min.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/food-app/ranking/creating_page_js/vue.min.js"></script>
<script src="<?php echo get_template_directory_uri(); ?>/food-app/ranking/creating_page_js/qs.js"></script>
<link href="<?php echo get_template_directory_uri(); ?>/food-app/ranking/creating_page_js/antd.min.css"
rel="stylesheet">
<script src="<?php echo get_template_directory_uri(); ?>/food-app/ranking/creating_page_js/moment.min.js"></script>
<style>
img {
max-width: 100%;
height: auto;
}
p {
margin: 0;
}
/*.form_section {*/
/* border: 1px solid #E6E6E6;*/
/* border-radius: 2px;*/
/*}*/
.title_div {
border-bottom: 1px solid #E6E6E6;
margin-bottom: 20px;
}
.form_section .form_section_title {
margin-top: 20px;
margin-bottom: 20px;
height: 24px;
font-size: 24px;
font-family: Source Han Sans CN;
font-weight: 500;
line-height: 41px;
color: #333333;
}
.top_user_info {
background: linear-gradient(315deg, #00839B 0%, #1ABFBA 100%);
opacity: 1;
border-radius: 10px;
}
.mid_item_info {
/*display: none;*/
}
.mid_competition_info {
display: none;
}
.mid_user_info {
display: none;
}
#mid_competition_detail {
display: none;
}
.ant-btn .ant-btn-primary {
background: #00839B;
}
.mid_nav a {
font-weight: 900;
}
.mid_nav .a_active {
color: #00839B;
}
.empty_item {
box-sizing: border-box;
box-shadow: 0 0 20px rgba(0, 155, 150, 0.2);
/*width: calc(100% - 40px);*/
padding-left: 5px;
padding-right: 5px;
margin-bottom: 20px;
}
.ant-upload-list {
display: none;
}
.ant-upload.ant-upload-drag p.ant-upload-hint {
font-size: 12px;
}
</style>
</head>
<body>
<div id="app">
<yq-header :search_text="submit_info.search_text" @search="hdSearch"></yq-header>
<div class="flex flex-wrap lg:flex-row px-1 content-start top_user_info text-white mx-1 w-100 md:w-[768px] md:mx-auto xl:w-[1280px]">
<div class="w-full lg:w-4/6 sm:p-1 px-1 mb-1">
<!-- <h1 class="title-font font-medium text-xl mb-2 text-gray-900">Moon hashtag pop-up try-hard offal-->
<!-- truffaut</h1>-->
<div class="h-full flex items-center border-gray-200 border-b lg:border-0 p-1">
<!-- <img alt="team" class="w-4 h-4 bg-gray-100 object-cover object-center flex-shrink-0 rounded-full mr-1"-->
<!-- src="--><?php //echo $wp_user_avatar_url; ?><!--">-->
<img alt="team" class="w-4 h-4 bg-gray-100 object-cover object-center flex-shrink-0 rounded-full mr-1"
:src="user_info.wp_user_avatar_url">
<div class="flex-grow">
<h2 class=" font-bold text-white text-[0.32rem]"><?php echo $display_name; ?> </h2>
<p class="">{{current_user.declaration}}</p>
</div>
</div>
<!-- <div class="leading-relaxed">Pour-over craft beer pug drinking vinegar live-edge gastropub, keytar-->
<!-- neutra sustainable fingerstache kickstarter.-->
<!-- </div>-->
</div>
<div class="flex w-full lg:w-2/6 items-center text-center">
<div class="p-1 w-1/3">
<h2 class="title-font font-medium text-[0.24rem] text-white">關註數</h2>
<p class="text-[0.4rem] font-bold">0</p>
</div>
<div class="p-1 w-1/3">
<h2 class="title-font font-medium text-[0.24rem] text-white">粉絲數</h2>
<p class="text-[0.4rem] font-bold">0</p>
</div>
<div class="p-1 w-1/3">
<h2 class="title-font font-medium text-[0.24rem] text-white">獲讚數</h2>
<p class="text-[0.4rem] font-bold">0</p>
</div>
</div>
</div>
<div class="pb-1 mx-1 form_section border-b-[0.02rem] w-100 md:w-[768px] md:mx-auto xl:w-[1280px]">
<!-- style="width: 400px"-->
<nav class="mid_nav flex text-[0.28rem] text-bold text-333 text-center w-full md:w-[6rem]">
<a class=" text-bold border-b-1 p-[0.1rem] text-333" :class="{ 'a_active': mid_nav_a_isActive1 }"
id="mid_item_info_id" @click="fn1()">投稿視頻</a>
<a v-if="is_admin" class=" text-bold border-b-1 border-gray-300 p-[0.1rem] text-333"
:class="{ 'a_active': mid_nav_a_isActive2 }" id="mid_competition_info_id"
@click="fn2()">比賽管理</a>
<a class="border-b-1 border-gray-300 p-[0.1rem] text-333" :class="{ 'a_active': mid_nav_a_isActive3 }"
id="mid_user_info_id" @click="fn3()">基本資料</a>
</nav>
</div>
<section id="mid_item_info"
class="w-100 md:w-[768px] md:mx-auto xl:w-[1280px] mx-1 text-gray-600 body-font relative mid_item_info">
<div class="container py-1 mx-auto">
<div class="flex flex-wrap ">
<!-- @click="toDetail(item.aid,item.id)"-->
<div v-for="item in competition_item_list" :key="item.id"
class=" w-full text-333 mb-1 overflow-hidden">
<div class="relative h-full flex sm:flex-row items-center sm:justify-start justify-center text-center sm:text-left">
<div class="absolute top-0 left-0 text-white float"
v-if="item.item_status === 0 || item.item_status === 2 || item.item_status === 3"
style="background-color: #1ABFBA;height: 25px;padding-left: 5px;padding-right: 5px;border-bottom-right-radius: 5px;">
<span style="font-size:16px;" class="text-white">{{item.status_title}}</span>
</div>
<img alt="team"
class="flex-shrink-0 w-[2.56rem] h-[1.44rem] object-cover object-center"
:src="item.avatar">
<div class=" flex-grow ml-[0.2rem] ">
<h2 class="title-font font-bold text-[0.28rem] text-left">{{item.title}}</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/time_black.webp'">
</div>
<span class="text-333 text-[0.20rem] title-font font-medium">{{ item.update_time}} </span>
<div class="w-[0.20rem] h-[0.20rem] ml-[0.1rem] 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/zan_black.webp'">
</div>
<span class="text-333 text-[0.20rem] title-font font-medium">{{item.score}}</span>
</div>
<!-- <p class="mb-1">DIY tote bag drinking vinegar cronut adaptogen squid fanny pack-->
<!-- vaporware.</p>-->
<span class="inline-flex">
<!-- <button class="border-2 border-r-2 " @click="toCompetitionUpdate(item.id)">編輯</button>-->
<!-- <a-button type="primary " class="mr-1 bg-main">參賽視頻</a-button>-->
<!-- 处理 比赛item-->
<!-- <a-button v-if="is_admin" class="mr-1"-->
<!-- @click="toCompetitionItemReview(item.aid,item.id)"-->
<!-- type="primary">審核</a-button>-->
<a-button class="mr-1"
@click="toCompetitionItemUpdate(item.aid,item.id)">編輯</a-button>
<!-- <a-button type="danger" class="mr-1"-->
<!-- @click="delCompetitionItem(item.aid,item.id,item.title)">刪除</a-button>-->
</span>
</div>
</div>
</div>
<div v-if="competition_item_list.length == 0"
class="empty_item flex flex-col px-[0.15rem] static p-1 lg:w-1/4 md:w-1/2 w-full">
<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>
</div>
</div>
</section>
<section id="mid_competition_info" v-if="is_admin"
class="w-100 md:w-[768px] md:mx-auto xl:w-[1280px] mx-1 text-gray-600 body-font mid_competition_info">
<div class="container py-1 mx-auto">
<a-button v-if="is_admin"
class=" text-bold border-b-1 border-gray-300 p-[0.2rem] text-333 mb-[0.2rem] ml-[0.2rem]"
@click="creatingActivity()">創建比賽
</a-button>
<div class="flex flex-wrap ">
<!-- @click="toDetail(item.aid,item.id)"-->
<div v-for="item in competition_list" :key="item.id"
class=" w-full text-333 mb-1 overflow-hidden">
<div class="h-full flex sm:flex-row items-center sm:justify-start justify-center text-center sm:text-left">
<img alt="team"
class="flex-shrink-0 w-[2.56rem] h-[1.44rem] object-cover object-center"
:src="item.img_url">
<div class="flex-grow ml-[0.2rem] ">
<h2 class="title-font font-bold text-[0.28rem] text-left">{{item.name}}</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>
<span class="text-333 text-[0.20rem] title-font font-medium">{{ item.start_date }} -
{{item.end_date}}</span>
</div>
<!-- <p class="mb-1">DIY tote bag drinking vinegar cronut adaptogen squid fanny pack-->
<!-- vaporware.</p>-->
<span class="inline-flex">
<a-button type="primary " class="mr-1 bg-main" @click="goCompetitionItemList(item.id)">參賽視頻</a-button>
<a-button class="mr-1" @click="toCompetitionUpdate(item.id)">編輯</a-button>
<!-- <a-button type="danger" class="mr-1"-->
<!-- @click="delCompetition(item.id,item.title)">刪除</a-button>-->
</span>
</div>
</div>
</div>
<div v-if="competition_list.length == 0"
class="empty_item flex flex-col px-[0.15rem] static p-1 lg:w-1/4 md:w-1/2 w-full">
<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>
</div>
</div>
</section>
<section id="mid_user_info"
class="w-100 md:w-[768px] md:mx-auto xl:w-[1280px] mx-1 text-gray-600 body-font relative mid_user_info">
<div class="container px-1 pb-1 mx-auto form_section border-t-[0.02rem]">
<div class=" w-full mx-auto">
<!-- <div class="flex flex-col text-left w-full title_div pb-1">-->
<!-- <h1 class="text-[0.26rem] font-medium title-font mb-4 text-gray-900 form_section_title">-->
<!-- 用户信息</h1>-->
<!-- </div>-->
<div class="flex flex-wrap ">
<div class="mt-[0.1rem] p-[0.1rem] w-full md:w-2/3">
<div class="relative flex flex-wrap">
<img alt="img_url" class=" mt-1 mr-1 rounded-full" style="width: 150px;height: 150px;"
:src="img_url"/>
<div>
<!-- <label for="img_url"-->
<!-- class="text-[0.16rem] font-bold text-gray-600">头像:JPG、JPEG、PNG格式圖片需≤10M</label>-->
<div style="height: 10px"></div>
<!-- <a-upload :file-list="fileList" :remove="handleRemove"-->
<!-- :before-upload="beforeUpload">-->
<!-- <a-button style="width:200px;">-->
<!-- 選擇圖片-->
<!-- <a-icon type="upload"/>-->
<!-- </a-button>-->
<!-- </a-upload>-->
<!-- <a-button-->
<!-- type="primary"-->
<!-- :disabled="fileList.length === 0"-->
<!-- :loading="uploading"-->
<!-- style="margin-top: 16px"-->
<!-- @click="uploadHandleChangeImg"-->
<!-- >-->
<!-- {{ uploading ? '上傳中...' : '上傳圖片' }}-->
<!-- </a-button>-->
<div style="width: 200px;height: 150px;margin-bottom: 50px;">
<a-upload-dragger
:remove="handleRemove"
:before-upload="beforeUpload"
name="images"
:multiple="false"
@change="handleChange"
:default-file-list=[]
>
<p class="ant-upload-drag-icon">
<!-- <a-icon type="inbox"/>-->
<a-icon type="picture" theme="twoTone"/>
<!-- <img alt="img_url" style="width: 50px" :src="img_url"/>-->
</p>
<p class="ant-upload-text"> 更改頭像</p>
<p class="ant-upload-hint">JPG、JPEG、PNG格式圖片需≤10M</p>
</a-upload-dragger>
</div>
</div>
</div>
</div>
<!-- <div class="p-[0.1rem] w-1/2 text-[0.26rem]">-->
<!-- <div class="relative">-->
<!-- <label for="user_id" class=" text-gray-600 ml-1">ID</label>-->
<!-- <input type="text" v-model="user_id" disabled-->
<!-- class="mt-[0.1rem] w-full bg-gray-100 bg-opacity-50 rounded-sm border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 outline-none text-gray-700 py-1 px-1 transition-colors duration-200 ease-in-out">-->
<!-- </div>-->
<!-- </div>-->
<div class="p-[0.1rem] w-1/2 text-[0.26rem]">
<div class="relative">
<label for="name" class=" text-gray-600 ml-1">登錄賬號:</label>
<input type="text" v-model="user_login" disabled
class="mt-[0.1rem] w-full bg-gray-100 bg-opacity-50 rounded-sm border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 outline-none text-gray-700 py-1 px-1 transition-colors duration-200 ease-in-out">
</div>
</div>
<!-- <div class="p-[0.1rem] w-full text-[0.26rem]">-->
<!-- <div class="relative">-->
<!-- <label for="name" class=" text-gray-600 ml-1">郵箱:</label>-->
<!-- <input type="text" v-model="user_email" disabled-->
<!-- class=" mt-[0.1rem] w-full bg-gray-100 bg-opacity-50 rounded-sm border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 outline-none text-gray-700 py-1 px-1 transition-colors duration-200 ease-in-out">-->
<!-- </div>-->
<!-- </div>-->
<div class="p-[0.1rem] w-full text-[0.26rem]">
<div class="relative">
<label for="name" class="ml-1 text-gray-600">用戶名:</label>
<input type="text" v-model="display_name"
class="mt-[0.1rem] w-full bg-gray-100 bg-opacity-50 rounded-sm border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 outline-none text-gray-700 py-1 px-1 transition-colors duration-200 ease-in-out">
</div>
</div>
<div class="p-[0.1rem] w-full text-[0.26rem]">
<div class="relative">
<label for="name" class=" text-gray-600 ml-1">個人描述:</label>
<input type="text" v-model="current_user.declaration"
class=" mt-[0.1rem] w-full bg-gray-100 bg-opacity-50 rounded-sm border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 outline-none text-gray-700 py-1 px-1 transition-colors duration-200 ease-in-out">
</div>
</div>
<div class="p-[0.1rem] w-1/2 text-[0.26rem]">
<div class="relative">
<label for="name" class="ml-1 text-gray-600">電話:</label>
<input type="text" v-model="current_user.phone"
class="mt-[0.1rem] w-full bg-gray-100 bg-opacity-50 rounded-sm border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 outline-none text-gray-700 py-1 px-1 transition-colors duration-200 ease-in-out">
</div>
</div>
<div class="p-[0.1rem] w-1/2 text-[0.26rem]">
<div class="relative">
<label for="name" class="ml-1 text-gray-600">出生日期:</label>
<input type="date" v-model="current_user.birthday"
class="mt-[0.1rem] w-full bg-gray-100 bg-opacity-50 rounded-sm border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 outline-none text-gray-700 py-1 px-1 transition-colors duration-200 ease-in-out">
</div>
</div>
<!-- <div class="p-2 w-full">-->
<!-- <div class="relative">-->
<!-- <label for="content" class="leading-7 text-sm text-gray-600">简介:</label>-->
<!-- <textarea style="height: 200px" v-model="content" :disabled="textFieldDisabled"-->
<!-- class="w-full bg-gray-100 bg-opacity-50 rounded border border-gray-300 focus:border-indigo-500 focus:bg-white focus:ring-2 focus:ring-indigo-200 h-64 text-base outline-none text-gray-700 py-1 px-3 resize-none leading-6 transition-colors duration-200 ease-in-out"></textarea>-->
<!-- </div>-->
<!-- </div>-->
<div class="p-[0.1rem] w-full text-[0.26rem] mt-[0.3rem]">
<!-- <button @click="submitForm"-->
<!-- :disabled="uploading"-->
<!-- style="padding-left: 50px;padding-right: 10px;width: 150px;text-align: center"-->
<!-- class=" inline-flex text-white bg-main-color border-0 py-1 px-1 focus:outline-none hover:bg-indigo-600 rounded-sm ">-->
<!-- 提交-->
<!-- </button>-->
<a-button @click="submitForm"
style="padding-left: 10px;padding-right: 10px;width:150px;text-align: center;"
:disabled="uploading"
class="w-[2rem] inline-flex text-white bg-main-color border-0 py-1 px-1 focus:outline-none hover:bg-indigo-600 rounded-sm text-center"
type="primary">
提交
</a-button>
</div>
</div>
</div>
</div>
</section>
<!-- 审核比赛-->
<section id="mid_competition_detail"
class="w-100 md:w-[768px] md:mx-auto xl:w-[1280px] mx-1 text-gray-600 body-font relative">
<div class="container py-1 mx-auto">
<!-- 头部比赛 信息-->
<div class="empty_item flex flex-col w-full lg:w-2/3 ">
<button v-on:click="goBackPage()"><img style="width: 32px; margin-top: 10px;margin-left: 10px"
src="<?php showFoodAppPath('/img/arrow.png') ?>"/></button>
<div class=" flex flex-col cursor-pointer ">
<div class="h-[0.3rem] my-[0.2rem]">
<div class="text-center w-full overflow-ellipsis-1 text-[0.30rem] font-bold leading-[0.33rem]"
style="display:inline-block;display: -webkit-box;
overflow: hidden;">
{{current_competition_info.name}}
</div>
</div>
</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_item_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_item_title_func">搜寻
</button>
</div>
</div>
<!-- 头部比赛 信息 End-->
<div class="flex flex-wrap ">
<!-- @click="toDetail(item.aid,item.id)"-->
<div v-for="item in competition_item_list" :key="item.id"
class=" w-full text-333 mb-1 overflow-hidden">
<div class="relative h-full flex sm:flex-row items-center sm:justify-start justify-center text-center sm:text-left">
<div class="absolute top-0 left-0 text-white float"
v-if="item.item_status === 0 || item.item_status === 2 || item.item_status === 3"
style="background-color: #1ABFBA;height: 25px;padding-left: 5px;padding-right: 5px;border-bottom-right-radius: 5px;">
<span style="font-size:16px;" class="text-white">{{item.status_title}}</span>
</div>
<img alt="team"
class="flex-shrink-0 w-[2.56rem] h-[1.44rem] object-cover object-center"
:src="item.avatar">
<div class="flex-grow ml-[0.2rem] ">
<h2 class="title-font font-bold text-[0.28rem] text-left">{{item.title}}</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/time_black.webp'">
</div>
<span class="text-333 text-[0.20rem] title-font font-medium">{{ item.update_time}} </span>
<div class="w-[0.20rem] h-[0.20rem] ml-[0.1rem] 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/zan_black.webp'">
</div>
<span class="text-333 text-[0.20rem] title-font font-medium">{{item.score}}</span>
</div>
<!-- <p class="mb-1">DIY tote bag drinking vinegar cronut adaptogen squid fanny pack-->
<!-- vaporware.</p>-->
<span class="inline-flex">
<!-- <button class="border-2 border-r-2 " @click="toCompetitionUpdate(item.id)">編輯</button>-->
<!-- <a-button type="primary " class="mr-1 bg-main">參賽視頻</a-button>-->
<!-- 处理 比赛item-->
<a-button v-if="is_admin" class="mr-1"
@click="toCompetitionItemReview(item.aid,item.id)"
type="primary">審核</a-button>
<!-- <a-button class="mr-1"-->
<!-- @click="toCompetitionItemUpdate(item.aid,item.id)">編輯</a-button>-->
<!-- <a-button type="danger" class="mr-1"-->
<!-- @click="delCompetitionItem(item.aid,item.id,item.title)">刪除</a-button>-->
</span>
</div>
</div>
</div>
<div v-if="competition_item_list.length == 0"
class="empty_item flex flex-col px-[0.15rem] static p-1 lg:w-1/4 md:w-1/2 w-full mt-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>
</div>
</div>
</section>
<!-- 审核比赛 End -->
<!-- <div style="height: 80px"></div>-->
<yq-footer :year_text="year_text"></yq-footer>
</div>
<script>
const local_url = '<?php echo $local_url ?>'
const domain = '<?php echo esc_url(home_url('/')); ?>'
const app = {
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) ?>'),
},
data() {
return {
year_text: <?php echo date("Y") ?>,
token: '',
action: 'update',
aid: '0',
name: "",
content: "",
start_date: "0000-00-00 00:00:00",
end_date: "0000-00-00 00:00:00",
score: "0",
status: "1",
user_id: "<?php echo $user_id; ?>",
user_login: "<?php echo $user_login; ?>",
user_email: "<?php echo $user_email; ?>",
display_name: "<?php echo $display_name; ?>",
phone: "<?php echo $phone; ?>",
img_id: "<?php echo $wpuseravatarID; ?>",
img_url: "<?php echo $wp_user_avatar_url; ?>",
img_id_has_uploaded: false,
fileList: [],
uploading: false,
//page
submit_info: {
price_pre: '0',
price_next: '0',
order_name: '日期',
search_text: ''
},
current_user: {
add_time: '',
aid: '',
avatar: '',
declaration: '<?php echo $declaration; ?>',
id: '',
img_id: '',
nickname: '',
birthday: '<?php echo $birthday; ?>',
phone: "<?php echo $phone; ?>",
score: '',
status: '',
update_time: '',
video_url: '',
},
current_competition_info: {
content: "",
end_date: "",
id: "",
img_id: "",
img_url: "",
name: "",
score: "0",
share_num: "0",
start_date: "",
status: "0",
update_time: "",
user_id: "",
user_name: "",
video_file_id: "",
video_url: ''
},
competition_list: [],
competition_item_list: [],
is_author: true,
mid_nav_a_isActive1: true,
mid_nav_a_isActive2: false,
mid_nav_a_isActive3: false,
search_competition_item_title: '', //搜索比賽項目title
//is_admin: <?php //echo ($user_id == 1); ?>// ? true : false,
is_admin: false,
// is_admin: true,
fromType: true,
}
},
computed: {
//自定义请求头
headers() {
return {
'Authorization': 'Bearer ' + this.token,
}
}
},
mounted() {
this.is_admin = (<?php echo $user_id; ?> == 1 || <?php echo $user_id; ?> == 123457) ? true : false;
this.fromType = this.getQueryString("fromType"); //参数名1
console.log("fromType => ", this.fromType);
this.aid = this.getQueryString("aid"); //参数名1
console.log("aid => ", this.aid);
if (this.fromType === 'competition_user_info_review') {
this.goCompetitionItemList(this.aid, true)
} else {
this.get_competition_item_list(true, this.aid)
this.getCompetitionList()
}
// let id = this.$route.query.id;
// this.type = this.getQueryString("type"); //参数名1
// this.id = this.getQueryString("id"); //参数名1
// console.log("id => ", this.id);
// 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 = 3; // this.user_id;
// this.user_id = localStorage.user_id;
// // this.user_id = this.getQueryString("user_id");
// console.log('user_id => ' + this.user_id);
// this.user_name = localStorage.user_name;
// console.log('user_name => ' + this.user_name);
// this.token = this.getQueryString("token");
// console.log('token => ' + this.token);
// this.action = this.getQueryString("action");
// console.log('action => ' + this.action);
//
// if (this.action === 'update') {
// this.initForm();
// }
},
methods: {
changeFormState() {
this.textFieldDisabled = !this.textFieldDisabled;
},
fn1() {
// console.log('fn1');
this.search_competition_item_title = '';
this.get_competition_item_list(true, 0)
// var t1 = document.getElementById('mid_item_info_id');
// var t2 = document.getElementById('mid_competition_info_id');
// var t3 = document.getElementById('mid_user_info_id');
var c1 = document.getElementById('mid_item_info');
var c3 = document.getElementById('mid_user_info');
// console.log('fn1 => ' + t1.style);
// if(t1.style.display === 'none') {
// console.log('fn1 none');
// t1.style.display = 'block';// 以块级元素显示
// t2.style.display = 'none';// 以块级元素显示
// t3.style.display = 'none';// 以块级元素显示
// }
// console.log('fn1 none');
c1.style.display = 'block';// 以块级元素显示
c3.style.display = 'none';// 以块级元素显示
this.mid_nav_a_isActive1 = true;
this.mid_nav_a_isActive3 = false;
if (this.is_admin) {
var c2 = document.getElementById('mid_competition_info');
c2.style.display = 'none';// 以块级元素显示
this.mid_nav_a_isActive2 = false;
}
var id4 = document.getElementById('mid_competition_detail');
id4.style.display = 'none';// 以块级元素显示
// else {
// t.style.display = 'none'; // 隐藏
// }
},
fn2() {
// console.log('fn2');
this.getCompetitionList()
var c1 = document.getElementById('mid_item_info');
var c2 = document.getElementById('mid_competition_info');
var c3 = document.getElementById('mid_user_info');
c1.style.display = 'none';// 以块级元素显示
c2.style.display = 'block';// 以块级元素显示
c3.style.display = 'none';// 以块级元素显示
this.mid_nav_a_isActive1 = false;
this.mid_nav_a_isActive2 = true;
this.mid_nav_a_isActive3 = false;
var id4 = document.getElementById('mid_competition_detail');
id4.style.display = 'none';// 以块级元素显示
},
fn3() {
// console.log('fn3');
var c1 = document.getElementById('mid_item_info');
var c3 = document.getElementById('mid_user_info');
c1.style.display = 'none';// 以块级元素显示
// c2.style.display = 'none';// 以块级元素显示
c3.style.display = 'block';// 以块级元素显示
this.mid_nav_a_isActive1 = false;
// this.mid_nav_a_isActive2= false;
this.mid_nav_a_isActive3 = true;
var id4 = document.getElementById('mid_competition_detail');
id4.style.display = 'none';// 以块级元素显示
if (this.is_admin) {
var c2 = document.getElementById('mid_competition_info');
c2.style.display = 'none';// 以块级元素显示
this.mid_nav_a_isActive2 = false;
}
},
fn4() {
// console.log('fn3');
var c1 = document.getElementById('mid_item_info');
var c3 = document.getElementById('mid_user_info');
c1.style.display = 'none';// 以块级元素显示
// c2.style.display = 'none';// 以块级元素显示
c3.style.display = 'block';// 以块级元素显示
this.mid_nav_a_isActive1 = false;
this.mid_nav_a_isActive2 = true;
this.mid_nav_a_isActive3 = false;
if (this.is_admin) {
var id2 = document.getElementById('mid_competition_info');
id2.style.display = 'none';// 以块级元素显示
var id3 = document.getElementById('mid_user_info');
id3.style.display = 'none';// 以块级元素显示
///比赛子视频
var id4 = document.getElementById('mid_competition_detail');
id4.style.display = 'block';// 以块级元素显示
}
},
backFn4() {
console.log('backFn4');
var c1 = document.getElementById('mid_item_info');
var c3 = document.getElementById('mid_user_info');
c1.style.display = 'none';// 以块级元素显示
c3.style.display = 'block';// 以块级元素显示
this.mid_nav_a_isActive1 = false;
this.mid_nav_a_isActive2 = true;
this.mid_nav_a_isActive3 = false;
if (this.is_admin) {
// var id2 = document.getElementById('mid_competition_info');
// id2.style.display = 'none';// 以块级元素显示
var id3 = document.getElementById('mid_user_info');
id3.style.display = 'none';// 以块级元素显示
///比赛子视频
var id4 = document.getElementById('mid_competition_detail');
id4.style.display = 'block';// 以块级元素显示
}
},
submitForm() {
this.status = this.radioValue
const up_img_id = this.img_id_has_uploaded ? this.img_id : null;
// const up_video_id = this.video_file_id_has_uploaded ? this.video_file_id : null;
// var stringTime = this.start_date; //'2012-10-12 22:37:33';
// var timestamp = Date.parse(new Date(stringTime));
// var live_timestamp = timestamp / 1000;
// // console.log(timestamp + '就是' + stringTime + '时间戳 ' + live_timestamp);
// console.log(stringTime + ' 时间戳 => ' + live_timestamp);
// console.log(this.start_date + ' 处理前 => ' + this.end_date);
// this.start_date = this.date2Db(this.start_date)
// this.end_date = this.date2Db(this.end_date)
// console.log(this.start_date + ' 处理后 => ' + this.end_date);
// console.log('video_file_id_has_uploaded => ' + this.video_file_id_has_uploaded + ', up_video_id => ' + up_video_id + ', video_file_id => ' + this.video_file_id + ' video_url => ' + this.video_url);
let formData = {
'module': 'user',
'action': 'index',
'a': 'updateWpUser',
'func_action': 'competition_user_info',
'user_id': this.user_id,
'display_name': this.display_name,
'phone': this.current_user.phone,
'birthday': this.current_user.birthday,
'declaration': this.current_user.declaration,
'wp_user_avatar_id': up_img_id,
'wp_user_avatar_url': this.img_url,
// 'debugmod': 1,
}
console.log(' formData => ');
console.log(formData);
axios({
method: 'post',
// headers: {
// 'Authorization': 'Bearer ' + this.token,
// },
url: '/api/',
data: Qs.stringify(formData)
})
.then((response) => {
// console.log(response);
let data = response.data
console.log('submitForm', data);
if (data.rc === 0) {
// if (this.action === 'add') {
// // let backData = data.data;
// this.id = data.id;
//
// console.log('add done id =>' + this.id);
// }
antd.notification.success({
message: '提交成功',
});
setTimeout(() => {
window.open('/competition_user_info', '_self')
}, 3000);
// this.initForm()
}
})
.catch(function (error) {
console.log(error);
});
},
getQueryString(name) {
let reg = `(^|&)${name}=([^&]*)(&|$)`
let r = window.location.search.substr(1).match(reg);
if (r != null) return unescape(r[2]);
return null;
},
// 第三种方式:函数处理 时间戳转日期
timestampsFormatDate(times) {
times = times * 1000;
var now = new Date(times);
// console.log('timestampsFormatDate', now);
var year = now.getFullYear();
var month = now.getMonth() + 1;
var date = now.getDate();
var hour = now.getHours();
var minute = now.getMinutes();
var second = now.getSeconds();
// console.log('timestampsFormatDate 2 ', year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second);
return year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second;
},
// var d = new Date(1368360620000);
// console.log(formatDate(d));
beforeUpload(file) {
// console.log('beforeUpload', file);
const isJpgOrPng = file.type === 'image/jpeg' || file.type === 'image/png';
if (!isJpgOrPng) {
this.$message.error('You can only upload JPG/PNG file!');
}
const isLt8M = file.size / 1024 / 1024 < 10;
if (!isLt8M) {
this.$message.error('Image must smaller than 10MB!');
}
// return isJpgOrPng && isLt8M;
this.fileList = [file]; // [...this.fileList, file];
// return false;
return isJpgOrPng && isLt8M;
},
handleRemove(file) {
const index = this.fileList.indexOf(file);
const newFileList = this.fileList.slice();
newFileList.splice(index, 1);
this.fileList = newFileList;
},
//图片上传文件
handleChange(info) {
const status = info.file.status;
if (status === 'uploading') {
this.uploading = true
}
if (status !== 'uploading') {
this.uploading = false
// console.log(info.file, info.fileList);
}
if (status === 'done') {
this.uploadHandleChangeImg(info)
// this.$message.success(`${info.file.name} file uploaded successfully.`);
} else if (status === 'error') {
this.$message.error(`${info.file.name} 上傳失敗.`);
}
},
//图片上传文件
uploadHandleChangeImg(info) {
this.uploadHandleChange(info, false);
},
uploadHandleChange(info, isVideo = false) {
// const {fileList} = this;
// const formData = new FormData();
// fileList.forEach(file => {
// formData.append('files[]', file);
// });
this.uploading = true;
// let file = e.target.files[0]
var file = this.fileList[0]
// if (isVideo) {
// file = this.videoFileList[0];
// }
/* eslint-disable no-undef */
let param = new FormData() // 创建form对象
param.append('images', file) // 通过append向form对象添加数据
param.append('user_id', this.user_id) // 添加form表单中其他数据
param.append('img_upload_verify', 'imgE5FCDG3HQA4B1NOPIJ2RSTUV67KL') // 添加form表单中其他数据
// console.log(param.get('tang_file')) // FormData私有类对象,访问不到,可以通过get判断值是否传进去
let config = {
headers: {'Authorization': 'Bearer ' + this.token}
}
// axios.post('https://app.tangchinese.org/api-app-data?module=upload&action=upload_app', param, config)
//axios.post('<?php //echo $domain_url; ?>//' + '/wp_upload_img', param, config)
axios.post(domain + '/wp_upload_img', param, config)
.then(response => {
// console.log(response)
// console.log(response.data)
var model = response.data;
if (model.rc == 0) {
if (isVideo) {
this.video_file_id = model.id;
this.video_url = model.url;
this.video_file_id_has_uploaded = true;
} else {
this.img_id = model.id;
this.img_url = model.url;
this.img_id_has_uploaded = true;
}
this.uploading = false;
// antd.notification.success({
// message: '圖片上傳成功',
// });
this.$message.success(`${info.file.name} 上傳成功.`);
} else {
// antd.notification.error({
// message: '圖片上傳失敗',
// });
this.$message.error(`${info.file.name} 上傳失敗.`);
}
})
.catch(error => {
console.log(error)
// antd.notification.error({
// message: '圖片上傳失敗',
// });
this.$message.error(`${info.file.name} 上傳失敗.`);
})
}
,
///page
searchSubmit() {
this.page_num = 1
this.get_product()
},
hdSearch(e) {
this.submit_info.search_text = e
this.searchSubmit()
},
///mid_competition_info 比赛列表
getCompetitionList(id = 0) {
axios({
method: 'post',
url: '/api',
data: Qs.stringify({
'module': 'ranking',
'action': 'index',
'a': 'getActivityListInfoByPage',
pageNum: 1,
pageSize: 100,
id: id
// status: '1',
})
// , headers: {
// 'Authorization': 'Bearer ' + this.token,
// }
})
.then((response) => {
// console.log(response);
let data = response.data
// console.log(data);
// console.log("data.rc => ", data.rc);
if (data.rc === 0) {
console.log("Competition => ", data.data[0]);
const post_data = data.data[0];
this.current_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;
// console.log("data.rc => ", data.data)
if (data.data.length > 0) {
this.competition_list = data.data
}
} else if (data.rc === 104) {
this.competition_list = []
}
})
.catch(function (error) {
console.log(error);
});
},
//搜索比賽項目title
search_competition_item_title_func() {
this.page_num = 1;
this.get_competition_item_list(false, this.aid, this.search_competition_item_title);
},
///比賽-投稿視頻
async get_competition_item_list(isUser = true, aid = 0, title = '') {
var user_id = <?php echo $user_id; ?>;
if (!isUser) {
user_id = 0;
}
let res = await axios({
method: 'post',
url: '/api/',
data: Qs.stringify({
module: 'ranking',
action: 'index',
a: 'playerlist',
pageSize: 200,
pageNum: 1,
user_id: user_id,
aid: aid, // this.aid,
title: title
// status: '1',
})
});
if (res.status == 200) {
let data = res.data;
if (data.rc == 0) {
// console.log('competition_item ', data.data)
if (data.data.length > 0) {
var item_list = data.data
var new_list = []
for (let i = 0; i < item_list.length; i++) {
var item = item_list[i];
var item_status = parseInt(item.status);
var status_title = '';
if (item_status === 0) {
status_title = '下架'
} else if (item_status === 1) {
status_title = ''
} else if (item_status === 2) {
status_title = '審核下架'
} else if (item_status === 3) {
status_title = '未通過審核'
}
item.status_title = status_title;
item.item_status = item_status;
item.update_time = this.timestampsFormatDate(item.update_time)
new_list.push(item)
}
this.competition_item_list = new_list
// if (this.page_num == 1) {
//
// } else {
// this.product_list = this.product_list.concat(data.data)
// }
console.log(this.competition_item_list)
}
// else {
// // antd.message.info('已顯示所有產品');
// this.is_end = true
// }
} else if (data.rc === 104) {
this.competition_item_list = []
}
}
},
toDetail(aid, id) {
// console.log('user_id list vue', this.user_id)
window.open('/competition_player_vote_page/?aid=' + aid + '&id=' + id, '_self');
},
//創建比賽
creatingActivity() {
window.open('/creating_competition_page?id=0&action=add&fromType=competition_user_info', '_self')
},
toCompetitionUpdate(aid) {
//creating_competition_page/?id=1&action=update
window.open('/creating_competition_page/?action=update&fromType=competition_user_info&id=' + aid, '_self');
},
//处理 比赛item
toCompetitionItemUpdate(aid, id) {
// /creating_competition_player_page/?id=1&action=update
window.open('/creating_competition_item_page/?aid=' + aid + '&id=' + id + '&action=update&fromType=competition_user_info', '_self');
},
//比赛item 審核
toCompetitionItemReview(aid, id) {
// /creating_competition_player_page/?id=1&action=update
window.open('/creating_competition_item_page/?aid=' + aid + '&id=' + id + '&action=update&fromType=competition_user_info_review', '_self');
},
//比赛审核
// goCompetitionReview(aid) {
// // /creating_competition_player_page/?id=1&action=update
// // window.open('/creating_competition_item_page/?aid=' + aid + '&id=' + id + '&action=update&fromType=competition_user_info', '_self');
// // this.fn4();
// //
// // this.getCompetitionList(aid)
// //
// // this.get_competition_item_list(false, aid)
// },
//查看 比赛item 列表
goCompetitionItemList(aid, isBack = false) {
// /competition_user_info/?id=1&action=update
// window.open('/competition_user_info/?aid=' + aid , '_self');
// console.log(aid);
this.aid = aid
this.getCompetitionList(aid)
this.get_competition_item_list(false, aid)
if (isBack) {
this.backFn4();
} else {
this.fn4();
}
},
//返回 比赛列表
goBackPage() {
// console.log('goBackPage')
this.getCompetitionList()
this.fn2();
},
async setDelCompetition(id) {
let formData = {
'module': 'ranking',
'action': 'index',
'a': 'setActivity',
'func_action': 'del',
'id': id,
// 'debugmod': 1,
}
console.log(' formData => ');
console.log(formData);
await axios({
method: 'post',
// headers: {
// 'Authorization': 'Bearer ' + this.token,
// },
url: '/api/',
data: Qs.stringify(formData)
})
.then((response) => {
// console.log(response);
let data = response.data
if (data.rc === 0) {
antd.notification.success({
message: '刪除成功',
});
this.getCompetitionList()
}
})
.catch(function (error) {
console.log(error);
});
},
//刪除 比赛
delCompetition(id, title) {
// window.open('/competition_user_info/?aid=' + aid , '_blank');
var that = this
this.$confirm({
title: '是否確認刪除 ' + title + ' ?',
content: '刪除後將無法找到',
okText: '確認',
okType: 'danger',
cancelText: '取消',
onOk() {
console.log('OK');
console.log('id -> ', id)
that.setDelCompetition(id);
},
onCancel() {
console.log('Cancel');
},
});
},
//刪除 比赛item
delCompetitionItem(aid, id, title) {
// showDeleteConfirm() {
var that = this
this.$confirm({
title: '是否確認刪除 ' + title + ' ?',
content: '刪除後將無法找到',
okText: '確認',
okType: 'danger',
cancelText: '取消',
onOk() {
console.log('OK');
that.setDelCompetitionItem(aid, id)
},
onCancel() {
console.log('Cancel');
},
});
// },
// window.open('/competition_user_info/?aid=' + aid , '_blank');
},
setDelCompetitionItem(aid, id) {
let formData = {
'module': 'ranking',
'action': 'index',
'a': 'setActivityPlayer',
'func_action': 'del',
'aid': aid,
'id': id,
// 'debugmod': 1,
}
console.log(' formData => ');
console.log(formData);
axios({
method: 'post',
// headers: {
// 'Authorization': 'Bearer ' + this.token,
// },
url: '/api/',
data: Qs.stringify(formData)
})
.then((response) => {
// console.log(response);
let data = response.data
if (data.rc === 0) {
antd.notification.success({
message: '刪除 比賽項目 成功',
});
this.get_competition_item_list()
}
})
.catch(function (error) {
console.log(error);
});
},
},
}
function init() {
new Vue(app)
}
</script>
<script src="<?php echo get_template_directory_uri(); ?>/food-app/ranking/creating_page_js/antd.min.js"
onload="init()"></script>
<?php get_footer('food'); ?>