爱简收旧衣按件回收前端代码仓库
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.

162 lines
4.0 KiB

1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
  1. <template>
  2. <view class="staff-manage-container">
  3. <!-- 顶部导航栏 -->
  4. <view class="navbar" :style="navbarStyle">
  5. <view class="nav-left" @tap="goBack">
  6. <uni-icons type="back" size="24" color="#222" />
  7. </view>
  8. <view class="nav-title">员工管理</view>
  9. <view class="nav-right">
  10. <!-- <uni-icons type="more-filled" size="24" color="#222" style="margin-right: 16rpx;" />
  11. <uni-icons type="scan" size="24" color="#222" /> -->
  12. </view>
  13. </view>
  14. <view class="staff-list" :style="{marginTop: navBarRealHeight + 'px'}">
  15. <view v-for="(staff, idx) in staffList" :key="idx" class="staff-card" @tap="goStaffDetail(staff)">
  16. <view class="staff-info-row">
  17. <text class="staff-label">姓名</text>
  18. <text class="staff-value">{{ staff.name }}</text>
  19. </view>
  20. <view class="staff-info-row">
  21. <text class="staff-label">角色</text>
  22. <text class="staff-value">{{ staff.role }}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import pullRefreshMixin from '../mixins/pullRefreshMixin.js'
  30. export default {
  31. mixins: [pullRefreshMixin],
  32. data() {
  33. return {
  34. staffList: [
  35. { name: '冯启彬', role: '质检员' },
  36. { name: '周琪', role: '质检员' },
  37. { name: '王凡玄', role: '质检员' },
  38. { name: '李世海', role: '质检员' },
  39. { name: '李娅', role: '质检员' },
  40. { name: '郑婷雅', role: '质检员' },
  41. { name: '冯思钰', role: '质检员' },
  42. ],
  43. statusBarHeight: 0,
  44. navBarRealHeight: 0,
  45. }
  46. },
  47. computed: {
  48. navbarStyle() {
  49. return `padding-top: ${this.statusBarHeight}px;`;
  50. }
  51. },
  52. onLoad() {
  53. uni.getSystemInfo({
  54. success: (res) => {
  55. this.statusBarHeight = res.statusBarHeight || 20;
  56. }
  57. });
  58. this.$nextTick(() => {
  59. uni.createSelectorQuery().select('.navbar').boundingClientRect(rect => {
  60. if (rect) {
  61. this.navBarRealHeight = rect.height;
  62. }
  63. }).exec();
  64. });
  65. },
  66. methods: {
  67. goBack() {
  68. uni.navigateBack();
  69. },
  70. goStaffDetail(staff) {
  71. uni.navigateTo({
  72. url: '/pages/manager/staff-detail',
  73. success: (res) => {
  74. res.eventChannel.emit('staffDetail', staff);
  75. }
  76. });
  77. },
  78. refreshData() {
  79. // TODO: 实现员工列表刷新逻辑,如重新请求接口
  80. },
  81. async onRefresh() {
  82. await this.refreshData && this.refreshData()
  83. },
  84. },
  85. onPullDownRefresh() {
  86. this.refreshData && this.refreshData()
  87. uni.stopPullDownRefresh()
  88. }
  89. }
  90. </script>
  91. <style lang="scss" scoped>
  92. .staff-manage-container {
  93. min-height: 100vh;
  94. background: #f7f7f7;
  95. padding-bottom: 40rpx;
  96. }
  97. .navbar {
  98. position: fixed;
  99. top: 0;
  100. left: 0;
  101. width: 100vw;
  102. height: 100rpx;
  103. background: #fff;
  104. z-index: 10;
  105. display: flex;
  106. align-items: flex-end;
  107. justify-content: space-between;
  108. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  109. padding: 0 32rpx;
  110. .nav-left {
  111. flex: 0 0 48rpx;
  112. display: flex;
  113. align-items: center;
  114. height: 100%;
  115. }
  116. .nav-title {
  117. flex: 1;
  118. text-align: center;
  119. font-size: 36rpx;
  120. font-weight: bold;
  121. color: #222;
  122. line-height: 100rpx;
  123. }
  124. .nav-right {
  125. flex: 0 0 80rpx;
  126. display: flex;
  127. align-items: center;
  128. justify-content: flex-end;
  129. height: 100%;
  130. }
  131. }
  132. .staff-list {
  133. margin-top: calc(100rpx + var(--status-bar-height));
  134. padding: 32rpx 0;
  135. min-height: calc(100vh - 100rpx - var(--status-bar-height));
  136. box-sizing: border-box;
  137. }
  138. .staff-card {
  139. background: #fff;
  140. border-radius: 40rpx;
  141. margin: 0 32rpx 32rpx 32rpx;
  142. padding: 40rpx 36rpx 36rpx 36rpx;
  143. box-shadow: 0 2rpx 8rpx rgba(0,0,0,0.03);
  144. }
  145. .staff-info-row {
  146. display: flex;
  147. align-items: center;
  148. margin-bottom: 18rpx;
  149. .staff-label {
  150. font-size: 30rpx;
  151. color: #b3b3b3;
  152. width: 110rpx;
  153. font-weight: 400;
  154. }
  155. .staff-value {
  156. font-size: 32rpx;
  157. color: #222;
  158. font-weight: 500;
  159. }
  160. }
  161. </style>