index.vue 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869
  1. <template>
  2. <view class="container">
  3. <!-- 搜索区域 -->
  4. <view class="search-section">
  5. <view class="search-box" :class="{ 'search-focus': isSearchFocused }">
  6. <view class="search-icon">
  7. <text class="iconfont icon-search"></text>
  8. </view>
  9. <input
  10. class="search-input"
  11. type="text"
  12. v-model="searchKeyword"
  13. placeholder="搜索设备名称 / 编号"
  14. confirm-type="search"
  15. @confirm="handleSearch"
  16. @focus="isSearchFocused = true"
  17. @blur="isSearchFocused = false"
  18. />
  19. <view class="clear-icon" v-if="searchKeyword" @click="handleClearSearch">
  20. <text class="iconfont icon-close"></text>
  21. </view>
  22. </view>
  23. </view>
  24. <!-- 状态筛选区域 -->
  25. <view class="filter-section">
  26. <view
  27. class="filter-item"
  28. :class="{ active: statusFilter === 'all' }"
  29. @click="setStatusFilter('all')"
  30. >
  31. 全部
  32. </view>
  33. <view
  34. class="filter-item"
  35. :class="{ active: statusFilter === 'online' }"
  36. @click="setStatusFilter('online')"
  37. >
  38. <view class="filter-dot online-dot"></view>
  39. 在线 ({{ onlineCount }})
  40. </view>
  41. <view
  42. class="filter-item"
  43. :class="{ active: statusFilter === 'offline' }"
  44. @click="setStatusFilter('offline')"
  45. >
  46. <view class="filter-dot offline-dot"></view>
  47. 离线 ({{ offlineCount }})
  48. </view>
  49. </view>
  50. <!-- 设备列表区域 -->
  51. <scroll-view
  52. scroll-y
  53. class="device-list"
  54. @scrolltolower="loadMore"
  55. :scroll-with-animation="true"
  56. :enable-back-to-top="true"
  57. :refresher-enabled="true"
  58. :refresher-threshold="80"
  59. :refresher-triggered="isRefreshing"
  60. @refresherrefresh="handleRefresh"
  61. @refresherrestore="isRefreshing = false"
  62. >
  63. <!-- 无数据提示 -->
  64. <view v-if="filteredDeviceList.length === 0 && !isLoading" class="empty-tips">
  65. <view class="empty-icon">
  66. <text class="iconfont icon-empty"></text>
  67. </view>
  68. <text class="empty-text">{{ searchKeyword ? '未找到匹配的设备' : '暂无设备' }}</text>
  69. <view v-if="searchKeyword" class="empty-action" @click="handleClearSearch">
  70. <text>清除搜索条件</text>
  71. </view>
  72. </view>
  73. <!-- 首次加载中状态 -->
  74. <view v-if="isLoading && deviceList.length === 0" class="loading-container">
  75. <view class="loading-spinner"></view>
  76. <text class="loading-text">加载中...</text>
  77. </view>
  78. <!-- 设备列表 -->
  79. <view
  80. v-for="(item, index) in filteredDeviceList"
  81. :key="index"
  82. class="device-card"
  83. :class="{
  84. 'has-alert': item.alarmCount > 0,
  85. 'is-offline': item.status === 'offline'
  86. }"
  87. hover-class="device-card-hover"
  88. hover-stay-time="70"
  89. @click="navigateToDetail(item)"
  90. >
  91. <!-- 设备基本信息 -->
  92. <view class="device-info">
  93. <view class="device-icon-wrapper">
  94. <!-- 告警角标 -->
  95. <view v-if="item.alarmCount > 0" class="alarm-badge">
  96. {{ item.alarmCount }}
  97. </view>
  98. <view class="device-icon-container" :class="{'offline-icon': item.status === 'offline'}">
  99. <image :src="getDeviceIcon(item.type)" mode="aspectFit" class="device-icon"></image>
  100. </view>
  101. </view>
  102. <view class="device-meta">
  103. <view class="device-name-row">
  104. <text class="device-name" :class="{'offline-text': item.status === 'offline'}">{{ item.name }}</text>
  105. <view
  106. class="status-tag"
  107. :class="item.status === 'online' ? 'status-online' : 'status-offline'"
  108. >
  109. <text class="status-dot" :class="{'offline-dot': item.status === 'offline'}"></text>
  110. {{ item.status === 'online' ? '在线' : '离线' }}
  111. </view>
  112. </view>
  113. <view class="device-id">
  114. <text class="id-label">设备编号:</text>
  115. <text class="id-value">{{ item.code }}</text>
  116. </view>
  117. <view class="device-location">
  118. <text class="location-label">安装位置:</text>
  119. <text class="location-value">{{ item.location }}</text>
  120. </view>
  121. </view>
  122. </view>
  123. <!-- 底部信息栏 -->
  124. <view class="device-footer">
  125. <text class="update-time">{{ item.updateTime }}</text>
  126. <view class="device-actions">
  127. <text class="iconfont icon-right"></text>
  128. </view>
  129. </view>
  130. </view>
  131. <!-- 加载更多提示 -->
  132. <view v-if="filteredDeviceList.length > 0" class="load-more">
  133. <view class="load-more-content" v-if="loadMoreStatus === 'loading'">
  134. <view class="loading-icon"></view>
  135. <text>正在加载...</text>
  136. </view>
  137. <view class="load-more-content" v-if="loadMoreStatus === 'nomore'">
  138. <text>没有更多了</text>
  139. </view>
  140. <view class="load-more-content" v-if="loadMoreStatus === 'loadmore'" @click="loadMore">
  141. <text>点击加载更多</text>
  142. </view>
  143. </view>
  144. </scroll-view>
  145. </view>
  146. </template>
  147. <script>
  148. export default {
  149. data() {
  150. return {
  151. deviceType: '',
  152. searchKeyword: '',
  153. isSearchFocused: false,
  154. statusFilter: 'all', // 'all', 'online', 'offline'
  155. deviceList: [],
  156. page: 1,
  157. limit: 10,
  158. loadMoreStatus: 'loading', // 'loadmore', 'loading', 'nomore'
  159. isLoading: true,
  160. isRefreshing: false
  161. }
  162. },
  163. computed: {
  164. // 过滤后的设备列表
  165. filteredDeviceList() {
  166. let result = this.deviceList;
  167. // 按状态筛选
  168. if (this.statusFilter !== 'all') {
  169. result = result.filter(device => device.status === this.statusFilter);
  170. }
  171. // 按关键词搜索
  172. if (this.searchKeyword) {
  173. const keyword = this.searchKeyword.toLowerCase();
  174. result = result.filter(device =>
  175. device.name.toLowerCase().includes(keyword) ||
  176. device.code.toLowerCase().includes(keyword)
  177. );
  178. }
  179. return result;
  180. },
  181. // 在线设备数量
  182. onlineCount() {
  183. return this.deviceList.filter(device => device.status === 'online').length;
  184. },
  185. // 离线设备数量
  186. offlineCount() {
  187. return this.deviceList.filter(device => device.status === 'offline').length;
  188. }
  189. },
  190. onLoad(options) {
  191. // 获取路由参数
  192. if (options.type) {
  193. this.deviceType = options.type;
  194. this.setPageTitle();
  195. }
  196. // 加载设备数据
  197. this.loadDeviceData();
  198. },
  199. methods: {
  200. // 设置页面标题
  201. setPageTitle() {
  202. const titleMap = {
  203. 'monitor': '监控设备列表',
  204. 'sensor': '采集设备列表',
  205. 'control': '控制设备列表',
  206. 'irrigation': '灌溉设备列表',
  207. 'tractor': '农机设备列表'
  208. };
  209. const title = titleMap[this.deviceType] || '设备列表';
  210. uni.setNavigationBarTitle({
  211. title: title
  212. });
  213. },
  214. // 获取设备图标
  215. getDeviceIcon(type) {
  216. const iconMap = {
  217. 'monitor': '/static/icons/camera.png',
  218. 'sensor': '/static/icons/sensor.png',
  219. 'control': '/static/icons/control.png',
  220. 'irrigation': '/static/icons/water.png',
  221. 'tractor': '/static/icons/tractor.png'
  222. };
  223. return iconMap[type] || '/static/icons/device-default.png';
  224. },
  225. // 设置状态筛选
  226. setStatusFilter(status) {
  227. this.statusFilter = status;
  228. },
  229. // 加载设备数据
  230. loadDeviceData() {
  231. this.isLoading = true;
  232. // 模拟API请求数据
  233. setTimeout(() => {
  234. // 这里应该是真实的API请求
  235. // 模拟一些设备数据用于展示
  236. const newDevices = this.generateMockDevices();
  237. this.deviceList = [...this.deviceList, ...newDevices];
  238. if (this.deviceList.length >= 30) {
  239. this.loadMoreStatus = 'nomore';
  240. } else {
  241. this.loadMoreStatus = 'loadmore';
  242. }
  243. this.isLoading = false;
  244. this.isRefreshing = false;
  245. }, 1000);
  246. },
  247. // 生成模拟设备数据
  248. generateMockDevices() {
  249. const devices = [];
  250. const locations = ['东区A1地块', '西区B2地块', '南区C3地块', '北区D4地块'];
  251. const updateTimes = ['刚刚更新', '1分钟前更新', '5分钟前更新', '10分钟前更新', '1小时前更新'];
  252. // 根据当前页码和限制数量生成对应数量的模拟数据
  253. const startIndex = (this.page - 1) * this.limit;
  254. for (let i = 0; i < this.limit; i++) {
  255. const index = startIndex + i;
  256. // 如果已经生成了30条数据,则停止
  257. if (index >= 30) break;
  258. // 对于采集设备类型,生成随机的气象或土壤设备
  259. let deviceType = this.deviceType;
  260. let deviceCode = `DEV${String(index + 1001).padStart(4, '0')}`;
  261. // 如果是采集设备,随机生成气象站或土壤墒情设备
  262. if (this.deviceType === 'sensor') {
  263. // 随机分配采集设备子类型:气象站或土壤墒情
  264. const sensorSubType = Math.random() > 0.5 ? 'weather' : 'soil';
  265. deviceCode = sensorSubType === 'weather' ? `W${deviceCode}` : `S${deviceCode}`;
  266. }
  267. devices.push({
  268. id: `device-${index + 1}`,
  269. name: `${this.getDeviceTypeName(this.deviceType)}-${index + 1}`,
  270. code: deviceCode,
  271. type: deviceType,
  272. status: Math.random() > 0.3 ? 'online' : 'offline', // 70% 概率在线
  273. location: locations[Math.floor(Math.random() * locations.length)],
  274. updateTime: updateTimes[Math.floor(Math.random() * updateTimes.length)],
  275. alarmCount: Math.random() > 0.7 ? Math.floor(Math.random() * 3) + 1 : 0 // 30% 概率有告警
  276. });
  277. }
  278. return devices;
  279. },
  280. // 获取设备类型名称
  281. getDeviceTypeName(type) {
  282. const nameMap = {
  283. 'monitor': '监控设备',
  284. 'sensor': '采集设备',
  285. 'control': '控制设备',
  286. 'irrigation': '灌溉设备',
  287. 'tractor': '农机设备'
  288. };
  289. return nameMap[type] || '未知设备';
  290. },
  291. // 处理搜索
  292. handleSearch() {
  293. // 执行搜索逻辑
  294. console.log('搜索关键词:', this.searchKeyword);
  295. },
  296. // 处理清空搜索
  297. handleClearSearch() {
  298. this.searchKeyword = '';
  299. },
  300. // 加载更多数据
  301. loadMore() {
  302. if (this.loadMoreStatus !== 'nomore') {
  303. this.loadMoreStatus = 'loading';
  304. this.page += 1;
  305. this.loadDeviceData();
  306. }
  307. },
  308. // 跳转到设备详情页
  309. navigateToDetail(device) {
  310. // 根据设备类型跳转到不同的详情页
  311. let url = '';
  312. if (device.type === 'monitor') {
  313. url = `/pages/device-list/detail-camera?id=${device.id}`;
  314. } else if (device.type === 'sensor') {
  315. // 采集设备跳转到采集设备详情页,同时传递设备编码,便于判断设备子类型
  316. url = `/pages/device-list/detail-collector?id=${device.id}&code=${device.code}`;
  317. } else {
  318. // 其他类型设备暂时使用通用详情页
  319. url = `/pages/device-detail/index?id=${device.id}&type=${device.type}`;
  320. }
  321. uni.navigateTo({
  322. url: url
  323. });
  324. },
  325. // 处理刷新
  326. handleRefresh() {
  327. this.isRefreshing = true;
  328. this.page = 1;
  329. this.deviceList = [];
  330. this.loadDeviceData();
  331. }
  332. }
  333. }
  334. </script>
  335. <style scoped>
  336. /* 图标字体 */
  337. @font-face {
  338. font-family: "iconfont";
  339. src: url('data:font/woff2;charset=utf-8;base64,d09GMgABAAAAAAOMAAsAAAAACFAAAAM+AAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHFQGYACDMgqDGIJmATYCJAMUCwwABCAFhGcHRhvqBsgOJaDgwABgBNFYPPy3H/3OSB4kWdI1Pb2QBw8gSpZIsxBFsTCNTIm//9dv/7FzF1E1S9ysIZWDPNdPJdSYbfLy/+fpTTMwKn5ZZ3OImpRUTZ8FHAcYFrLCBqyAHZD3CP9I09oXUgNcDSEAS8oGR507tO6KhRQTNQGQyeNGD8PCkVATUkFYsMgGcuqQ5YiFWruCPAVYnn9f/KGFBQxrghRq0KjzAXS5TP3SHp3ZmXUyEIfTAYDvDEiQARSQiaJjIjKaZiDJ+hpQYnY1i8tK1ZfWl83/fxYLm8TS//EADBBU6C9ghIBwJXxprxqwhC8d6x9AvAB4BcARgGWgRlWY71Cn5I5XvJ5Ot5sXy91Ud9Oj1nXnfbK9vK09bVsrGq2rrB1sxMcbxZmXntbdI8u6cRGhGy9r92Hj7hCjx1G6Dd9G9N6sbSvwVZiw+/hC0D7WFi5tbcltVyPOdqm41HkQr9T0bKFa2zrLLVeKJufZy7vn7aXtY+3XMvl65fJ7wnHT7ZJWozcvrHC5XNnTGy5/0NvX1xdSu8W9Ml0ePXEqZ3Jm0r6SLSdPbJnc27Mm05YsrLjfI8Ypvb5dL5pAj9m5c3Tzw+UvtK/SzO/Vv+Dt/9Lfq3+Xr30Hf9pz0JsnGgsPDBWHv+v12l5zGsE7Pz9A2d0W9WJ2dUZ/a/PkxQW58o/asvHDfyvJEw39G/5zf2p9OmZFYYGKoioVKPzPpwQA0+d2xv7C/aL/Dx/m7QfkjDLZL8AH4F3p+8PBrGIuqFLmM3uqfI6+YxAFCRZWAQ9LM8Q3JuRm2/bCgWEDCgzzIFgrEYk0AxgciQCDtQxgSRr76yYgfkIiHoB0FxGEEKfAEOQMJCHukYj0CQyjPsMQ0oJgyQD6hI6DL3FILJJLiqDqQs9kbYnLnTRuoA+5j7HsWmUJG2QdvdPrY51xR0WpwQZZIJvsGJ8OWYgVpomO28rIDCGTHHGJpqFe7xSPlUXs04FBiQV1FxSCqhboGVlrEldXpOGP94G4Hwydnaj6DjJBj1dvVtZizE8WlMYD9rHWaVsLsmF6QhZEmMDsIk1wOZWLgSHSSTkEJzGNQvvLc3HLFVXz9euBBWkm+YbLZKGH3uISrbIXRuNaAA==');
  340. }
  341. .iconfont {
  342. font-family: "iconfont" !important;
  343. font-size: 24rpx;
  344. font-style: normal;
  345. -webkit-font-smoothing: antialiased;
  346. -moz-osx-font-smoothing: grayscale;
  347. }
  348. .icon-search:before {
  349. content: "\e6e1";
  350. font-size: 32rpx;
  351. }
  352. .icon-close:before {
  353. content: "\e6a7";
  354. font-size: 28rpx;
  355. }
  356. .icon-right:before {
  357. content: "\e6a3";
  358. font-size: 28rpx;
  359. }
  360. .icon-empty:before {
  361. content: "\e6a9";
  362. font-size: 80rpx;
  363. }
  364. /* 容器样式 */
  365. .container {
  366. display: flex;
  367. flex-direction: column;
  368. min-height: 100vh;
  369. background-color: #F9FCFA;
  370. padding-bottom: 20rpx;
  371. }
  372. /* 搜索区域 */
  373. .search-section {
  374. padding: 20rpx 30rpx;
  375. background-color: #FFFFFF;
  376. margin-bottom: 2rpx;
  377. width: 100%;
  378. box-sizing: border-box;
  379. position: relative;
  380. z-index: 5;
  381. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.03);
  382. }
  383. .search-box {
  384. display: flex;
  385. align-items: center;
  386. background-color: #F7F7F7;
  387. height: 80rpx;
  388. border-radius: 40rpx;
  389. padding: 0 24rpx;
  390. width: 100%;
  391. box-sizing: border-box;
  392. border: 2rpx solid transparent;
  393. transition: all 0.3s ease;
  394. }
  395. .search-box.search-focus {
  396. border-color: #4CAF50;
  397. background-color: #FFFFFF;
  398. box-shadow: 0 0 10rpx rgba(76, 175, 80, 0.1);
  399. }
  400. .search-icon {
  401. color: #4CAF50;
  402. width: 60rpx;
  403. display: flex;
  404. justify-content: center;
  405. }
  406. .search-input {
  407. flex: 1;
  408. height: 80rpx;
  409. font-size: 28rpx;
  410. color: #333333;
  411. }
  412. .clear-icon {
  413. width: 60rpx;
  414. display: flex;
  415. justify-content: center;
  416. color: #999;
  417. }
  418. /* 状态筛选区域 */
  419. .filter-section {
  420. display: flex;
  421. padding: 24rpx 30rpx;
  422. background-color: #FFFFFF;
  423. margin-bottom: 20rpx;
  424. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.03);
  425. position: relative;
  426. z-index: 4;
  427. }
  428. .filter-item {
  429. display: flex;
  430. align-items: center;
  431. font-size: 28rpx;
  432. color: #666666;
  433. margin-right: 30rpx;
  434. padding: 12rpx 20rpx;
  435. border-radius: 30rpx;
  436. transition: all 0.2s ease;
  437. position: relative;
  438. }
  439. .filter-item.active {
  440. background-color: #F0F9F0;
  441. color: #4CAF50;
  442. font-weight: 500;
  443. }
  444. .filter-dot {
  445. width: 14rpx;
  446. height: 14rpx;
  447. border-radius: 50%;
  448. margin-right: 10rpx;
  449. }
  450. .online-dot {
  451. background-color: #4CAF50;
  452. box-shadow: 0 0 6rpx rgba(76, 175, 80, 0.5);
  453. }
  454. .offline-dot {
  455. background-color: #F56C6C;
  456. box-shadow: 0 0 6rpx rgba(245, 108, 108, 0.5);
  457. }
  458. /* 设备列表区域 */
  459. .device-list {
  460. flex: 1;
  461. padding: 0 30rpx;
  462. box-sizing: border-box;
  463. width: 100%;
  464. position: relative;
  465. z-index: 3;
  466. }
  467. /* 空数据提示 */
  468. .empty-tips {
  469. padding: 120rpx 0;
  470. display: flex;
  471. flex-direction: column;
  472. align-items: center;
  473. justify-content: center;
  474. }
  475. .empty-icon {
  476. color: #DDDDDD;
  477. margin-bottom: 20rpx;
  478. }
  479. .empty-text {
  480. font-size: 28rpx;
  481. color: #999999;
  482. margin-bottom: 20rpx;
  483. }
  484. .empty-action {
  485. font-size: 26rpx;
  486. color: #4CAF50;
  487. padding: 12rpx 30rpx;
  488. border-radius: 30rpx;
  489. background-color: rgba(76, 175, 80, 0.1);
  490. }
  491. /* 首次加载中状态 */
  492. .loading-container {
  493. padding: 80rpx 0;
  494. display: flex;
  495. flex-direction: column;
  496. align-items: center;
  497. justify-content: center;
  498. }
  499. .loading-spinner {
  500. width: 60rpx;
  501. height: 60rpx;
  502. border: 4rpx solid #E0E0E0;
  503. border-top: 4rpx solid #4CAF50;
  504. border-radius: 50%;
  505. animation: spin 1s linear infinite;
  506. margin-bottom: 20rpx;
  507. }
  508. .loading-text {
  509. font-size: 28rpx;
  510. color: #999999;
  511. }
  512. /* 设备卡片 */
  513. .device-card {
  514. position: relative;
  515. background-color: #FFFFFF;
  516. border-radius: 24rpx;
  517. padding: 28rpx;
  518. margin-bottom: 24rpx;
  519. box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.05);
  520. transition: all 0.25s ease;
  521. width: 100%;
  522. box-sizing: border-box;
  523. border: 1rpx solid rgba(0, 0, 0, 0.05);
  524. overflow: hidden;
  525. }
  526. .device-card::before {
  527. content: "";
  528. position: absolute;
  529. top: 0;
  530. left: 0;
  531. width: 6rpx;
  532. height: 100%;
  533. background: linear-gradient(to bottom, #66CC6A, #3BB44A);
  534. opacity: 0;
  535. transition: opacity 0.3s ease;
  536. }
  537. .device-card:active::before {
  538. opacity: 1;
  539. }
  540. .device-card-hover {
  541. background-color: #f2fef6;
  542. box-shadow: 0 10rpx 25rpx rgba(59, 180, 74, 0.1);
  543. transform: translateY(-3rpx);
  544. }
  545. .device-card.has-alert {
  546. box-shadow: 0 6rpx 20rpx rgba(245, 108, 108, 0.08);
  547. border: 1rpx solid rgba(245, 108, 108, 0.08);
  548. }
  549. .device-card.has-alert::before {
  550. background: linear-gradient(to bottom, #FF8F8F, #F56C6C);
  551. }
  552. .device-card.is-offline {
  553. opacity: 0.9;
  554. }
  555. .device-card.is-offline.device-card-hover {
  556. background-color: #f5f5f5;
  557. box-shadow: 0 10rpx 25rpx rgba(0, 0, 0, 0.05);
  558. }
  559. /* 告警角标 */
  560. .alarm-badge {
  561. position: absolute;
  562. top: -8rpx;
  563. right: -8rpx;
  564. min-width: 36rpx;
  565. height: 36rpx;
  566. border-radius: 18rpx;
  567. background-color: #F56C6C;
  568. color: #FFFFFF;
  569. font-size: 22rpx;
  570. font-weight: 600;
  571. display: flex;
  572. align-items: center;
  573. justify-content: center;
  574. padding: 0 8rpx;
  575. z-index: 3;
  576. box-shadow: 0 3rpx 8rpx rgba(245, 108, 108, 0.3);
  577. animation: pulse 1.5s infinite;
  578. }
  579. @keyframes pulse {
  580. 0% {
  581. transform: scale(1);
  582. }
  583. 50% {
  584. transform: scale(1.1);
  585. }
  586. 100% {
  587. transform: scale(1);
  588. }
  589. }
  590. /* 设备基本信息 */
  591. .device-info {
  592. display: flex;
  593. margin-bottom: 24rpx;
  594. width: 100%;
  595. }
  596. .device-icon-wrapper {
  597. position: relative;
  598. margin-right: 24rpx;
  599. flex-shrink: 0;
  600. }
  601. .device-icon-container {
  602. width: 96rpx;
  603. height: 96rpx;
  604. border-radius: 50%;
  605. background: linear-gradient(135deg, #66CC6A 0%, #3BB44A 100%);
  606. display: flex;
  607. align-items: center;
  608. justify-content: center;
  609. flex-shrink: 0;
  610. box-shadow: 0 6rpx 16rpx rgba(59, 180, 74, 0.2);
  611. transition: all 0.3s ease;
  612. }
  613. .device-icon-container.offline-icon {
  614. background: linear-gradient(135deg, #AAB2BD 0%, #656D78 100%);
  615. box-shadow: 0 6rpx 16rpx rgba(101, 109, 120, 0.2);
  616. }
  617. .device-icon {
  618. width: 52rpx;
  619. height: 52rpx;
  620. filter: brightness(0) invert(1);
  621. }
  622. .device-meta {
  623. flex: 1;
  624. width: calc(100% - 120rpx);
  625. overflow: hidden;
  626. }
  627. .device-name-row {
  628. display: flex;
  629. justify-content: space-between;
  630. align-items: center;
  631. margin-bottom: 14rpx;
  632. width: 100%;
  633. }
  634. .device-name {
  635. font-size: 34rpx;
  636. font-weight: 600;
  637. color: #333333;
  638. max-width: 65%;
  639. overflow: hidden;
  640. text-overflow: ellipsis;
  641. white-space: nowrap;
  642. transition: color 0.3s ease;
  643. }
  644. .device-name.offline-text {
  645. color: #656D78;
  646. }
  647. .status-tag {
  648. padding: 6rpx 16rpx 6rpx 32rpx;
  649. border-radius: 8rpx;
  650. font-size: 24rpx;
  651. font-weight: 500;
  652. flex-shrink: 0;
  653. border: 1rpx solid;
  654. position: relative;
  655. overflow: hidden;
  656. }
  657. .status-online {
  658. background-color: rgba(76, 175, 80, 0.1);
  659. color: #4CAF50;
  660. border-color: rgba(76, 175, 80, 0.3);
  661. }
  662. .status-dot {
  663. position: absolute;
  664. width: 8rpx;
  665. height: 8rpx;
  666. background-color: #4CAF50;
  667. border-radius: 50%;
  668. top: 50%;
  669. left: 16rpx;
  670. transform: translateY(-50%);
  671. box-shadow: 0 0 4rpx rgba(76, 175, 80, 0.8);
  672. animation: blink 1.5s infinite;
  673. display: inline-block;
  674. }
  675. .status-dot.offline-dot {
  676. background-color: #F56C6C;
  677. box-shadow: 0 0 4rpx rgba(245, 108, 108, 0.8);
  678. }
  679. .status-offline {
  680. background-color: rgba(245, 108, 108, 0.1);
  681. color: #F56C6C;
  682. border-color: rgba(245, 108, 108, 0.3);
  683. padding-left: 32rpx;
  684. }
  685. @keyframes blink {
  686. 0% {
  687. opacity: 0.4;
  688. }
  689. 50% {
  690. opacity: 1;
  691. }
  692. 100% {
  693. opacity: 0.4;
  694. }
  695. }
  696. .device-id, .device-location {
  697. display: flex;
  698. font-size: 26rpx;
  699. margin-top: 10rpx;
  700. color: #666666;
  701. width: 100%;
  702. overflow: hidden;
  703. }
  704. .id-label, .location-label {
  705. color: #999999;
  706. margin-right: 8rpx;
  707. flex-shrink: 0;
  708. }
  709. .id-value, .location-value {
  710. color: #666666;
  711. overflow: hidden;
  712. text-overflow: ellipsis;
  713. white-space: nowrap;
  714. }
  715. /* 底部信息栏 */
  716. .device-footer {
  717. display: flex;
  718. justify-content: space-between;
  719. align-items: center;
  720. padding-top: 18rpx;
  721. border-top: 1rpx solid #F2F2F2;
  722. }
  723. .update-time {
  724. font-size: 24rpx;
  725. color: #999999;
  726. }
  727. .device-actions {
  728. display: flex;
  729. align-items: center;
  730. color: #CCCCCC;
  731. }
  732. /* 加载更多区域 */
  733. .load-more {
  734. padding: 20rpx 0 40rpx;
  735. }
  736. .load-more-content {
  737. display: flex;
  738. justify-content: center;
  739. align-items: center;
  740. height: 60rpx;
  741. font-size: 24rpx;
  742. color: #999999;
  743. }
  744. .loading-icon {
  745. width: 30rpx;
  746. height: 30rpx;
  747. margin-right: 10rpx;
  748. border: 2rpx solid #E0E0E0;
  749. border-top: 2rpx solid #4CAF50;
  750. border-radius: 50%;
  751. animation: spin 1s linear infinite;
  752. }
  753. @keyframes spin {
  754. 0% { transform: rotate(0deg); }
  755. 100% { transform: rotate(360deg); }
  756. }
  757. </style>