index.vue 29 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039
  1. <template>
  2. <view>
  3. <view class="weather">
  4. <image
  5. :src="
  6. 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/img/weather/' +
  7. weatherinfo.wea +
  8. '.png'
  9. "
  10. mode=""
  11. class="weaimg"
  12. ></image>
  13. <view class="weatext">
  14. <view class="weatext_title">
  15. {{ hello }}
  16. </view>
  17. <view class=""> 欢迎登录云飞智控 </view>
  18. </view>
  19. </view>
  20. <view class="weatherinfo">
  21. <view class="weatherinfo_item">
  22. <image
  23. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/weizhi.png"
  24. mode=""
  25. class="weaimg"
  26. ></image>
  27. <view class="textbox">
  28. {{ weatherinfo.district || '-' }}
  29. </view>
  30. </view>
  31. <view class="weatherinfo_item">
  32. <image
  33. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/wendu.png"
  34. mode=""
  35. class="weaimg"
  36. ></image>
  37. <view class="textbox"> {{ weatherinfo.at || '-' }}℃ </view>
  38. </view>
  39. <view class="weatherinfo_item">
  40. <image
  41. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/shidu.png"
  42. mode=""
  43. class="weaimg"
  44. ></image>
  45. <view class="textbox"> {{ weatherinfo.ah || '-' }} </view>
  46. </view>
  47. <view class="weatherinfo_item">
  48. <view class="first_item"> PM2.5 </view>
  49. <view class="textbox">
  50. {{ weatherinfo.air_pm25 || '-' }}
  51. </view>
  52. </view>
  53. </view>
  54. <view class="functionbox">
  55. <view class="functionbox_title"> 功能应用 </view>
  56. <view class="functionbox_text">
  57. <view
  58. class="functionbox_text_item"
  59. v-if="jurisdiction.sqtf"
  60. @click="tabfunction(0)"
  61. >
  62. <image
  63. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/base.png"
  64. mode=""
  65. class="itemimg"
  66. ></image>
  67. <view class=""> 四情基地 </view>
  68. </view>
  69. <view class="functionbox_text_item" @click="tabfunction(1)">
  70. <image
  71. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/worm.png"
  72. mode=""
  73. class="itemimg"
  74. ></image>
  75. <view class=""> 田间随识 </view>
  76. </view>
  77. <view
  78. class="functionbox_text_item"
  79. v-if="jurisdiction.zjtf"
  80. @click="tabfunction(2)"
  81. >
  82. <image
  83. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/knowledge.png"
  84. mode=""
  85. class="itemimg"
  86. ></image>
  87. <view class=""> 知识百科 </view>
  88. </view>
  89. <view class="functionbox_text_item" @click="tabfunction(3)">
  90. <image
  91. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/aftersale.png"
  92. mode=""
  93. class="itemimg"
  94. ></image>
  95. <view class=""> 售后服务 </view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="facilitybox">
  100. <view class="facilitybox_title"> 系统设备 </view>
  101. <view class="facilitybox_itembox">
  102. <view
  103. class="facilitybox_item"
  104. v-if="jurisdiction.cbtf"
  105. @click="tabequipment('../cb/index/index')"
  106. >
  107. <image
  108. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/cb.png"
  109. mode=""
  110. class="itemimg"
  111. ></image>
  112. <view class=""> 测报系统 </view>
  113. </view>
  114. <view
  115. class="facilitybox_item"
  116. v-if="jurisdiction.cbyj"
  117. @click="tabequipment('../cbqxyj/cbwarn')"
  118. >
  119. <image
  120. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/cbyj.png"
  121. mode=""
  122. class="itemimg"
  123. ></image>
  124. <view class=""> 测报预警 </view>
  125. </view>
  126. <view
  127. class="facilitybox_item"
  128. v-if="jurisdiction.fztf"
  129. @click="tabequipment('../prevention/index')"
  130. >
  131. <image
  132. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/fz.png"
  133. mode=""
  134. class="itemimg"
  135. ></image>
  136. <view class=""> 防治系统 </view>
  137. </view>
  138. <view
  139. class="facilitybox_item"
  140. v-if="jurisdiction.jktf"
  141. @click="tabequipment('../monitor/index')"
  142. >
  143. <image
  144. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/jk.png"
  145. mode=""
  146. class="itemimg"
  147. ></image>
  148. <view class=""> 监控系统 </view>
  149. </view>
  150. <view
  151. class="facilitybox_item"
  152. v-if="jurisdiction.hjtf"
  153. @click="tabequipment('../environment/index')"
  154. >
  155. <image
  156. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/hj.png"
  157. mode=""
  158. class="itemimg"
  159. ></image>
  160. <view class=""> 环境监测 </view>
  161. </view>
  162. <view
  163. class="facilitybox_item"
  164. v-if="jurisdiction.qxz"
  165. @click="tabequipment('../qxzyj/cbwarn', 5)"
  166. >
  167. <image
  168. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/qxyj.png"
  169. mode=""
  170. class="itemimg"
  171. ></image>
  172. <view class=""> 气象预警 </view>
  173. </view>
  174. <view
  175. class="facilitybox_item"
  176. v-if="jurisdiction.sq"
  177. @click="tabequipment('../qxzyj/cbwarn', '15')"
  178. >
  179. <image
  180. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/sqyj.png"
  181. mode=""
  182. class="itemimg"
  183. >
  184. </image>
  185. <view class=""> 墒情预警 </view>
  186. </view>
  187. <view
  188. class="facilitybox_item"
  189. v-if="jurisdiction.ggtf"
  190. @click="tabequipment('../irrigate/index')"
  191. >
  192. <image
  193. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/guangai.png"
  194. mode=""
  195. class="itemimg"
  196. ></image>
  197. <view class=""> 智能灌溉 </view>
  198. </view>
  199. <view
  200. class="facilitybox_item"
  201. v-if="jurisdiction.sbtf"
  202. @click="tabequipment('../equipMange/index/index')"
  203. >
  204. <image
  205. src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/user.png"
  206. mode=""
  207. class="itemimg"
  208. ></image>
  209. <view class=""> 用户管理 </view>
  210. </view>
  211. </view>
  212. </view>
  213. <view class="insectattack">
  214. <view class="insectattack_title" @click="worm">
  215. <view class=""> 虫情百科 </view>
  216. <view class="iconbox">
  217. <u-icon name="arrow-right"></u-icon>
  218. </view>
  219. </view>
  220. <!-- <view class="insectattack_listbox">
  221. <view class="insectattack_list">
  222. <view class="list_box list_box1" @click="introduce(79,'虫情百科')">
  223. <view class="list_boxbg">
  224. <image src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/cao.png" mode="" class="list_boxbg_img"></image>
  225. </view>
  226. <view class="list_box_xiang">
  227. <view class="list_box_xiang_click">
  228. 详情
  229. </view>
  230. </view>
  231. <view class="list_box_info">
  232. <view class="list_box_info_name">
  233. 小地老虎
  234. </view>
  235. <view class="list_box_info_text">
  236. 该虫能危害百余种植物,是对农、林木幼苗危害很大的地下害虫, 在东北主要危害落叶松、红松、水曲柳、核桃楸等苗木
  237. </view>
  238. </view>
  239. </view>
  240. <view class="list_box list_box2" @click="introduce(369,'虫情百科')">
  241. <view class="list_boxbg">
  242. <image src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/yee.jpg" mode="" class="list_boxbg_img"></image>
  243. </view>
  244. <view class="list_box_xiang">
  245. <view class="list_box_xiang_click">
  246. 详情
  247. </view>
  248. </view>
  249. <view class="list_box_info">
  250. <view class="list_box_info_name">
  251. 草地贪夜蛾
  252. </view>
  253. <view class="list_box_info_text">
  254. 草地贪夜蛾被认为是世界上最具破坏性的害虫之一,其巨大的破坏性主要源于其“贪”的本性——贪吃、贪育、贪婪、广适、耐药。
  255. </view>
  256. </view>
  257. </view>
  258. <view class="list_box list_box3" @click="introduce(6,'虫情百科')">
  259. <view class="list_boxbg">
  260. <image src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/lingc.jpg" mode="" class="list_boxbg_img"></image>
  261. </view>
  262. <view class="list_box_xiang">
  263. <view class="list_box_xiang_click">
  264. 详情
  265. </view>
  266. </view>
  267. <view class="list_box_info">
  268. <view class="list_box_info_name">
  269. 棉铃虫
  270. </view>
  271. <view class="list_box_info_text">
  272. 棉铃虫具有高度多食性,可以为害20余科200多种植物,但比较喜食禾本科、锦葵科、茄科和豆科植物的花蕾和果实等繁殖器官。
  273. </view>
  274. </view>
  275. </view>
  276. <view class="list_box list_box4" @click="introduce(67,'虫情百科')">
  277. <view class="list_boxbg">
  278. <image src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/ming.png" mode="" class="list_boxbg_img"></image>
  279. </view>
  280. <view class="list_box_xiang">
  281. <view class="list_box_xiang_click">
  282. 详情
  283. </view>
  284. </view>
  285. <view class="list_box_info">
  286. <view class="list_box_info_name">
  287. 稻纵卷叶螟
  288. </view>
  289. <view class="list_box_info_text">
  290. 生命潜能强,寿命长,产卵期长,产卵量也多。各代雌、雄蛾比例几乎各占半数。蛾子有强烈的趋荫蔽栖息习性
  291. </view>
  292. </view>
  293. </view>
  294. </view>
  295. </view> -->
  296. </view>
  297. <view class="insectattack">
  298. <view class="insectattack_title" @click="virus">
  299. <view class=""> 病害百科 </view>
  300. <view class="iconbox">
  301. <u-icon name="arrow-right"></u-icon>
  302. </view>
  303. </view>
  304. <!-- <view class="insectattack_listbox">
  305. <view class="insectattack_list">
  306. <view class="list_box list_box5" @click="introduce(267,'病害百科')">
  307. <view class="list_boxbg">
  308. <image src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/mai.png" mode="" class="list_boxbg_img"></image>
  309. </view>
  310. <view class="list_box_xiang">
  311. <view class="list_box_xiang_click">
  312. 详情
  313. </view>
  314. </view>
  315. <view class="list_box_info">
  316. <view class="list_box_info_name">
  317. 小麦赤霉病
  318. </view>
  319. <view class="list_box_info_text">
  320. 小麦赤霉病从苗期到穗期均可发生,引起苗腐、茎基腐、秆腐和穗腐,以穗腐危害最大。湿度大时,病部均可见粉红色霉层。
  321. </view>
  322. </view>
  323. </view>
  324. <view class="list_box list_box6" @click="introduce(320,'病害百科')">
  325. <view class="list_boxbg">
  326. <image src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/dadou.jpg" mode="" class="list_boxbg_img"></image>
  327. </view>
  328. <view class="list_box_xiang">
  329. <view class="list_box_xiang_click">
  330. 详情
  331. </view>
  332. </view>
  333. <view class="list_box_info">
  334. <view class="list_box_info_name">
  335. 大豆根腐病
  336. </view>
  337. <view class="list_box_info_text">
  338. 初期茎基部或胚根表皮出现淡红褐色不规则的小斑,后变红褐色凹陷坏死斑,绕根茎扩展致根皮枯死
  339. </view>
  340. </view>
  341. </view>
  342. <view class="list_box list_box7" @click="introduce(292,'病害百科')">
  343. <view class="list_boxbg">
  344. <image src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/yumi.png" mode="" class="list_boxbg_img"></image>
  345. </view>
  346. <view class="list_box_xiang">
  347. <view class="list_box_xiang_click">
  348. 详情
  349. </view>
  350. </view>
  351. <view class="list_box_info">
  352. <view class="list_box_info_name">
  353. 玉米大斑病
  354. </view>
  355. <view class="list_box_info_text">
  356. 玉米大斑病主要为害叶片,严重时也为害叶鞘和苞叶。植株下部叶片先发病,然后向上扩展。
  357. </view>
  358. </view>
  359. </view>
  360. <view class="list_box list_box8" @click="introduce(278,'病害百科')">
  361. <view class="list_boxbg">
  362. <image src="https://www.hnyfwlw.com:8006/bigdata_app/newindex/dao.png" mode="" class="list_boxbg_img"></image>
  363. </view>
  364. <view class="list_box_xiang">
  365. <view class="list_box_xiang_click">
  366. 详情
  367. </view>
  368. </view>
  369. <view class="list_box_info">
  370. <view class="list_box_info_name">
  371. 水稻稻瘟病
  372. </view>
  373. <view class="list_box_info_text">
  374. 发生于三叶前,由种子带菌所致。病苗基部灰黑,上部变褐,卷缩而死,湿度较大时病部产生大量灰黑色霉层。
  375. </view>
  376. </view>
  377. </view>
  378. </view>
  379. </view> -->
  380. </view>
  381. </view>
  382. </template>
  383. <script>
  384. export default {
  385. data() {
  386. return {
  387. weatherinfo: {
  388. wea: '晴',
  389. },
  390. hello: '',
  391. jurisdiction: {
  392. cbtf: false,
  393. jktf: false,
  394. hjtf: false,
  395. fztf: false,
  396. sytf: false,
  397. sbtf: false,
  398. sqtf: false,
  399. zjtf: false,
  400. ggtf: false,
  401. qxz: false,
  402. sq: false,
  403. cbyj: false,
  404. },
  405. show: false,
  406. url: '',
  407. loadTF: false,
  408. };
  409. },
  410. watch: {
  411. url(news) {
  412. if (news != '') {
  413. uni.pageScrollTo({
  414. scrollTop: 0,
  415. duration: 500,
  416. });
  417. }
  418. },
  419. },
  420. methods: {
  421. moveHandle() {
  422. return;
  423. },
  424. async getcity(lng, lat) {
  425. const res = await this.$myRequest({
  426. url: '/api/api_gateway?method=device.device_manage.weathers',
  427. data: {
  428. lng: lng,
  429. lat: lat,
  430. },
  431. });
  432. // uni.showToast({
  433. // title: JSON.stringify(res[0]),
  434. // duration: 20000,
  435. // icon:'none'
  436. // });
  437. // console.log(res);
  438. this.weatherinfo = res[0];
  439. },
  440. async getUserlogin() {
  441. const res = await this.$myRequest({
  442. url: '/api/api_gateway?method=user.login.user_login_info',
  443. });
  444. // this.jurisdiction = {
  445. // cbtf: false,
  446. // jktf: false,
  447. // hjtf: false,
  448. // fztf: false,
  449. // sytf: false,
  450. // sbtf: false,
  451. // sqtf: false,
  452. // zjtf: false,
  453. // }
  454. uni.setStorage({
  455. key: 'jurisdiction',
  456. data: JSON.stringify(res.children),
  457. });
  458. uni.setStorage({
  459. key: 'myuser_type',
  460. data: JSON.stringify(res.myuser_type),
  461. });
  462. uni.setStorage({
  463. key: 'myuid',
  464. data: JSON.stringify(res.myuid),
  465. });
  466. let QueryPermission = (id) => {
  467. let list = res.children;
  468. for (var i = 0; i < list.length; i++) {
  469. if (list[i].children) {
  470. var data = list[i].children;
  471. for (var j = 0; j < data.length; j++) {
  472. if (data[j].children) {
  473. var item = data[j].children;
  474. for (var k = 0; k < item.length; k++) {
  475. if (item[k].pur_id == id) {
  476. return true;
  477. }
  478. }
  479. }
  480. }
  481. }
  482. }
  483. return false;
  484. };
  485. this.jurisdiction = {
  486. cbtf: false,
  487. jktf: false,
  488. hjtf: false,
  489. fztf: false,
  490. sytf: false,
  491. sbtf: false,
  492. sqtf: false,
  493. zjtf: false,
  494. qxz: QueryPermission(242),
  495. sq: QueryPermission(284),
  496. cbyj: QueryPermission(243),
  497. };
  498. console.log(res.children);
  499. for (var i = 0; i < res.children.length; i++) {
  500. switch (res.children[i].pur_id) {
  501. case 36:
  502. this.jurisdiction.cbtf = true; //"测报系统"
  503. break;
  504. case 42:
  505. this.jurisdiction.jktf = true; //"可视农业"
  506. break;
  507. case 40:
  508. this.jurisdiction.hjtf = true; //"环境监测系统"
  509. break;
  510. case 44:
  511. this.jurisdiction.fztf = true; //"防治系统"
  512. break;
  513. case 58:
  514. this.jurisdiction.sytf = true; //"溯源系统"
  515. break;
  516. case 28:
  517. this.jurisdiction.sbtf = true; //"系统管理"
  518. break;
  519. case 25:
  520. this.jurisdiction.sqtf = true; //"四情基地"
  521. break;
  522. case 124:
  523. this.jurisdiction.zjtf = true; //"专家诊断"
  524. break;
  525. // case "灌溉控制系统":
  526. // this.jurisdiction.sftf = true
  527. // break;
  528. case 202:
  529. this.jurisdiction.ggtf = true; //"灌溉控制系统"
  530. break;
  531. }
  532. }
  533. },
  534. tabfunction(index) {
  535. if (index == 0) {
  536. uni.navigateTo({
  537. url: '../fourBase/index',
  538. });
  539. } else if (index == 1) {
  540. // var that = this
  541. // this.show = true
  542. uni.navigateTo({
  543. url: '/pages/identifyPest/identifyPest',
  544. });
  545. } else if (index == 2) {
  546. uni.navigateTo({
  547. url: '../expertDiagnosis/index',
  548. });
  549. } else if (index == 3) {
  550. uni.navigateTo({
  551. url: '../afterSale/index',
  552. });
  553. }
  554. },
  555. tabequipment(url, type) {
  556. console.log(url);
  557. uni.navigateTo({
  558. url: `${url}${type ? `?typeId=${type}` : ''}`,
  559. });
  560. },
  561. // onok(ev) {
  562. // this.path = this.url;
  563. // console.log(ev);
  564. // this.loadTF = true;
  565. // uni.showLoading({
  566. // mask: true,
  567. // success: function () {
  568. // console.log(999);
  569. // },
  570. // });
  571. // var publiukey = `-----BEGIN PUBLIC KEY-----
  572. // MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC6m92fXUrccS4SoLg4W4jPRNua
  573. // 4BcRk4ldLcqPuQpD2Mds2+hw+Gi+0MUnshF/r/DTcCJgkt7rtoY9EB6/XJ6MFw14
  574. // whhESFie/lZUWRsk8M89Rkr8m5rwmBl+uLAd5LopyshFqKTBXeT2ytHP1JCQLPBO
  575. // 34Fy4/yEz4qEzkzBuwIDAQAB
  576. // -----END PUBLIC KEY-----`;
  577. // var time = +new Date();
  578. // var str2 = 'YuNfEi' + time + 'YuNfEi';
  579. // var pubblicData = jsencrypt.setEncrypt(publiukey, str2);
  580. // if (this.flag == 2) {
  581. // console.log('111');
  582. // // pest.pests.insect_discern 虫害
  583. // uni.uploadFile({
  584. // // url: 'http://114.115.147.140:8002/api/api_gateway?method=base.bases.base_photo', //仅为示例,非真实的接口地址
  585. // url: 'https://wx.hnyfwlw.com/api/api_gateway?method=pest.pests.insect_discern', //仅为示例,非真实的接口地址
  586. // filePath: ev.path,
  587. // name: 'img_file',
  588. // formData: {
  589. // user: 'test',
  590. // sign: pubblicData,
  591. // },
  592. // success: (uploadFileRes) => {
  593. // this.loadTF = false;
  594. // console.log(JSON.parse(uploadFileRes.data));
  595. // uni.navigateTo({
  596. // url:
  597. // '../disandpests/index?datas=' +
  598. // uploadFileRes.data +
  599. // '&path=' +
  600. // ev.path,
  601. // });
  602. // },
  603. // fail(res) {
  604. // console.log(res);
  605. // },
  606. // });
  607. // } else if (this.flag == 1) {
  608. // //pest.pests.insect_discern病害识别
  609. // // uni.showLoading({
  610. // // title: '加载中'
  611. // // });
  612. // uni.uploadFile({
  613. // // url: 'http://114.115.147.140:8002/api/api_gateway?method=base.bases.base_photo', //仅为示例,非真实的接口地址
  614. // url: 'https://wx.hnyfwlw.com/api/api_gateway?method=pest.pests.plant_discern', //仅为示例,非真实的接口地址
  615. // filePath: ev.path,
  616. // name: 'img_file',
  617. // formData: {
  618. // user: 'test',
  619. // sign: pubblicData,
  620. // },
  621. // success: (uploadFileRes) => {
  622. // this.loadTF = false;
  623. // console.log(JSON.parse(uploadFileRes.data));
  624. // uni.navigateTo({
  625. // url:
  626. // '../disandpests/index?datas=' +
  627. // uploadFileRes.data +
  628. // '&path=' +
  629. // ev.path,
  630. // });
  631. // },
  632. // });
  633. // }
  634. // this.url = '';
  635. // },
  636. // oncancle() {
  637. // // url设置为空,隐藏控件
  638. // this.url = '';
  639. // },
  640. // confirm() {
  641. // this.flag = 1;
  642. // uni.chooseImage({
  643. // count: 1, //默认9
  644. // // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  645. // sourceType: ['camera', 'album'], //从相册选择
  646. // success: (res) => {
  647. // this.url = res.tempFilePaths[0];
  648. // },
  649. // });
  650. // console.log(1);
  651. // },
  652. // cancel() {
  653. // this.flag = 2;
  654. // uni.chooseImage({
  655. // count: 1, //默认9
  656. // // sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  657. // sourceType: ['camera', 'album'], //从相册选择
  658. // success: (res) => {
  659. // console.log(1);
  660. // this.url = res.tempFilePaths[0];
  661. // },
  662. // });
  663. // },
  664. worm() {
  665. uni.navigateTo({
  666. url: '../expertDiagnosis/wormcase?name=虫情百科',
  667. });
  668. },
  669. virus() {
  670. uni.navigateTo({
  671. url: '../expertDiagnosis/wormcase?name=病害百科',
  672. });
  673. },
  674. introduce(id, title) {
  675. uni.navigateTo({
  676. url: '../expertDiagnosis/introduce?id=' + id + '&title=' + title,
  677. });
  678. },
  679. checkLocationPermission(isTest) {
  680. let session_key = uni.getStorageSync('session_key');
  681. let _this = this;
  682. // 当用户登录之后再弹位置权限框
  683. if(session_key) {
  684. uni.getSetting({
  685. success(res) {
  686. console.log(res);
  687. if(res.authSetting['scope.userLocation']) {
  688. uni.getLocation({
  689. type: 'wgs84 ',
  690. success: (res) => {
  691. // console.log(res, 'loacation');
  692. // uni.showToast({
  693. // title: `${res.longitude}, ${res.longitude}`,
  694. // duration: 20000,
  695. // icon:'none'
  696. // });
  697. _this.getcity(res.longitude, res.latitude);
  698. },
  699. fail(e) {
  700. uni.showToast({
  701. title: JSON.stringify(e),
  702. duration: 5000,
  703. icon:'none'
  704. });
  705. }
  706. });
  707. } else {
  708. uni.authorize({
  709. scope: 'scope.userLocation',
  710. success: () => {
  711. // 用户已授权
  712. uni.getLocation({
  713. type: 'wgs84 ',
  714. success: (res) => {
  715. console.log(res, 'loacation');
  716. _this.getcity(res.longitude, res.latitude);
  717. },
  718. });
  719. },
  720. fail: () => {
  721. // 用户拒绝授权,可引导用户至设置页手动开启
  722. if(isTest) {
  723. uni.showModal({
  724. title: '需要授权',
  725. content: '天气功能需要获取您的地理位置,请在设置中打开位置权限',
  726. success: (modalRes) => {
  727. if (modalRes.confirm) {
  728. uni.openSetting()
  729. } else {
  730. uni.showToast({
  731. title: '您拒绝了授权,将无法查看天气信息',
  732. duration: 2000,
  733. icon:'none'
  734. });
  735. }
  736. },
  737. })
  738. }
  739. },
  740. })
  741. }
  742. }
  743. })
  744. }
  745. }
  746. },
  747. onLoad() {
  748. console.log(this.$isneutral);
  749. var time = new Date();
  750. var hours = time.getHours();
  751. if (hours < 12) {
  752. this.hello = '上午好!';
  753. } else {
  754. this.hello = '下午好!';
  755. }
  756. this.getUserlogin();
  757. this.checkLocationPermission(true); // 首次加载弹框提醒
  758. },
  759. onShow() {
  760. this.loadTF = false;
  761. this.getUserlogin();
  762. this.checkLocationPermission();
  763. },
  764. };
  765. </script>
  766. <style lang="less">
  767. page {
  768. background-image: url(https://www.hnyfwlw.com:8006/bigdata_app/newindex/bg.png);
  769. background-size: 100%;
  770. background-repeat: no-repeat;
  771. background-color: #f9f9f9;
  772. }
  773. .weather {
  774. display: flex;
  775. width: 85%;
  776. margin: 0 auto;
  777. padding-top: 40rpx;
  778. .weaimg {
  779. width: 296rpx;
  780. height: 296rpx;
  781. }
  782. .weatext {
  783. width: 300rpx;
  784. text-align: center;
  785. font-size: 36rpx;
  786. color: #fff;
  787. padding-top: 60rpx;
  788. margin-left: 60rpx;
  789. .weatext_title {
  790. font-size: 80rpx;
  791. margin-bottom: 30rpx;
  792. }
  793. }
  794. }
  795. .weatherinfo {
  796. display: flex;
  797. background-color: rgba(255, 255, 255, 0.2);
  798. width: 85%;
  799. margin: 60rpx auto;
  800. padding: 30rpx;
  801. justify-content: space-around;
  802. border-radius: 170rpx;
  803. .weatherinfo_item {
  804. text-align: center;
  805. .first_item {
  806. height: 50rpx;
  807. margin-bottom: 10rpx;
  808. color: #fff;
  809. line-height: 50rpx;
  810. }
  811. .weaimg {
  812. width: 50rpx;
  813. height: 50rpx;
  814. }
  815. .textbox {
  816. text-align: center;
  817. color: #fff;
  818. }
  819. }
  820. }
  821. .functionbox {
  822. width: 85%;
  823. margin: 0 auto;
  824. padding: 30rpx;
  825. // box-sizing: border-box;
  826. background-color: #fff;
  827. border-radius: 30rpx;
  828. .functionbox_title {
  829. padding-left: 20rpx;
  830. font-size: 34rpx;
  831. }
  832. .functionbox_text {
  833. display: flex;
  834. justify-content: space-around;
  835. margin-top: 30rpx;
  836. .functionbox_text_item {
  837. text-align: center;
  838. color: #616666;
  839. .itemimg {
  840. width: 60rpx;
  841. height: 60rpx;
  842. margin-bottom: 20rpx;
  843. }
  844. }
  845. }
  846. }
  847. .facilitybox {
  848. width: 90%;
  849. margin: 0 auto;
  850. padding: 30rpx;
  851. .facilitybox_title {
  852. font-size: 34rpx;
  853. // padding-left: 20rpx;
  854. }
  855. .facilitybox_itembox {
  856. display: flex;
  857. // justify-content: space-around;
  858. flex-wrap: wrap;
  859. margin-top: 30rpx;
  860. .facilitybox_item {
  861. width: 25%;
  862. text-align: center;
  863. color: #616666;
  864. margin-bottom: 20rpx;
  865. .itemimg {
  866. width: 100rpx;
  867. height: 100rpx;
  868. margin-bottom: 20rpx;
  869. }
  870. }
  871. }
  872. }
  873. .insectattack {
  874. width: 90%;
  875. margin: 0 auto;
  876. padding: 30rpx;
  877. .insectattack_title {
  878. font-size: 34rpx;
  879. // padding-left: 20rpx;
  880. display: flex;
  881. justify-content: space-between;
  882. .iconbox {
  883. width: 40rpx;
  884. height: 40rpx;
  885. background-color: #cfd6d6;
  886. color: #909696;
  887. border-radius: 40rpx;
  888. line-height: 40rpx;
  889. text-align: center;
  890. font-size: 20rpx;
  891. }
  892. }
  893. .insectattack_listbox {
  894. // padding: 0 20rpx;
  895. overflow-x: auto;
  896. .insectattack_list {
  897. width: 1104rpx;
  898. display: flex;
  899. margin-top: 30rpx;
  900. flex-wrap: wrap;
  901. .list_box {
  902. // background-color: #f00;
  903. background-size: 100% 100%;
  904. width: 246rpx;
  905. height: 324rpx;
  906. margin-right: 30rpx;
  907. border-radius: 20rpx;
  908. position: relative;
  909. .list_boxbg {
  910. width: 100%;
  911. height: 100%;
  912. position: absolute;
  913. top: 0;
  914. left: 0;
  915. z-index: -1;
  916. .list_boxbg_img {
  917. width: 100%;
  918. height: 100%;
  919. }
  920. }
  921. .list_box_xiang {
  922. width: 95%;
  923. margin-top: 0rpx auto;
  924. display: flex;
  925. justify-content: flex-end;
  926. padding-top: 20rpx;
  927. .list_box_xiang_click {
  928. padding: 8rpx 15rpx;
  929. background-color: rgba(0, 0, 0, 0.2);
  930. color: #fff;
  931. font-size: 20rpx;
  932. border-radius: 52rpx;
  933. }
  934. }
  935. .list_box_info {
  936. width: 90%;
  937. margin: 130rpx auto 0;
  938. height: 120rpx;
  939. border-radius: 10rpx;
  940. background-image: linear-gradient(
  941. to right,
  942. #ffffff,
  943. rgba(255, 255, 255, 0.44)
  944. );
  945. padding: 10rpx;
  946. box-sizing: border-box;
  947. .list_box_info_name {
  948. font-weight: 700;
  949. }
  950. .list_box_info_text {
  951. font-size: 18rpx;
  952. overflow: hidden;
  953. text-overflow: ellipsis;
  954. display: -webkit-box;
  955. -webkit-box-orient: vertical;
  956. -webkit-line-clamp: 2;
  957. }
  958. }
  959. }
  960. // .list_box1 {
  961. // background-image: url(../../static/images/newindex/cao.png);
  962. // }
  963. // .list_box2 {
  964. // background-image: url(../../static/images/newindex/yee.jpg);
  965. // }
  966. // .list_box3 {
  967. // background-image: url(../../static/images/newindex/lingc.jpg);
  968. // }
  969. // .list_box4 {
  970. // background-image: url(../../static/images/newindex/ming.png);
  971. // }
  972. // .list_box5 {
  973. // background-image: url(../../static/images/newindex/mai.png);
  974. // }
  975. // .list_box6 {
  976. // background-image: url(../../static/images/newindex/dadou.jpg)
  977. // }
  978. // .list_box7 {
  979. // background-image: url(../../static/images/newindex/yumi.png);
  980. // }
  981. // .list_box8 {
  982. // background-image: url(../../static/images/newindex/dao.png);
  983. // }
  984. }
  985. }
  986. }
  987. .loading {
  988. position: absolute;
  989. top: 0;
  990. left: 0;
  991. z-index: 100;
  992. width: 100%;
  993. height: 100vh;
  994. background-color: rgba(0, 0, 0, 0.5);
  995. display: flex;
  996. justify-content: center;
  997. align-items: center;
  998. }
  999. </style>