<template>
  <div class="pk">
    <!-- pK页面 -->
    <div class="el-scrollbar__wrap">
      <el-splitter>
        <el-splitter-panel collapsible>
          <el-splitter layout="vertical">
            <el-splitter-panel collapsible size="15 %" :resizable="false">
              <!-- 顶部面板 -->
              <div class="demo-panel">
                <div class="controlPanel">
                  <div
                    class="today"
                    @click="PKistodayorhall = true"
                    :style="{
                      boxShadow: PKistodayorhall
                        ? '0px 0px 10px rgba(0, 0, 0, 0.4)'
                        : 'none',
                      color: PKistodayorhall ? '#6c757d' : '',
                    }"
                  >
                    PK大厅
                  </div>
                  <div
                    class="hall"
                    @click="PKistodayorhall = false"
                    :style="{
                      boxShadow: PKistodayorhall
                        ? 'none'
                        : '0px 0px 10px rgba(0, 0, 0, 0.4)',
                      color: PKistodayorhall ? '' : '#6c757d',
                    }"
                  >
                    今日PK
                  </div>
                  <div class="selectbox" :style="{flexDirection: PKistodayorhall? 'column' : 'row'}">
                    <!-- 国家 -->
                    <el-select-v2
                      v-model="countryvalue"
                      filterable
                      :options="country"
                      placeholder="请选择国家"
                      style="vertical-align: middle"
                      class="select"
                    />
                    <!-- 性别 -->
                    <el-select-v2
                      v-model="gendervalue"
                      filterable
                      :options="genderOptions"
                      placeholder="请选择性别"
                      style="vertical-align: middle"
                      class="select"
                      :style="{marginLeft: PKistodayorhall? '0px' : '30px'}"
                    />
                  </div>
                  <!-- 最大最小金币 -->
                  <div class="Goldcoinbox">
                    <div class="Goldcoinbox-left">
                      <div class="Goldcoinbox-text">最小金币数（单位为K）</div>
                      <el-input-number
                        v-model="minnum"
                        controls-position="right"
                        @change="handleChange"
                      />
                    </div>
                    <div class="Goldcoinbox-middle"></div>
                    <div class="Goldcoinbox-right">
                      <div class="Goldcoinbox-text">最大金币数（单位为K）</div>
                      <el-input-number
                        v-model="maxnum"
                        controls-position="right"
                        @change="handleChange"
                      />
                    </div>
                  </div>
                  <!-- 时间 -->
                  <div class="timebox" v-if="PKistodayorhall">
                    <el-date-picker
                      v-model="timevalue"
                      type="datetimerange"
                      range-separator="至"
                      start-placeholder="最小PK时间"
                      end-placeholder="最大PK时间"
                    />
                  </div>
                  <div class="btnbox" :style="{flexDirection: PKistodayorhall? 'column' : 'row',width: PKistodayorhall? '80px' : '190px'}">
                    <div
                      class="primary search"
                      @click="search"
                      :style="{
                        backgroundColor: searchStatus ? '#5a6268' : '',
                        color: searchStatus ? '#ffffff' : '',
                      }"
                    >
                      搜索
                    </div>
                    <div class="primary" @click="reset"  :style="{marginLeft: PKistodayorhall? '0px' : '30px'}">重置</div>
                  </div>
                </div>
              </div>
            </el-splitter-panel>
            <el-splitter-panel collapsible>
              <el-splitter>
                <el-splitter-panel collapsible :resizable="false">
                  <!-- 列表面板 -->
                  <div class="demo-panel">
                    <div
                      v-infinite-scroll="load"
                      infinite-scroll-distance="100px"
                      class="infinite-list"
                      style="overflow: auto"
                    >
                      <div
                        class="infinite-list-item"
                        v-for="(item, index) in list"
                        :key="index"
                      >
                        <div class="infinite-card">
                          <!-- 头像 -->
                          <div class="Avatar"></div>
                          <div class="Information">
                            <!-- 个人信息 -->
                            <div class="Information-Personal">
                              <div class="Information-name">
                                来自世界上最长名的国家的某个人
                              </div>
                              <div class="Information-gender">女</div>
                              <div class="Information-Country">
                                来自世界上最长名的国家的某个人
                              </div>
                            </div>
                            <!-- 时间 -->
                            <div class="time">PK时间（北京时间）:2025-08-09 01:00</div>
                            <!--PK信息 -->
                            <div class="Information-PK">
                              <img
                                class="goldimg"
                                src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/gold.png"
                                alt=""
                              />
                              <div class="gold">金币：9999k</div>
                              <img
                                class="sessionimg"
                                src="https://vv-1317974657.cos.ap-shanghai.myqcloud.com/util/session.png"
                                alt=""
                              />
                              <div class="Session">场次：100场</div>
                            </div>
                            <!-- 备注信息 -->
                            <div class="Information-Remarks">
                              这是一条备注信息他很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很长很
                            </div>
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </el-splitter-panel>
                <el-splitter-panel collapsible size="27%" :resizable="false">
                  <!-- 聊天面板 -->
                  <div class="demo-panel">
                    <div class="chat">
                      <div class="chat-name">来自世界上最长名的国家的某个人</div>
                      <div class="chat-content"></div>
                      <div class="chat-input">
                        <div class="chat-input-Controls"></div>
                        <div class="chat-input-Textarea">
                          <el-input
                            v-model="textarea"
                            style="width:100%"
                            :rows="4"
                            type="textarea"
                            placeholder="请输入内容"
                          />
                        </div>
                      </div>
                    </div>
                  </div>
                </el-splitter-panel>
              </el-splitter>
            </el-splitter-panel>
          </el-splitter>
        </el-splitter-panel>
      </el-splitter>
    </div>
    <!--  -->
  </div>
</template>

<script setup>
import {
  ref, // 响应式基础
  watch, // 侦听器
  onMounted, // 组件挂载完成后执行
  onUpdated, // 组件更新后执行
  onUnmounted, // 组件销毁前执行
} from "vue";
import { getCountryNamesArray } from "../../utils/countryUtil";
import { time } from "echarts";
const country = ref([]);
country.value = getCountryNamesArray(); //国家条目
const PKistodayorhall = ref(true); // 选择今日PK还是PK大厅/false 今日PK/true PK大厅
const genderOptions = [
  { value: 1, label: "男" },
  { value: 2, label: "女" },
]; // 性别选项
const searchStatus = ref(false); // 搜索状态

const countryvalue = ref(null); //选中的国家
const gendervalue = ref(null); // 选中的性别
const minnum = ref(null); // 最小金币
const maxnum = ref(null); // 最大金币
const timevalue = ref(null); // 时间
const textarea = ref(""); // 聊天输入框

const list = ref([{}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}, {}]); // 列表数据

//搜索按钮
function search() {
  searchStatus.value = true;
}

//重置按钮
function reset() {
  searchStatus.value = false;
  countryvalue.value = null;
  gendervalue.value = null;
  minnum.value = null;
  maxnum.value = null;
  timevalue.value = null;
}

function load() {} // 加载更多

const refname = ref(""); //
watch(refname, async (newQuestion, oldQuestion) => {
  // 变化后执行
});
onMounted(() => {
  // 组件挂载完成后执行
});
onUpdated(() => {
  // 组件更新后执行
});
onUnmounted(() => {
  // 组件销毁前执行
});
</script>

<style scoped lang="less">
.pk {
  width: 100%;
  height: 100%;
  // background-color: #ffffff;
}
.demo-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}
.el-scrollbar__wrap {
  height: 100%;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}
.controlPanel {
  width: 100%;
  height: 100%;
  background-image: linear-gradient(
    30deg,
    @bg-Sidebar-color-bottom,
    @bg-Sidebar-color-top
  );
  display: flex;
  align-items: center;
  justify-content: space-around;
}
.today {
  width: 150px;
  height: 50px;
  background-color: #ffffff;
  border-radius: 50px;
  transition: all 0.4s ease;
  color: #e9e8e8;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  line-height: 50px;
  letter-spacing: 3px;
}
.today:hover {
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
  transform: scale(1.1);
  opacity: 0.8;
}
.today:active {
  transform: scale(1.1) rotate(10deg);
}
.hall {
  width: 150px;
  height: 50px;
  background-color: #ffffff;
  border-radius: 50px;
  transition: all 0.4s ease;
  color: #e9e8e8;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  line-height: 50px;
  letter-spacing: 3px;
}
.hall:hover {
  box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
  transform: scale(1.1);
  opacity: 0.8;
}
.hall:active {
  transform: scale(1.1) rotate(10deg);
}
.selectbox {
  display: flex;
  // flex-direction: column;
  align-items: center;
}
.select {
  width: 150px;
  margin-top: 10px;
}
.Goldcoinbox {
  width: 330px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.Goldcoinbox-left {
  display: flex;
  flex-direction: column;
}
.Goldcoinbox-right {
  display: flex;
  flex-direction: column;
}
.Goldcoinbox-text {
  font-size: 10px;
  color: @Prompt-text-color;
}
.Goldcoinbox-middle {
  border-bottom: 2px solid #b9b9b9;
  width: 5px;
  height: 15px;
}
.timebox {
  width: 410px;
}
.btnbox {
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}
.primary {
  width: 80px;
  height: 30px;
  background-color: #e9e7e7;
  border-radius: 10px;
  color: @Supplementary-text-color;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  line-height: 30px;
  letter-spacing: 2px;
  transition: all 0.4s ease;
}
.search {
  margin-bottom: 20px;
}
.primary:hover {
  background-color: #5a6268;
  color: #ffffff;
  transform: scale(1.1);
  opacity: 0.8;
}
.infinite-list {
  width: 100%;
  height: 100%;
  background-color: #ffffff;
}
.infinite-list-item {
  width: 100%;
  height: 170px;
  margin-bottom: 20px;
  margin-top: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.infinite-card {
  width: 90%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background-image: linear-gradient(0deg, @bg-Sidebar-color-top, @bg-color);
  border-radius: 20px;
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.3);
  transition: all 0.4s ease;
}
.infinite-card:hover {
  box-shadow: 0px 0px 10px rgba(0, 0, 0, 0.8);
  transform: scale(1.1);
  opacity: 0.8;
}
.Avatar {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background-color: #ececec;
  margin-left: 30px;
}
.Information {
  width: calc(100% - 160px);
  height: 90%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.Information-Personal {
  display: flex;
  align-items: center;
}
.Information-name {
  width: auto;
  font-size: 20px;
  font-weight: bold;
  color: @font-color;
}
.Information-gender {
  width: 50px;
  height: 20px;
  background-color: #e9e7e7;
  border-radius: 10px;
  color: @Prompt-text-color;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  line-height: 20px;
  letter-spacing: 2px;
  margin-left: 20px;
}
.Information-Country {
  width: auto;
  height: 20px;
  background-color: #e9e7e7;
  border-radius: 10px;
  color: @Prompt-text-color;
  font-size: 12px;
  font-weight: bold;
  text-align: center;
  line-height: 20px;
  letter-spacing: 2px;
  padding-left: 5px;
  padding-right: 5px;
  margin-left: 20px;
}
.time {
  font-size: 16px;
  color: @Prompt-text-color;
}
.Information-PK {
  display: flex;
  align-items: center;
}
.goldimg {
  width: 20px;
  height: 20px;
  margin-right: 10px;
}
.gold {
  font-size: 16px;
  color: @font-color;
}
.sessionimg {
  width: 20px;
  height: 20px;
  margin-left: 50px;
  margin-right: 10px;
}
.Session {
  font-size: 16px;
  color: @font-color;
}
.Information-Remarks {
  font-size: 14px;
  color: @Prompt-text-color;
}
.chat {
  width: 100%;
  height: 100%;
}
.chat-name {
  width: 100%;
  height: 50px;
  background-color: #ffffff;
  // border-bottom: 3px solid #b9b9b9;
  color: @Prompt-text-color;
  font-size: 16px;
  font-weight: bold;
  text-align: center;
  line-height: 50px;
  letter-spacing: 3px;
  white-space: nowrap; /* 单行显示 */
  overflow: hidden;
  text-overflow: ellipsis; /* 显示省略号 */
}
.chat-content {
  width: 100%;
  height: calc(100% - 200px);
}
.chat-input {
  width: 100%;
  height: 150px;
  // border-top: 3px solid #b9b9b9;
}
.chat-input-Controls {
  width: 100%;
  height: 50px;
  background-color: @border-color;
}
.chat-input-Textarea {
  width: 100%;
  height: 80px;
  // background-color: #ffffff;
}
</style>
