| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596 |
- <template>
- <view class="dashboard-container">
- <!-- 顶部用户信息卡片 -->
- <view class="user-info-card">
- <view class="user-info">
- <text class="greeting">您好,{{ userData.nickname }}</text>
- <view class="plot-info">
- <text class="plot-label">当前地块:</text>
- <text class="plot-name">{{ userData.selectedPlot }}</text>
- <view class="switch-plot-btn" v-if="isLogin">
- <u-picker :show="show" :columns="columns" :defaultIndex="defaultIndex" @cancel="show = false"
- @confirm="onConfirm"></u-picker>
- <text @click="handleSwitchPlot">切换</text>
- </view>
- </view>
- </view>
- <view class="avatar-container" @click="navigateToProfile">
- <view class="avatar">
- <image :src="userData.avatar" mode="aspectFill"></image>
- </view>
- </view>
- </view>
- <!-- 顶部统计概览 -->
- <view class="stats-overview">
- <view class="alert-card" v-for="(alert, index) in alertSummaries" :key="index"
- @click="navigateToAlertDetail(alert.type)">
- <view class="alert-header">
- <view class="alert-icon-container">
- <image class="custom-icon" :src="alert.iconSrc"></image>
- </view>
- <text class="alert-title">{{ alert.title }}</text>
- </view>
- <text class="alert-value">{{ alert.value }}</text>
- <text class="alert-description">{{ alert.description }}</text>
- </view>
- </view>
- <!-- 天气卡片 -->
- <view class="card weather-card">
- <view class="card-header">
- <view class="title-section">
- <view class="title-line"></view>
- <text class="card-title">天气与预报</text>
- </view>
- </view>
- <view class="weather-content">
- <view class="current-weather">
- <view class="weather-icon-container">
- <view class="weather-icon">
- <text v-if="weatherData.description === '晴朗'">☀️</text>
- <text v-else-if="weatherData.description.includes('雨')">🌧️</text>
- <text v-else-if="weatherData.description.includes('云')">⛅</text>
- <text v-else>🌤️</text>
- </view>
- </view>
- <view class="weather-details">
- <text class="weather-temp">{{ weatherData.temperature }}°C</text>
- <text class="weather-desc">{{ weatherData.description }}</text>
- </view>
- </view>
- <view class="weather-metrics">
- <view class="weather-metric">
- <text class="metric-label">湿度</text>
- <text class="metric-value">{{ weatherData.humidity }}%</text>
- </view>
- <view class="vertical-divider"></view>
- <view class="weather-metric">
- <text class="metric-label">风力</text>
- <text class="metric-value">{{ weatherData.windLevel }} 级</text>
- </view>
- <view class="vertical-divider"></view>
- <view class="weather-metric">
- <text class="metric-label">降水量</text>
- <text class="metric-value">{{ weatherData.rainfall }} mm</text>
- </view>
- </view>
- <view class="weather-advice">
- <view class="advice-header">
- <view class="icon-tile small">
- <u-icon name="info" color="#ffffff" size="14"></u-icon>
- </view>
- <text class="advice-title">今日建议:</text>
- </view>
- <text class="advice-content">{{ weatherData.advice }}</text>
- </view>
- </view>
- </view>
- <!-- 农场绩效卡片 -->
- <view class="card farm-performance">
- <view class="card-header">
- <view class="title-section">
- <view class="title-line"></view>
- <text class="card-title">产值分析</text>
- </view>
- <view class="period-selector">
- <text class="period" :class="{ active: currentPeriod === 'month' }"
- @click="changePeriod('month')">月</text>
- <text class="period" :class="{ active: currentPeriod === 'quarter' }"
- @click="changePeriod('quarter')">季</text>
- <text class="period" :class="{ active: currentPeriod === 'year' }"
- @click="changePeriod('year')">年</text>
- </view>
- </view>
- <view class="performance-stats">
- <view class="metric-column">
- <text class="metric-value">128<text class="metric-unit">亩</text></text>
- <text class="metric-label">管理面积总计</text>
- <view class="growth positive">
- <u-icon name="arrow-upward" color="#3BB44A" size="12"></u-icon>
- <text>比上月增长12%</text>
- </view>
- </view>
- <view class="metric-divider"></view>
- <view class="metric-column">
- <text class="metric-value">¥36,480</text>
- <text class="metric-label">预计产值</text>
- <view class="growth positive">
- <u-icon name="arrow-upward" color="#3BB44A" size="12"></u-icon>
- <text>比上月增长8.2%</text>
- </view>
- </view>
- </view>
- <view class="chart-container">
- <view class="chart-header">
- <text class="chart-title">产值趋势 (万元)</text>
- <view class="chart-legend">
- <view class="legend-item">
- <view class="legend-color" style="background: #3BB44A;"></view>
- <text>今年</text>
- </view>
- <view class="legend-item">
- <view class="legend-color" style="background: #E0E0E0;"></view>
- <text>去年</text>
- </view>
- </view>
- </view>
- <view class="chart-body">
- <view class="y-axis">
- <text v-for="(value, index) in [4, 3, 2, 1, 0]" :key="index">{{ value }}</text>
- </view>
- <view class="bars-container">
- <view class="month-group" v-for="(month, index) in farmPerformanceData.months" :key="index">
- <view class="bar-wrapper">
- <view class="bar last-year"
- :style="{ height: (farmPerformanceData.lastYearValues[index] / 4) * 100 + '%' }">
- </view>
- <view class="bar this-year"
- :style="{ height: (farmPerformanceData.thisYearValues[index] / 4) * 100 + '%' }">
- </view>
- </view>
- <text class="month-label">{{ month }}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- <!-- 监控设备概览 -->
- <view class="card device-overview">
- <view class="card-header">
- <view class="title-section">
- <view class="title-line"></view>
- <text class="card-title">监控设备概览</text>
- </view>
- </view>
- <view class="device-metrics-grid">
- <view class="device-metric-card" v-for="(metric, index) in deviceMetrics" :key="index">
- <view class="device-metric-header">
- <view class="icon-tile" :style="{ background: metric.gradient }">
- <u-icon :name="metric.icon" color="#ffffff" size="18"></u-icon>
- </view>
- <text class="metric-name">{{ metric.name }}</text>
- </view>
- <view class="device-metric-value">{{ metric.value }}</view>
- <view class="device-metric-trend" :class="metric.trend.type">
- <u-icon :name="metric.trend.type === 'up' ? 'arrow-upward' : 'arrow-downward'"
- :color="metric.trend.type === 'up' ? '#3BB44A' : '#FF5252'" size="14"></u-icon>
- <text>{{ metric.trend.value }}</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 农业机械活动 -->
- <view class="card machinery-activity">
- <view class="card-header">
- <view class="title-section">
- <view class="title-line"></view>
- <text class="card-title">农机作业概览</text>
- </view>
- </view>
- <view class="machinery-metrics-grid">
- <view class="machinery-metric-card" v-for="(metric, index) in machineryMetrics" :key="index">
- <view class="machinery-metric-header">
- <view class="icon-tile" :style="{ background: metric.gradient }">
- <u-icon :name="metric.icon" color="#ffffff" size="18"></u-icon>
- </view>
- <text class="metric-name">{{ metric.name }}</text>
- </view>
- <view class="machinery-metric-value">{{ metric.value }}</view>
- <view v-if="metric.trend" class="machinery-metric-trend" :class="metric.trend.type">
- <u-icon :name="metric.trend.type === 'up' ? 'arrow-upward' : 'arrow-downward'"
- :color="metric.trend.type === 'up' ? '#3BB44A' : '#FF5252'" size="14"></u-icon>
- <text>{{ metric.trend.value }}</text>
- </view>
- <view v-else class="machinery-metric-unit">
- <text>{{ metric.unit }}</text>
- </view>
- </view>
- </view>
- </view>
- <!-- 农场活动卡片 -->
- <view class="card farm-activities">
- <view class="card-header">
- <view class="title-section">
- <view class="title-line"></view>
- <text class="card-title">农事活动</text>
- </view>
- <view class="action-button">
- <text>查看全部</text>
- <u-icon name="arrow-right" color="#ffffff" size="14"></u-icon>
- </view>
- </view>
- <view class="activities-list">
- <view class="activity-item" v-for="(activity, index) in farmData.recentActivities" :key="index">
- <view class="activity-dot" :class="activity.status"></view>
- <view class="activity-details">
- <view class="activity-title-row">
- <text class="activity-title">{{ activity.title }}</text>
- <text class="activity-date">{{ activity.date }}</text>
- </view>
- <view class="activity-meta-row">
- <text class="activity-executor">{{ activity.executor }}</text>
- <view class="activity-action" @click.stop="navigateToActivity(activity)">
- <text class="action-text">查看</text>
- <u-icon name="arrow-right" color="#3BB44A" size="14"></u-icon>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import storage from "@/utils/storage.js";
- import {
- listFieldName
- } from "@/api/services/field.js"
- export default {
- data() {
- return {
- isLogin:false,
- show: false,
- columns: [
- []
- ],
- defaultIndex: [0],
- // 用户数据
- userData: {
- nickname: '游客',
- selectedPlot: '未选择地块',
- avatar: '/static/images/user-avatar.png',
- },
- // 农场数据
- farmData: {
- plotCount: 5,
- deviceCount: 12,
- deviceOnlineRate: 85,
- taskCompletionRate: 76,
- recentActivities: [{
- title: '稻田水稻施肥',
- date: '2023-05-15',
- status: 'pending',
- id: 1,
- executor: '李四'
- },
- {
- title: '南地块除草',
- date: '2023-05-12',
- status: 'completed',
- id: 2,
- executor: '王五'
- },
- {
- title: '西北区域杀虫',
- date: '2023-05-08',
- status: 'completed',
- id: 3,
- executor: '张三'
- }
- ]
- },
- // 天气数据
- weatherData: {
- temperature: 28,
- description: '晴朗',
- humidity: 65,
- windLevel: 3,
- rainfall: 0,
- advice: '今日适宜进行春玉米防虫作业,注意水分管理。'
- },
- // 作物数据
- crops: [{
- name: '水稻',
- area: 48,
- progress: 75,
- icon: '🌾',
- bgColor: '#4CAF50'
- },
- {
- name: '小麦',
- area: 36,
- progress: 60,
- icon: '🌿',
- bgColor: '#66BB6A'
- },
- {
- name: '玉米',
- area: 32,
- progress: 85,
- icon: '🌽',
- bgColor: '#43A047'
- },
- {
- name: '大豆',
- area: 12,
- progress: 40,
- icon: '🫘',
- bgColor: '#388E3C'
- }
- ],
- // 监控设备指标
- deviceMetrics: [{
- name: '在线设备',
- value: '28',
- icon: 'wifi',
- gradient: 'linear-gradient(135deg, #26A69A, #00796B)',
- trend: {
- type: 'up',
- value: '5.2%'
- }
- },
- {
- name: '告警设备',
- value: '3',
- icon: 'error-circle',
- gradient: 'linear-gradient(135deg, #FF7043, #E64A19)',
- trend: {
- type: 'down',
- value: '2.1%'
- }
- },
- {
- name: '离线设备',
- value: '5',
- icon: 'close-circle',
- gradient: 'linear-gradient(135deg, #78909C, #455A64)',
- trend: {
- type: 'down',
- value: '1.8%'
- }
- },
- {
- name: '数据稳定性',
- value: '96.3%',
- icon: 'checkmark-circle',
- gradient: 'linear-gradient(135deg, #66BB6A, #388E3C)',
- trend: {
- type: 'up',
- value: '0.5%'
- }
- }
- ],
- // 农业机械指标
- machineryMetrics: [{
- name: '今日运行时长',
- value: '36.5',
- unit: '小时',
- icon: 'clock',
- gradient: 'linear-gradient(135deg, #42A5F5, #1976D2)'
- },
- {
- name: '今日作业地块',
- value: '8',
- unit: '块',
- icon: 'map',
- gradient: 'linear-gradient(135deg, #66BB6A, #388E3C)'
- },
- {
- name: '今日执行任务',
- value: '12',
- unit: '个',
- icon: 'calendar',
- gradient: 'linear-gradient(135deg, #FFA726, #F57C00)'
- },
- {
- name: '使用率',
- value: '78.2%',
- icon: 'star',
- gradient: 'linear-gradient(135deg, #5C6BC0, #3949AB)',
- trend: {
- type: 'up',
- value: '3.7%'
- }
- }
- ],
- // 当前选择的周期
- currentPeriod: 'month',
- // 警报摘要数据
- alertSummaries: [{
- title: '设备离线',
- value: '3 台',
- iconSrc: '/static/icons/offline.png',
- description: '最长离线时长:26 小时',
- type: 'device-offline'
- },
- {
- title: '虫害预警',
- value: '稻飞虱|小地老虎',
- iconSrc: '/static/icons/Pest_Alert.png',
- description: '预警等级:中',
- type: 'pest-warning'
- },
- {
- title: '气象预警',
- value: '强风(8级)',
- iconSrc: '/static/icons/weather_risk.png',
- description: '预计:未来 12 小时内',
- type: 'weather-risk'
- },
- {
- title: '作业延迟',
- value: '5 项',
- iconSrc: '/static/icons/task_delay.png',
- description: '最长延迟:3 天',
- type: 'task-delay'
- }
- ],
- // 农场绩效图表数据 - 月度数据
- monthlyData: {
- months: ['1月', '2月', '3月', '4月', '5月', '6月'],
- thisYearValues: [2.8, 3.4, 2.9, 3.6, 3.8, 3.2],
- lastYearValues: [2.5, 2.8, 2.4, 3.0, 3.2, 2.7]
- },
- // 季度数据
- quarterlyData: {
- months: ['Q1', 'Q2', 'Q3', 'Q4'],
- thisYearValues: [3.2, 3.7, 4.0, 3.5],
- lastYearValues: [2.7, 3.3, 3.6, 3.0]
- },
- // 年度数据
- yearlyData: {
- months: ['2019', '2020', '2021', '2022', '2023'],
- thisYearValues: [2.2, 2.5, 3.0, 3.5, 3.8],
- lastYearValues: [2.0, 2.3, 2.7, 3.2, 3.4]
- }
- };
- },
- computed: {
- // 核心统计数据
- coreStats() {
- return [{
- label: '地块',
- value: this.farmData.plotCount,
- icon: 'map',
- },
- {
- label: '设备',
- value: this.farmData.deviceCount,
- icon: 'setting',
- },
- {
- label: '设备在线',
- value: this.farmData.deviceOnlineRate + '%',
- icon: 'wifi',
- },
- {
- label: '任务完成',
- value: this.farmData.taskCompletionRate + '%',
- icon: 'checkmark-circle',
- }
- ];
- },
- // 根据当前周期计算要显示的数据
- farmPerformanceData() {
- if (this.currentPeriod === 'month') {
- return this.monthlyData;
- } else if (this.currentPeriod === 'quarter') {
- return this.quarterlyData;
- } else {
- return this.yearlyData;
- }
- }
- },
- methods: {
- loadPhots(userId) {
- console.log("加载用户字段", userId);
- listFieldName(userId)
- .then(res => {
- const {
- data
- } = res || {};
- if (data?.code !== 200 || !Array.isArray(data.data)) {
- console.warn("接口返回异常或数据格式不正确", res);
- return;
- }
- const fieldList = data.data;
- console.log("fieldList:",fieldList);
- const fields = [];
- fieldList.forEach(item => {
- const fieldName = item?.fieldName;
- if (fieldName && !fields.includes(fieldName)) {
- fields.push({
- text: fieldName,
- value: item.id,
- growCrops: item.growCrops,
- managerName: item.managerName,
- size: item.size,
- farmId: item.farmId
- });
- }
- });
- this.columns = [fields]; // 符合 u-picker 的二维数组格式
- storage.setCurrentUserPlotsList(fields)
- console.log("字段加载完成:", this.columns);
-
- // 字段加载完成后立即设置默认索引
- this.setDefaultSelectedPlot();
- })
- .catch(err => {
- console.error("加载字段失败", err);
- });
- },
- // 初始化地块列表
- initPlotColumns() {
- const cached = storage.getCurrentUserPlotsList();
- if (Array.isArray(cached) && cached.length > 0) {
- this.columns = [cached]; // 结构上是二维数组
- console.log("从缓存加载字段:", this.columns);
- } else {
- this.loadPhots(this.userData.userid); // 异步方法内部要处理赋值 columns
- }
- },
- // 设置默认选中项
- setDefaultSelectedPlot() {
- try {
- const currentPlots = JSON.parse(storage.getPlots() || '{}');
- console.log("设置默认地块", currentPlots);
-
- if (currentPlots?.name) {
- this.userData.selectedPlot = currentPlots.name;
- // 防止 this.columns 未定义或格式不正确
- if (Array.isArray(this.columns) && this.columns.length > 0 && Array.isArray(this.columns[0])) {
- const plots = this.columns[0];
- const index = plots.findIndex(item => item.text === currentPlots.name);
- if (index !== -1) {
- this.defaultIndex = [index];
- console.log("设置默认选中地块索引:", index, "defaultIndex:", this.defaultIndex);
- } else {
- console.warn("未找到匹配的地块:", currentPlots.name);
- this.defaultIndex = [0]; // 默认选中第一项
- }
- } else {
- console.warn("columns数据格式不正确:", this.columns);
- this.defaultIndex = [0]; // 默认选中第一项
- }
- } else {
- console.warn("未设置默认地块或地块名为空");
- this.defaultIndex = [0]; // 默认选中第一项
- }
- } catch (error) {
- console.error("设置默认地块时出错:", error);
- this.defaultIndex = [0]; // 出错时默认选中第一项
- }
- },
- onConfirm(e) {
- console.log('选择了:', e);
- this.userData.selectedPlot = e.value[0].text
- 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}
- storage.setPlots(JSON.stringify(obj))
- this.show = false;
- },
- // 处理切换地块
- handleSwitchPlot() {
- // 在显示picker前重新设置defaultIndex
- this.setDefaultSelectedPlot();
- this.show = true;
- },
- // 导航到个人资料
- navigateToProfile() {
- uni.navigateTo({
- url: '/pages/user/index'
- });
- },
- // 导航到活动详情
- navigateToActivity(activity) {
- uni.navigateTo({
- url: `/pages/activity/detail?id=${activity.id}`
- });
- },
- // 导航到警报详情
- navigateToAlertDetail(type) {
- // 实现导航到警报详情页的逻辑
- console.log(`Navigating to alert detail for type: ${type}`);
- },
- // 切换周期
- changePeriod(period) {
- this.currentPeriod = period;
- }
- },
- onShow() {
- const userInfo = storage.getUserInfo()
- console.log("userInfo", userInfo);
- this.userData.nickname = userInfo.username || '未登录'
- this.userData.avatar = userInfo.avatar || '/static/icons/user_icon.png'
- this.userData.userId = userInfo.userid
-
- if(storage.getHasLogin()){
- this.isLogin = true;
- // 加载当前登录用户所属所有地块信息
- const cached = storage.getCurrentUserPlotsList();
- if (Array.isArray(cached) && cached.length > 0) {
- // 如果有缓存,直接用缓存构造 columns
- this.columns = [cached];
- console.log("从缓存加载字段:", this.columns);
- // 有缓存时,在columns设置后立即设置defaultIndex
- this.setDefaultSelectedPlot();
- } else {
- // 无缓存时请求接口,在接口完成后会调用setDefaultSelectedPlot
- this.loadPhots(this.userData.userId);
- }
- console.log("columns", this.columns);
- }
- },
- mounted() {
-
- }
- };
- </script>
- <style lang="scss" scoped>
- .dashboard-container {
- padding: 24rpx;
- background-color: #F6FDF9;
- min-height: 100vh;
- }
- // 顶部用户信息卡片
- .user-info-card {
- display: flex;
- justify-content: space-between;
- align-items: center;
- background: white;
- border-radius: 20rpx;
- padding: 24rpx 28rpx;
- margin-bottom: 24rpx;
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.04);
- .user-info {
- flex: 1;
- .greeting {
- font-size: 32rpx;
- font-weight: 600;
- color: #2C3E50;
- margin-bottom: 8rpx;
- }
- .plot-info {
- display: flex;
- align-items: center;
- .plot-label {
- font-size: 24rpx;
- color: #8C9396;
- }
- .plot-name {
- font-size: 24rpx;
- color: #2C3E50;
- margin: 0 8rpx;
- }
- .switch-plot-btn {
- display: flex;
- align-items: center;
- justify-content: center;
- background: linear-gradient(135deg, #3BB44A, #66CC6A);
- border-radius: 16rpx;
- padding: 4rpx 16rpx;
- box-shadow: 0 2rpx 8rpx rgba(59, 180, 74, 0.25);
- text {
- font-size: 22rpx;
- color: white;
- }
- }
- }
- }
- .avatar-container {
- .avatar {
- width: 80rpx;
- height: 80rpx;
- border-radius: 50%;
- background-color: rgba(59, 180, 74, 0.1);
- border: 2px solid rgba(255, 255, 255, 0.8);
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
- overflow: hidden;
- image {
- width: 100%;
- height: 100%;
- object-fit: cover;
- }
- }
- }
- }
- // Top Stats Overview
- .stats-overview {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 16rpx;
- margin-bottom: 24rpx;
- .alert-card {
- background: white;
- border-radius: 16rpx;
- padding: 20rpx;
- display: flex;
- flex-direction: column;
- box-shadow: 0 4rpx 12rpx rgba(0, 0, 0, 0.05);
- position: relative;
- overflow: hidden;
- transition: transform 0.2s, box-shadow 0.2s;
- &:active {
- transform: translateY(2rpx);
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
- }
- &::after {
- content: "";
- position: absolute;
- right: 12rpx;
- bottom: 12rpx;
- width: 16rpx;
- height: 16rpx;
- border-top: 2rpx solid #E0E0E0;
- border-right: 2rpx solid #E0E0E0;
- transform: rotate(45deg);
- opacity: 0.5;
- }
- .alert-header {
- display: flex;
- align-items: center;
- margin-bottom: 12rpx;
- .alert-icon-container {
- margin-right: 12rpx;
- width: 40rpx;
- height: 40rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- .custom-icon {
- width: 40rpx;
- height: 40rpx;
- object-fit: contain;
- }
- }
- .alert-title {
- font-size: 26rpx;
- color: #333333;
- font-weight: 600;
- }
- }
- .alert-value {
- font-size: 30rpx;
- font-weight: 700;
- color: #3BB44A;
- margin-bottom: 6rpx;
- line-height: 1.2;
- padding-left: 52rpx;
- }
- .alert-description {
- font-size: 22rpx;
- color: #757575;
- padding-left: 52rpx;
- }
- }
- }
- // Card Base Styles
- .card {
- background: white;
- border-radius: 20rpx;
- box-shadow: 0 4rpx 20rpx rgba(0, 0, 0, 0.04), 0 1rpx 4rpx rgba(0, 0, 0, 0.02);
- margin-bottom: 24rpx;
- overflow: hidden;
- .card-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 24rpx 28rpx;
- border-bottom: 1px solid rgba(0, 0, 0, 0.03);
- .title-section {
- display: flex;
- align-items: center;
- .title-line {
- width: 4rpx;
- height: 28rpx;
- border-radius: 0;
- background: linear-gradient(180deg, #3BB44A, #66CC6A);
- margin-right: 16rpx;
- }
- .card-title {
- font-size: 28rpx;
- font-weight: 600;
- color: #2C3E50;
- }
- }
- .period-selector {
- display: flex;
- background: rgba(0, 0, 0, 0.03);
- border-radius: 20rpx;
- padding: 2rpx;
- .period {
- font-size: 22rpx;
- color: #8C9396;
- padding: 8rpx 16rpx;
- border-radius: 16rpx;
- &.active {
- background: white;
- color: #3BB44A;
- font-weight: 500;
- box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.05);
- }
- }
- }
- .action-button {
- display: flex;
- align-items: center;
- background: linear-gradient(135deg, #3BB44A, #66CC6A);
- border-radius: 24rpx;
- padding: 8rpx 16rpx;
- box-shadow: 0 2rpx 8rpx rgba(59, 180, 74, 0.25);
- text {
- font-size: 22rpx;
- color: white;
- margin-right: 6rpx;
- }
- }
- }
- }
- // Farm Performance Card
- .farm-performance {
- .performance-stats {
- display: flex;
- padding: 24rpx 28rpx;
- .metric-column {
- flex: 1;
- display: flex;
- flex-direction: column;
- .metric-value {
- font-size: 48rpx;
- font-weight: 700;
- color: #2C3E50;
- margin-bottom: 6rpx;
- line-height: 1.1;
- .metric-unit {
- font-size: 24rpx;
- font-weight: 500;
- color: #8C9396;
- margin-left: 4rpx;
- }
- }
- .metric-label {
- font-size: 24rpx;
- color: #8C9396;
- margin-bottom: 12rpx;
- }
- .growth {
- display: flex;
- align-items: center;
- font-size: 22rpx;
- &.positive {
- color: #3BB44A;
- }
- &.negative {
- color: #FF5252;
- }
- }
- }
- .metric-divider {
- width: 1px;
- background: rgba(0, 0, 0, 0.04);
- margin: 0 28rpx;
- }
- }
- .chart-container {
- padding: 24rpx 28rpx;
- .chart-header {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 16rpx;
- .chart-title {
- font-size: 28rpx;
- font-weight: 600;
- color: #2C3E50;
- }
- .chart-legend {
- display: flex;
- align-items: center;
- .legend-item {
- display: flex;
- align-items: center;
- margin-left: 16rpx;
- .legend-color {
- width: 16rpx;
- height: 16rpx;
- border-radius: 4rpx;
- margin-right: 8rpx;
- }
- text {
- font-size: 22rpx;
- color: #8C9396;
- }
- }
- }
- }
- .chart-body {
- display: flex;
- height: 240rpx;
- position: relative;
- margin-top: 12rpx;
- .y-axis {
- width: 40rpx;
- height: 200rpx;
- display: flex;
- flex-direction: column;
- justify-content: space-between;
- text-align: right;
- padding-right: 16rpx;
- margin-bottom: 30rpx;
- text {
- font-size: 22rpx;
- color: #8C9396;
- }
- }
- .bars-container {
- flex: 1;
- display: flex;
- justify-content: space-around;
- height: 200rpx;
- position: relative;
- &::before {
- content: "";
- position: absolute;
- left: 0;
- bottom: 0;
- width: 100%;
- height: 1px;
- background-color: #E0E0E0;
- }
- .month-group {
- display: flex;
- flex-direction: column;
- align-items: center;
- width: 14%;
- .bar-wrapper {
- height: 200rpx;
- width: 70%;
- display: flex;
- justify-content: center;
- position: relative;
- .bar {
- position: absolute;
- bottom: 0;
- width: 45%;
- border-radius: 4rpx 4rpx 0 0;
- transition: height 0.3s ease;
- }
- .last-year {
- left: 0;
- background: #E0E0E0;
- }
- .this-year {
- right: 0;
- background: #3BB44A;
- }
- }
- .month-label {
- font-size: 22rpx;
- color: #8C9396;
- margin-top: 8rpx;
- }
- }
- }
- }
- }
- }
- // Crop Portfolio
- .crop-portfolio {
- .crop-grid {
- padding: 16rpx;
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 16rpx;
- }
- .crop-item {
- padding: 16rpx;
- background: rgba(0, 0, 0, 0.01);
- border-radius: 16rpx;
- display: flex;
- align-items: center;
- .crop-icon {
- width: 48rpx;
- height: 48rpx;
- border-radius: 12rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 16rpx;
- .crop-icon-text {
- font-size: 24rpx;
- }
- }
- .crop-details {
- flex: 1;
- .crop-info {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 10rpx;
- .crop-name {
- font-size: 26rpx;
- font-weight: 600;
- color: #2C3E50;
- }
- .crop-area {
- font-size: 22rpx;
- color: #8C9396;
- }
- }
- .crop-stats {
- display: flex;
- align-items: center;
- .crop-progress-container {
- flex: 1;
- height: 8rpx;
- background: rgba(0, 0, 0, 0.03);
- border-radius: 4rpx;
- margin-right: 12rpx;
- overflow: hidden;
- .crop-progress {
- height: 100%;
- border-radius: 4rpx;
- }
- }
- .crop-progress-text {
- font-size: 22rpx;
- color: #8C9396;
- min-width: 36rpx;
- text-align: right;
- }
- }
- }
- }
- }
- // Resource Efficiency
- .resource-efficiency {
- .resource-grid {
- padding: 16rpx;
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 16rpx;
- }
- .resource-item {
- padding: 16rpx;
- background: rgba(0, 0, 0, 0.01);
- border-radius: 16rpx;
- .resource-header {
- display: flex;
- align-items: center;
- margin-bottom: 12rpx;
- .icon-tile {
- width: 28rpx;
- height: 28rpx;
- border-radius: 6rpx;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 10rpx;
- &.small {
- width: 28rpx;
- height: 28rpx;
- }
- }
- .resource-name {
- font-size: 24rpx;
- color: #8C9396;
- }
- }
- .resource-value {
- margin-bottom: 12rpx;
- .value {
- font-size: 36rpx;
- font-weight: 700;
- color: #2C3E50;
- }
- .unit {
- font-size: 22rpx;
- color: #8C9396;
- margin-left: 4rpx;
- }
- }
- .resource-progress-container {
- .resource-progress-bg {
- height: 8rpx;
- background: rgba(0, 0, 0, 0.03);
- border-radius: 4rpx;
- margin-bottom: 8rpx;
- overflow: hidden;
- .resource-progress {
- height: 100%;
- border-radius: 4rpx;
- }
- }
- .resource-efficiency {
- font-size: 22rpx;
- color: #8C9396;
- }
- }
- }
- }
- // Farm Activities
- .farm-activities {
- .activities-list {
- padding: 8rpx 0;
- }
- .activity-item {
- display: flex;
- align-items: center;
- padding: 20rpx 28rpx;
- border-bottom: 1px solid rgba(0, 0, 0, 0.02);
- &:last-child {
- border-bottom: none;
- }
- .activity-dot {
- width: 10rpx;
- height: 10rpx;
- border-radius: 50%;
- margin-right: 16rpx;
- flex-shrink: 0;
- &.completed {
- background: #4CAF50;
- }
- &.pending {
- background: #FFC107;
- }
- &.failed {
- background: #FF5252;
- }
- }
- .activity-details {
- flex: 1;
- .activity-title-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-bottom: 6rpx;
- .activity-title {
- font-size: 26rpx;
- font-weight: 500;
- color: #2C3E50;
- }
- .activity-date {
- font-size: 22rpx;
- color: #8C9396;
- }
- }
- .activity-meta-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .activity-executor {
- font-size: 22rpx;
- color: #8C9396;
- }
- .activity-action {
- display: flex;
- align-items: center;
- .action-text {
- font-size: 22rpx;
- color: #3BB44A;
- margin-right: 6rpx;
- }
- }
- }
- }
- }
- }
- // Weather Card
- .weather-card {
- .weather-content {
- padding: 20rpx 28rpx;
- }
- .current-weather {
- display: flex;
- align-items: center;
- margin-bottom: 24rpx;
- .weather-icon-container {
- margin-right: 20rpx;
- .weather-icon {
- font-size: 60rpx;
- line-height: 1;
- }
- }
- .weather-details {
- .weather-temp {
- font-size: 48rpx;
- font-weight: 700;
- color: #2C3E50;
- line-height: 1.1;
- }
- .weather-desc {
- font-size: 26rpx;
- color: #8C9396;
- }
- }
- }
- .weather-metrics {
- display: flex;
- justify-content: space-between;
- align-items: center;
- padding: 16rpx 24rpx;
- margin-bottom: 24rpx;
- border-radius: 12rpx;
- background-color: rgba(247, 247, 247, 0.5);
- border: 1px solid rgba(0, 0, 0, 0.03);
- .weather-metric {
- flex: 1;
- display: flex;
- flex-direction: column;
- align-items: center;
- .metric-label {
- font-size: 22rpx;
- color: #8C9396;
- margin-bottom: 6rpx;
- }
- .metric-value {
- font-size: 28rpx;
- font-weight: 600;
- color: #2C3E50;
- }
- }
- .vertical-divider {
- width: 1px;
- height: 36rpx;
- background-color: rgba(0, 0, 0, 0.05);
- }
- }
- .weather-advice {
- background: rgba(59, 180, 74, 0.05);
- border-radius: 16rpx;
- padding: 16rpx;
- .advice-header {
- display: flex;
- align-items: center;
- margin-bottom: 10rpx;
- .icon-tile {
- width: 24rpx;
- height: 24rpx;
- border-radius: 50%;
- background: linear-gradient(135deg, #3BB44A, #66CC6A);
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 10rpx;
- box-shadow: 0 2rpx 8rpx rgba(59, 180, 74, 0.25);
- &.small {
- width: 24rpx;
- height: 24rpx;
- }
- }
- .advice-title {
- font-size: 24rpx;
- font-weight: 600;
- color: #2C3E50;
- }
- }
- .advice-content {
- font-size: 24rpx;
- color: #2C3E50;
- line-height: 1.4;
- }
- }
- }
- // For small screens - mobile responsiveness
- @media screen and (max-width: 768px) {
- .stats-overview {
- grid-template-columns: repeat(2, 1fr);
- }
- .crop-grid {
- grid-template-columns: 1fr;
- }
- }
- // 监控设备概览
- .device-overview {
- .device-metrics-grid {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 16rpx;
- padding: 16rpx;
- }
- .device-metric-card {
- background: white;
- border-radius: 16rpx;
- padding: 20rpx;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
- border: 1px solid rgba(0, 0, 0, 0.02);
- .device-metric-header {
- display: flex;
- align-items: center;
- margin-bottom: 16rpx;
- .icon-tile {
- width: 24rpx;
- height: 24rpx;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 10rpx;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
- }
- .metric-name {
- font-size: 24rpx;
- color: #8C9396;
- }
- }
- .device-metric-value {
- font-size: 44rpx;
- font-weight: 700;
- color: #2C3E50;
- margin-bottom: 12rpx;
- }
- .device-metric-trend {
- display: flex;
- align-items: center;
- font-size: 22rpx;
- &.up {
- color: #3BB44A;
- }
- &.down {
- color: #FF5252;
- }
- text {
- margin-left: 4rpx;
- }
- }
- }
- }
- // 农业机械活动
- .machinery-activity {
- .machinery-metrics-grid {
- display: grid;
- grid-template-columns: repeat(2, 1fr);
- gap: 16rpx;
- padding: 16rpx;
- }
- .machinery-metric-card {
- background: white;
- border-radius: 16rpx;
- padding: 20rpx;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.03);
- border: 1px solid rgba(0, 0, 0, 0.02);
- .machinery-metric-header {
- display: flex;
- align-items: center;
- margin-bottom: 16rpx;
- .icon-tile {
- width: 24rpx;
- height: 24rpx;
- border-radius: 50%;
- display: flex;
- align-items: center;
- justify-content: center;
- margin-right: 10rpx;
- box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.08);
- }
- .metric-name {
- font-size: 24rpx;
- color: #8C9396;
- }
- }
- .machinery-metric-value {
- font-size: 44rpx;
- font-weight: 700;
- color: #2C3E50;
- margin-bottom: 12rpx;
- }
- .machinery-metric-trend {
- display: flex;
- align-items: center;
- font-size: 22rpx;
- &.up {
- color: #3BB44A;
- }
- &.down {
- color: #FF5252;
- }
- text {
- margin-left: 4rpx;
- }
- }
- .machinery-metric-unit {
- font-size: 22rpx;
- color: #8C9396;
- }
- }
- }
- // 添加测试样式
- .test-block {
- background-color: #4CAF50;
- padding: 30rpx;
- margin: 20rpx;
- border-radius: 12rpx;
- display: flex;
- justify-content: center;
- align-items: center;
- }
- .test-text {
- color: white;
- font-size: 36rpx;
- font-weight: bold;
- }
- </style>
|