| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592 |
- <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;
- const fields = [];
- fieldList.forEach(item => {
- const fieldName = item?.fieldName;
- if (fieldName && !fields.includes(fieldName)) {
- fields.push({
- text: fieldName,
- value: item.id
- });
- }
- });
- 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}
- 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.nickName || '未登录'
- 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>
|