index.vue 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <!-- 页面容器 -->
  3. <view class="container">
  4. <!-- 顶部标签栏 -->
  5. <view class="tab-bar">
  6. <view
  7. v-for="(tab, index) in tabs"
  8. :key="index"
  9. :class="['tab-item', currentTab === index ? 'active' : '']"
  10. @click="currentTab = index"
  11. >
  12. {{ tab }}
  13. </view>
  14. </view>
  15. <!-- 搜索区域 -->
  16. <view class="search-bar">
  17. <input
  18. type="text"
  19. placeholder="请输入承包方姓名"
  20. v-model="searchName"
  21. class="search-input"
  22. />
  23. <button class="search-btn" @click="handleSearch">搜索</button>
  24. </view>
  25. <!-- 无数据占位区域 -->
  26. <view class="empty-data" v-if="isDataEmpty">
  27. <text class="empty-text">暂无数据</text>
  28. </view>
  29. </view>
  30. </template>
  31. <script setup>
  32. import { ref } from 'vue';
  33. // 标签栏数据
  34. const tabs = ref(['未调查', '已调查', '内业已处理']);
  35. // 当前选中标签索引
  36. const currentTab = ref(0);
  37. // 搜索框绑定值
  38. const searchName = ref('');
  39. // 是否无数据(实际项目中根据接口返回值判断)
  40. const isDataEmpty = ref(true);
  41. // 搜索按钮点击事件
  42. const handleSearch = () => {
  43. console.log('搜索关键词:', searchName.value);
  44. // 实际项目中调用接口查询数据
  45. };
  46. </script>
  47. <style scoped>
  48. /* 页面容器 */
  49. .container {
  50. padding: 10rpx;
  51. background-color: #fff;
  52. min-height: 100vh;
  53. }
  54. /* 标签栏样式 */
  55. .tab-bar {
  56. display: flex;
  57. margin-bottom: 20rpx;
  58. }
  59. .tab-item {
  60. flex: 1;
  61. text-align: center;
  62. padding: 15rpx 0;
  63. font-size: 28rpx;
  64. color: #333;
  65. border: 1px solid #e5e5e5;
  66. border-right: none;
  67. }
  68. .tab-item:last-child {
  69. border-right: 1px solid #e5e5e5;
  70. }
  71. .tab-item.active {
  72. background-color: #2c83ff;
  73. color: #fff;
  74. border-color: #2c83ff;
  75. }
  76. /* 搜索栏样式 */
  77. .search-bar {
  78. display: flex;
  79. align-items: center;
  80. margin-bottom: 40rpx;
  81. }
  82. .search-input {
  83. flex: 1;
  84. height: 60rpx;
  85. border: 1px solid #e5e5e5;
  86. border-radius: 8rpx 0 0 8rpx;
  87. padding: 0 20rpx;
  88. font-size: 28rpx;
  89. }
  90. .search-btn {
  91. width: 120rpx;
  92. height: 60rpx;
  93. background-color: #2c83ff;
  94. color: #fff;
  95. font-size: 28rpx;
  96. border-radius: 0 8rpx 8rpx 0;
  97. display: flex;
  98. align-items: center;
  99. justify-content: center;
  100. }
  101. /* 无数据占位样式 */
  102. .empty-data {
  103. display: flex;
  104. flex-direction: column;
  105. align-items: center;
  106. margin-top: 100rpx;
  107. }
  108. .empty-img {
  109. width: 200rpx;
  110. margin-bottom: 20rpx;
  111. }
  112. .empty-text {
  113. font-size: 28rpx;
  114. color: #999;
  115. }
  116. </style>