index.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855
  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. devices.push({
  259. id: `device-${index + 1}`,
  260. name: `${this.getDeviceTypeName(this.deviceType)}-${index + 1}`,
  261. code: `DEV${String(index + 1001).padStart(4, '0')}`,
  262. type: this.deviceType || 'default',
  263. status: Math.random() > 0.3 ? 'online' : 'offline', // 70% 概率在线
  264. location: locations[Math.floor(Math.random() * locations.length)],
  265. updateTime: updateTimes[Math.floor(Math.random() * updateTimes.length)],
  266. alarmCount: Math.random() > 0.7 ? Math.floor(Math.random() * 3) + 1 : 0 // 30% 概率有告警
  267. });
  268. }
  269. return devices;
  270. },
  271. // 获取设备类型名称
  272. getDeviceTypeName(type) {
  273. const nameMap = {
  274. 'monitor': '监控设备',
  275. 'sensor': '采集设备',
  276. 'control': '控制设备',
  277. 'irrigation': '灌溉设备',
  278. 'tractor': '农机设备'
  279. };
  280. return nameMap[type] || '未知设备';
  281. },
  282. // 处理搜索
  283. handleSearch() {
  284. // 执行搜索逻辑
  285. console.log('搜索关键词:', this.searchKeyword);
  286. },
  287. // 处理清空搜索
  288. handleClearSearch() {
  289. this.searchKeyword = '';
  290. },
  291. // 加载更多数据
  292. loadMore() {
  293. if (this.loadMoreStatus !== 'nomore') {
  294. this.loadMoreStatus = 'loading';
  295. this.page += 1;
  296. this.loadDeviceData();
  297. }
  298. },
  299. // 跳转到设备详情页
  300. navigateToDetail(device) {
  301. // 根据设备类型跳转到不同的详情页
  302. let url = '';
  303. if (device.type === 'monitor') {
  304. url = `/pages/device-list/detail-camera?id=${device.id}`;
  305. } else {
  306. // 其他类型设备暂时使用通用详情页
  307. url = `/pages/device-detail/index?id=${device.id}&type=${device.type}`;
  308. }
  309. uni.navigateTo({
  310. url: url
  311. });
  312. },
  313. // 处理刷新
  314. handleRefresh() {
  315. this.isRefreshing = true;
  316. this.page = 1;
  317. this.deviceList = [];
  318. this.loadDeviceData();
  319. }
  320. }
  321. }
  322. </script>
  323. <style scoped>
  324. /* 图标字体 */
  325. @font-face {
  326. font-family: "iconfont";
  327. 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==');
  328. }
  329. .iconfont {
  330. font-family: "iconfont" !important;
  331. font-size: 24rpx;
  332. font-style: normal;
  333. -webkit-font-smoothing: antialiased;
  334. -moz-osx-font-smoothing: grayscale;
  335. }
  336. .icon-search:before {
  337. content: "\e6e1";
  338. font-size: 32rpx;
  339. }
  340. .icon-close:before {
  341. content: "\e6a7";
  342. font-size: 28rpx;
  343. }
  344. .icon-right:before {
  345. content: "\e6a3";
  346. font-size: 28rpx;
  347. }
  348. .icon-empty:before {
  349. content: "\e6a9";
  350. font-size: 80rpx;
  351. }
  352. /* 容器样式 */
  353. .container {
  354. display: flex;
  355. flex-direction: column;
  356. min-height: 100vh;
  357. background-color: #F9FCFA;
  358. padding-bottom: 20rpx;
  359. }
  360. /* 搜索区域 */
  361. .search-section {
  362. padding: 20rpx 30rpx;
  363. background-color: #FFFFFF;
  364. margin-bottom: 2rpx;
  365. width: 100%;
  366. box-sizing: border-box;
  367. position: relative;
  368. z-index: 5;
  369. box-shadow: 0 2rpx 10rpx rgba(0, 0, 0, 0.03);
  370. }
  371. .search-box {
  372. display: flex;
  373. align-items: center;
  374. background-color: #F7F7F7;
  375. height: 80rpx;
  376. border-radius: 40rpx;
  377. padding: 0 24rpx;
  378. width: 100%;
  379. box-sizing: border-box;
  380. border: 2rpx solid transparent;
  381. transition: all 0.3s ease;
  382. }
  383. .search-box.search-focus {
  384. border-color: #4CAF50;
  385. background-color: #FFFFFF;
  386. box-shadow: 0 0 10rpx rgba(76, 175, 80, 0.1);
  387. }
  388. .search-icon {
  389. color: #4CAF50;
  390. width: 60rpx;
  391. display: flex;
  392. justify-content: center;
  393. }
  394. .search-input {
  395. flex: 1;
  396. height: 80rpx;
  397. font-size: 28rpx;
  398. color: #333333;
  399. }
  400. .clear-icon {
  401. width: 60rpx;
  402. display: flex;
  403. justify-content: center;
  404. color: #999;
  405. }
  406. /* 状态筛选区域 */
  407. .filter-section {
  408. display: flex;
  409. padding: 24rpx 30rpx;
  410. background-color: #FFFFFF;
  411. margin-bottom: 20rpx;
  412. box-shadow: 0 4rpx 16rpx rgba(0, 0, 0, 0.03);
  413. position: relative;
  414. z-index: 4;
  415. }
  416. .filter-item {
  417. display: flex;
  418. align-items: center;
  419. font-size: 28rpx;
  420. color: #666666;
  421. margin-right: 30rpx;
  422. padding: 12rpx 20rpx;
  423. border-radius: 30rpx;
  424. transition: all 0.2s ease;
  425. position: relative;
  426. }
  427. .filter-item.active {
  428. background-color: #F0F9F0;
  429. color: #4CAF50;
  430. font-weight: 500;
  431. }
  432. .filter-dot {
  433. width: 14rpx;
  434. height: 14rpx;
  435. border-radius: 50%;
  436. margin-right: 10rpx;
  437. }
  438. .online-dot {
  439. background-color: #4CAF50;
  440. box-shadow: 0 0 6rpx rgba(76, 175, 80, 0.5);
  441. }
  442. .offline-dot {
  443. background-color: #F56C6C;
  444. box-shadow: 0 0 6rpx rgba(245, 108, 108, 0.5);
  445. }
  446. /* 设备列表区域 */
  447. .device-list {
  448. flex: 1;
  449. padding: 0 30rpx;
  450. box-sizing: border-box;
  451. width: 100%;
  452. position: relative;
  453. z-index: 3;
  454. }
  455. /* 空数据提示 */
  456. .empty-tips {
  457. padding: 120rpx 0;
  458. display: flex;
  459. flex-direction: column;
  460. align-items: center;
  461. justify-content: center;
  462. }
  463. .empty-icon {
  464. color: #DDDDDD;
  465. margin-bottom: 20rpx;
  466. }
  467. .empty-text {
  468. font-size: 28rpx;
  469. color: #999999;
  470. margin-bottom: 20rpx;
  471. }
  472. .empty-action {
  473. font-size: 26rpx;
  474. color: #4CAF50;
  475. padding: 12rpx 30rpx;
  476. border-radius: 30rpx;
  477. background-color: rgba(76, 175, 80, 0.1);
  478. }
  479. /* 首次加载中状态 */
  480. .loading-container {
  481. padding: 80rpx 0;
  482. display: flex;
  483. flex-direction: column;
  484. align-items: center;
  485. justify-content: center;
  486. }
  487. .loading-spinner {
  488. width: 60rpx;
  489. height: 60rpx;
  490. border: 4rpx solid #E0E0E0;
  491. border-top: 4rpx solid #4CAF50;
  492. border-radius: 50%;
  493. animation: spin 1s linear infinite;
  494. margin-bottom: 20rpx;
  495. }
  496. .loading-text {
  497. font-size: 28rpx;
  498. color: #999999;
  499. }
  500. /* 设备卡片 */
  501. .device-card {
  502. position: relative;
  503. background-color: #FFFFFF;
  504. border-radius: 24rpx;
  505. padding: 28rpx;
  506. margin-bottom: 24rpx;
  507. box-shadow: 0 6rpx 20rpx rgba(0, 0, 0, 0.05);
  508. transition: all 0.25s ease;
  509. width: 100%;
  510. box-sizing: border-box;
  511. border: 1rpx solid rgba(0, 0, 0, 0.05);
  512. overflow: hidden;
  513. }
  514. .device-card::before {
  515. content: "";
  516. position: absolute;
  517. top: 0;
  518. left: 0;
  519. width: 6rpx;
  520. height: 100%;
  521. background: linear-gradient(to bottom, #66CC6A, #3BB44A);
  522. opacity: 0;
  523. transition: opacity 0.3s ease;
  524. }
  525. .device-card:active::before {
  526. opacity: 1;
  527. }
  528. .device-card-hover {
  529. background-color: #f2fef6;
  530. box-shadow: 0 10rpx 25rpx rgba(59, 180, 74, 0.1);
  531. transform: translateY(-3rpx);
  532. }
  533. .device-card.has-alert {
  534. box-shadow: 0 6rpx 20rpx rgba(245, 108, 108, 0.08);
  535. border: 1rpx solid rgba(245, 108, 108, 0.08);
  536. }
  537. .device-card.has-alert::before {
  538. background: linear-gradient(to bottom, #FF8F8F, #F56C6C);
  539. }
  540. .device-card.is-offline {
  541. opacity: 0.9;
  542. }
  543. .device-card.is-offline.device-card-hover {
  544. background-color: #f5f5f5;
  545. box-shadow: 0 10rpx 25rpx rgba(0, 0, 0, 0.05);
  546. }
  547. /* 告警角标 */
  548. .alarm-badge {
  549. position: absolute;
  550. top: -8rpx;
  551. right: -8rpx;
  552. min-width: 36rpx;
  553. height: 36rpx;
  554. border-radius: 18rpx;
  555. background-color: #F56C6C;
  556. color: #FFFFFF;
  557. font-size: 22rpx;
  558. font-weight: 600;
  559. display: flex;
  560. align-items: center;
  561. justify-content: center;
  562. padding: 0 8rpx;
  563. z-index: 3;
  564. box-shadow: 0 3rpx 8rpx rgba(245, 108, 108, 0.3);
  565. animation: pulse 1.5s infinite;
  566. }
  567. @keyframes pulse {
  568. 0% {
  569. transform: scale(1);
  570. }
  571. 50% {
  572. transform: scale(1.1);
  573. }
  574. 100% {
  575. transform: scale(1);
  576. }
  577. }
  578. /* 设备基本信息 */
  579. .device-info {
  580. display: flex;
  581. margin-bottom: 24rpx;
  582. width: 100%;
  583. }
  584. .device-icon-wrapper {
  585. position: relative;
  586. margin-right: 24rpx;
  587. flex-shrink: 0;
  588. }
  589. .device-icon-container {
  590. width: 96rpx;
  591. height: 96rpx;
  592. border-radius: 50%;
  593. background: linear-gradient(135deg, #66CC6A 0%, #3BB44A 100%);
  594. display: flex;
  595. align-items: center;
  596. justify-content: center;
  597. flex-shrink: 0;
  598. box-shadow: 0 6rpx 16rpx rgba(59, 180, 74, 0.2);
  599. transition: all 0.3s ease;
  600. }
  601. .device-icon-container.offline-icon {
  602. background: linear-gradient(135deg, #AAB2BD 0%, #656D78 100%);
  603. box-shadow: 0 6rpx 16rpx rgba(101, 109, 120, 0.2);
  604. }
  605. .device-icon {
  606. width: 52rpx;
  607. height: 52rpx;
  608. filter: brightness(0) invert(1);
  609. }
  610. .device-meta {
  611. flex: 1;
  612. width: calc(100% - 120rpx);
  613. overflow: hidden;
  614. }
  615. .device-name-row {
  616. display: flex;
  617. justify-content: space-between;
  618. align-items: center;
  619. margin-bottom: 14rpx;
  620. width: 100%;
  621. }
  622. .device-name {
  623. font-size: 34rpx;
  624. font-weight: 600;
  625. color: #333333;
  626. max-width: 65%;
  627. overflow: hidden;
  628. text-overflow: ellipsis;
  629. white-space: nowrap;
  630. transition: color 0.3s ease;
  631. }
  632. .device-name.offline-text {
  633. color: #656D78;
  634. }
  635. .status-tag {
  636. padding: 6rpx 16rpx 6rpx 32rpx;
  637. border-radius: 8rpx;
  638. font-size: 24rpx;
  639. font-weight: 500;
  640. flex-shrink: 0;
  641. border: 1rpx solid;
  642. position: relative;
  643. overflow: hidden;
  644. }
  645. .status-online {
  646. background-color: rgba(76, 175, 80, 0.1);
  647. color: #4CAF50;
  648. border-color: rgba(76, 175, 80, 0.3);
  649. }
  650. .status-dot {
  651. position: absolute;
  652. width: 8rpx;
  653. height: 8rpx;
  654. background-color: #4CAF50;
  655. border-radius: 50%;
  656. top: 50%;
  657. left: 16rpx;
  658. transform: translateY(-50%);
  659. box-shadow: 0 0 4rpx rgba(76, 175, 80, 0.8);
  660. animation: blink 1.5s infinite;
  661. display: inline-block;
  662. }
  663. .status-dot.offline-dot {
  664. background-color: #F56C6C;
  665. box-shadow: 0 0 4rpx rgba(245, 108, 108, 0.8);
  666. }
  667. .status-offline {
  668. background-color: rgba(245, 108, 108, 0.1);
  669. color: #F56C6C;
  670. border-color: rgba(245, 108, 108, 0.3);
  671. padding-left: 32rpx;
  672. }
  673. @keyframes blink {
  674. 0% {
  675. opacity: 0.4;
  676. }
  677. 50% {
  678. opacity: 1;
  679. }
  680. 100% {
  681. opacity: 0.4;
  682. }
  683. }
  684. .device-id, .device-location {
  685. display: flex;
  686. font-size: 26rpx;
  687. margin-top: 10rpx;
  688. color: #666666;
  689. width: 100%;
  690. overflow: hidden;
  691. }
  692. .id-label, .location-label {
  693. color: #999999;
  694. margin-right: 8rpx;
  695. flex-shrink: 0;
  696. }
  697. .id-value, .location-value {
  698. color: #666666;
  699. overflow: hidden;
  700. text-overflow: ellipsis;
  701. white-space: nowrap;
  702. }
  703. /* 底部信息栏 */
  704. .device-footer {
  705. display: flex;
  706. justify-content: space-between;
  707. align-items: center;
  708. padding-top: 18rpx;
  709. border-top: 1rpx solid #F2F2F2;
  710. }
  711. .update-time {
  712. font-size: 24rpx;
  713. color: #999999;
  714. }
  715. .device-actions {
  716. display: flex;
  717. align-items: center;
  718. color: #CCCCCC;
  719. }
  720. /* 加载更多区域 */
  721. .load-more {
  722. padding: 20rpx 0 40rpx;
  723. }
  724. .load-more-content {
  725. display: flex;
  726. justify-content: center;
  727. align-items: center;
  728. height: 60rpx;
  729. font-size: 24rpx;
  730. color: #999999;
  731. }
  732. .loading-icon {
  733. width: 30rpx;
  734. height: 30rpx;
  735. margin-right: 10rpx;
  736. border: 2rpx solid #E0E0E0;
  737. border-top: 2rpx solid #4CAF50;
  738. border-radius: 50%;
  739. animation: spin 1s linear infinite;
  740. }
  741. @keyframes spin {
  742. 0% { transform: rotate(0deg); }
  743. 100% { transform: rotate(360deg); }
  744. }
  745. </style>