| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181 |
- <template>
- <view class="container">
- <!-- 列表区域 -->
- <scroll-view class="scroll-container" scroll-y refresher-enabled @refresherrefresh="onRefresh"
- :refresher-triggered="isRefreshing">
- <view class="security-list">
- <view v-for="(item, index) in securityList" :key="index" class="security-card">
- <view class="card-left">
- <image class="avatar" :src="item.avatar" mode="aspectFill" />
- </view>
- <view class="card-middle">
- <text class="name">{{ item.name }}</text>
- <text class="phone">{{ item.phone }}</text>
- <text class="position">{{ item.position }}</text>
- </view>
- <view class="card-right">
- <view class="action-buttons">
- <button size="mini" type="primary" class="action-btn"
- @tap.stop="onCardTap(item)">查看详情</button>
- </view>
- </view>
- </view>
- </view>
- </scroll-view>
- </view>
- </template>
- <script lang="ts" setup>
- import { ref } from 'vue';
- interface SecurityPerson {
- id : number;
- name : string;
- phone : string;
- position : string;
- status : string;
- avatar : string;
- }
- const isRefreshing = ref(false);
- const securityList = ref<SecurityPerson[]>([
- {
- id: 1,
- name: '张明',
- phone: '13800138000',
- position: '安保主管',
- status: '在岗',
- avatar: 'https://ai-public.mastergo.com/ai/img_res/0e24afc38826cc6acd7c21f9423bfff1.jpg'
- },
- {
- id: 2,
- name: '李强',
- phone: '13800138001',
- position: '安保队长',
- status: '休息',
- avatar: 'https://ai-public.mastergo.com/ai/img_res/5c69aa860f81bf5bcf6592deb7391099.jpg'
- },
- {
- id: 3,
- name: '王华',
- phone: '13800138002',
- position: '安保员',
- status: '在岗',
- avatar: 'https://ai-public.mastergo.com/ai/img_res/4b109fb7399df8f30756530cac9e9004.jpg'
- }
- ]);
- const onRefresh = () => {
- isRefreshing.value = true;
- setTimeout(() => {
- isRefreshing.value = false;
- }, 1000);
- };
- const onCardTap = (item : SecurityPerson) => {
- uni.navigateTo({
- url: `/pages/security/personnelDetails?name=${item.name}`
- })
- };
- </script>
- <style>
- page {
- height: 100%;
- }
- .container {
- height: 100%;
- display: flex;
- flex-direction: column;
- background-color: #f5f5f5;
- }
- .scroll-container {
- flex: 1;
- overflow: auto;
- }
- .security-list {
- padding: 20rpx;
- }
- .security-card {
- display: flex;
- align-items: center;
- padding: 30rpx;
- background-color: #ffffff;
- border-radius: 12rpx;
- margin-bottom: 20rpx;
- }
- .card-left {
- margin-right: 30rpx;
- flex-shrink: 0;
- }
- .avatar {
- width: 120rpx;
- height: 120rpx;
- border-radius: 60rpx;
- }
- .card-middle {
- flex: 1;
- display: flex;
- flex-direction: column;
- }
- .name {
- font-size: 16px;
- font-weight: 600;
- color: #333333;
- margin-bottom: 8rpx;
- }
- .phone {
- font-size: 14px;
- color: #666666;
- margin-bottom: 8rpx;
- }
- .position {
- font-size: 14px;
- color: #999999;
- }
- .card-right {
- display: flex;
- flex-direction: column;
- align-items: flex-end;
- flex-shrink: 0;
- }
- .status-tag {
- padding: 4rpx 16rpx;
- border-radius: 4rpx;
- font-size: 12px;
- margin-bottom: 16rpx;
- }
- .status-active {
- background-color: #e6f7ff;
- color: #1890ff;
- }
- .status-inactive {
- background-color: #fff1f0;
- color: #ff4d4f;
- }
- .action-buttons {
- display: flex;
- gap: 16rpx;
- }
- .action-btn {
- font-size: 12px;
- padding: 0 20rpx;
- }
- </style>
|