index.vue 27 KB

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