face.html 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <script src="../js/lib/jquery-1.9.1/jquery.min.js"></script>
  6. <script src="../js/lib/vue.js"></script>
  7. <script src="../js/config/base_config.js"></script>
  8. <script src="../js/lib/ajaxRedirect.js"></script>
  9. <link href="../ztree/css/zTreeStyle/zTreeStyle.css" rel="stylesheet" />
  10. <script src="../ztree/js/jquery.ztree.all.js"></script>
  11. <script src="../jqueryUI/jquery-ui.js"></script>
  12. <link href="../jqueryUI/jquery-ui.css" rel="stylesheet" />
  13. <link href="../css/css.css" rel="stylesheet" type="text/css">
  14. <title>Title</title>
  15. </head>
  16. <body>
  17. <div>
  18. <!--内容-->
  19. <div class="content">
  20. <!--筛选-->
  21. <ul class="recommendation-screen">
  22. <li>
  23. <input class="input01" type="text" id="selectName" placeholder="请输入关键字"/>
  24. <div class="button01">
  25. <button onclick="setlist();">查询</button>
  26. </div>
  27. </li>
  28. <li>
  29. <button onclick="toAdd()">添加</button>
  30. <button onclick="toAddFace()">添加图片</button>
  31. </li>
  32. </ul>
  33. <!--table表格-->
  34. <div class="table">
  35. <table>
  36. <thead>
  37. <tr>
  38. <!--<th>id</th>-->
  39. <th>名称</th>
  40. <th>faceSetToken</th>
  41. <th>操作</th>
  42. </tr>
  43. </thead>
  44. <tbody id="faceSetListTable">
  45. </tbody>
  46. </table>
  47. </div>
  48. <!--分页-->
  49. </div>
  50. </div>
  51. <div id="iFaceSetAdd" style="display: none;">
  52. <div class="" style="padding-bottom:0;">
  53. <div >
  54. <form id="iFaceSetAddForm">
  55. <input type="hidden" name="id" id="iFaceSetAddId">
  56. <table border="0" width="90%"><tr><td width="20%">
  57. <span >名称:</span>
  58. </td><td width="80%">
  59. <input style="border-radius: 5px;margin-bottom: 20px;margin-right: 10px;border: solid 1px #ccc;width: 148px;
  60. height: 32px; padding-left: 30px; line-height: 32px;"
  61. type="text" id="iFaceSetAddName" autocomplete="off" name="setName">
  62. </td></tr></table>
  63. </form>
  64. </div>
  65. </div>
  66. </div>
  67. <iframe name="hidden_frameFile" id="hidden_frameFile" style="display:none"></iframe>
  68. <div id="iFaceAdd" style="display: none;">
  69. <div class="" style="padding-bottom:0;">
  70. <div >
  71. <form id="iFaceAddForm" target="hidden_frameFile" method="post" enctype="multipart/form-data" >
  72. faceSetToken : <input name="setToken" id="iFaceAddsetToken">
  73. <table border="0" width="90%">
  74. <tr><td width="20%">
  75. <span > 图片:</span>
  76. </td><td width="80%">
  77. <input type="file" name="faceFile">
  78. </td></tr></table>
  79. </form>
  80. </div>
  81. </div>
  82. </div>
  83. <div id="iFaceSearch" style="display: none;">
  84. <div class="" style="padding-bottom:0;">
  85. <div >
  86. <form id="iFaceSearchForm" target="hidden_frameFile" method="post" enctype="multipart/form-data" >
  87. faceSetToken : <input name="setToken" id="iFaceSearchsetToken">
  88. <table border="0" width="90%">
  89. <tr><td width="20%">
  90. <span > 图片:</span>
  91. </td><td width="80%">
  92. <input type="file" name="faceFile">
  93. </td></tr></table>
  94. </form>
  95. </div>
  96. </div>
  97. </div>
  98. </body>
  99. <script type="text/javascript">
  100. $(document).ready(function(){
  101. setlist();
  102. $("#iFaceSetAdd").dialog({
  103. autoOpen:false,
  104. modal:true,
  105. closeable:false,
  106. bgiframe:true,
  107. height:250,
  108. width:800,
  109. closeOnEscape:false,
  110. draggable:false,
  111. resizable:false,
  112. title:"集合",
  113. open:function (event, ui) {
  114. $(".ui-dialog-titlebar-close").hide();
  115. },
  116. buttons:{
  117. "保存添加信息":function () {
  118. $.ajax({
  119. url:"/face/faceSetAdd" ,
  120. type:"POST",
  121. data:$("#iFaceSetAddForm").serialize(),
  122. dataType:"json",
  123. success:function (data) {
  124. if (data.status == 'SUCCESS') {
  125. alert("信息已经成功保存");
  126. $("#iFaceSetAdd").dialog("close");
  127. setlist();
  128. }
  129. },
  130. complete:function (XHR, TS) {
  131. $('.ui-dialog-buttonpane').find('button:contains("保存添加信息")').removeAttr("disabled");
  132. },
  133. error:function (XMLHttpRequest, textStatus, errorThrown) {
  134. alert(textStatus);
  135. }
  136. });
  137. },
  138. "关闭":function () {
  139. $(this).dialog("close");
  140. }
  141. }
  142. });
  143. $("#iFaceAdd").dialog({
  144. autoOpen:false,
  145. modal:true,
  146. closeable:false,
  147. bgiframe:true,
  148. height:250,
  149. width:800,
  150. closeOnEscape:false,
  151. draggable:false,
  152. resizable:false,
  153. title:"集合",
  154. open:function (event, ui) {
  155. $(".ui-dialog-titlebar-close").hide();
  156. },
  157. buttons:{
  158. "保存添加信息":function () {
  159. $("#iFaceAddForm").attr("action","/face/faceAdd");
  160. $('#iFaceAddForm').submit();
  161. },
  162. "关闭":function () {
  163. $(this).dialog("close");
  164. }
  165. }
  166. });
  167. $("#iFaceSearch").dialog({
  168. autoOpen:false,
  169. modal:true,
  170. closeable:false,
  171. bgiframe:true,
  172. height:250,
  173. width:800,
  174. closeOnEscape:false,
  175. draggable:false,
  176. resizable:false,
  177. title:"集合",
  178. open:function (event, ui) {
  179. $(".ui-dialog-titlebar-close").hide();
  180. },
  181. buttons:{
  182. "保存添加信息":function () {
  183. $("#iFaceSearchForm").attr("action","/face/faceSearch");
  184. $('#iFaceSearchForm').submit();
  185. },
  186. "关闭":function () {
  187. $(this).dialog("close");
  188. }
  189. }
  190. });
  191. });
  192. function showMessage(message){
  193. var obj=eval(message);
  194. console.log(obj);
  195. // alert(''+obj.status);
  196. // alert(obj.length);
  197. for(var i=0;i<obj.length;i++){
  198. alert('相似图片:'+obj[i].face_token+'相似度:'+obj[i].confidence+'%');
  199. }
  200. }
  201. function toAdd(){
  202. $("#iFaceSetAdd").dialog("open");
  203. }
  204. function toAddFace(){
  205. $("#iFaceAdd").dialog("open");
  206. }
  207. function setlist(){
  208. $("#faceSetListTable").html("");
  209. $.ajax( {
  210. url: "/face/faceSetList",
  211. dataType: 'json',
  212. type: 'post',
  213. data:{},
  214. success : function(data,textStatus) {
  215. console.log(data);
  216. if(data.status=="SUCCESS"){
  217. $.each(data.list, function (i, value) {
  218. $("#faceSetListTable").append('<tr><td>'+value.display_name+'</td><td>'+value.faceset_token+'</td>' +
  219. '<td><a href="#" onclick="faceSetDelete('+"'"+value.faceset_token+"'"+')">删除</a></td>' +
  220. '<td><a href="#" onclick="faceSetDetail('+"'"+value.faceset_token+"'"+')">详情</a></td>' +
  221. '<td><a href="#" onclick="faceSearch('+"'"+value.faceset_token+"'"+')">对比</a></td>' +
  222. '</tr>');
  223. });
  224. }
  225. },
  226. error : function() {
  227. alert("404");
  228. }
  229. });
  230. }
  231. function faceSetDelete(setToken){
  232. $.ajax({
  233. url: "/face/faceSetDelete",
  234. dataType: 'json',
  235. type: 'post',
  236. data:{"setToken":setToken},
  237. success : function(data,textStatus) {
  238. console.log(data);
  239. setlist();
  240. },
  241. error : function() {
  242. alert("404");
  243. }
  244. });
  245. }
  246. function faceSetDetail(setToken){
  247. $.ajax({
  248. url: "/face/faceSetInfo",
  249. dataType: 'json',
  250. type: 'post',
  251. data:{"setToken":setToken},
  252. success : function(data,textStatus) {
  253. console.log(data);
  254. alert(data.info.display_name);
  255. $.each(data.info.face_tokens, function (i, value) {
  256. alert(value)
  257. });
  258. },
  259. error : function() {
  260. alert("404");
  261. }
  262. });
  263. }
  264. function faceSearch(setToken){
  265. $("#iFaceSearchsetToken").val(setToken);
  266. $("#iFaceSearch").dialog("open");
  267. }
  268. </script>
  269. </html>