index2.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740
  1. <template>
  2. <view class="home">
  3. <view class="welcom">{{ hello }} 欢迎登录</view>
  4. <view class="weather-bg">
  5. <view class="weather-box">
  6. <view class="weather">
  7. <view class="weatext">
  8. <view>今天<span class="text-span">{{weatherinfo.air_level}}</span></view>
  9. <view class="text-value">{{weatherinfo.at}}℃</view>
  10. </view>
  11. <view class="weatext">
  12. <image :src="
  13. 'https://webstaticimg.oss-cn-hangzhou.aliyuncs.com/bigdata_app/img/weather/' +weatherinfo.wea +'.png'
  14. " mode="" class="weaimg"
  15. ></image>
  16. <view class="weatext_title">
  17. {{ weatherinfo.wea }}
  18. </view>
  19. </view>
  20. </view>
  21. <view class="weather">
  22. <view class="weatext">
  23. <view>湿度<span class="text-span">{{weatherinfo.ah | ahFilter}}</span></view>
  24. <view class="text-value">{{weatherinfo.ah}}%</view>
  25. </view>
  26. <view class="weatext">
  27. <view>PM2.5</view>
  28. <view class="textbox">
  29. {{ weatherinfo.air_pm25 }}
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. <view class="weather-warning" v-if="weatherinfo.alarm_content">
  35. <image class="weather-alert" :src="$imageURL+'/bigdata_app/newImg/home/weather-alert.png'" mode=""></image>
  36. {{weatherinfo.alarm_content}}
  37. </view>
  38. </view>
  39. <view class="ai-box">
  40. <view class="ai-content" @click="tabfunction(4)">
  41. <image :src="$imageURL+'/bigdata_app/newImg/home/ai-bot.png'" class="float-left" mode=""></image>
  42. <view class="ai-text">
  43. <view class="ai-text-title">我是千耘农业种植大模型</view>
  44. <view class="ai-text-subtitle">耕耘千百变,智慧一点通</view>
  45. </view>
  46. <view class="float-right">
  47. 问一问
  48. </view>
  49. </view>
  50. </view>
  51. <view class="functionbox">
  52. <view class="functionbox_text">
  53. <view class="functionbox_text_item" @click="tabfunction(0,item)" v-if="index < 9" v-for="(item,index) in menuList" :key="index">
  54. <image :src="item.app_menu_icon" mode="" class="itemimg">
  55. </image>
  56. <view class=""> {{ item.purview_name }} </view>
  57. </view>
  58. <view class="functionbox_text_item" @click="tabfunction(9)" v-if="menuList.length >= 9">
  59. <image :src="$imageURL+'/bigdata_app/newImg/home/shfw.png'" mode="" class="itemimg"></image>
  60. <view class=""> 更多功能 </view>
  61. </view>
  62. </view>
  63. </view>
  64. <view class="facilitybox">
  65. <view class="facilitybox-content">
  66. <view class="facilitybox_title"> 智慧助手 </view>
  67. <view style="display: flex;flex-direction: column;">
  68. <view class="facilitybox_itembox">
  69. <view class="facilitybox_item facilitybox-zhuanjia"
  70. @click="tabfunction(2)">
  71. <image :src="$imageURL+'/bigdata_app/newImg/home/zjhk.png'" mode="" class="itemimg">
  72. </image>
  73. <view class="facilitybox_span">
  74. <text> 专家库 </text>
  75. <view class="text">农业相关博士、教授、研究员</view>
  76. </view>
  77. </view>
  78. <view class="facilitybox_item" style="display: flex; flex-direction: column;gap: 24rpx;">
  79. <view class="facilitybox-suishi"
  80. @click="tabfunction(1)">
  81. <image style="width: 72rpx;height:72rpx;margin-right: 10rpx;"
  82. :src="$imageURL+'/bigdata_app/newImg/home/tjss.png'" mode=""
  83. class="itemimg float-right">
  84. </image>
  85. <view class="facilitybox_span"> 田间随识 </view>
  86. </view>
  87. <view class="facilitybox-bchk"
  88. @click="worm">
  89. <image :src="$imageURL+'/bigdata_app/newImg/home/cshk.png'" mode="" class="itemimg">
  90. </image>
  91. <view style="width: 69%;" class="facilitybox_span"> 病虫草鼠害库 </view>
  92. </view>
  93. </view>
  94. </view>
  95. <!-- <view class="facilitybox_itembox">
  96. <view class="facilitybox_item facilitybox-jwjy"
  97. @click="tabequipment('../prevention/index')">
  98. <image :src="$imageURL+'/bigdata_app/newImg/home/jwjy.png'" mode="" class="itemimg">
  99. </image>
  100. <view class="facilitybox_span"> 积温积雨 </view>
  101. </view>
  102. <view class="facilitybox_item facilitybox-jgqs"
  103. @click="tabequipment('../monitor/index')">
  104. <image :src="$imageURL+'/bigdata_app/newImg/home/jgqs.png'" mode="" class="itemimg">
  105. </image>
  106. <view class="facilitybox_span"> 价格趋势 </view>
  107. </view>
  108. </view> -->
  109. </view>
  110. </view>
  111. <view class="banner-ad">
  112. <view class="ad-text">
  113. <view class="title">
  114. 松墨天牛拍照性诱智能监测
  115. </view>
  116. <view class="sub-title">
  117. AI慧眼识天牛 智守青山护松林
  118. </view>
  119. <!-- <view class="btn">
  120. 查看详情
  121. </view> -->
  122. </view>
  123. </view>
  124. </view>
  125. </view>
  126. </template>
  127. <script>
  128. export default {
  129. // // 分享给朋友
  130. // onShareAppMessage() {
  131. // return {
  132. // title: '云飞智控', // 分享标题
  133. // path: 'pages/index/index', // 分享路径,通常包含页面参数
  134. // imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg', // 分享图片,可选
  135. // success: (res) => {
  136. // // 分享成功回调
  137. // uni.showToast({
  138. // title: '分享成功',
  139. // icon: 'success'
  140. // })
  141. // },
  142. // fail: (err) => {
  143. // // 分享失败回调
  144. // console.log('分享失败', err)
  145. // }
  146. // }
  147. // },
  148. // // 分享到朋友圈(基础库2.11.3+)
  149. // onShareTimeline() {
  150. // return {
  151. // title: '云飞智控', // 分享标题
  152. // query: 'id=123', // 页面参数,不同于分享给朋友的path,这里用query
  153. // imageUrl: 'http://www.hnyfwlw.com:8006/data/home_logo/log1.jpg' // 分享图片,可选
  154. // }
  155. // },
  156. filters:{
  157. ahFilter(value){
  158. if(value>70){
  159. return"湿润"
  160. }else if(value<30){
  161. return'干燥'
  162. }else{
  163. return'正常'
  164. }
  165. }
  166. },
  167. data() {
  168. return {
  169. menuList:[],
  170. indicatorDots: true,
  171. autoplay: false,
  172. interval: 2000,
  173. duration: 500,
  174. weatherinfo: {
  175. wea: '-',
  176. air_level: '-',
  177. at: '-',
  178. air_pm25: '-',
  179. ah: '-',
  180. alarm_content: ''
  181. },
  182. hello: '',
  183. show: false,
  184. url: '',
  185. loadTF: false
  186. };
  187. },
  188. watch: {
  189. url(news) {
  190. if (news != '') {
  191. uni.pageScrollTo({
  192. scrollTop: 0,
  193. duration: 500,
  194. });
  195. }
  196. },
  197. },
  198. methods: {
  199. async getcity(lng, lat) {
  200. const res = await this.$myRequest({
  201. url: '/api/api_gateway?method=device.device_manage.weathers',
  202. data: {
  203. lng: lng,
  204. lat: lat,
  205. },
  206. });
  207. this.weatherinfo = res[0];
  208. console.log(this.weatherinfo,'weatherinfo')
  209. },
  210. async getUserlogin() {
  211. const res = await this.$myRequest({
  212. url: '/api/api_gateway?method=user.login.user_login_info',
  213. data: {
  214. is_app: 1,
  215. }
  216. });
  217. const menuList = [];
  218. res.forEach(item =>{
  219. if(item.children){
  220. menuList.push(...item.children);
  221. }
  222. })
  223. this.menuList = menuList || [];
  224. },
  225. tabfunction(index,item) {
  226. if (index == 0) {
  227. uni.switchTab({
  228. url: '/pages/equipList2/index',
  229. success: () => {
  230. setTimeout(() => {
  231. uni.$emit('purId',item.pur_id);
  232. }, 50);
  233. }
  234. });
  235. } else if (index == 1) {
  236. uni.navigateTo({
  237. url: '/pages/identifyPest/identifyPest',
  238. });
  239. } else if (index == 2) {
  240. uni.navigateTo({
  241. url: '../expertDiagnosis/index',
  242. });
  243. } else if (index == 3) {
  244. uni.navigateTo({
  245. url: '../afterSale/index',
  246. });
  247. } else if(index == 4){
  248. uni.navigateTo({
  249. url: '/pages/index/developing',
  250. });
  251. }else if (index == 9) {
  252. uni.navigateTo({
  253. url: '/pages/server/index',
  254. });
  255. }
  256. },
  257. tabequipment(url, type) {
  258. console.log(url);
  259. uni.navigateTo({
  260. url: `${url}${type ? `?typeId=${type}` : ''}`,
  261. });
  262. },
  263. worm() {
  264. uni.navigateTo({
  265. url: '../expertDiagnosis/wormcase?name=虫情百科',
  266. });
  267. },
  268. checkLocationPermission(isTest) {
  269. let session_key = uni.getStorageSync('session_key');
  270. console.log(session_key,'session_key');
  271. let _this = this;
  272. // 当用户登录之后再弹位置权限框
  273. if (session_key) {
  274. uni.getSetting({
  275. success(res) {
  276. console.log(res,'resres');
  277. if (res.authSetting['scope.userLocation']) {
  278. uni.getLocation({
  279. type: 'wgs84 ',
  280. success: (res) => {
  281. _this.getcity(res.longitude, res.latitude);
  282. },
  283. fail(e) {
  284. uni.showToast({
  285. title: '系统未开启定位或未授权微信定位',
  286. duration: 5000,
  287. icon: 'none'
  288. });
  289. }
  290. });
  291. } else {
  292. uni.authorize({
  293. scope: 'scope.userLocation',
  294. success: () => {
  295. // 用户已授权
  296. uni.getLocation({
  297. type: 'wgs84 ',
  298. success: (res) => {
  299. console.log(res, 'loacation');
  300. _this.getcity(res.longitude, res.latitude);
  301. },
  302. });
  303. },
  304. fail: () => {
  305. // 用户拒绝授权,可引导用户至设置页手动开启
  306. if (isTest) {
  307. uni.showModal({
  308. title: '需要授权',
  309. content: '天气功能需要获取您的地理位置,请在设置中打开位置权限',
  310. success: (modalRes) => {
  311. if (modalRes.confirm) {
  312. uni.openSetting()
  313. } else {
  314. uni.showToast({
  315. title: '您拒绝了授权,将无法查看天气信息',
  316. duration: 2000,
  317. icon: 'none'
  318. });
  319. }
  320. },
  321. })
  322. }
  323. },
  324. })
  325. }
  326. }
  327. })
  328. }
  329. }
  330. },
  331. onLoad() {
  332. var time = new Date();
  333. var hours = time.getHours();
  334. if (hours < 12) {
  335. this.hello = '上午好!';
  336. } else {
  337. this.hello = '下午好!';
  338. }
  339. this.getUserlogin();
  340. this.checkLocationPermission(true); // 首次加载弹框提醒
  341. },
  342. onShow() {
  343. this.loadTF = false;
  344. this.getUserlogin();
  345. this.checkLocationPermission();
  346. },
  347. };
  348. </script>
  349. <style lang="less">
  350. page {
  351. background: linear-gradient(180deg, #1FC676 11.72%, #1FC676 11.52%, #D5F9E7 29.83%, #F5F6FA 36.96%), #FFF;
  352. background-size: 100%;
  353. background-repeat: no-repeat;
  354. background-color: #f9f9f9;
  355. }
  356. .home {
  357. width: 100%;
  358. height: 100%;
  359. padding-top: 94rpx;
  360. box-sizing: border-box;
  361. }
  362. .welcom {
  363. height: 64rpx;
  364. line-height: 64rpx;
  365. padding-left: 16rpx;
  366. font-size: 40rpx;
  367. color: #fff;
  368. }
  369. .weather-bg {
  370. width: 100%;
  371. height: 212rpx;
  372. background-image: url(https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/banner-bg.png);
  373. background-size: 100% 100%;
  374. background-repeat: no-repeat;
  375. }
  376. .weather-box {
  377. display: flex;
  378. margin: 24rpx 0 16rpx 0;
  379. }
  380. .weather:nth-child(1) {
  381. border-right: 1px solid rgba(255, 255, 255, 0.6);
  382. }
  383. .weather {
  384. flex: 1;
  385. display: flex;
  386. .weaimg {
  387. width: 42rpx;
  388. height: 42rpx;
  389. }
  390. .weatext {
  391. gap: 8rpx;
  392. flex: 1;
  393. display: flex;
  394. flex-direction: column;
  395. align-items: center;
  396. font-size: 24rpx;
  397. color: rgba(255, 255, 255, 0.8);
  398. }
  399. .weatext_title {
  400. font-size: 24rpx;
  401. color: #fff;
  402. }
  403. .text-span {
  404. color: #0BBC58;
  405. margin-left: 16rpx;
  406. padding: 0 2px;
  407. border-radius: 4px;
  408. background: rgba(255, 255, 255, 0.6);
  409. }
  410. .text-value {
  411. font-size: 48rpx;
  412. color: #fff;
  413. }
  414. }
  415. .weather-warning {
  416. margin: 20rpx 0;
  417. padding: 0 40rpx;
  418. color: #fff;
  419. .weather-alert{
  420. width:30rpx;
  421. height: 30rpx;
  422. margin-right: 10rpx;
  423. }
  424. }
  425. .ai-box {
  426. width: 100%;
  427. padding: 0 40rpx;
  428. box-sizing: border-box;
  429. height: 128rpx;
  430. margin-bottom: 12rpx;
  431. position: relative;
  432. top: -20rpx;
  433. .ai-content {
  434. box-sizing: border-box;
  435. height: 100%;
  436. border-radius: 8px;
  437. border: 1.5px solid #FFF;
  438. background: linear-gradient(180deg, #ffffffa3 0%, #FFF 100%);
  439. padding: 24rpx;
  440. image {
  441. width: 80rpx;
  442. height: 80rpx;
  443. float: left;
  444. margin-right: 16rpx;
  445. }
  446. .float-right {
  447. float: right;
  448. padding: 4px 12px;
  449. color: #fff;
  450. border-radius: 28px;
  451. background: #0BBC58;
  452. margin: 12rpx 0;
  453. }
  454. .ai-text {
  455. float: left;
  456. }
  457. .ai-text-title {
  458. color: #333834;
  459. line-height: 40rpx;
  460. font-size: 28rpx;
  461. font-weight: 700;
  462. }
  463. .ai-text-subtitle {
  464. color: #7b9783;
  465. line-height: 40rpx;
  466. font-size: 20rpx;
  467. font-weight: 400;
  468. }
  469. }
  470. }
  471. .functionbox {
  472. width: 100%;
  473. padding: 0rpx 32rpx 0 32rpx;
  474. box-sizing: border-box;
  475. margin-bottom: 16rpx;
  476. .swiper {
  477. height: 208rpx;
  478. }
  479. .functionbox_title {
  480. padding-left: 20rpx;
  481. font-size: 34rpx;
  482. }
  483. .functionbox_text {
  484. display: flex;
  485. flex-wrap: wrap;
  486. margin-top: 30rpx;
  487. .functionbox_text_item {
  488. width:20%;
  489. text-align: center;
  490. color: #616666;
  491. font-size: 24rpx;
  492. margin-bottom: 32rpx;
  493. .itemimg {
  494. width: 80rpx;
  495. height: 80rpx;
  496. margin-bottom: 16rpx;
  497. }
  498. }
  499. }
  500. }
  501. .facilitybox {
  502. width: 100%;
  503. padding: 0 32rpx;
  504. box-sizing: border-box;
  505. background: #F5F6FA;
  506. .facilitybox-content {
  507. border-radius: 16rpx;
  508. background: #FFF;
  509. padding: 32rpx;
  510. }
  511. .facilitybox_title {
  512. font-size: 30rpx;
  513. color: #333;
  514. margin-bottom: 24rpx;
  515. }
  516. .facilitybox_itembox {
  517. display: flex;
  518. gap: 32rpx;
  519. .facilitybox_item {
  520. flex: 1;
  521. color: #616666;
  522. .facilitybox_span {
  523. padding: 16rpx 24rpx;
  524. width: 50%;
  525. color: #0B3F5D;
  526. font-weight: 500;
  527. font-size: 28rpx;
  528. .text {
  529. font-size: 20rpx;
  530. color: #4E916E;
  531. font-weight: 400;
  532. margin-top: 9rpx;
  533. }
  534. }
  535. .itemimg {
  536. width: 90rpx;
  537. height: 90rpx;
  538. float: right;
  539. margin: 7rpx 0;
  540. }
  541. }
  542. .facilitybox-zhuanjia {
  543. border-radius: 8px;
  544. background: linear-gradient(180deg, #D3FBE6 0%, #F5F7FA 100%);
  545. position: relative;
  546. .itemimg {
  547. width: 112rpx;
  548. height: 146rpx;
  549. position: absolute;
  550. bottom: 0;
  551. right: 16rpx;
  552. }
  553. text {
  554. color: #003318;
  555. font-weight: 500;
  556. font-size: 28rpx;
  557. }
  558. }
  559. .facilitybox-suishi {
  560. border-radius: 8px;
  561. background: linear-gradient(180deg, #CAECFF 0%, #F5F7FA 99.89%);
  562. padding: 9rpx 0;
  563. .facilitybox_span {
  564. color: #0B3F5D;
  565. }
  566. }
  567. .facilitybox-bchk {
  568. border-radius: 8px;
  569. background: linear-gradient(180deg, #EEE5F6 0%, #F5F7FA 95.65%);
  570. padding: 10rpx 0;
  571. .facilitybox_span {
  572. color: #3E2B50;
  573. }
  574. .itemimg {
  575. width: 78rpx;
  576. height: 72rpx;
  577. margin-right: 10rpx;
  578. }
  579. }
  580. .facilitybox-jgqs {
  581. border-radius: 8px;
  582. background: linear-gradient(180deg, #D2E5FF 0%, #F5F7FA 95.65%);
  583. .facilitybox_span {
  584. color: #0D2E5B;
  585. }
  586. }
  587. .facilitybox-jwjy {
  588. border-radius: 8px;
  589. background: linear-gradient(180deg, #FFF4D2 0%, #F5F7FA 95.65%);
  590. .facilitybox_span {
  591. color: #3D4012;
  592. }
  593. }
  594. }
  595. }
  596. .banner-ad {
  597. margin: 32rpx 0;
  598. height: 224rpx;
  599. border-radius: 8px;
  600. background-size: 100% 100%;
  601. background-image: url(https://s3.hnyfwlw.com/webstaticimg/bigdata_app/newImg/home/ad-banner.png);
  602. .ad-text{
  603. height: 100%;
  604. display: flex;
  605. flex-direction: column;
  606. justify-content: space-around;
  607. padding: 40rpx;
  608. box-sizing: border-box;
  609. .title{
  610. color: #333333;
  611. font-size: 28rpx;
  612. font-style: normal;
  613. font-weight: 700;
  614. line-height: normal;
  615. }
  616. .sub-title{
  617. color: #666666;
  618. font-size: 20rpx;
  619. font-style: normal;
  620. font-weight: 500;
  621. line-height: normal;
  622. }
  623. .btn{
  624. text-align: center;
  625. width: 112rpx;
  626. color:#fff;
  627. padding: 4px 0px;
  628. font-size: 20rpx;
  629. border-radius: 4px;
  630. background: linear-gradient(106deg, #0BBC58 2.6%, #7CE6FB 86.51%);
  631. }
  632. }
  633. }
  634. .insectattack {
  635. width: 90%;
  636. margin: 0 auto;
  637. padding: 30rpx;
  638. .insectattack_title {
  639. font-size: 34rpx;
  640. display: flex;
  641. justify-content: space-between;
  642. .iconbox {
  643. width: 40rpx;
  644. height: 40rpx;
  645. background-color: #cfd6d6;
  646. color: #909696;
  647. border-radius: 40rpx;
  648. line-height: 40rpx;
  649. text-align: center;
  650. font-size: 20rpx;
  651. }
  652. }
  653. .insectattack_listbox {
  654. overflow-x: auto;
  655. .insectattack_list {
  656. width: 1104rpx;
  657. display: flex;
  658. margin-top: 30rpx;
  659. flex-wrap: wrap;
  660. .list_box {
  661. background-size: 100% 100%;
  662. width: 246rpx;
  663. height: 324rpx;
  664. margin-right: 30rpx;
  665. border-radius: 20rpx;
  666. position: relative;
  667. .list_boxbg {
  668. width: 100%;
  669. height: 100%;
  670. position: absolute;
  671. top: 0;
  672. left: 0;
  673. z-index: -1;
  674. .list_boxbg_img {
  675. width: 100%;
  676. height: 100%;
  677. }
  678. }
  679. .list_box_xiang {
  680. width: 95%;
  681. margin-top: 0rpx auto;
  682. display: flex;
  683. justify-content: flex-end;
  684. padding-top: 20rpx;
  685. .list_box_xiang_click {
  686. padding: 8rpx 15rpx;
  687. background-color: rgba(0, 0, 0, 0.2);
  688. color: #fff;
  689. font-size: 20rpx;
  690. border-radius: 52rpx;
  691. }
  692. }
  693. .list_box_info {
  694. width: 90%;
  695. margin: 130rpx auto 0;
  696. height: 120rpx;
  697. border-radius: 10rpx;
  698. background-image: linear-gradient(to right,
  699. #ffffff,
  700. rgba(255, 255, 255, 0.44));
  701. padding: 10rpx;
  702. box-sizing: border-box;
  703. .list_box_info_name {
  704. font-weight: 700;
  705. }
  706. .list_box_info_text {
  707. font-size: 18rpx;
  708. overflow: hidden;
  709. text-overflow: ellipsis;
  710. display: -webkit-box;
  711. -webkit-box-orient: vertical;
  712. -webkit-line-clamp: 2;
  713. }
  714. }
  715. }
  716. }
  717. }
  718. }
  719. .loading {
  720. position: absolute;
  721. top: 0;
  722. left: 0;
  723. z-index: 100;
  724. width: 100%;
  725. height: 100vh;
  726. background-color: rgba(0, 0, 0, 0.5);
  727. display: flex;
  728. justify-content: center;
  729. align-items: center;
  730. }
  731. </style>