Diseaselibrary.html 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0">
  7. <title>病害库</title>
  8. <link rel="stylesheet" href="./static/layui/css/layui.css">
  9. <style>
  10. body {
  11. background-color: #f6f6f6;
  12. padding: 0;
  13. margin: 0;
  14. }
  15. /* @font-face {
  16. font-family: zhanti;
  17. src: url("./static/font/zhanti.ttf");
  18. } */
  19. p {
  20. margin: 0;
  21. }
  22. .recognbox {
  23. width: 100%;
  24. height: 100vh;
  25. position: relative;
  26. overflow: hidden;
  27. background-color: #101010;
  28. }
  29. .videobox {
  30. width: 100%;
  31. height: 100%;
  32. overflow: hidden;
  33. }
  34. .shang {
  35. position: absolute;
  36. top: -14px;
  37. left: 1.8%;
  38. width: 100%;
  39. height: 100px;
  40. }
  41. .tilte {
  42. position: absolute;
  43. top: 0;
  44. left: 0;
  45. width: 100%;
  46. height: 80px;
  47. /* font-family: zhanti; */
  48. color: #fff;
  49. text-align: center;
  50. line-height: 55px;
  51. font-size: 30px;
  52. margin: 0;
  53. }
  54. .xia {
  55. position: absolute;
  56. bottom: -10px;
  57. left: 1.8%;
  58. width: 100%;
  59. height: 80px;
  60. }
  61. .wormlistbox {
  62. display: flex;
  63. justify-content: space-between;
  64. padding: 15px;
  65. box-sizing: border-box;
  66. position: absolute;
  67. top: 66px;
  68. left: 5%;
  69. width: 90%;
  70. height: 90%;
  71. z-index: 98;
  72. text-align: center;
  73. }
  74. .wormlistpai {
  75. width: 300px;
  76. background-color: #fff;
  77. height: 100%;
  78. }
  79. .wormlistinfo {
  80. width: calc(100% - 320px);
  81. background-color: #fff;
  82. height: 100%;
  83. }
  84. #wormlist {
  85. display: flex;
  86. flex-wrap: wrap;
  87. /* justify-content: space-around; */
  88. }
  89. .searcbox {
  90. display: flex;
  91. margin: 15px;
  92. }
  93. .searchbtn {
  94. width: 60px;
  95. height: 30px;
  96. color: #fff;
  97. background-color: #4F71FF;
  98. outline: none;
  99. border: 0px;
  100. font-size: 14px;
  101. text-align: center;
  102. line-height: 30px;
  103. margin-left: 10px;
  104. border-radius: 5px;
  105. cursor: pointer;
  106. }
  107. #uname {
  108. outline: none;
  109. padding-left: 10px;
  110. }
  111. .wormlistpai {
  112. padding: 10px;
  113. box-sizing: border-box;
  114. }
  115. .wormlistpai_list {
  116. padding: 0 10px;
  117. }
  118. .wormlistpai_top {
  119. display: flex;
  120. justify-content: space-between;
  121. }
  122. .topage {
  123. width: 126px;
  124. height: 54px;
  125. background-image: url(./static/images/button.png);
  126. background-repeat: no-repeat;
  127. background-size: 100% 100%;
  128. position: absolute;
  129. top: 25px;
  130. left: 95px;
  131. z-index: 99999;
  132. color: #fff;
  133. line-height: 52px;
  134. /* padding-left: 15px; */
  135. box-sizing: border-box;
  136. /* padding: 8px 15px; */
  137. text-align: center;
  138. }
  139. .caozuo {
  140. position: absolute;
  141. top: 20px;
  142. right: 20px;
  143. height: 100px;
  144. }
  145. .fangda img,.suoxiao img{
  146. width: 24px;
  147. height: 24px;
  148. }
  149. #bindingsimbox {
  150. width: 100%;
  151. padding: 20px 15px;
  152. box-sizing: border-box;
  153. display: flex;
  154. }
  155. #simtype {
  156. height: 30px;
  157. width: 300px;
  158. }
  159. .simboxsearchbtn {
  160. width: 80px;
  161. height: 30px;
  162. color: #fff;
  163. background-color: #4F71FF;
  164. outline: none;
  165. border: 0px;
  166. font-size: 14px;
  167. text-align: center;
  168. line-height: 30px;
  169. margin-left: 10px;
  170. border-radius: 5px;
  171. cursor: pointer;
  172. }
  173. </style>
  174. </head>
  175. <body>
  176. <div class="recognbox" id="recognbox">
  177. <div class="videobox">
  178. <video controls="controls" muted="muted" autoplay="autoplay" loop="loop" class="fillWidth" id="fillWidths">
  179. <source src="https://zhanting-shibie.oss-cn-hangzhou.aliyuncs.com/1.mp4" type="video/mp4" />
  180. </video>
  181. </div>
  182. <img src="./static/images/shang.png" alt="" class="shang" />
  183. <img src="./static/images/xia.png" alt="" class="xia" />
  184. <p class="tilte">病害库</p>
  185. <div class="wormlistbox">
  186. <div class="wormlistinfo">
  187. <div class="searcbox">
  188. <input type="text" value="" class="" id="uname" placeholder="病害名称搜索" />
  189. <div class="searchbtn" onclick="searcbtn()">搜索</div>
  190. </div>
  191. <div id="wormlist">
  192. </div>
  193. <div style="display: flex;justify-content: space-around;" id="pageid">
  194. <div id="demo1"></div>
  195. </div>
  196. </div>
  197. <div class="wormlistpai">
  198. <div class="wormlistpai_top">
  199. <p style="font-size: 16px;line-height: 30px;">识别排名</p>
  200. <div class="searchbtn" onclick="bieshibtn()">识别</div>
  201. </div>
  202. <div class="wormlistpai_list" id="wormlistpai_list">
  203. </div>
  204. </div>
  205. </div>
  206. <div id="tokenbox" style="width:800px;display:none">
  207. <div style="padding: 20px;">
  208. <div style="display:flex;margin-bottom: 15px;">
  209. <p style="width: 70px;margin-right: 10px;">病害名称:</p>
  210. <p id="bingname"></p>
  211. </div>
  212. <div style="display:flex;margin-bottom: 15px;">
  213. <p style="width: 70px;margin-right: 10px;">病害图片:</p>
  214. <p id="bingsrc"></p>
  215. </div>
  216. <div style="display:flex;">
  217. <p style="width: 70px;margin-right: 10px;">病害详情:</p>
  218. <p id="binginfo" style="width: calc(100% - 80px);"></p>
  219. </div>
  220. </div>
  221. </div>
  222. <div id="shibiebox">
  223. <div style="padding: 20px;">
  224. <div style="display:flex;margin-bottom: 15px;">
  225. <p style="width: 70px;margin-right: 10px;">病害名称:</p>
  226. <p id="shibiename"></p>
  227. </div>
  228. <div style="display:flex;margin-bottom: 15px;">
  229. <p style="width: 70px;margin-right: 10px;">病害图片:</p>
  230. <p id="shibiesrc"></p>
  231. </div>
  232. <div style="display:flex;">
  233. <p style="width: 70px;margin-right: 10px;">病害详情:</p>
  234. <p id="shibieinfo" style="width: calc(100% - 80px);"></p>
  235. </div>
  236. </div>
  237. </div>
  238. <div class="topage" onclick="topage()">
  239. <i class="el-icon-back"></i>
  240. 返 回
  241. </div>
  242. <div class="caozuo">
  243. <div class="fangda" id="fangda" onclick="btnClick()">
  244. <img src="./static/images/index/fangda.png" alt="">
  245. </div>
  246. <div class="suoxiao" id="suoxiao" onclick="exitFullScreen()">
  247. <img src="./static/images/index/suoxiao.png" alt="">
  248. </div>
  249. </div>
  250. <div id="bindingsimbox" style="display: none;">
  251. <div style="margin-bottom: 15px;">
  252. <select name="simtype" lay-verify="required" lay-search="" id="simtype">
  253. <option value="1">小麦</option>
  254. <option value="2">水稻</option>
  255. <option value="3">油菜</option>
  256. <option value="4">玉米</option>
  257. <option value="5">大豆</option>
  258. <option value="6">萝卜</option>
  259. <option value="7">梨</option>
  260. <option value="8">黄瓜</option>
  261. <option value="9">豇豆</option>
  262. <option value="10">桑</option>
  263. <option value="11">柿</option>
  264. <option value="12">烟草</option>
  265. <option value="13">甘薯</option>
  266. <option value="14">茄子</option>
  267. <option value="15">甘蔗</option>
  268. <option value="16">甘蓝</option>
  269. <option value="17">番茄</option>
  270. <option value="18">南瓜</option>
  271. <option value="19">辣椒</option>
  272. <option value="20">桃</option>
  273. <option value="21">棉花</option>
  274. <option value="22">茶</option>
  275. <option value="23">花生</option>
  276. <option value="24">白菜</option>
  277. <option value="25">马铃薯</option>
  278. <option value="26">葡萄</option>
  279. <option value="27">柑橘</option>
  280. <option value="28">苹果</option>
  281. </select>
  282. </div>
  283. <div class="simboxsearchbtn" id="bieshi">上传图片</div>
  284. </div>
  285. </div>
  286. <script src="./static/js/jquery-2.1.4.min.js"></script>
  287. <script src="./static/layui/layui.all.js"></script>
  288. <script src="./static/js/show.js"></script>
  289. <script>
  290. function Base64() {
  291. // private property
  292. _keyStr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
  293. // public method for encoding
  294. this.encode = function (input) {
  295. var output = "";
  296. var chr1, chr2, chr3, enc1, enc2, enc3, enc4;
  297. var i = 0;
  298. input = _utf8_encode(input);
  299. while (i < input.length) {
  300. chr1 = input.charCodeAt(i++);
  301. chr2 = input.charCodeAt(i++);
  302. chr3 = input.charCodeAt(i++);
  303. enc1 = chr1 >> 2;
  304. enc2 = ((chr1 & 3) << 4) | (chr2 >> 4);
  305. enc3 = ((chr2 & 15) << 2) | (chr3 >> 6);
  306. enc4 = chr3 & 63;
  307. if (isNaN(chr2)) {
  308. enc3 = enc4 = 64;
  309. } else if (isNaN(chr3)) {
  310. enc4 = 64;
  311. }
  312. output = output +
  313. _keyStr.charAt(enc1) + _keyStr.charAt(enc2) +
  314. _keyStr.charAt(enc3) + _keyStr.charAt(enc4);
  315. }
  316. return output;
  317. }
  318. // public method for decoding
  319. this.decode = function (input) {
  320. var output = "";
  321. var chr1, chr2, chr3;
  322. var enc1, enc2, enc3, enc4;
  323. var i = 0;
  324. input = input.replace(/[^A-Za-z0-9\+\/\=]/g, "");
  325. while (i < input.length) {
  326. enc1 = _keyStr.indexOf(input.charAt(i++));
  327. enc2 = _keyStr.indexOf(input.charAt(i++));
  328. enc3 = _keyStr.indexOf(input.charAt(i++));
  329. enc4 = _keyStr.indexOf(input.charAt(i++));
  330. chr1 = (enc1 << 2) | (enc2 >> 4);
  331. chr2 = ((enc2 & 15) << 4) | (enc3 >> 2);
  332. chr3 = ((enc3 & 3) << 6) | enc4;
  333. output = output + String.fromCharCode(chr1);
  334. if (enc3 != 64) {
  335. output = output + String.fromCharCode(chr2);
  336. }
  337. if (enc4 != 64) {
  338. output = output + String.fromCharCode(chr3);
  339. }
  340. }
  341. output = _utf8_decode(output);
  342. return output;
  343. }
  344. // private method for UTF-8 encoding
  345. _utf8_encode = function (string) {
  346. string = string.replace(/\r\n/g, "\n");
  347. var utftext = "";
  348. for (var n = 0; n < string.length; n++) {
  349. var c = string.charCodeAt(n);
  350. if (c < 128) {
  351. utftext += String.fromCharCode(c);
  352. } else if ((c > 127) && (c < 2048)) {
  353. utftext += String.fromCharCode((c >> 6) | 192);
  354. utftext += String.fromCharCode((c & 63) | 128);
  355. } else {
  356. utftext += String.fromCharCode((c >> 12) | 224);
  357. utftext += String.fromCharCode(((c >> 6) & 63) | 128);
  358. utftext += String.fromCharCode((c & 63) | 128);
  359. }
  360. }
  361. return utftext;
  362. }
  363. // private method for UTF-8 decoding
  364. _utf8_decode = function (utftext) {
  365. var string = "";
  366. var i = 0;
  367. var c = c1 = c2 = 0;
  368. while (i < utftext.length) {
  369. c = utftext.charCodeAt(i);
  370. if (c < 128) {
  371. string += String.fromCharCode(c);
  372. i++;
  373. } else if ((c > 191) && (c < 224)) {
  374. c2 = utftext.charCodeAt(i + 1);
  375. string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));
  376. i += 2;
  377. } else {
  378. c2 = utftext.charCodeAt(i + 1);
  379. c3 = utftext.charCodeAt(i + 2);
  380. string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));
  381. i += 3;
  382. }
  383. }
  384. return string;
  385. }
  386. }
  387. console.log($)
  388. var wornnanme = ""
  389. function getdatalist(page, wornnanmedata, first) {
  390. if (wornnanmedata == "") {
  391. url = "pest.pests.pests_info"
  392. } else {
  393. url = "pest.pests.pests_search"
  394. }
  395. $.ajax({
  396. method: "post",
  397. url: "http://8.136.98.49:8002/api/api_gateway?method=" + url, //请求的url地址
  398. data: {
  399. code: 1,
  400. page: page,
  401. name: wornnanmedata,
  402. token: "OURKOlrV9dXxUGpGR2UWF7gYOJgqEfV LTemxZDudFA=",
  403. "page_size": "15"
  404. },
  405. dataType: "json",
  406. success: function (data) {
  407. console.log(data.data)
  408. var list = data.data.data
  409. var str = "";
  410. for (var i = 0; i < list.length; i++) {
  411. str += `<div style="width:17.5%;box-shadow: 1px 1px 8px 0 #ddd;margin:0 15px 15px 15px;" onclick="tab(` + list[i].id + `)"><img src="` + list[i].img_urls + `" style='width:100%;height:180px;' alt=""><p style="text-align: center;margin:5px 0;">` + list[i].name + `</p></div>`
  412. }
  413. $("#wormlist")[0].innerHTML = str
  414. if (first) {
  415. layui.use(['laypage', 'layer'], function () {
  416. var laypage = layui.laypage
  417. , layer = layui.layer;
  418. //总页数大于页码总数
  419. laypage.render({
  420. elem: 'demo1'
  421. , count: data.data.nums //数据总数
  422. , theme: '#4F71FF'
  423. , limit: 15
  424. , jump: function (obj, first) {
  425. // console.log(obj, first)
  426. // getwarnlist(obj.curr, 0)
  427. getdatalist(obj.curr, wornnanme, false)
  428. }
  429. });
  430. })
  431. }
  432. }
  433. });
  434. }
  435. getdatalist(1, wornnanme, true)
  436. function searcbtn() {
  437. wornnanme = $("#uname").val()
  438. // console.log(str)
  439. getdatalist(1, wornnanme, true)
  440. }
  441. function getranking() {
  442. $.ajax({
  443. method: "post",
  444. url: "http://8.136.98.49:8002/api/api_gateway?method=pest.pests.pests_search", //请求的url地址
  445. data: {
  446. code: 1,
  447. page: 1,
  448. token: "OURKOlrV9dXxUGpGR2UWF7gYOJgqEfV LTemxZDudFA="
  449. },
  450. dataType: "json",
  451. success: function (data) {
  452. console.log(data.data)
  453. var list = data.data.data
  454. var str = ""
  455. for (var i = 0; i < list.length; i++) {
  456. str += `<div style="display:flex;margin:10px 0;" onclick="tab(` + list[i].id + `)">
  457. <p style="line-height:50px;">`+ (i + 1) + `</p>
  458. <img src="`+ list[i].img_urls + `" style="width: 50px;height: 50px;border-radius: 50%;margin-left:50px;" alt="">
  459. <p style="line-height:50px;width: 61%;text-align: end;">`+ list[i].name + `</p>
  460. </div>`
  461. }
  462. $("#wormlistpai_list")[0].innerHTML = str
  463. }
  464. });
  465. }
  466. getranking()
  467. function tab(id) {
  468. console.log(id)
  469. layer.open({
  470. type: 1,
  471. title: '病害信息',
  472. area: ['800px', '600px'], //宽高
  473. content: $('#tokenbox'),
  474. success: function (layero, index) {
  475. $.ajax({
  476. method: "post",
  477. url: "http://8.136.98.49:8002/api/api_gateway?method=pest.pests.pests_info", //请求的url地址
  478. data: {
  479. code: "2",
  480. page: "1",
  481. pest_id: id,
  482. token: "OURKOlrV9dXxUGpGR2UWF7gYOJgqEfV LTemxZDudFA="
  483. },
  484. dataType: "json",
  485. success: function (data) {
  486. console.log(data.data)
  487. $("#bingname")[0].innerText = data.data.name
  488. var str = `<img src="` + data.data.img_urls + `" style="width: 160px;height: 160px;" alt="">`
  489. $("#bingsrc")[0].innerHTML = str
  490. let Adata = data.data.prevention;
  491. var a = Adata.replace(/]/g, ":");
  492. let Bdata = new Array();
  493. Bdata = a.split("[");
  494. console.log(Bdata)
  495. var str = ""
  496. for (var i = 0; i < Bdata.length; i++) {
  497. if (Bdata[i] != "") {
  498. str += `<p style="margin-bottom:10px;">` + Bdata[i] + `</p>`
  499. }
  500. }
  501. $("#binginfo")[0].innerHTML = str
  502. }
  503. });
  504. }
  505. })
  506. }
  507. function bieshibtn() {
  508. layer.open({
  509. type: 1,
  510. title: '病害识别',
  511. area: ['450px', '130px'], //宽高
  512. content: $('#bindingsimbox'),
  513. skin: 'layui-layer-editName', //样式类名
  514. success: function (layero, index) {
  515. }
  516. })
  517. }
  518. // function bieshibtn() {
  519. layui.use(['upload', 'element', 'layer'], function () {
  520. var $ = layui.jquery
  521. , upload = layui.upload
  522. , element = layui.element
  523. , layer = layui.layer;
  524. //常规使用 - 普通图片上传
  525. var myMsg;
  526. var base = new Base64();
  527. var uploadInst = upload.render({
  528. elem: '#bieshi'
  529. , url: 'http://8.136.98.49:8002/identify/zhichong'
  530. , field: "imageFile"
  531. , data: {
  532. type: $("#simtype").val()
  533. },
  534. headers: {
  535. Authorization: "Basic " + base.encode("pingpu:123456789")
  536. }
  537. , before: function (obj) {
  538. //预读本地文件示例,不支持ie8
  539. // console.log(obj)
  540. myMsg = layer.msg('识别中,请稍后.....', { icon: 16, time: 0 });
  541. }, done: function (res) {
  542. console.log(res)
  543. layer.close(myMsg)
  544. if (res.message == "") {
  545. layer.open({
  546. type: 1,
  547. title: '病害信息',
  548. area: ['800px', '600px'], //宽高
  549. content: $('#shibiebox'),
  550. success: function (layero, index) {
  551. var data = res.data
  552. $("#shibiename")[0].innerText = data.name
  553. var str = `<img src="` + data.img_urls + `" style="width: 160px;height: 160px;" alt="">`
  554. $("#shibiesrc")[0].innerHTML = str
  555. let Adata = data.prevention;
  556. var a = Adata.replace(/]/g, ":");
  557. let Bdata = new Array();
  558. Bdata = a.split("[");
  559. console.log(Bdata)
  560. var str = ""
  561. for (var i = 0; i < Bdata.length; i++) {
  562. if (Bdata[i] != "") {
  563. str += `<p style="margin-bottom:10px;">` + Bdata[i] + `</p>`
  564. }
  565. }
  566. $("#shibieinfo")[0].innerHTML = str
  567. }
  568. })
  569. } else {
  570. layer.msg(res.message)
  571. }
  572. }
  573. });
  574. })
  575. function topage() {
  576. window.location.href = "./index.html"
  577. }
  578. </script>
  579. </body>
  580. </html>