index.vue 35 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596
  1. <template>
  2. <view class="dashboard-container">
  3. <!-- 顶部用户信息卡片 -->
  4. <view class="user-info-card">
  5. <view class="user-info">
  6. <text class="greeting">您好,{{ userData.nickname }}</text>
  7. <view class="plot-info">
  8. <text class="plot-label">当前地块:</text>
  9. <text class="plot-name">{{ userData.selectedPlot }}</text>
  10. <view class="switch-plot-btn" v-if="isLogin">
  11. <u-picker :show="show" :columns="columns" :defaultIndex="defaultIndex" @cancel="show = false"
  12. @confirm="onConfirm"></u-picker>
  13. <text @click="handleSwitchPlot">切换</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="avatar-container" @click="navigateToProfile">
  18. <view class="avatar">
  19. <image :src="userData.avatar" mode="aspectFill"></image>
  20. </view>
  21. </view>
  22. </view>
  23. <!-- 顶部统计概览 -->
  24. <view class="stats-overview">
  25. <view class="alert-card" v-for="(alert, index) in alertSummaries" :key="index"
  26. @click="navigateToAlertDetail(alert.type)">
  27. <view class="alert-header">
  28. <view class="alert-icon-container">
  29. <image class="custom-icon" :src="alert.iconSrc"></image>
  30. </view>
  31. <text class="alert-title">{{ alert.title }}</text>
  32. </view>
  33. <text class="alert-value">{{ alert.value }}</text>
  34. <text class="alert-description">{{ alert.description }}</text>
  35. </view>
  36. </view>
  37. <!-- 天气卡片 -->
  38. <view class="card weather-card">
  39. <view class="card-header">
  40. <view class="title-section">
  41. <view class="title-line"></view>
  42. <text class="card-title">天气与预报</text>
  43. </view>
  44. </view>
  45. <view class="weather-content">
  46. <view class="current-weather">
  47. <view class="weather-icon-container">
  48. <view class="weather-icon">
  49. <text v-if="weatherData.description === '晴朗'">☀️</text>
  50. <text v-else-if="weatherData.description.includes('雨')">🌧️</text>
  51. <text v-else-if="weatherData.description.includes('云')">⛅</text>
  52. <text v-else>🌤️</text>
  53. </view>
  54. </view>
  55. <view class="weather-details">
  56. <text class="weather-temp">{{ weatherData.temperature }}°C</text>
  57. <text class="weather-desc">{{ weatherData.description }}</text>
  58. </view>
  59. </view>
  60. <view class="weather-metrics">
  61. <view class="weather-metric">
  62. <text class="metric-label">湿度</text>
  63. <text class="metric-value">{{ weatherData.humidity }}%</text>
  64. </view>
  65. <view class="vertical-divider"></view>
  66. <view class="weather-metric">
  67. <text class="metric-label">风力</text>
  68. <text class="metric-value">{{ weatherData.windLevel }} 级</text>
  69. </view>
  70. <view class="vertical-divider"></view>
  71. <view class="weather-metric">
  72. <text class="metric-label">降水量</text>
  73. <text class="metric-value">{{ weatherData.rainfall }} mm</text>
  74. </view>
  75. </view>
  76. <view class="weather-advice">
  77. <view class="advice-header">
  78. <view class="icon-tile small">
  79. <u-icon name="info" color="#ffffff" size="14"></u-icon>
  80. </view>
  81. <text class="advice-title">今日建议:</text>
  82. </view>
  83. <text class="advice-content">{{ weatherData.advice }}</text>
  84. </view>
  85. </view>
  86. </view>
  87. <!-- 农场绩效卡片 -->
  88. <view class="card farm-performance">
  89. <view class="card-header">
  90. <view class="title-section">
  91. <view class="title-line"></view>
  92. <text class="card-title">产值分析</text>
  93. </view>
  94. <view class="period-selector">
  95. <text class="period" :class="{ active: currentPeriod === 'month' }"
  96. @click="changePeriod('month')">月</text>
  97. <text class="period" :class="{ active: currentPeriod === 'quarter' }"
  98. @click="changePeriod('quarter')">季</text>
  99. <text class="period" :class="{ active: currentPeriod === 'year' }"
  100. @click="changePeriod('year')">年</text>
  101. </view>
  102. </view>
  103. <view class="performance-stats">
  104. <view class="metric-column">
  105. <text class="metric-value">128<text class="metric-unit">亩</text></text>
  106. <text class="metric-label">管理面积总计</text>
  107. <view class="growth positive">
  108. <u-icon name="arrow-upward" color="#3BB44A" size="12"></u-icon>
  109. <text>比上月增长12%</text>
  110. </view>
  111. </view>
  112. <view class="metric-divider"></view>
  113. <view class="metric-column">
  114. <text class="metric-value">¥36,480</text>
  115. <text class="metric-label">预计产值</text>
  116. <view class="growth positive">
  117. <u-icon name="arrow-upward" color="#3BB44A" size="12"></u-icon>
  118. <text>比上月增长8.2%</text>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="chart-container">
  123. <view class="chart-header">
  124. <text class="chart-title">产值趋势 (万元)</text>
  125. <view class="chart-legend">
  126. <view class="legend-item">
  127. <view class="legend-color" style="background: #3BB44A;"></view>
  128. <text>今年</text>
  129. </view>
  130. <view class="legend-item">
  131. <view class="legend-color" style="background: #E0E0E0;"></view>
  132. <text>去年</text>
  133. </view>
  134. </view>
  135. </view>
  136. <view class="chart-body">
  137. <view class="y-axis">
  138. <text v-for="(value, index) in [4, 3, 2, 1, 0]" :key="index">{{ value }}</text>
  139. </view>
  140. <view class="bars-container">
  141. <view class="month-group" v-for="(month, index) in farmPerformanceData.months" :key="index">
  142. <view class="bar-wrapper">
  143. <view class="bar last-year"
  144. :style="{ height: (farmPerformanceData.lastYearValues[index] / 4) * 100 + '%' }">
  145. </view>
  146. <view class="bar this-year"
  147. :style="{ height: (farmPerformanceData.thisYearValues[index] / 4) * 100 + '%' }">
  148. </view>
  149. </view>
  150. <text class="month-label">{{ month }}</text>
  151. </view>
  152. </view>
  153. </view>
  154. </view>
  155. </view>
  156. <!-- 监控设备概览 -->
  157. <view class="card device-overview">
  158. <view class="card-header">
  159. <view class="title-section">
  160. <view class="title-line"></view>
  161. <text class="card-title">监控设备概览</text>
  162. </view>
  163. </view>
  164. <view class="device-metrics-grid">
  165. <view class="device-metric-card" v-for="(metric, index) in deviceMetrics" :key="index">
  166. <view class="device-metric-header">
  167. <view class="icon-tile" :style="{ background: metric.gradient }">
  168. <u-icon :name="metric.icon" color="#ffffff" size="18"></u-icon>
  169. </view>
  170. <text class="metric-name">{{ metric.name }}</text>
  171. </view>
  172. <view class="device-metric-value">{{ metric.value }}</view>
  173. <view class="device-metric-trend" :class="metric.trend.type">
  174. <u-icon :name="metric.trend.type === 'up' ? 'arrow-upward' : 'arrow-downward'"
  175. :color="metric.trend.type === 'up' ? '#3BB44A' : '#FF5252'" size="14"></u-icon>
  176. <text>{{ metric.trend.value }}</text>
  177. </view>
  178. </view>
  179. </view>
  180. </view>
  181. <!-- 农业机械活动 -->
  182. <view class="card machinery-activity">
  183. <view class="card-header">
  184. <view class="title-section">
  185. <view class="title-line"></view>
  186. <text class="card-title">农机作业概览</text>
  187. </view>
  188. </view>
  189. <view class="machinery-metrics-grid">
  190. <view class="machinery-metric-card" v-for="(metric, index) in machineryMetrics" :key="index">
  191. <view class="machinery-metric-header">
  192. <view class="icon-tile" :style="{ background: metric.gradient }">
  193. <u-icon :name="metric.icon" color="#ffffff" size="18"></u-icon>
  194. </view>
  195. <text class="metric-name">{{ metric.name }}</text>
  196. </view>
  197. <view class="machinery-metric-value">{{ metric.value }}</view>
  198. <view v-if="metric.trend" class="machinery-metric-trend" :class="metric.trend.type">
  199. <u-icon :name="metric.trend.type === 'up' ? 'arrow-upward' : 'arrow-downward'"
  200. :color="metric.trend.type === 'up' ? '#3BB44A' : '#FF5252'" size="14"></u-icon>
  201. <text>{{ metric.trend.value }}</text>
  202. </view>
  203. <view v-else class="machinery-metric-unit">
  204. <text>{{ metric.unit }}</text>
  205. </view>
  206. </view>
  207. </view>
  208. </view>
  209. <!-- 农场活动卡片 -->
  210. <view class="card farm-activities">
  211. <view class="card-header">
  212. <view class="title-section">
  213. <view class="title-line"></view>
  214. <text class="card-title">农事活动</text>
  215. </view>
  216. <view class="action-button">
  217. <text>查看全部</text>
  218. <u-icon name="arrow-right" color="#ffffff" size="14"></u-icon>
  219. </view>
  220. </view>
  221. <view class="activities-list">
  222. <view class="activity-item" v-for="(activity, index) in farmData.recentActivities" :key="index">
  223. <view class="activity-dot" :class="activity.status"></view>
  224. <view class="activity-details">
  225. <view class="activity-title-row">
  226. <text class="activity-title">{{ activity.title }}</text>
  227. <text class="activity-date">{{ activity.date }}</text>
  228. </view>
  229. <view class="activity-meta-row">
  230. <text class="activity-executor">{{ activity.executor }}</text>
  231. <view class="activity-action" @click.stop="navigateToActivity(activity)">
  232. <text class="action-text">查看</text>
  233. <u-icon name="arrow-right" color="#3BB44A" size="14"></u-icon>
  234. </view>
  235. </view>
  236. </view>
  237. </view>
  238. </view>
  239. </view>
  240. </view>
  241. </template>
  242. <script>
  243. import storage from "@/utils/storage.js";
  244. import {
  245. listFieldName
  246. } from "@/api/services/field.js"
  247. export default {
  248. data() {
  249. return {
  250. isLogin:false,
  251. show: false,
  252. columns: [
  253. []
  254. ],
  255. defaultIndex: [0],
  256. // 用户数据
  257. userData: {
  258. nickname: '游客',
  259. selectedPlot: '未选择地块',
  260. avatar: '/static/images/user-avatar.png',
  261. },
  262. // 农场数据
  263. farmData: {
  264. plotCount: 5,
  265. deviceCount: 12,
  266. deviceOnlineRate: 85,
  267. taskCompletionRate: 76,
  268. recentActivities: [{
  269. title: '稻田水稻施肥',
  270. date: '2023-05-15',
  271. status: 'pending',
  272. id: 1,
  273. executor: '李四'
  274. },
  275. {
  276. title: '南地块除草',
  277. date: '2023-05-12',
  278. status: 'completed',
  279. id: 2,
  280. executor: '王五'
  281. },
  282. {
  283. title: '西北区域杀虫',
  284. date: '2023-05-08',
  285. status: 'completed',
  286. id: 3,
  287. executor: '张三'
  288. }
  289. ]
  290. },
  291. // 天气数据
  292. weatherData: {
  293. temperature: 28,
  294. description: '晴朗',
  295. humidity: 65,
  296. windLevel: 3,
  297. rainfall: 0,
  298. advice: '今日适宜进行春玉米防虫作业,注意水分管理。'
  299. },
  300. // 作物数据
  301. crops: [{
  302. name: '水稻',
  303. area: 48,
  304. progress: 75,
  305. icon: '🌾',
  306. bgColor: '#4CAF50'
  307. },
  308. {
  309. name: '小麦',
  310. area: 36,
  311. progress: 60,
  312. icon: '🌿',
  313. bgColor: '#66BB6A'
  314. },
  315. {
  316. name: '玉米',
  317. area: 32,
  318. progress: 85,
  319. icon: '🌽',
  320. bgColor: '#43A047'
  321. },
  322. {
  323. name: '大豆',
  324. area: 12,
  325. progress: 40,
  326. icon: '🫘',
  327. bgColor: '#388E3C'
  328. }
  329. ],
  330. // 监控设备指标
  331. deviceMetrics: [{
  332. name: '在线设备',
  333. value: '28',
  334. icon: 'wifi',
  335. gradient: 'linear-gradient(135deg, #26A69A, #00796B)',
  336. trend: {
  337. type: 'up',
  338. value: '5.2%'
  339. }
  340. },
  341. {
  342. name: '告警设备',
  343. value: '3',
  344. icon: 'error-circle',
  345. gradient: 'linear-gradient(135deg, #FF7043, #E64A19)',
  346. trend: {
  347. type: 'down',
  348. value: '2.1%'
  349. }
  350. },
  351. {
  352. name: '离线设备',
  353. value: '5',
  354. icon: 'close-circle',
  355. gradient: 'linear-gradient(135deg, #78909C, #455A64)',
  356. trend: {
  357. type: 'down',
  358. value: '1.8%'
  359. }
  360. },
  361. {
  362. name: '数据稳定性',
  363. value: '96.3%',
  364. icon: 'checkmark-circle',
  365. gradient: 'linear-gradient(135deg, #66BB6A, #388E3C)',
  366. trend: {
  367. type: 'up',
  368. value: '0.5%'
  369. }
  370. }
  371. ],
  372. // 农业机械指标
  373. machineryMetrics: [{
  374. name: '今日运行时长',
  375. value: '36.5',
  376. unit: '小时',
  377. icon: 'clock',
  378. gradient: 'linear-gradient(135deg, #42A5F5, #1976D2)'
  379. },
  380. {
  381. name: '今日作业地块',
  382. value: '8',
  383. unit: '块',
  384. icon: 'map',
  385. gradient: 'linear-gradient(135deg, #66BB6A, #388E3C)'
  386. },
  387. {
  388. name: '今日执行任务',
  389. value: '12',
  390. unit: '个',
  391. icon: 'calendar',
  392. gradient: 'linear-gradient(135deg, #FFA726, #F57C00)'
  393. },
  394. {
  395. name: '使用率',
  396. value: '78.2%',
  397. icon: 'star',
  398. gradient: 'linear-gradient(135deg, #5C6BC0, #3949AB)',
  399. trend: {
  400. type: 'up',
  401. value: '3.7%'
  402. }
  403. }
  404. ],
  405. // 当前选择的周期
  406. currentPeriod: 'month',
  407. // 警报摘要数据
  408. alertSummaries: [{
  409. title: '设备离线',
  410. value: '3 台',
  411. iconSrc: '/static/icons/offline.png',
  412. description: '最长离线时长:26 小时',
  413. type: 'device-offline'
  414. },
  415. {
  416. title: '虫害预警',
  417. value: '稻飞虱|小地老虎',
  418. iconSrc: '/static/icons/Pest_Alert.png',
  419. description: '预警等级:中',
  420. type: 'pest-warning'
  421. },
  422. {
  423. title: '气象预警',
  424. value: '强风(8级)',
  425. iconSrc: '/static/icons/weather_risk.png',
  426. description: '预计:未来 12 小时内',
  427. type: 'weather-risk'
  428. },
  429. {
  430. title: '作业延迟',
  431. value: '5 项',
  432. iconSrc: '/static/icons/task_delay.png',
  433. description: '最长延迟:3 天',
  434. type: 'task-delay'
  435. }
  436. ],
  437. // 农场绩效图表数据 - 月度数据
  438. monthlyData: {
  439. months: ['1月', '2月', '3月', '4月', '5月', '6月'],
  440. thisYearValues: [2.8, 3.4, 2.9, 3.6, 3.8, 3.2],
  441. lastYearValues: [2.5, 2.8, 2.4, 3.0, 3.2, 2.7]
  442. },
  443. // 季度数据
  444. quarterlyData: {
  445. months: ['Q1', 'Q2', 'Q3', 'Q4'],
  446. thisYearValues: [3.2, 3.7, 4.0, 3.5],
  447. lastYearValues: [2.7, 3.3, 3.6, 3.0]
  448. },
  449. // 年度数据
  450. yearlyData: {
  451. months: ['2019', '2020', '2021', '2022', '2023'],
  452. thisYearValues: [2.2, 2.5, 3.0, 3.5, 3.8],
  453. lastYearValues: [2.0, 2.3, 2.7, 3.2, 3.4]
  454. }
  455. };
  456. },
  457. computed: {
  458. // 核心统计数据
  459. coreStats() {
  460. return [{
  461. label: '地块',
  462. value: this.farmData.plotCount,
  463. icon: 'map',
  464. },
  465. {
  466. label: '设备',
  467. value: this.farmData.deviceCount,
  468. icon: 'setting',
  469. },
  470. {
  471. label: '设备在线',
  472. value: this.farmData.deviceOnlineRate + '%',
  473. icon: 'wifi',
  474. },
  475. {
  476. label: '任务完成',
  477. value: this.farmData.taskCompletionRate + '%',
  478. icon: 'checkmark-circle',
  479. }
  480. ];
  481. },
  482. // 根据当前周期计算要显示的数据
  483. farmPerformanceData() {
  484. if (this.currentPeriod === 'month') {
  485. return this.monthlyData;
  486. } else if (this.currentPeriod === 'quarter') {
  487. return this.quarterlyData;
  488. } else {
  489. return this.yearlyData;
  490. }
  491. }
  492. },
  493. methods: {
  494. loadPhots(userId) {
  495. console.log("加载用户字段", userId);
  496. listFieldName(userId)
  497. .then(res => {
  498. const {
  499. data
  500. } = res || {};
  501. if (data?.code !== 200 || !Array.isArray(data.data)) {
  502. console.warn("接口返回异常或数据格式不正确", res);
  503. return;
  504. }
  505. const fieldList = data.data;
  506. console.log("fieldList:",fieldList);
  507. const fields = [];
  508. fieldList.forEach(item => {
  509. const fieldName = item?.fieldName;
  510. if (fieldName && !fields.includes(fieldName)) {
  511. fields.push({
  512. text: fieldName,
  513. value: item.id,
  514. growCrops: item.growCrops,
  515. managerName: item.managerName,
  516. size: item.size,
  517. farmId: item.farmId
  518. });
  519. }
  520. });
  521. this.columns = [fields]; // 符合 u-picker 的二维数组格式
  522. storage.setCurrentUserPlotsList(fields)
  523. console.log("字段加载完成:", this.columns);
  524. // 字段加载完成后立即设置默认索引
  525. this.setDefaultSelectedPlot();
  526. })
  527. .catch(err => {
  528. console.error("加载字段失败", err);
  529. });
  530. },
  531. // 初始化地块列表
  532. initPlotColumns() {
  533. const cached = storage.getCurrentUserPlotsList();
  534. if (Array.isArray(cached) && cached.length > 0) {
  535. this.columns = [cached]; // 结构上是二维数组
  536. console.log("从缓存加载字段:", this.columns);
  537. } else {
  538. this.loadPhots(this.userData.userid); // 异步方法内部要处理赋值 columns
  539. }
  540. },
  541. // 设置默认选中项
  542. setDefaultSelectedPlot() {
  543. try {
  544. const currentPlots = JSON.parse(storage.getPlots() || '{}');
  545. console.log("设置默认地块", currentPlots);
  546. if (currentPlots?.name) {
  547. this.userData.selectedPlot = currentPlots.name;
  548. // 防止 this.columns 未定义或格式不正确
  549. if (Array.isArray(this.columns) && this.columns.length > 0 && Array.isArray(this.columns[0])) {
  550. const plots = this.columns[0];
  551. const index = plots.findIndex(item => item.text === currentPlots.name);
  552. if (index !== -1) {
  553. this.defaultIndex = [index];
  554. console.log("设置默认选中地块索引:", index, "defaultIndex:", this.defaultIndex);
  555. } else {
  556. console.warn("未找到匹配的地块:", currentPlots.name);
  557. this.defaultIndex = [0]; // 默认选中第一项
  558. }
  559. } else {
  560. console.warn("columns数据格式不正确:", this.columns);
  561. this.defaultIndex = [0]; // 默认选中第一项
  562. }
  563. } else {
  564. console.warn("未设置默认地块或地块名为空");
  565. this.defaultIndex = [0]; // 默认选中第一项
  566. }
  567. } catch (error) {
  568. console.error("设置默认地块时出错:", error);
  569. this.defaultIndex = [0]; // 出错时默认选中第一项
  570. }
  571. },
  572. onConfirm(e) {
  573. console.log('选择了:', e);
  574. this.userData.selectedPlot = e.value[0].text
  575. let obj = {id:e.value[0].value,name:e.value[0].text,growCrops:e.value[0].growCrops,managerName:e.value[0].managerName,size:e.value[0].size,farmId: e.value[0].farmId}
  576. storage.setPlots(JSON.stringify(obj))
  577. this.show = false;
  578. },
  579. // 处理切换地块
  580. handleSwitchPlot() {
  581. // 在显示picker前重新设置defaultIndex
  582. this.setDefaultSelectedPlot();
  583. this.show = true;
  584. },
  585. // 导航到个人资料
  586. navigateToProfile() {
  587. uni.navigateTo({
  588. url: '/pages/user/index'
  589. });
  590. },
  591. // 导航到活动详情
  592. navigateToActivity(activity) {
  593. uni.navigateTo({
  594. url: `/pages/activity/detail?id=${activity.id}`
  595. });
  596. },
  597. // 导航到警报详情
  598. navigateToAlertDetail(type) {
  599. // 实现导航到警报详情页的逻辑
  600. console.log(`Navigating to alert detail for type: ${type}`);
  601. },
  602. // 切换周期
  603. changePeriod(period) {
  604. this.currentPeriod = period;
  605. }
  606. },
  607. onShow() {
  608. const userInfo = storage.getUserInfo()
  609. console.log("userInfo", userInfo);
  610. this.userData.nickname = userInfo.username || '未登录'
  611. this.userData.avatar = userInfo.avatar || '/static/icons/user_icon.png'
  612. this.userData.userId = userInfo.userid
  613. if(storage.getHasLogin()){
  614. this.isLogin = true;
  615. // 加载当前登录用户所属所有地块信息
  616. const cached = storage.getCurrentUserPlotsList();
  617. if (Array.isArray(cached) && cached.length > 0) {
  618. // 如果有缓存,直接用缓存构造 columns
  619. this.columns = [cached];
  620. console.log("从缓存加载字段:", this.columns);
  621. // 有缓存时,在columns设置后立即设置defaultIndex
  622. this.setDefaultSelectedPlot();
  623. } else {
  624. // 无缓存时请求接口,在接口完成后会调用setDefaultSelectedPlot
  625. this.loadPhots(this.userData.userId);
  626. }
  627. console.log("columns", this.columns);
  628. }
  629. },
  630. mounted() {
  631. }
  632. };
  633. </script>
  634. <style lang="scss" scoped>
  635. .dashboard-container {
  636. padding: 24rpx;
  637. background-color: #F6FDF9;
  638. min-height: 100vh;
  639. }
  640. // 顶部用户信息卡片
  641. .user-info-card {
  642. display: flex;
  643. justify-content: space-between;
  644. align-items: center;
  645. background: white;
  646. border-radius: 20rpx;
  647. padding: 24rpx 28rpx;
  648. margin-bottom: 24rpx;
  649. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
  650. .user-info {
  651. flex: 1;
  652. .greeting {
  653. font-size: 32rpx;
  654. font-weight: 600;
  655. color: #2C3E50;
  656. margin-bottom: 8rpx;
  657. }
  658. .plot-info {
  659. display: flex;
  660. align-items: center;
  661. .plot-label {
  662. font-size: 24rpx;
  663. color: #8C9396;
  664. }
  665. .plot-name {
  666. font-size: 24rpx;
  667. color: #2C3E50;
  668. margin: 0 8rpx;
  669. }
  670. .switch-plot-btn {
  671. display: flex;
  672. align-items: center;
  673. justify-content: center;
  674. background: linear-gradient(135deg, #3BB44A, #66CC6A);
  675. border-radius: 16rpx;
  676. padding: 4rpx 16rpx;
  677. box-shadow: 0 2rpx 8rpx rgba(59, 180, 74, 0.25);
  678. text {
  679. font-size: 22rpx;
  680. color: white;
  681. }
  682. }
  683. }
  684. }
  685. .avatar-container {
  686. .avatar {
  687. width: 80rpx;
  688. height: 80rpx;
  689. border-radius: 50%;
  690. background-color: rgba(59, 180, 74, 0.1);
  691. border: 2px solid rgba(255, 255, 255, 0.8);
  692. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  693. overflow: hidden;
  694. image {
  695. width: 100%;
  696. height: 100%;
  697. object-fit: cover;
  698. }
  699. }
  700. }
  701. }
  702. // Top Stats Overview
  703. .stats-overview {
  704. display: grid;
  705. grid-template-columns: repeat(2, 1fr);
  706. gap: 16rpx;
  707. margin-bottom: 24rpx;
  708. .alert-card {
  709. background: white;
  710. border-radius: 16rpx;
  711. padding: 20rpx;
  712. display: flex;
  713. flex-direction: column;
  714. box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
  715. position: relative;
  716. overflow: hidden;
  717. transition: transform 0.2s, box-shadow 0.2s;
  718. &:active {
  719. transform: translateY(2rpx);
  720. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
  721. }
  722. &::after {
  723. content: "";
  724. position: absolute;
  725. right: 12rpx;
  726. bottom: 12rpx;
  727. width: 16rpx;
  728. height: 16rpx;
  729. border-top: 2rpx solid #E0E0E0;
  730. border-right: 2rpx solid #E0E0E0;
  731. transform: rotate(45deg);
  732. opacity: 0.5;
  733. }
  734. .alert-header {
  735. display: flex;
  736. align-items: center;
  737. margin-bottom: 12rpx;
  738. .alert-icon-container {
  739. margin-right: 12rpx;
  740. width: 40rpx;
  741. height: 40rpx;
  742. display: flex;
  743. align-items: center;
  744. justify-content: center;
  745. .custom-icon {
  746. width: 40rpx;
  747. height: 40rpx;
  748. object-fit: contain;
  749. }
  750. }
  751. .alert-title {
  752. font-size: 26rpx;
  753. color: #333333;
  754. font-weight: 600;
  755. }
  756. }
  757. .alert-value {
  758. font-size: 30rpx;
  759. font-weight: 700;
  760. color: #3BB44A;
  761. margin-bottom: 6rpx;
  762. line-height: 1.2;
  763. padding-left: 52rpx;
  764. }
  765. .alert-description {
  766. font-size: 22rpx;
  767. color: #757575;
  768. padding-left: 52rpx;
  769. }
  770. }
  771. }
  772. // Card Base Styles
  773. .card {
  774. background: white;
  775. border-radius: 20rpx;
  776. box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.04), 0 1rpx 4rpx rgba(0, 0, 0, 0.02);
  777. margin-bottom: 24rpx;
  778. overflow: hidden;
  779. .card-header {
  780. display: flex;
  781. justify-content: space-between;
  782. align-items: center;
  783. padding: 24rpx 28rpx;
  784. border-bottom: 1px solid rgba(0, 0, 0, 0.03);
  785. .title-section {
  786. display: flex;
  787. align-items: center;
  788. .title-line {
  789. width: 4rpx;
  790. height: 28rpx;
  791. border-radius: 0;
  792. background: linear-gradient(180deg, #3BB44A, #66CC6A);
  793. margin-right: 16rpx;
  794. }
  795. .card-title {
  796. font-size: 28rpx;
  797. font-weight: 600;
  798. color: #2C3E50;
  799. }
  800. }
  801. .period-selector {
  802. display: flex;
  803. background: rgba(0, 0, 0, 0.03);
  804. border-radius: 20rpx;
  805. padding: 2rpx;
  806. .period {
  807. font-size: 22rpx;
  808. color: #8C9396;
  809. padding: 8rpx 16rpx;
  810. border-radius: 16rpx;
  811. &.active {
  812. background: white;
  813. color: #3BB44A;
  814. font-weight: 500;
  815. box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05);
  816. }
  817. }
  818. }
  819. .action-button {
  820. display: flex;
  821. align-items: center;
  822. background: linear-gradient(135deg, #3BB44A, #66CC6A);
  823. border-radius: 24rpx;
  824. padding: 8rpx 16rpx;
  825. box-shadow: 0 2rpx 8rpx rgba(59, 180, 74, 0.25);
  826. text {
  827. font-size: 22rpx;
  828. color: white;
  829. margin-right: 6rpx;
  830. }
  831. }
  832. }
  833. }
  834. // Farm Performance Card
  835. .farm-performance {
  836. .performance-stats {
  837. display: flex;
  838. padding: 24rpx 28rpx;
  839. .metric-column {
  840. flex: 1;
  841. display: flex;
  842. flex-direction: column;
  843. .metric-value {
  844. font-size: 48rpx;
  845. font-weight: 700;
  846. color: #2C3E50;
  847. margin-bottom: 6rpx;
  848. line-height: 1.1;
  849. .metric-unit {
  850. font-size: 24rpx;
  851. font-weight: 500;
  852. color: #8C9396;
  853. margin-left: 4rpx;
  854. }
  855. }
  856. .metric-label {
  857. font-size: 24rpx;
  858. color: #8C9396;
  859. margin-bottom: 12rpx;
  860. }
  861. .growth {
  862. display: flex;
  863. align-items: center;
  864. font-size: 22rpx;
  865. &.positive {
  866. color: #3BB44A;
  867. }
  868. &.negative {
  869. color: #FF5252;
  870. }
  871. }
  872. }
  873. .metric-divider {
  874. width: 1px;
  875. background: rgba(0, 0, 0, 0.04);
  876. margin: 0 28rpx;
  877. }
  878. }
  879. .chart-container {
  880. padding: 24rpx 28rpx;
  881. .chart-header {
  882. display: flex;
  883. justify-content: space-between;
  884. align-items: center;
  885. margin-bottom: 16rpx;
  886. .chart-title {
  887. font-size: 28rpx;
  888. font-weight: 600;
  889. color: #2C3E50;
  890. }
  891. .chart-legend {
  892. display: flex;
  893. align-items: center;
  894. .legend-item {
  895. display: flex;
  896. align-items: center;
  897. margin-left: 16rpx;
  898. .legend-color {
  899. width: 16rpx;
  900. height: 16rpx;
  901. border-radius: 4rpx;
  902. margin-right: 8rpx;
  903. }
  904. text {
  905. font-size: 22rpx;
  906. color: #8C9396;
  907. }
  908. }
  909. }
  910. }
  911. .chart-body {
  912. display: flex;
  913. height: 240rpx;
  914. position: relative;
  915. margin-top: 12rpx;
  916. .y-axis {
  917. width: 40rpx;
  918. height: 200rpx;
  919. display: flex;
  920. flex-direction: column;
  921. justify-content: space-between;
  922. text-align: right;
  923. padding-right: 16rpx;
  924. margin-bottom: 30rpx;
  925. text {
  926. font-size: 22rpx;
  927. color: #8C9396;
  928. }
  929. }
  930. .bars-container {
  931. flex: 1;
  932. display: flex;
  933. justify-content: space-around;
  934. height: 200rpx;
  935. position: relative;
  936. &::before {
  937. content: "";
  938. position: absolute;
  939. left: 0;
  940. bottom: 0;
  941. width: 100%;
  942. height: 1px;
  943. background-color: #E0E0E0;
  944. }
  945. .month-group {
  946. display: flex;
  947. flex-direction: column;
  948. align-items: center;
  949. width: 14%;
  950. .bar-wrapper {
  951. height: 200rpx;
  952. width: 70%;
  953. display: flex;
  954. justify-content: center;
  955. position: relative;
  956. .bar {
  957. position: absolute;
  958. bottom: 0;
  959. width: 45%;
  960. border-radius: 4rpx 4rpx 0 0;
  961. transition: height 0.3s ease;
  962. }
  963. .last-year {
  964. left: 0;
  965. background: #E0E0E0;
  966. }
  967. .this-year {
  968. right: 0;
  969. background: #3BB44A;
  970. }
  971. }
  972. .month-label {
  973. font-size: 22rpx;
  974. color: #8C9396;
  975. margin-top: 8rpx;
  976. }
  977. }
  978. }
  979. }
  980. }
  981. }
  982. // Crop Portfolio
  983. .crop-portfolio {
  984. .crop-grid {
  985. padding: 16rpx;
  986. display: grid;
  987. grid-template-columns: repeat(2, 1fr);
  988. gap: 16rpx;
  989. }
  990. .crop-item {
  991. padding: 16rpx;
  992. background: rgba(0, 0, 0, 0.01);
  993. border-radius: 16rpx;
  994. display: flex;
  995. align-items: center;
  996. .crop-icon {
  997. width: 48rpx;
  998. height: 48rpx;
  999. border-radius: 12rpx;
  1000. display: flex;
  1001. align-items: center;
  1002. justify-content: center;
  1003. margin-right: 16rpx;
  1004. .crop-icon-text {
  1005. font-size: 24rpx;
  1006. }
  1007. }
  1008. .crop-details {
  1009. flex: 1;
  1010. .crop-info {
  1011. display: flex;
  1012. justify-content: space-between;
  1013. align-items: center;
  1014. margin-bottom: 10rpx;
  1015. .crop-name {
  1016. font-size: 26rpx;
  1017. font-weight: 600;
  1018. color: #2C3E50;
  1019. }
  1020. .crop-area {
  1021. font-size: 22rpx;
  1022. color: #8C9396;
  1023. }
  1024. }
  1025. .crop-stats {
  1026. display: flex;
  1027. align-items: center;
  1028. .crop-progress-container {
  1029. flex: 1;
  1030. height: 8rpx;
  1031. background: rgba(0, 0, 0, 0.03);
  1032. border-radius: 4rpx;
  1033. margin-right: 12rpx;
  1034. overflow: hidden;
  1035. .crop-progress {
  1036. height: 100%;
  1037. border-radius: 4rpx;
  1038. }
  1039. }
  1040. .crop-progress-text {
  1041. font-size: 22rpx;
  1042. color: #8C9396;
  1043. min-width: 36rpx;
  1044. text-align: right;
  1045. }
  1046. }
  1047. }
  1048. }
  1049. }
  1050. // Resource Efficiency
  1051. .resource-efficiency {
  1052. .resource-grid {
  1053. padding: 16rpx;
  1054. display: grid;
  1055. grid-template-columns: repeat(2, 1fr);
  1056. gap: 16rpx;
  1057. }
  1058. .resource-item {
  1059. padding: 16rpx;
  1060. background: rgba(0, 0, 0, 0.01);
  1061. border-radius: 16rpx;
  1062. .resource-header {
  1063. display: flex;
  1064. align-items: center;
  1065. margin-bottom: 12rpx;
  1066. .icon-tile {
  1067. width: 28rpx;
  1068. height: 28rpx;
  1069. border-radius: 6rpx;
  1070. display: flex;
  1071. align-items: center;
  1072. justify-content: center;
  1073. margin-right: 10rpx;
  1074. &.small {
  1075. width: 28rpx;
  1076. height: 28rpx;
  1077. }
  1078. }
  1079. .resource-name {
  1080. font-size: 24rpx;
  1081. color: #8C9396;
  1082. }
  1083. }
  1084. .resource-value {
  1085. margin-bottom: 12rpx;
  1086. .value {
  1087. font-size: 36rpx;
  1088. font-weight: 700;
  1089. color: #2C3E50;
  1090. }
  1091. .unit {
  1092. font-size: 22rpx;
  1093. color: #8C9396;
  1094. margin-left: 4rpx;
  1095. }
  1096. }
  1097. .resource-progress-container {
  1098. .resource-progress-bg {
  1099. height: 8rpx;
  1100. background: rgba(0, 0, 0, 0.03);
  1101. border-radius: 4rpx;
  1102. margin-bottom: 8rpx;
  1103. overflow: hidden;
  1104. .resource-progress {
  1105. height: 100%;
  1106. border-radius: 4rpx;
  1107. }
  1108. }
  1109. .resource-efficiency {
  1110. font-size: 22rpx;
  1111. color: #8C9396;
  1112. }
  1113. }
  1114. }
  1115. }
  1116. // Farm Activities
  1117. .farm-activities {
  1118. .activities-list {
  1119. padding: 8rpx 0;
  1120. }
  1121. .activity-item {
  1122. display: flex;
  1123. align-items: center;
  1124. padding: 20rpx 28rpx;
  1125. border-bottom: 1px solid rgba(0, 0, 0, 0.02);
  1126. &:last-child {
  1127. border-bottom: none;
  1128. }
  1129. .activity-dot {
  1130. width: 10rpx;
  1131. height: 10rpx;
  1132. border-radius: 50%;
  1133. margin-right: 16rpx;
  1134. flex-shrink: 0;
  1135. &.completed {
  1136. background: #4CAF50;
  1137. }
  1138. &.pending {
  1139. background: #FFC107;
  1140. }
  1141. &.failed {
  1142. background: #FF5252;
  1143. }
  1144. }
  1145. .activity-details {
  1146. flex: 1;
  1147. .activity-title-row {
  1148. display: flex;
  1149. justify-content: space-between;
  1150. align-items: center;
  1151. margin-bottom: 6rpx;
  1152. .activity-title {
  1153. font-size: 26rpx;
  1154. font-weight: 500;
  1155. color: #2C3E50;
  1156. }
  1157. .activity-date {
  1158. font-size: 22rpx;
  1159. color: #8C9396;
  1160. }
  1161. }
  1162. .activity-meta-row {
  1163. display: flex;
  1164. justify-content: space-between;
  1165. align-items: center;
  1166. .activity-executor {
  1167. font-size: 22rpx;
  1168. color: #8C9396;
  1169. }
  1170. .activity-action {
  1171. display: flex;
  1172. align-items: center;
  1173. .action-text {
  1174. font-size: 22rpx;
  1175. color: #3BB44A;
  1176. margin-right: 6rpx;
  1177. }
  1178. }
  1179. }
  1180. }
  1181. }
  1182. }
  1183. // Weather Card
  1184. .weather-card {
  1185. .weather-content {
  1186. padding: 20rpx 28rpx;
  1187. }
  1188. .current-weather {
  1189. display: flex;
  1190. align-items: center;
  1191. margin-bottom: 24rpx;
  1192. .weather-icon-container {
  1193. margin-right: 20rpx;
  1194. .weather-icon {
  1195. font-size: 60rpx;
  1196. line-height: 1;
  1197. }
  1198. }
  1199. .weather-details {
  1200. .weather-temp {
  1201. font-size: 48rpx;
  1202. font-weight: 700;
  1203. color: #2C3E50;
  1204. line-height: 1.1;
  1205. }
  1206. .weather-desc {
  1207. font-size: 26rpx;
  1208. color: #8C9396;
  1209. }
  1210. }
  1211. }
  1212. .weather-metrics {
  1213. display: flex;
  1214. justify-content: space-between;
  1215. align-items: center;
  1216. padding: 16rpx 24rpx;
  1217. margin-bottom: 24rpx;
  1218. border-radius: 12rpx;
  1219. background-color: rgba(247, 247, 247, 0.5);
  1220. border: 1px solid rgba(0, 0, 0, 0.03);
  1221. .weather-metric {
  1222. flex: 1;
  1223. display: flex;
  1224. flex-direction: column;
  1225. align-items: center;
  1226. .metric-label {
  1227. font-size: 22rpx;
  1228. color: #8C9396;
  1229. margin-bottom: 6rpx;
  1230. }
  1231. .metric-value {
  1232. font-size: 28rpx;
  1233. font-weight: 600;
  1234. color: #2C3E50;
  1235. }
  1236. }
  1237. .vertical-divider {
  1238. width: 1px;
  1239. height: 36rpx;
  1240. background-color: rgba(0, 0, 0, 0.05);
  1241. }
  1242. }
  1243. .weather-advice {
  1244. background: rgba(59, 180, 74, 0.05);
  1245. border-radius: 16rpx;
  1246. padding: 16rpx;
  1247. .advice-header {
  1248. display: flex;
  1249. align-items: center;
  1250. margin-bottom: 10rpx;
  1251. .icon-tile {
  1252. width: 24rpx;
  1253. height: 24rpx;
  1254. border-radius: 50%;
  1255. background: linear-gradient(135deg, #3BB44A, #66CC6A);
  1256. display: flex;
  1257. align-items: center;
  1258. justify-content: center;
  1259. margin-right: 10rpx;
  1260. box-shadow: 0 2rpx 8rpx rgba(59, 180, 74, 0.25);
  1261. &.small {
  1262. width: 24rpx;
  1263. height: 24rpx;
  1264. }
  1265. }
  1266. .advice-title {
  1267. font-size: 24rpx;
  1268. font-weight: 600;
  1269. color: #2C3E50;
  1270. }
  1271. }
  1272. .advice-content {
  1273. font-size: 24rpx;
  1274. color: #2C3E50;
  1275. line-height: 1.4;
  1276. }
  1277. }
  1278. }
  1279. // For small screens - mobile responsiveness
  1280. @media screen and (max-width: 768px) {
  1281. .stats-overview {
  1282. grid-template-columns: repeat(2, 1fr);
  1283. }
  1284. .crop-grid {
  1285. grid-template-columns: 1fr;
  1286. }
  1287. }
  1288. // 监控设备概览
  1289. .device-overview {
  1290. .device-metrics-grid {
  1291. display: grid;
  1292. grid-template-columns: repeat(2, 1fr);
  1293. gap: 16rpx;
  1294. padding: 16rpx;
  1295. }
  1296. .device-metric-card {
  1297. background: white;
  1298. border-radius: 16rpx;
  1299. padding: 20rpx;
  1300. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
  1301. border: 1px solid rgba(0, 0, 0, 0.02);
  1302. .device-metric-header {
  1303. display: flex;
  1304. align-items: center;
  1305. margin-bottom: 16rpx;
  1306. .icon-tile {
  1307. width: 24rpx;
  1308. height: 24rpx;
  1309. border-radius: 50%;
  1310. display: flex;
  1311. align-items: center;
  1312. justify-content: center;
  1313. margin-right: 10rpx;
  1314. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
  1315. }
  1316. .metric-name {
  1317. font-size: 24rpx;
  1318. color: #8C9396;
  1319. }
  1320. }
  1321. .device-metric-value {
  1322. font-size: 44rpx;
  1323. font-weight: 700;
  1324. color: #2C3E50;
  1325. margin-bottom: 12rpx;
  1326. }
  1327. .device-metric-trend {
  1328. display: flex;
  1329. align-items: center;
  1330. font-size: 22rpx;
  1331. &.up {
  1332. color: #3BB44A;
  1333. }
  1334. &.down {
  1335. color: #FF5252;
  1336. }
  1337. text {
  1338. margin-left: 4rpx;
  1339. }
  1340. }
  1341. }
  1342. }
  1343. // 农业机械活动
  1344. .machinery-activity {
  1345. .machinery-metrics-grid {
  1346. display: grid;
  1347. grid-template-columns: repeat(2, 1fr);
  1348. gap: 16rpx;
  1349. padding: 16rpx;
  1350. }
  1351. .machinery-metric-card {
  1352. background: white;
  1353. border-radius: 16rpx;
  1354. padding: 20rpx;
  1355. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
  1356. border: 1px solid rgba(0, 0, 0, 0.02);
  1357. .machinery-metric-header {
  1358. display: flex;
  1359. align-items: center;
  1360. margin-bottom: 16rpx;
  1361. .icon-tile {
  1362. width: 24rpx;
  1363. height: 24rpx;
  1364. border-radius: 50%;
  1365. display: flex;
  1366. align-items: center;
  1367. justify-content: center;
  1368. margin-right: 10rpx;
  1369. box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
  1370. }
  1371. .metric-name {
  1372. font-size: 24rpx;
  1373. color: #8C9396;
  1374. }
  1375. }
  1376. .machinery-metric-value {
  1377. font-size: 44rpx;
  1378. font-weight: 700;
  1379. color: #2C3E50;
  1380. margin-bottom: 12rpx;
  1381. }
  1382. .machinery-metric-trend {
  1383. display: flex;
  1384. align-items: center;
  1385. font-size: 22rpx;
  1386. &.up {
  1387. color: #3BB44A;
  1388. }
  1389. &.down {
  1390. color: #FF5252;
  1391. }
  1392. text {
  1393. margin-left: 4rpx;
  1394. }
  1395. }
  1396. .machinery-metric-unit {
  1397. font-size: 22rpx;
  1398. color: #8C9396;
  1399. }
  1400. }
  1401. }
  1402. // 添加测试样式
  1403. .test-block {
  1404. background-color: #4CAF50;
  1405. padding: 30rpx;
  1406. margin: 20rpx;
  1407. border-radius: 12rpx;
  1408. display: flex;
  1409. justify-content: center;
  1410. align-items: center;
  1411. }
  1412. .test-text {
  1413. color: white;
  1414. font-size: 36rpx;
  1415. font-weight: bold;
  1416. }
  1417. </style>