index.js 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. "use strict";
  2. const common_vendor = require("../../common/vendor.js");
  3. if (!Array) {
  4. const _component_u_icon = common_vendor.resolveComponent("u-icon");
  5. const _component_circle = common_vendor.resolveComponent("circle");
  6. const _component_path = common_vendor.resolveComponent("path");
  7. const _component_svg = common_vendor.resolveComponent("svg");
  8. const _component_line = common_vendor.resolveComponent("line");
  9. (_component_u_icon + _component_circle + _component_path + _component_svg + _component_line)();
  10. }
  11. const _sfc_main = {
  12. __name: "index",
  13. setup(__props) {
  14. const userData = common_vendor.ref({
  15. nickname: "张三",
  16. selectedPlot: "南地块"
  17. });
  18. const showPlotSelector = common_vendor.ref(false);
  19. common_vendor.ref([
  20. { name: "南地块", id: 1 },
  21. { name: "西北区域", id: 2 },
  22. { name: "稻田", id: 3 },
  23. { name: "东区试验田", id: 4 },
  24. { name: "温室大棚", id: 5 }
  25. ]);
  26. const farmData = common_vendor.ref({
  27. plotCount: 5,
  28. deviceCount: 12,
  29. deviceOnlineRate: 85,
  30. taskCompletionRate: 76,
  31. recentActivities: [
  32. { title: "稻田水稻施肥", date: "2023-05-15", status: "pending", id: 1, executor: "李四" },
  33. { title: "南地块除草", date: "2023-05-12", status: "completed", id: 2, executor: "王五" },
  34. { title: "西北区域杀虫", date: "2023-05-08", status: "completed", id: 3, executor: "张三" }
  35. ]
  36. });
  37. const coreStats = common_vendor.computed(() => [
  38. {
  39. label: "地块总数",
  40. value: farmData.value.plotCount,
  41. icon: "map",
  42. bgColor: "linear-gradient(135deg, #4CAF50, #2E7D32)"
  43. },
  44. {
  45. label: "设备数量",
  46. value: farmData.value.deviceCount,
  47. icon: "setting",
  48. bgColor: "linear-gradient(135deg, #42A5F5, #1976D2)"
  49. },
  50. {
  51. label: "设备在线率",
  52. value: farmData.value.deviceOnlineRate + "%",
  53. icon: "wifi",
  54. bgColor: "linear-gradient(135deg, #26C6DA, #00838F)"
  55. },
  56. {
  57. label: "农事完成率",
  58. value: farmData.value.taskCompletionRate + "%",
  59. icon: "checkmark-circle",
  60. bgColor: "linear-gradient(135deg, #66BB6A, #388E3C)"
  61. }
  62. ]);
  63. const weatherData = common_vendor.ref({
  64. temperature: 28,
  65. description: "晴朗",
  66. humidity: 65,
  67. windLevel: 3,
  68. rainfall: 0,
  69. advice: "今日适宜进行春玉米防虫作业,注意水分管理。"
  70. });
  71. common_vendor.ref({
  72. operation: {
  73. workCount: 36,
  74. workArea: 128,
  75. mainCrops: ["小麦", "玉米"]
  76. },
  77. machine: {
  78. totalHours: 172,
  79. mainEquipment: ["无人拖拉机", "播种机"]
  80. },
  81. irrigation: {
  82. irrigationArea: 85,
  83. fertilizationCount: 12,
  84. waterUsage: 230
  85. },
  86. pest: {
  87. totalReports: 5,
  88. handled: 4,
  89. pending: 1
  90. }
  91. });
  92. const navigateToProfile = () => {
  93. common_vendor.index.navigateTo({
  94. url: "/pages/profile/index"
  95. });
  96. };
  97. const handleSwitchPlot = () => {
  98. showPlotSelector.value = true;
  99. };
  100. const navigateToActivity = (activity) => {
  101. common_vendor.index.navigateTo({
  102. url: `/pages/activity/detail?id=${activity.id}`
  103. });
  104. };
  105. const navigateToAllActivities = () => {
  106. common_vendor.index.navigateTo({
  107. url: "/pages/activity/list"
  108. });
  109. };
  110. const fetchStatsData = async () => {
  111. try {
  112. common_vendor.index.__f__("log", "at pages/dashboard/index.vue:429", "统计数据加载成功");
  113. } catch (error) {
  114. common_vendor.index.__f__("error", "at pages/dashboard/index.vue:431", "获取统计数据失败", error);
  115. common_vendor.index.showToast({
  116. title: "数据加载失败",
  117. icon: "none"
  118. });
  119. }
  120. };
  121. common_vendor.onMounted(() => {
  122. fetchStatsData();
  123. });
  124. return (_ctx, _cache) => {
  125. return {
  126. a: common_vendor.t(userData.value.nickname),
  127. b: common_vendor.t(userData.value.selectedPlot),
  128. c: common_vendor.p({
  129. name: "arrow-down-fill",
  130. color: "#ffffff",
  131. size: "14"
  132. }),
  133. d: common_vendor.o(handleSwitchPlot),
  134. e: common_vendor.p({
  135. cx: "45",
  136. cy: "45",
  137. r: "45",
  138. fill: "#E1F5E9"
  139. }),
  140. f: common_vendor.p({
  141. d: "M15 35C15 35 25 25 35 35C45 45 65 25 75 35",
  142. stroke: "#4CAF50",
  143. ["stroke-width"]: "2",
  144. ["stroke-opacity"]: "0.3"
  145. }),
  146. g: common_vendor.p({
  147. d: "M20 30L20 40",
  148. stroke: "#4CAF50",
  149. ["stroke-width"]: "2",
  150. ["stroke-opacity"]: "0.3"
  151. }),
  152. h: common_vendor.p({
  153. d: "M35 30L35 45",
  154. stroke: "#4CAF50",
  155. ["stroke-width"]: "2",
  156. ["stroke-opacity"]: "0.3"
  157. }),
  158. i: common_vendor.p({
  159. d: "M50 30L50 40",
  160. stroke: "#4CAF50",
  161. ["stroke-width"]: "2",
  162. ["stroke-opacity"]: "0.3"
  163. }),
  164. j: common_vendor.p({
  165. d: "M65 30L65 45",
  166. stroke: "#4CAF50",
  167. ["stroke-width"]: "2",
  168. ["stroke-opacity"]: "0.3"
  169. }),
  170. k: common_vendor.p({
  171. cx: "45",
  172. cy: "35",
  173. r: "15",
  174. fill: "#4CAF50"
  175. }),
  176. l: common_vendor.p({
  177. d: "M25 82C25 67 34 55 45 55C56 55 65 67 65 82H25Z",
  178. fill: "#4CAF50"
  179. }),
  180. m: common_vendor.p({
  181. d: "M25 30C25 30 35 20 45 20C55 20 65 30 65 30C65 30 55 25 45 25C35 25 25 30 25 30Z",
  182. fill: "#8BC34A"
  183. }),
  184. n: common_vendor.p({
  185. cx: "38",
  186. cy: "32",
  187. r: "2",
  188. fill: "white",
  189. ["fill-opacity"]: "0.7"
  190. }),
  191. o: common_vendor.p({
  192. cx: "52",
  193. cy: "32",
  194. r: "2",
  195. fill: "white",
  196. ["fill-opacity"]: "0.7"
  197. }),
  198. p: common_vendor.p({
  199. d: "M40 40C40 40 43 42 45 42C47 42 50 40 50 40",
  200. stroke: "white",
  201. ["stroke-width"]: "1.5",
  202. ["stroke-linecap"]: "round"
  203. }),
  204. q: common_vendor.p({
  205. d: "M70 15C70 15 75 20 75 25",
  206. stroke: "#8BC34A",
  207. ["stroke-width"]: "1.5",
  208. ["stroke-linecap"]: "round"
  209. }),
  210. r: common_vendor.p({
  211. d: "M73 18L77 20",
  212. stroke: "#8BC34A",
  213. ["stroke-width"]: "1.5",
  214. ["stroke-linecap"]: "round"
  215. }),
  216. s: common_vendor.p({
  217. d: "M72 22L76 24",
  218. stroke: "#8BC34A",
  219. ["stroke-width"]: "1.5",
  220. ["stroke-linecap"]: "round"
  221. }),
  222. t: common_vendor.p({
  223. d: "M20 15C20 15 15 20 15 25",
  224. stroke: "#8BC34A",
  225. ["stroke-width"]: "1.5",
  226. ["stroke-linecap"]: "round"
  227. }),
  228. v: common_vendor.p({
  229. d: "M17 18L13 20",
  230. stroke: "#8BC34A",
  231. ["stroke-width"]: "1.5",
  232. ["stroke-linecap"]: "round"
  233. }),
  234. w: common_vendor.p({
  235. d: "M18 22L14 24",
  236. stroke: "#8BC34A",
  237. ["stroke-width"]: "1.5",
  238. ["stroke-linecap"]: "round"
  239. }),
  240. x: common_vendor.p({
  241. width: "100%",
  242. height: "100%",
  243. viewBox: "0 0 90 90",
  244. fill: "none",
  245. xmlns: "http://www.w3.org/2000/svg"
  246. }),
  247. y: common_vendor.o(navigateToProfile),
  248. z: common_vendor.f(coreStats.value, (stat, index, i0) => {
  249. return {
  250. a: common_vendor.t(stat.value),
  251. b: common_vendor.t(stat.label),
  252. c: index
  253. };
  254. }),
  255. A: common_vendor.p({
  256. name: "arrow-right",
  257. color: "#4CAF50",
  258. size: "14"
  259. }),
  260. B: common_vendor.o(navigateToAllActivities),
  261. C: common_vendor.f(farmData.value.recentActivities, (item, index, i0) => {
  262. return {
  263. a: common_vendor.t(item.title),
  264. b: common_vendor.t(item.executor),
  265. c: common_vendor.t(item.date),
  266. d: "a869e244-21-" + i0,
  267. e: index,
  268. f: common_vendor.o(($event) => navigateToActivity(item), index)
  269. };
  270. }),
  271. D: common_vendor.p({
  272. name: "arrow-right",
  273. color: "#CCCCCC",
  274. size: "16"
  275. }),
  276. E: common_vendor.p({
  277. cx: "100",
  278. cy: "100",
  279. r: "65",
  280. fill: "rgba(255, 193, 7, 0.1)"
  281. }),
  282. F: common_vendor.p({
  283. cx: "100",
  284. cy: "100",
  285. r: "45",
  286. fill: "#FFC107"
  287. }),
  288. G: common_vendor.p({
  289. x1: "100",
  290. y1: "25",
  291. x2: "100",
  292. y2: "5",
  293. stroke: "#FFC107",
  294. ["stroke-width"]: "8",
  295. ["stroke-linecap"]: "round"
  296. }),
  297. H: common_vendor.p({
  298. x1: "100",
  299. y1: "195",
  300. x2: "100",
  301. y2: "175",
  302. stroke: "#FFC107",
  303. ["stroke-width"]: "8",
  304. ["stroke-linecap"]: "round"
  305. }),
  306. I: common_vendor.p({
  307. x1: "25",
  308. y1: "100",
  309. x2: "5",
  310. y2: "100",
  311. stroke: "#FFC107",
  312. ["stroke-width"]: "8",
  313. ["stroke-linecap"]: "round"
  314. }),
  315. J: common_vendor.p({
  316. x1: "195",
  317. y1: "100",
  318. x2: "175",
  319. y2: "100",
  320. stroke: "#FFC107",
  321. ["stroke-width"]: "8",
  322. ["stroke-linecap"]: "round"
  323. }),
  324. K: common_vendor.p({
  325. cx: "100",
  326. cy: "100",
  327. r: "35",
  328. fill: "#FF9800"
  329. }),
  330. L: common_vendor.p({
  331. width: "48",
  332. height: "48",
  333. viewBox: "0 0 200 200",
  334. fill: "none",
  335. xmlns: "http://www.w3.org/2000/svg"
  336. }),
  337. M: common_vendor.t(weatherData.value.temperature),
  338. N: common_vendor.t(weatherData.value.description),
  339. O: common_vendor.p({
  340. name: "account",
  341. color: "#666666",
  342. size: "32"
  343. }),
  344. P: common_vendor.t(weatherData.value.advice),
  345. Q: common_vendor.t(weatherData.value.humidity),
  346. R: common_vendor.t(weatherData.value.windLevel),
  347. S: common_vendor.t(weatherData.value.rainfall)
  348. };
  349. };
  350. }
  351. };
  352. const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-a869e244"]]);
  353. wx.createPage(MiniProgramPage);
  354. //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/dashboard/index.js.map