<template>
  <view class="team-page">
    <!-- 固定顶部搜索框 -->
    <view class="fixed-header">
      <view class="search-container">
        <uv-search 
          v-model="searchKeyword" 
          placeholder="请输入" 
          :show-action="true"
          action-text="搜索"
          :animation="true"
          bg-color="#f5f5f5"
          @search="handleSearch"
          @custom="handleSearch"
          
          :action-style="{color: '#fff', backgroundColor: '#06DADC', borderRadius:'8rpx', width:'100rpx', height: '64rpx', lineHeight: '64rpx', borderRadius: '198rpx', text:'white', fontSize:'26rpx'}"
          action
        ></uv-search>
      </view>
    </view>
    
    <!-- 内容区域 -->
    <view class="content-area">
      <!-- 成员列表 -->
      <view class="member-list">
        <view 
          class="member-item" 
          v-for="(member, index) in filteredMembers" 
          :key="index"
          @click="handleMemberClick(member)"
        >
          <image 
            class="member-avatar" 
            :src="member.avatar || '/static/默认头像.png'"
            mode="aspectFill"
          ></image>
          <text class="member-name">{{ member.name }}</text>
        </view>
      </view>
    </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      searchKeyword: '',
      members: [
        {
          id: 1,
          name: '李世海',
          avatar: '/static/默认头像.png'
        },
        {
          id: 2,
          name: '周静',
          avatar: '/static/默认头像.png'
        },
        {
          id: 3,
          name: '周海',
          avatar: '/static/默认头像.png'
        },
        {
          id: 4,
          name: '冯启彬',
          avatar: '/static/默认头像.png'
        },
        {
          id: 5,
          name: '李嫣',
          avatar: '/static/默认头像.png'
        },
        {
          id: 6,
          name: '李书萍',
          avatar: '/static/默认头像.png'
        },
        {
          id: 7,
          name: '赵吾光',
          avatar: '/static/默认头像.png'
        },
        {
          id: 8,
          name: '冯云',
          avatar: '/static/默认头像.png'
        },
        {
          id: 9,
          name: '周静',
          avatar: '/static/默认头像.png'
        },
        {
          id: 10,
          name: '周海',
          avatar: '/static/默认头像.png'
        },
        {
          id: 11,
          name: '冯启彬',
          avatar: '/static/默认头像.png'
        },
        {
          id: 12,
          name: '李嫣',
          avatar: '/static/默认头像.png'
        }
      ]
    }
  },
  computed: {
    filteredMembers() {
      if (!this.searchKeyword) {
        return this.members
      }
      return this.members.filter(member => 
        member.name.includes(this.searchKeyword)
      )
    }
  },
  methods: {
    handleSearch() {
      // 搜索逻辑已通过computed实现
      console.log('搜索关键词:', this.searchKeyword)
    },
    handleMemberClick(member) {
      console.log('点击成员:', member)
      // 可以在这里添加跳转到成员详情页的逻辑
    }
  }
}
</script>

<style lang="scss" scoped>
// @import '@/uni.scss';

.team-page {
  min-height: 100vh;
  background-color: #f2f2f2;
  
  // 固定顶部搜索框
  .fixed-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 999;
    background-color: #fff;
    
    .search-container {
      padding: 20rpx 30rpx;
      background-color: #fff;
    }
  }
  
  // 内容区域
  .content-area {
    padding-top: 140rpx; // 为固定头部留出空间
    
    .member-list {
      background-color: #fff;
      margin: 0 40rpx;
      border-radius: 32rpx;
      .member-item {
        display: flex;
        align-items: center;
        padding: 16rpx 32rpx;
        height: 104rpx;
        border-bottom: 2rpx solid #F1F1F1;
        transition: background-color 0.3s;
        
        &:active {
          background-color: #f5f5f5;
        }
        
        &:last-child {
          border-bottom: none;
        }
        
        .member-avatar {
          width: 72rpx;
          height: 72rpx;
          border-radius: 50%;
          margin-right: 24rpx;
          background-color: #f0f0f0;
        }
        
        .member-name {
          font-size: 32rpx;
          color: #333;
          font-weight: 400;
        }
      }
    }
  }
}
</style>