index.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181
  1. <template>
  2. <view class="container">
  3. <!-- 列表区域 -->
  4. <scroll-view class="scroll-container" scroll-y refresher-enabled @refresherrefresh="onRefresh"
  5. :refresher-triggered="isRefreshing">
  6. <view class="security-list">
  7. <view v-for="(item, index) in securityList" :key="index" class="security-card">
  8. <view class="card-left">
  9. <image class="avatar" :src="item.avatar" mode="aspectFill" />
  10. </view>
  11. <view class="card-middle">
  12. <text class="name">{{ item.name }}</text>
  13. <text class="phone">{{ item.phone }}</text>
  14. <text class="position">{{ item.position }}</text>
  15. </view>
  16. <view class="card-right">
  17. <view class="action-buttons">
  18. <button size="mini" type="primary" class="action-btn"
  19. @tap.stop="onCardTap(item)">查看详情</button>
  20. </view>
  21. </view>
  22. </view>
  23. </view>
  24. </scroll-view>
  25. </view>
  26. </template>
  27. <script lang="ts" setup>
  28. import { ref } from 'vue';
  29. interface SecurityPerson {
  30. id : number;
  31. name : string;
  32. phone : string;
  33. position : string;
  34. status : string;
  35. avatar : string;
  36. }
  37. const isRefreshing = ref(false);
  38. const securityList = ref<SecurityPerson[]>([
  39. {
  40. id: 1,
  41. name: '张明',
  42. phone: '13800138000',
  43. position: '安保主管',
  44. status: '在岗',
  45. avatar: 'https://ai-public.mastergo.com/ai/img_res/0e24afc38826cc6acd7c21f9423bfff1.jpg'
  46. },
  47. {
  48. id: 2,
  49. name: '李强',
  50. phone: '13800138001',
  51. position: '安保队长',
  52. status: '休息',
  53. avatar: 'https://ai-public.mastergo.com/ai/img_res/5c69aa860f81bf5bcf6592deb7391099.jpg'
  54. },
  55. {
  56. id: 3,
  57. name: '王华',
  58. phone: '13800138002',
  59. position: '安保员',
  60. status: '在岗',
  61. avatar: 'https://ai-public.mastergo.com/ai/img_res/4b109fb7399df8f30756530cac9e9004.jpg'
  62. }
  63. ]);
  64. const onRefresh = () => {
  65. isRefreshing.value = true;
  66. setTimeout(() => {
  67. isRefreshing.value = false;
  68. }, 1000);
  69. };
  70. const onCardTap = (item : SecurityPerson) => {
  71. uni.navigateTo({
  72. url: `/pages/security/personnelDetails?name=${item.name}`
  73. })
  74. };
  75. </script>
  76. <style>
  77. page {
  78. height: 100%;
  79. }
  80. .container {
  81. height: 100%;
  82. display: flex;
  83. flex-direction: column;
  84. background-color: #f5f5f5;
  85. }
  86. .scroll-container {
  87. flex: 1;
  88. overflow: auto;
  89. }
  90. .security-list {
  91. padding: 20rpx;
  92. }
  93. .security-card {
  94. display: flex;
  95. align-items: center;
  96. padding: 30rpx;
  97. background-color: #ffffff;
  98. border-radius: 12rpx;
  99. margin-bottom: 20rpx;
  100. }
  101. .card-left {
  102. margin-right: 30rpx;
  103. flex-shrink: 0;
  104. }
  105. .avatar {
  106. width: 120rpx;
  107. height: 120rpx;
  108. border-radius: 60rpx;
  109. }
  110. .card-middle {
  111. flex: 1;
  112. display: flex;
  113. flex-direction: column;
  114. }
  115. .name {
  116. font-size: 16px;
  117. font-weight: 600;
  118. color: #333333;
  119. margin-bottom: 8rpx;
  120. }
  121. .phone {
  122. font-size: 14px;
  123. color: #666666;
  124. margin-bottom: 8rpx;
  125. }
  126. .position {
  127. font-size: 14px;
  128. color: #999999;
  129. }
  130. .card-right {
  131. display: flex;
  132. flex-direction: column;
  133. align-items: flex-end;
  134. flex-shrink: 0;
  135. }
  136. .status-tag {
  137. padding: 4rpx 16rpx;
  138. border-radius: 4rpx;
  139. font-size: 12px;
  140. margin-bottom: 16rpx;
  141. }
  142. .status-active {
  143. background-color: #e6f7ff;
  144. color: #1890ff;
  145. }
  146. .status-inactive {
  147. background-color: #fff1f0;
  148. color: #ff4d4f;
  149. }
  150. .action-buttons {
  151. display: flex;
  152. gap: 16rpx;
  153. }
  154. .action-btn {
  155. font-size: 12px;
  156. padding: 0 20rpx;
  157. }
  158. </style>