四零语境前端代码仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

214 lines
4.9 KiB

1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
1 month ago
  1. <template>
  2. <view class="team-page">
  3. <!-- 固定顶部搜索框 -->
  4. <view class="fixed-header">
  5. <view class="search-container">
  6. <uv-search
  7. v-model="searchKeyword"
  8. placeholder="请输入"
  9. :show-action="true"
  10. action-text="搜索"
  11. :animation="true"
  12. bg-color="#f5f5f5"
  13. @search="handleSearch"
  14. @custom="handleSearch"
  15. @clear="handleCancel"
  16. :action-style="{color: '#fff', backgroundColor: '#06DADC', borderRadius:'8rpx', width:'100rpx', height: '64rpx', lineHeight: '64rpx', borderRadius: '198rpx', text:'white', fontSize:'26rpx'}"
  17. action
  18. ></uv-search>
  19. </view>
  20. </view>
  21. <!-- 内容区域 -->
  22. <view class="content-area">
  23. <!-- 成员列表 -->
  24. <view class="member-list">
  25. <view
  26. class="member-item"
  27. v-for="(member, index) in list"
  28. :key="index"
  29. @click="handleMemberClick(member)"
  30. >
  31. <image
  32. class="member-avatar"
  33. :src="member.avatar || '/static/default-avatar.png'"
  34. mode="aspectFill"
  35. ></image>
  36. <text class="member-name">{{ member.name }}</text>
  37. </view>
  38. </view>
  39. <uv-loading-icon text="加载中" textSize="30rpx" v-if="isLoading"></uv-loading-icon>
  40. <uv-empty v-else-if="list.length === 0 " text="暂无数据"></uv-empty>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. import MixinList from '@/mixins/list'
  46. export default {
  47. mixins: [MixinList],
  48. data() {
  49. return {
  50. mixinListApi: 'promotion.team',
  51. searchKeyword: '',
  52. members: [
  53. {
  54. id: 1,
  55. name: '李世海',
  56. avatar: '/static/default-avatar.png'
  57. },
  58. {
  59. id: 2,
  60. name: '周静',
  61. avatar: '/static/default-avatar.png'
  62. },
  63. {
  64. id: 3,
  65. name: '周海',
  66. avatar: '/static/default-avatar.png'
  67. },
  68. {
  69. id: 4,
  70. name: '冯启彬',
  71. avatar: '/static/default-avatar.png'
  72. },
  73. {
  74. id: 5,
  75. name: '李嫣',
  76. avatar: '/static/default-avatar.png'
  77. },
  78. {
  79. id: 6,
  80. name: '李书萍',
  81. avatar: '/static/default-avatar.png'
  82. },
  83. {
  84. id: 7,
  85. name: '赵吾光',
  86. avatar: '/static/default-avatar.png'
  87. },
  88. {
  89. id: 8,
  90. name: '冯云',
  91. avatar: '/static/default-avatar.png'
  92. },
  93. {
  94. id: 9,
  95. name: '周静',
  96. avatar: '/static/default-avatar.png'
  97. },
  98. {
  99. id: 10,
  100. name: '周海',
  101. avatar: '/static/default-avatar.png'
  102. },
  103. {
  104. id: 11,
  105. name: '冯启彬',
  106. avatar: '/static/default-avatar.png'
  107. },
  108. {
  109. id: 12,
  110. name: '李嫣',
  111. avatar: '/static/default-avatar.png'
  112. }
  113. ]
  114. }
  115. },
  116. computed: {
  117. filteredMembers() {
  118. if (!this.searchKeyword) {
  119. return this.members
  120. }
  121. return this.members.filter(member =>
  122. member.name.includes(this.searchKeyword)
  123. )
  124. }
  125. },
  126. methods: {
  127. mixinSetParams(){
  128. return {
  129. name: this.searchKeyword
  130. }
  131. },
  132. handleCancel(){
  133. this.initPage()
  134. this.getList(true)
  135. },
  136. handleSearch() {
  137. // 搜索逻辑已通过computed实现
  138. console.log('搜索关键词:', this.searchKeyword)
  139. this.initPage()
  140. this.getList(true)
  141. },
  142. handleMemberClick(member) {
  143. console.log('点击成员:', member)
  144. // 可以在这里添加跳转到成员详情页的逻辑
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. // @import '@/uni.scss';
  151. .team-page {
  152. min-height: 100vh;
  153. background-color: #f2f2f2;
  154. // 固定顶部搜索框
  155. .fixed-header {
  156. position: fixed;
  157. top: 0;
  158. left: 0;
  159. right: 0;
  160. z-index: 999;
  161. background-color: #fff;
  162. .search-container {
  163. padding: 20rpx 30rpx;
  164. background-color: #fff;
  165. }
  166. }
  167. // 内容区域
  168. .content-area {
  169. padding-top: 140rpx; // 为固定头部留出空间
  170. .member-list {
  171. background-color: #fff;
  172. margin: 0 40rpx;
  173. border-radius: 32rpx;
  174. .member-item {
  175. display: flex;
  176. align-items: center;
  177. padding: 16rpx 32rpx;
  178. height: 104rpx;
  179. border-bottom: 2rpx solid #F1F1F1;
  180. transition: background-color 0.3s;
  181. &:active {
  182. background-color: #f5f5f5;
  183. }
  184. &:last-child {
  185. border-bottom: none;
  186. }
  187. .member-avatar {
  188. width: 72rpx;
  189. height: 72rpx;
  190. border-radius: 50%;
  191. margin-right: 24rpx;
  192. background-color: #f0f0f0;
  193. }
  194. .member-name {
  195. font-size: 32rpx;
  196. color: #333;
  197. font-weight: 400;
  198. }
  199. }
  200. }
  201. }
  202. }
  203. </style>