my-coin.js 56 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198
  1. window.cccField = '';
  2. window.apisMoveDivButton2Timer = '';
  3. window.apisMoveDivButton2Timer4Custorm = [];
  4. window.actualFlag = false;
  5. window.stopFlag = false;
  6. $(function () {
  7. initOther();
  8. });
  9. /*var dragJob=false;
  10. $(document).on("mousedown", '.watchlistpreview-top', function (e) {
  11. dragJob = true;
  12. });
  13. document.onmousemove = function (e) {
  14. if (dragJob) {
  15. var e = e || window.event;
  16. var height = $(document.body).height();
  17. var width = $(window).width();
  18. var widthJob = $("#watchlistpreview").width();
  19. var heightJob = $("#watchlistpreview").height();
  20. var left = e.clientX - widthJob / 2;
  21. var top = e.clientY - 18 + $(document).scrollTop();
  22. if (top >= 0 && top < height - heightJob) {
  23. $("#watchlistpreview").css("top", top);
  24. }
  25. if (left >= 0 && left < width - widthJob) {
  26. $("#watchlistpreview").css("left", left);
  27. }
  28. return false;
  29. }
  30. };
  31. $(document).mouseup(function (e) {
  32. dragJob = false;
  33. });*/
  34. /**
  35. * 初始化其他操作
  36. */
  37. function initOther() {
  38. initOther4Select();
  39. handleSelectChange($("select#apis-move-select,select#apis-quiet-select"));
  40. $(".apis-move-div-button1,.apis-quiet-div-button1").click(function () {
  41. var aa = $(this).attr("slideDiv");
  42. var display = $('#' + aa);
  43. if (display.css('display') == 'block') {
  44. display.slideUp("slow");
  45. //display.css("display", "none");
  46. $(this).html('展开');
  47. } else {
  48. display.slideDown("slow");
  49. //display.css("display", "block");
  50. $(this).html('收起');
  51. }
  52. });
  53. $(".apis-move-div-button2").click(function () {
  54. var this_ = $(this);
  55. stopFlag = false;
  56. if (!actualFlag) {
  57. var selectedOption = $("select#apis-move-select").find("option:selected");
  58. var nameEn = selectedOption.attr("nameEn");
  59. if (nameEn === 'needCustom') {
  60. $.each($(".needCustomInput"), function (index, obj) {
  61. var url = $(obj).attr("url");
  62. var typetype = $(obj).attr("typetype");
  63. var nameEn2 = $(obj).attr("nameEn");
  64. var slideDiv = $(this_).attr("slideDiv") + '-' + $(obj).attr("id");
  65. apisMoveDivButton2Timer4Custorm[index] = setInterval(mainSearch, 3000, url, nameEn2, slideDiv, typetype, "1");
  66. });
  67. actualFlag = true;
  68. } else {
  69. var url = selectedOption.attr("url");
  70. var typetype = selectedOption.attr("typetype");
  71. var slideDiv = $(this).attr("slideDiv");
  72. apisMoveDivButton2Timer = setInterval(mainSearch, 3000, url, nameEn, slideDiv, typetype, "2");
  73. actualFlag = true;
  74. }
  75. }
  76. });
  77. $(".apis-quiet-div-button2").click(function () {
  78. stopFlag = false;
  79. var selectedOption = $("select#apis-quiet-select").find("option:selected");
  80. var url = selectedOption.attr("url");
  81. var typetype = selectedOption.attr("typetype");
  82. var nameEn = selectedOption.attr("nameEn");
  83. var slideDiv = $(this).attr("slideDiv");
  84. mainSearch(url, nameEn, slideDiv, typetype,"2");
  85. });
  86. initOther4Popup();
  87. $(".apis-move-div-button3").click(function () {
  88. ownClearInterval();
  89. });
  90. }
  91. function ownClearInterval() {
  92. if (actualFlag) {
  93. if (apisMoveDivButton2Timer != undefined && apisMoveDivButton2Timer != null) {
  94. clearInterval(apisMoveDivButton2Timer);
  95. }
  96. if (apisMoveDivButton2Timer4Custorm != undefined && apisMoveDivButton2Timer != null) {
  97. $.each(apisMoveDivButton2Timer4Custorm, function (index, obj) {
  98. clearInterval(obj);
  99. });
  100. }
  101. //$("#apis-move-content").find("tbody.contentTD").html('');
  102. //$("#apis-move-content").find("span.contentSPAN").html('');
  103. actualFlag = false;
  104. }
  105. }
  106. function initOther4Select() {
  107. $.ajax({
  108. url: "coin/findApiConfig", //请求的url地址
  109. dataType: "json", //返回格式为json
  110. type: "post", //请求方式
  111. contentType: "application/json;charset=utf-8",
  112. async: false, //请求是否异步,默认为异步,这也是ajax重要特性
  113. success: function (data) {
  114. //请求成功时处理
  115. if (data != null && $.trim(data) != "" && data.success) {
  116. data = data.data;
  117. var quietStr = '';
  118. var moveStr = '';
  119. var move2Str = '';
  120. $.each(data, function (index, obj) {
  121. if (obj.type2 === 1) {
  122. if (obj.type === 0) {
  123. var nameEn = $('#' + obj.nameEn);
  124. nameEn.attr('nameEn', obj.nameEn);
  125. nameEn.attr('url', obj.url);
  126. nameEn.attr('typetype', obj.type);
  127. nameEn.attr('returnEn', obj.returnEn);
  128. nameEn.attr('returnCn', obj.returnCn);
  129. move2Str += obj.nameCn + '|';
  130. } else {
  131. moveStr += '<option type="9999" nameEn="' + obj.nameEn + '" url="' + obj.url + '" returnEn="' + obj.returnEn + '" returnCn="' + obj.returnCn + '" value="' + obj.nameEn + '-option">' + obj.nameCn + '</option>';
  132. }
  133. } else if (obj.type2 === 2) {
  134. quietStr += '<option typetype="' + obj.type + '" nameEn="' + obj.nameEn + '" url="' + obj.url + '" returnEn="' + obj.returnEn + '" returnCn="' + obj.returnCn + '" value="' + obj.nameEn + '-option">' + obj.nameCn + '</option>';
  135. }
  136. // watchlist
  137. if (obj.nameEn === 'watchlist') {
  138. var watchlistTrackCategoryStr = '';
  139. $.each(obj.trackCategoryList, function (index2, obj2) {
  140. watchlistTrackCategoryStr += '<option value="' + obj2 + '">' + obj2 + '</option>';
  141. });
  142. $("#apis-quiet-div-watchlist-trackCategoryField").append(watchlistTrackCategoryStr);
  143. var watchlistTrackCategory2Str = '';
  144. $.each(obj.trackCategory2List, function (index2, obj2) {
  145. watchlistTrackCategory2Str += '<option value="' + obj2 + '">' + obj2 + '</option>';
  146. });
  147. $("#apis-quiet-div-watchlist-trackCategory2Field").append(watchlistTrackCategory2Str);
  148. } else if (obj.nameEn === 'image') {
  149. var uploadImageCategoryStr = '';
  150. $.each(obj.otherAttrList, function (index2, obj2) {
  151. uploadImageCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
  152. });
  153. $("#apis-quiet-div-uploadImgs-categoryField").append(uploadImageCategoryStr);
  154. $("#apis-quiet-div-image-categoryField").append(uploadImageCategoryStr);
  155. } else if (obj.nameEn === 'music') {
  156. var uploadMusicCategoryStr = '';
  157. $.each(obj.musicCategoryList, function (index2, obj2) {
  158. uploadMusicCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
  159. });
  160. $("#apis-quiet-div-uploadMusics-categoryField").append(uploadMusicCategoryStr);
  161. $("#apis-quiet-div-music-categoryField").append(uploadMusicCategoryStr);
  162. // 初始化Select2并设置宽度
  163. $('#apis-quiet-div-uploadMusics-categoryField').select2({
  164. placeholder: '请选择分类', // 占位符
  165. allowClear: true, // 允许清除选择
  166. width: '160px' // 在初始化时设置宽度
  167. });
  168. } else if (obj.nameEn === 'currentHolding') {
  169. var exchangeCategoryStr = '';
  170. $.each(obj.exchangeCategoryList, function (index2, obj2) {
  171. exchangeCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
  172. });
  173. $("#apis-quiet-div-currentHolding-categoryField").append(exchangeCategoryStr);
  174. } else if (obj.nameEn === 'bookmark') {
  175. var categoryStr = '';
  176. $.each(obj.categoryList, function (index2, obj2) {
  177. categoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
  178. });
  179. $("#apis-quiet-div-bookmark-categoryField").append(categoryStr);
  180. }
  181. });
  182. move2Str = '<option nameEn="needCustom" type="9999">' + move2Str.substring(0, move2Str.length - 1) + '</option>';
  183. $("select#apis-move-select").html(move2Str + moveStr);
  184. $("select#apis-quiet-select").html(quietStr);
  185. $("select#apis-move-select,select#apis-quiet-select").change(function () {
  186. handleSelectChange($(this));
  187. stopFlag = true;
  188. });
  189. } else {
  190. //alert(data.message);
  191. }
  192. },
  193. beforeSend: function () {
  194. },
  195. complete: function () {
  196. },
  197. error: function (data) {
  198. //请求出错处理
  199. //alert('error:' + data);
  200. }
  201. });
  202. }
  203. function handleSelectChange(objj) {
  204. $.each(objj, function (index, obj) {
  205. var selectedOption = $(obj).find("option:selected");
  206. var type = selectedOption.attr("type");
  207. var nameEn = selectedOption.attr("nameEn");
  208. if ($(obj).attr("id") === 'apis-move-select') {
  209. ownClearInterval();
  210. }
  211. if (type === '9999') {
  212. $("#apis-move-content").find("div").slideUp("slow");
  213. if (nameEn === 'needCustom') {
  214. $.each($(".needCustomInput"), function (index, ob) {
  215. var returnEn = $(ob).attr("returnen").split(",");
  216. var returnCn = $(ob).attr("returncn").split(",");
  217. var theadStr = '';
  218. $.each(returnEn, function (index, o) {
  219. theadStr += '<th returnEn="' + o + '">' + returnCn[index] + '</th>';
  220. });
  221. $("#apis-move-content-" + $(ob).attr("id")).find("span.contentSPAN").html('0');
  222. $("#apis-move-content-" + $(ob).attr("id")).find("tr.contentTH").html(theadStr);
  223. $("#apis-move-content-" + $(ob).attr("id")).find("tbody.contentTD").html('');
  224. $("#apis-move-content-" + $(ob).attr("id")).slideDown("slow");
  225. });
  226. } else {
  227. var returnEn = selectedOption.attr("returnen").split(",");
  228. var returnCn = selectedOption.attr("returncn").split(",");
  229. var theadStr = '';
  230. $.each(returnEn, function (index, ob) {
  231. theadStr += '<th returnEn="' + obj + '">' + returnCn[index] + '</th>';
  232. });
  233. $("#apis-move-content-other").find("span.contentSPAN").html('0');
  234. $("#apis-move-content-other").find("tr.contentTH").html(theadStr);
  235. $("#apis-move-content-other").find("tbody.contentTD").html('');
  236. $("#apis-move-content-other").slideDown("slow");
  237. }
  238. } else {
  239. var returnEn = selectedOption.attr("returnen").split(",");
  240. var returnCn = selectedOption.attr("returncn").split(",");
  241. var theadStr = '';
  242. $.each(returnEn, function (index, obj) {
  243. theadStr += '<th returnEn="' + obj + '">' + returnCn[index] + '</th>';
  244. });
  245. if (nameEn === 'watchlist' || nameEn === 'image' || nameEn === 'music') {
  246. theadStr += '<th>操作</th>';
  247. }
  248. if (nameEn === 'music') {
  249. $("#apis-quiet-content > audio").css("display", "block");
  250. $("#apis-quiet-content > audio").on('ended', function () {
  251. let totalCount = $("div#apis-quiet-content").find("span.contentSPAN").text();
  252. if (totalCount === 0) {
  253. return;
  254. }
  255. let playRule = $("#apis-quiet-div-music-playRuleField").val();
  256. if (playRule === '1') {
  257. let randomNum = Math.floor(Math.random() * totalCount) + 1;
  258. let musicPageNo = $("#apis-quiet-div-music-pageNo").val();
  259. let musicPageSize = $("#apis-quiet-div-music-pageSize").val();
  260. if (randomNum >= (musicPageNo - 1) * musicPageSize + 1 && randomNum <= musicPageNo * musicPageSize) {
  261. let startNum = randomNum - ((musicPageNo - 1) * musicPageSize);
  262. $('#apis-quiet-content').find(".contentTD > tr").eq(startNum - 1).find("button.apis-quiet-div-music-play").click();
  263. } else {
  264. let toMusicPageNo = Math.floor(randomNum / musicPageSize + 1);
  265. $("#apis-quiet-div-music-pageNo").val(toMusicPageNo);
  266. $("#apis-quiet-div").find("button.apis-quiet-div-button2").click();
  267. let startNum = randomNum - ((toMusicPageNo - 1) * musicPageSize);
  268. setTimeout(function () {
  269. $('#apis-quiet-content').find(".contentTD > tr").eq(startNum - 1).find("button.apis-quiet-div-music-play").click();
  270. }, 3000);
  271. }
  272. } else if (playRule === '2') {
  273. let nextTr = $("#apis-quiet-content").find(".contentTD").find('td.music_highlight').parent("tr").next("tr");
  274. if (nextTr.length > 0) {
  275. $(this).find("button.apis-quiet-div-music-play").click();
  276. } else {
  277. let musicPageNo = $("#apis-quiet-div-music-pageNo").val();
  278. let musicPages = $("#apis-quiet-div-music-pages").val();
  279. if (musicPageNo < musicPages) {
  280. $("#apis-quiet-div-music").find("button[pageo='next']").click();
  281. } else {
  282. $("#apis-quiet-div-music-pageNo").val(1);
  283. $("#apis-quiet-div").find("button.apis-quiet-div-button2").click();
  284. }
  285. setTimeout(function () {
  286. $('#apis-quiet-content').find(".contentTD > tr").eq(0).find("button.apis-quiet-div-music-play").click();
  287. }, 3000);
  288. }
  289. } else if (playRule === '3') {
  290. $("#apis-quiet-content").find(".contentTD").find('td.music_highlight').parent("tr").find("button.apis-quiet-div-music-play").click();
  291. }
  292. });
  293. $("button.apis-quiet-div-music-start").click(function () {
  294. let totalCount = $("div#apis-quiet-content").find("span.contentSPAN").text();
  295. if (totalCount === 0) {
  296. return;
  297. }
  298. let playRule = $("#apis-quiet-div-music-playRuleField").val();
  299. if (playRule === '1') {
  300. let randomNum = Math.floor(Math.random() * totalCount) + 1;
  301. let musicPageNo = $("#apis-quiet-div-music-pageNo").val();
  302. let musicPageSize = $("#apis-quiet-div-music-pageSize").val();
  303. if (randomNum >= (musicPageNo - 1) * musicPageSize + 1 && randomNum <= musicPageNo * musicPageSize) {
  304. let startNum = randomNum - ((musicPageNo - 1) * musicPageSize);
  305. $('#apis-quiet-content').find(".contentTD > tr").eq(startNum - 1).find("button.apis-quiet-div-music-play").click();
  306. } else {
  307. let toMusicPageNo = Math.floor(randomNum / musicPageSize + 1);
  308. $("#apis-quiet-div-music-pageNo").val(toMusicPageNo);
  309. $("#apis-quiet-div").find("button.apis-quiet-div-button2").click();
  310. let startNum = randomNum - ((toMusicPageNo - 1) * musicPageSize);
  311. setTimeout(function () {
  312. $('#apis-quiet-content').find(".contentTD > tr").eq(startNum - 1).find("button.apis-quiet-div-music-play").click();
  313. }, 3000);
  314. }
  315. } else if (playRule === '2') {
  316. $('#apis-quiet-content').find(".contentTD > tr").eq(0).find("button.apis-quiet-div-music-play").click();
  317. } else if (playRule === '3') {
  318. $('#apis-quiet-content').find(".contentTD > tr").eq(0).find("button.apis-quiet-div-music-play").click();
  319. }
  320. });
  321. } else {
  322. $("#apis-quiet-content > audio").css("display", "none");
  323. $("#apis-quiet-content > audio > source").attr("src", "");
  324. $("#apis-quiet-content > audio")[0].load();
  325. }
  326. if (nameEn === 'currentHolding') {
  327. $("span.contentSPAN2").css("display", "inline");
  328. $("span.contentSPAN2").dblclick(function () {
  329. if ($(this).html().includes("***")) {
  330. $(this).html($(this).attr("realV"));
  331. } else {
  332. $(this).html(' | ' + "***");
  333. }
  334. });
  335. } else {
  336. $("span.contentSPAN2").css("display", "none");
  337. $("span.contentSPAN2").unbind("dblclick");
  338. }
  339. $(obj).parent("div").next("div").find("span.contentSPAN").html('0');
  340. $(obj).parent("div").next("div").find("tr.contentTH").html(theadStr);
  341. $(obj).parent("div").next("div").find("tbody.contentTD").html('');
  342. $("div[id^=apis-quiet-div-]").css("display", "none");
  343. $("#apis-quiet-div-" + nameEn).css("display", "block");
  344. $("#apis-quiet-div-" + nameEn).find("input[id$=pageNo]").val(1);
  345. $("div[id^=apis-quiet-div-]").find($("button.apis-quiet-div-button3")).unbind("click");
  346. $("div[id^=apis-quiet-div-]").find($("button.apis-quiet-div-button3")).click(function () {
  347. stopFlag = false;
  348. var url = selectedOption.attr("url");
  349. var typetype = selectedOption.attr("typetype");
  350. var slideDiv = $(this).attr("slideDiv");
  351. var pageNoVar = $("#" + $(this).parent().attr("id") + "-pageNo");
  352. var pageO = $(this).attr("pageO");
  353. var beforePageNo = $(pageNoVar).val();
  354. if (pageO === 'prev') {
  355. if (beforePageNo > 1) {
  356. $(pageNoVar).val(Number(beforePageNo) - 1);
  357. }
  358. } else if (pageO === 'next') {
  359. if (beforePageNo < Number($("#apis-quiet-div-" + nameEn).find("input[id$=pages]").val())) {
  360. $(pageNoVar).val(Number(beforePageNo) + 1);
  361. }
  362. }
  363. mainSearch(url, nameEn, slideDiv, typetype, "2");
  364. });
  365. // 对输入框、选择框加入对应事件,方便及时筛选查询操作
  366. $("div[id^=apis-quiet-div-]").find("input[id$=keyword]").unbind("keydown");
  367. $("#apis-quiet-div-" + nameEn).find("input[id$=keyword]").keydown(function (e) {
  368. if (e.keyCode == 13) {
  369. $(".apis-quiet-div-button2").click();
  370. }
  371. });
  372. $("div[id^=apis-quiet-div-]").find("select").unbind("change");
  373. $("#apis-quiet-div-" + nameEn).find("select").change(function (e) {
  374. if ($(this).attr("id") === 'apis-quiet-div-music-playRuleField') {
  375. return;
  376. }
  377. $(".apis-quiet-div-button2").click();
  378. });
  379. }
  380. });
  381. $(objj).parent("div").next("div").find(".contentTH").find("th").dblclick(function () {
  382. cccField = $(this).attr("returnEn");
  383. });
  384. }
  385. /**
  386. * 多条件搜索
  387. * @param pageNo
  388. */
  389. function mainSearch(url, nameEn, slideDiv, typetype, needCustomFlag) {
  390. var jsonData = {};
  391. jsonData.url = url;
  392. jsonData.nameEn = nameEn;
  393. if (nameEn === 'currentPlan' || nameEn === 'orderMarginCoinCurrent') {
  394. jsonData.chaRateSort = $("#chaRateSort").val();
  395. } else if (nameEn === 'monitorCurrency') {
  396. jsonData.changeUtcSort = $("#changeUtcSort").val();
  397. } else if (nameEn === 'allPositionv2') {
  398. jsonData.unrealizedPLSort = $("#unrealizedPLSort").val();
  399. } else if (nameEn === 'orderHistoryProductType') {
  400. jsonData.pageNo = $("#apis-quiet-div-orderHistoryProductType-pageNo").val();
  401. jsonData.pageSize = $("#apis-quiet-div-orderHistoryProductType-pageSize").val();
  402. jsonData.keyword = $("#apis-quiet-div-orderHistoryProductType-keyword").val();
  403. jsonData.sortField = $("#apis-quiet-div-orderHistoryProductType-sortField").val();
  404. jsonData.sort = $("#apis-quiet-div-orderHistoryProductType-sort").val();
  405. jsonData.side = $("#apis-quiet-div-orderHistoryProductType-side").val();
  406. } else if (nameEn === 'traderList') {
  407. jsonData.pageNo = $("#apis-quiet-div-traderList-pageNo").val();
  408. jsonData.pageSize = $("#apis-quiet-div-traderList-pageSize").val();
  409. jsonData.keyword = $("#apis-quiet-div-traderList-keyword").val();
  410. jsonData.sortField = $("#apis-quiet-div-traderList-sortField").val();
  411. jsonData.sort = $("#apis-quiet-div-traderList-sort").val();
  412. jsonData.canTrace = $("#apis-quiet-div-traderList-canTrace").val();
  413. } else if (nameEn === 'watchlist') {
  414. jsonData.pageNo = $("#apis-quiet-div-watchlist-pageNo").val();
  415. jsonData.pageSize = $("#apis-quiet-div-watchlist-pageSize").val();
  416. jsonData.keyword = $("#apis-quiet-div-watchlist-keyword").val();
  417. jsonData.sortField = $("#apis-quiet-div-watchlist-sortField").val();
  418. jsonData.sort = $("#apis-quiet-div-watchlist-sort").val();
  419. jsonData.filterField = $("#apis-quiet-div-watchlist-filterField").val();
  420. jsonData.trackCategoryField = $("#apis-quiet-div-watchlist-trackCategoryField").val();
  421. jsonData.trackCategory2Field = $("#apis-quiet-div-watchlist-trackCategory2Field").val();
  422. jsonData.cexFilterField = $("#apis-quiet-div-watchlist-cexFilterField").val();
  423. } else if (nameEn === 'image') {
  424. jsonData.pageNo = $("#apis-quiet-div-image-pageNo").val();
  425. jsonData.pageSize = $("#apis-quiet-div-image-pageSize").val();
  426. jsonData.keyword = $("#apis-quiet-div-image-keyword").val();
  427. jsonData.sortField = $("#apis-quiet-div-image-sortField").val();
  428. jsonData.sort = $("#apis-quiet-div-image-sort").val();
  429. jsonData.categoryField = $("#apis-quiet-div-image-categoryField").val();
  430. } else if (nameEn === 'cmcmap') {
  431. jsonData.pageNo = $("#apis-quiet-div-cmcmap-pageNo").val();
  432. jsonData.pageSize = $("#apis-quiet-div-cmcmap-pageSize").val();
  433. jsonData.keyword = $("#apis-quiet-div-cmcmap-keyword").val();
  434. jsonData.sortField = $("#apis-quiet-div-cmcmap-sortField").val();
  435. jsonData.sort = $("#apis-quiet-div-cmcmap-sort").val();
  436. jsonData.filterField = $("#apis-quiet-div-cmcmap-filterField").val();
  437. } else if (nameEn === 'music') {
  438. jsonData.pageNo = $("#apis-quiet-div-music-pageNo").val();
  439. jsonData.pageSize = $("#apis-quiet-div-music-pageSize").val();
  440. jsonData.keyword = $("#apis-quiet-div-music-keyword").val();
  441. jsonData.sortField = $("#apis-quiet-div-music-sortField").val();
  442. jsonData.sort = $("#apis-quiet-div-music-sort").val();
  443. jsonData.categoryField = $("#apis-quiet-div-music-categoryField").val();
  444. } else if (nameEn === 'currentHolding') {
  445. jsonData.pageNo = $("#apis-quiet-div-currentHolding-pageNo").val();
  446. jsonData.pageSize = $("#apis-quiet-div-currentHolding-pageSize").val();
  447. jsonData.keyword = $("#apis-quiet-div-currentHolding-keyword").val();
  448. jsonData.sortField = $("#apis-quiet-div-currentHolding-sortField").val();
  449. jsonData.sort = $("#apis-quiet-div-currentHolding-sort").val();
  450. jsonData.categoryField = $("#apis-quiet-div-currentHolding-categoryField").val();
  451. jsonData.status = $("#apis-quiet-div-currentHolding-status").val();
  452. } else if (nameEn === 'bookmark') {
  453. jsonData.pageNo = $("#apis-quiet-div-bookmark-pageNo").val();
  454. jsonData.pageSize = $("#apis-quiet-div-bookmark-pageSize").val();
  455. jsonData.keyword = $("#apis-quiet-div-bookmark-keyword").val();
  456. jsonData.sortField = $("#apis-quiet-div-bookmark-sortField").val();
  457. jsonData.sort = $("#apis-quiet-div-bookmark-sort").val();
  458. jsonData.categoryField = $("#apis-quiet-div-bookmark-categoryField").val();
  459. jsonData.subCategoryField = $("#apis-quiet-div-bookmark-subCategoryField").val();
  460. }
  461. $.ajax({
  462. url: "coin/mainSearch", //请求的url地址
  463. dataType: "json", //返回格式为json
  464. data: JSON.stringify(jsonData), //参数值
  465. type: "post", //请求方式
  466. contentType: "application/json;charset=utf-8",
  467. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  468. success: function (data) {
  469. //请求成功时处理
  470. if (data != null && $.trim(data) != "" && data.success) {
  471. if (stopFlag) {
  472. return;
  473. }
  474. if (nameEn === 'orderHistoryProductType' || nameEn === 'traderList' || nameEn === 'watchlist' || nameEn === 'image' || nameEn === 'cmcmap' || nameEn === 'music' || nameEn === 'currentHolding' || nameEn === 'bookmark') {
  475. $("#apis-quiet-div-" + nameEn).find("input[id$=pages]").val(data.data.pages);
  476. $('#' + slideDiv).find("span.contentSPAN").html(data.data.total);
  477. data = data.data.list;
  478. } else {
  479. data = data.data;
  480. $('#' + slideDiv).find("span.contentSPAN").html(data.length);
  481. }
  482. var returnEn = '';
  483. if (needCustomFlag === '1') {
  484. returnEn = $("#" + nameEn).attr("returnen").split(",");
  485. } else {
  486. var selectedOption = $('option[nameen="' + nameEn + '"]');
  487. returnEn = selectedOption.attr("returnen").split(",");
  488. }
  489. var str = '';
  490. var title = 'Coin主页|';
  491. for (var i = 0; i < data.length; i++) {
  492. var dataDetail = data[i];
  493. if (nameEn === 'allPositionv2') {
  494. var bbbField = $(".apis-move-div-input1").val();
  495. var symbol = dataDetail.symbol;
  496. if (cccField.length > 0 && bbbField.length > 0 && symbol.indexOf(bbbField) != -1) {
  497. title += bbbField + '|' + dataDetail[cccField];
  498. $("title").html(title);
  499. }
  500. }
  501. str += '<tr>';
  502. $.each(returnEn, function (index, obj) {
  503. var objStyle = dataDetail.hasOwnProperty(obj + 'Style') && dataDetail[obj + 'Style'] != null ? dataDetail[obj + 'Style'] : '';
  504. var objContent = dataDetail.hasOwnProperty(obj) ? dataDetail[obj] : '--';
  505. if (nameEn === 'currentHolding') {
  506. objContent = objContent != null ? objContent : '--';
  507. }else if (nameEn === 'bookmark') {
  508. objContent = objContent != null ? objContent : '--';
  509. }
  510. str += '<td' + objStyle + '>' + objContent + '</td>';
  511. });
  512. if (nameEn === 'watchlist') {
  513. str += '<td style="padding: 0px 10px 0px 10px;">';
  514. str += '<button class="apis-quiet-div-watchlist-detail" operationType="detail" symbolName="' + dataDetail.symbol + '">详情</button>';
  515. str += '<button class="apis-quiet-div-watchlist-update" operationType="update" symbolName="' + dataDetail.symbol + '">编辑</button>';
  516. str += '</td>';
  517. } else if (nameEn === 'image') {
  518. str += '<td style="padding: 0px 10px 0px 10px;">';
  519. str += '<button class="apis-quiet-div-image-delete" operationType="delete" symbolName="' + dataDetail.id + '">删除</button>';
  520. str += '</td>';
  521. } else if (nameEn === 'music') {
  522. str += '<td style="padding: 0px 10px 0px 10px;">';
  523. str += '<button class="apis-quiet-div-music-play" operationType="play" symbolName="' + dataDetail.lowQualityUrl + '">播放</button>';
  524. // str += '<button class="apis-quiet-div-music-pause" operationType="pause" symbolName="' + dataDetail.lowQualityUrl + '">暂停</button>';
  525. str += '<button class="apis-quiet-div-music-detail" operationType="detail" symbolName="' + dataDetail.id + '">详情</button>';
  526. str += '<button class="apis-quiet-div-music-update" operationType="update" symbolName="' + dataDetail.id + '">编辑</button>';
  527. str += '<button class="apis-quiet-div-music-delete" operationType="delete" symbolName="' + dataDetail.id + '">删除</button>';
  528. str += '</td>';
  529. }
  530. str += '</tr>';
  531. }
  532. if (nameEn === 'watchlist') {
  533. $(".apis-quiet-div-watchlist-detail").unbind("click");
  534. $(".apis-quiet-div-watchlist-update").unbind("click");
  535. $(".watchlistpreview-top-close").unbind("click");
  536. } else if (nameEn === 'image') {
  537. $(".apis-quiet-div-image-delete").unbind("click");
  538. } else if (nameEn === 'music') {
  539. $(".apis-quiet-div-music-delete").unbind("click");
  540. $(".apis-quiet-div-music-play").unbind("click");
  541. // $(".apis-quiet-div-music-pause").unbind("click");
  542. $(".apis-quiet-div-music-detail").unbind("click");
  543. $(".apis-quiet-div-music-update").unbind("click");
  544. }
  545. $('#' + slideDiv).find(".contentTD").html(str);
  546. initContentEvent(nameEn);
  547. } else {
  548. //alert(data.message);
  549. }
  550. },
  551. beforeSend: function () {
  552. if (typetype === '2') {
  553. $(".quiet-loading").css("display", "block");
  554. }
  555. },
  556. complete: function () {
  557. if (typetype === '2') {
  558. $(".quiet-loading").css("display", "none");
  559. }
  560. if (nameEn === 'currentHolding') {
  561. getCurrentHoldingTotalAmout(jsonData);
  562. }
  563. },
  564. error: function (data) {
  565. //请求出错处理
  566. //alert('error:' + data);
  567. }
  568. });
  569. }
  570. function getCurrentHoldingTotalAmout(jsonData) {
  571. $.ajax({
  572. url: "coin/getCurrentHoldingTotalAmout", //请求的url地址
  573. dataType: "json", //返回格式为json
  574. data: JSON.stringify(jsonData), //参数值
  575. type: "post", //请求方式
  576. contentType: "application/json;charset=utf-8",
  577. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  578. success: function (data) {
  579. //请求成功时处理
  580. if (data != null && $.trim(data) != "" && data.success) {
  581. let contentSPAN2 = $('#apis-quiet-content').find("span.contentSPAN2");
  582. contentSPAN2.attr("realV", ' | ' + data.data);
  583. contentSPAN2.html(' | ' + "***");
  584. } else {
  585. //alert(data.message);
  586. }
  587. },
  588. beforeSend: function () {
  589. },
  590. complete: function () {
  591. },
  592. error: function (data) {
  593. }
  594. });
  595. }
  596. /**
  597. * 初始化主内容事件
  598. */
  599. function initContentEvent(nameEn) {
  600. if ($(".apis-move-div-input1").val().length === 0) {
  601. $("title").html('Coin主页');
  602. }
  603. if (nameEn === 'watchlist') {
  604. $("ul li").click(function () {
  605. $.ajax({
  606. url: "coin/watchlistUpdate", //请求的url地址
  607. dataType: "json", //返回格式为json
  608. data: {
  609. "symbol": $(this).attr("id"),
  610. "score": $(this).attr("val")
  611. }, //参数值
  612. type: "post", //请求方式
  613. async: false, //请求是否异步,默认为异步,这也是ajax重要特性
  614. success: function (data) {
  615. //请求成功时处理
  616. if (data != null && $.trim(data) != "" && data.success) {
  617. $(".apis-quiet-div-button2").click();
  618. } else {
  619. console.log("watchlistUpdate-score success error," + data);
  620. }
  621. },
  622. beforeSend: function () {
  623. },
  624. complete: function () {
  625. },
  626. error: function (data) {
  627. //请求出错处理
  628. console.log("watchlistUpdate-score error," + data);
  629. }
  630. });
  631. });
  632. $(".apis-quiet-div-watchlist-detail,.apis-quiet-div-watchlist-update").click(function () {
  633. if ($("#watchlistpreview").css("display") === 'none') {
  634. $("#watchlistpreview").css("display", "block");
  635. } else if ($("#watchlistpreview").css("display") === 'block') {
  636. $("#watchlistpreview").css("display", "none");
  637. }
  638. $(".watchlistpreview-top-close").click(function () {
  639. if ($("#watchlistpreview").css("display") === 'none') {
  640. $("#watchlistpreview").css("display", "block");
  641. } else if ($("#watchlistpreview").css("display") === 'block') {
  642. $("#watchlistpreview").css("display", "none");
  643. }
  644. $(this).unbind("click");
  645. $(".watchlistpreview-top-submit").unbind("click");
  646. });
  647. $(".watchlistpreview-top-submit").click(function () {
  648. $.ajax({
  649. url: "coin/watchlistUpdate", //请求的url地址
  650. dataType: "json", //返回格式为json
  651. data: {"symbol": $(".watchlistpreview-content").find(".watchlistpreview-symbol").val(), "remark": $(".watchlistpreview-content").find("textarea").val()}, //参数值
  652. type: "post", //请求方式
  653. async: false, //请求是否异步,默认为异步,这也是ajax重要特性
  654. success: function (data) {
  655. //请求成功时处理
  656. if (data != null && $.trim(data) != "" && data.success) {
  657. $(".watchlistpreview-top-close").click();
  658. } else {
  659. console.log("watchlistpreview-top-submit success error," + data);
  660. }
  661. },
  662. beforeSend: function () {
  663. },
  664. complete: function () {
  665. },
  666. error: function (data) {
  667. //请求出错处理
  668. console.log("watchlistpreview-top-submit error," + data);
  669. }
  670. });
  671. });
  672. var operationType = $(this).attr("operationType");
  673. if (operationType === 'detail') {
  674. $(".watchlistpreview-top-submit").css("display", "none");
  675. } else if (operationType === 'update') {
  676. $(".watchlistpreview-top-submit").css("display", "block");
  677. }
  678. var symbol = $(this).attr("symbolName");
  679. $.ajax({
  680. url: "coin/watchlistDetail/" + symbol + "/" + operationType, //请求的url地址
  681. type: "get", //请求方式
  682. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  683. success: function (data) {
  684. //请求成功时处理
  685. if (data != null && $.trim(data) != "" && data.success) {
  686. data = data.data;
  687. if (operationType === 'detail') {
  688. $(".watchlistpreview-content").html(data);
  689. } else if (operationType === 'update') {
  690. var update4Text = '<textarea rows="4" cols="50" style="background: antiquewhite;width: 100%;height: 100%;">' + data + '</textarea>';
  691. update4Text += '<input type="hidden" class="watchlistpreview-symbol" value="' + symbol + '"/>';
  692. $(".watchlistpreview-content").html(update4Text);
  693. }
  694. } else {
  695. //alert(data.message);
  696. }
  697. },
  698. beforeSend: function () {
  699. $(".watchlistpreview-content").html("");
  700. $(".watchlistpreview-loading").css("display", "block");
  701. },
  702. complete: function () {
  703. $(".watchlistpreview-loading").css("display", "none");
  704. },
  705. error: function (data) {
  706. //请求出错处理
  707. alert('error:' + data);
  708. }
  709. });
  710. });
  711. } else if (nameEn === 'image') {
  712. $(".apis-quiet-div-image-delete").click(function () {
  713. var symbol = $(this).attr("symbolName");
  714. $.ajax({
  715. url: "pictureInfo/deleteImgs/" + symbol, //请求的url地址
  716. type: "get", //请求方式
  717. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  718. success: function (data) {
  719. //请求成功时处理
  720. if (data != null && $.trim(data) != "" && data.success) {
  721. $(".apis-quiet-div-button2").click();
  722. } else {
  723. alert(data.message);
  724. }
  725. },
  726. beforeSend: function () {
  727. $(".quiet-loading").css("display", "block");
  728. },
  729. complete: function () {
  730. $(".quiet-loading").css("display", "none");
  731. },
  732. error: function (data) {
  733. //请求出错处理
  734. alert('error:' + data);
  735. }
  736. });
  737. });
  738. } else if (nameEn === 'music') {
  739. $("ul li").click(function () {
  740. $.ajax({
  741. url: "musicInfo/musicUpdate", //请求的url地址
  742. dataType: "json", //返回格式为json
  743. data: {
  744. "symbol": $(this).attr("id"),
  745. "score": $(this).attr("val")
  746. }, //参数值
  747. type: "post", //请求方式
  748. async: false, //请求是否异步,默认为异步,这也是ajax重要特性
  749. success: function (data) {
  750. //请求成功时处理
  751. if (data != null && $.trim(data) != "" && data.success) {
  752. $(".apis-quiet-div-button2").click();
  753. } else {
  754. console.log("musicUpdate-score success error," + data);
  755. }
  756. },
  757. beforeSend: function () {
  758. },
  759. complete: function () {
  760. },
  761. error: function (data) {
  762. //请求出错处理
  763. console.log("musicUpdate-score error," + data);
  764. }
  765. });
  766. });
  767. $(".apis-quiet-div-music-delete").click(function () {
  768. var symbol = $(this).attr("symbolName");
  769. $.ajax({
  770. url: "musicInfo/deleteMusics/" + symbol, //请求的url地址
  771. type: "get", //请求方式
  772. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  773. success: function (data) {
  774. //请求成功时处理
  775. if (data != null && $.trim(data) != "" && data.success) {
  776. $(".apis-quiet-div-button2").click();
  777. } else {
  778. alert(data.message);
  779. }
  780. },
  781. beforeSend: function () {
  782. $(".quiet-loading").css("display", "block");
  783. },
  784. complete: function () {
  785. $(".quiet-loading").css("display", "none");
  786. },
  787. error: function (data) {
  788. //请求出错处理
  789. alert('error:' + data);
  790. }
  791. });
  792. });
  793. $(".apis-quiet-div-music-play").click(function () {
  794. var symbol = $(this).attr("symbolName");
  795. var currentSrc = $("#apis-quiet-content > audio > source").attr("src");
  796. if (currentSrc === symbol) {
  797. $("#apis-quiet-content > audio")[0].play();
  798. } else {
  799. $("#apis-quiet-content > audio > source").attr("src", symbol);
  800. $("#apis-quiet-content > audio")[0].load();
  801. $("#apis-quiet-content > audio")[0].play();
  802. }
  803. $("#apis-quiet-content").find(".contentTD > tr").find('td:nth-child(2)').removeClass("music_highlight");
  804. $(this).parent("td").parent("tr").find('td:nth-child(2)').addClass("music_highlight");
  805. });
  806. /*$(".apis-quiet-div-music-pause").click(function () {
  807. var symbol = $(this).attr("symbolName");
  808. $("#apis-quiet-content > audio")[0].pause();
  809. });*/
  810. $(".apis-quiet-div-music-detail,.apis-quiet-div-music-update").click(function () {
  811. if ($("#musicpreview").css("display") === 'none') {
  812. $("#musicpreview").css("display", "block");
  813. } else if ($("#musicpreview").css("display") === 'block') {
  814. $("#musictpreview").css("display", "none");
  815. }
  816. $(".musicpreview-top-close").click(function () {
  817. if ($("#musicpreview").css("display") === 'none') {
  818. $("#musicpreview").css("display", "block");
  819. } else if ($("#musicpreview").css("display") === 'block') {
  820. $("#musicpreview").css("display", "none");
  821. }
  822. $(this).unbind("click");
  823. $(".musicpreview-top-submit").unbind("click");
  824. });
  825. $(".musicpreview-top-submit").click(function () {
  826. $.ajax({
  827. url: "musicInfo/musicUpdate", //请求的url地址
  828. dataType: "json", //返回格式为json
  829. data: {"symbol": $(".musicpreview-content").find(".musicpreview-symbol").val(), "remark": $(".musicpreview-content").find("textarea").val()}, //参数值
  830. type: "post", //请求方式
  831. async: false, //请求是否异步,默认为异步,这也是ajax重要特性
  832. success: function (data) {
  833. //请求成功时处理
  834. if (data != null && $.trim(data) != "" && data.success) {
  835. $(".musicpreview-top-close").click();
  836. } else {
  837. console.log("musicpreview-top-submit success error," + data);
  838. }
  839. },
  840. beforeSend: function () {
  841. },
  842. complete: function () {
  843. },
  844. error: function (data) {
  845. //请求出错处理
  846. console.log("musicpreview-top-submit error," + data);
  847. }
  848. });
  849. });
  850. var operationType = $(this).attr("operationType");
  851. if (operationType === 'detail') {
  852. $(".musicpreview-top-submit").css("display", "none");
  853. } else if (operationType === 'update') {
  854. $(".musicpreview-top-submit").css("display", "block");
  855. }
  856. var symbol = $(this).attr("symbolName");
  857. $.ajax({
  858. url: "musicInfo/musicDetail/" + symbol + "/" + operationType, //请求的url地址
  859. type: "get", //请求方式
  860. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  861. success: function (data) {
  862. //请求成功时处理
  863. if (data != null && $.trim(data) != "" && data.success) {
  864. data = data.data;
  865. if (operationType === 'detail') {
  866. $(".musicpreview-content").html(data);
  867. } else if (operationType === 'update') {
  868. var update4Text = '<textarea rows="4" cols="50" style="background: antiquewhite;width: 100%;height: 100%;">' + data + '</textarea>';
  869. update4Text += '<input type="hidden" class="musicpreview-symbol" value="' + symbol + '"/>';
  870. $(".musicpreview-content").html(update4Text);
  871. }
  872. } else {
  873. //alert(data.message);
  874. }
  875. },
  876. beforeSend: function () {
  877. $(".musicpreview-content").html("");
  878. $(".musicpreview-loading").css("display", "block");
  879. },
  880. complete: function () {
  881. $(".musicpreview-loading").css("display", "none");
  882. },
  883. error: function (data) {
  884. //请求出错处理
  885. alert('error:' + data);
  886. }
  887. });
  888. });
  889. }
  890. if (nameEn === 'orderHistoryProductType' || nameEn === 'traderList' || nameEn === 'watchlist' || nameEn === 'image' || nameEn === 'cmcmap') {
  891. // 鼠标滑过 开启菜单
  892. $(".primary").mouseenter(function () {
  893. savIDMouseEnter($(this), nameEn);
  894. });
  895. // 鼠标离开 关闭菜单
  896. $(".primary").mouseleave(function () {
  897. savIDMouseLeave($(this), nameEn);
  898. });
  899. }
  900. }
  901. function uploadImgsSubmit(){
  902. var fromData = new FormData($("#uploadImgs")[0]);
  903. $.ajax({
  904. url: "pictureInfo/insertOrUpdateImg", //请求的url地址
  905. dataType: "json", //返回格式为json
  906. data: fromData, //参数值
  907. type: "post", //请求方式
  908. processData: false,// 告诉jQuery不要去处理发送的数据
  909. contentType: false,// 告诉jQuery不要去设置Content-Type请求头
  910. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  911. success: function (data) {
  912. $(".uploadImgs-loading").css("display", "none");
  913. //请求成功时处理
  914. if (data != null && $.trim(data) != "" && data.success) {
  915. $("#uploadImgsAlert").html(JSON.stringify(data.data));
  916. var quietSelectOption = $("#apis-quiet-select option:selected");
  917. if ($(quietSelectOption).attr("nameen") === 'image') {
  918. $(".apis-quiet-div-button2").click();
  919. }
  920. } else {
  921. $("#uploadImgsAlert").html(data.message);
  922. }
  923. },
  924. beforeSend: function () {
  925. $(".uploadImgs-loading").css("display", "block");
  926. },
  927. complete: function () {
  928. },
  929. error: function (data) {
  930. //请求出错处理
  931. console.log("uploadImgs-submit error," + data);
  932. }
  933. });
  934. }
  935. function uploadMusicsSubmit(){
  936. var fromData = new FormData($("#uploadMusics")[0]);
  937. $.ajax({
  938. url: "musicInfo/insertOrUpdateMusic", //请求的url地址
  939. dataType: "json", //返回格式为json
  940. data: fromData, //参数值
  941. type: "post", //请求方式
  942. processData: false,// 告诉jQuery不要去处理发送的数据
  943. contentType: false,// 告诉jQuery不要去设置Content-Type请求头
  944. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  945. success: function (data) {
  946. $(".uploadMusics-loading").css("display", "none");
  947. //请求成功时处理
  948. if (data != null && $.trim(data) != "" && data.success) {
  949. $("#uploadMusicsAlert").html(JSON.stringify(data.data));
  950. var quietSelectOption = $("#apis-quiet-select option:selected");
  951. if ($(quietSelectOption).attr("nameen") === 'music') {
  952. $(".apis-quiet-div-button2").click();
  953. }
  954. } else {
  955. $("#uploadMusicsAlert").html(data.message);
  956. }
  957. },
  958. beforeSend: function () {
  959. $(".uploadMusics-loading").css("display", "block");
  960. },
  961. complete: function () {
  962. },
  963. error: function (data) {
  964. //请求出错处理
  965. console.log("uploadMusics-submit error," + data);
  966. }
  967. });
  968. }
  969. function insertOrUpdateWatchlistSubmit(){
  970. var fromData = new FormData($("#insertOrUpdateWatchlist")[0]);
  971. $.ajax({
  972. url: "coin/insertOrUpdateWatchlist", //请求的url地址
  973. dataType: "json", //返回格式为json
  974. data: fromData, //参数值
  975. type: "post", //请求方式
  976. processData: false,// 告诉jQuery不要去处理发送的数据
  977. contentType: false,// 告诉jQuery不要去设置Content-Type请求头
  978. async: true, //请求是否异步,默认为异步,这也是ajax重要特性
  979. success: function (data) {
  980. $(".watchlist-loading").css("display", "none");
  981. //请求成功时处理
  982. if (data != null && $.trim(data) != "" && data.success) {
  983. $("#insertOrUpdateWatchlistAlert").html(JSON.stringify(data.data));
  984. var quietSelectOption = $("#apis-quiet-select option:selected");
  985. if ($(quietSelectOption).attr("nameen") === 'watchlist') {
  986. $(".apis-quiet-div-button2").click();
  987. }
  988. } else {
  989. $("#insertOrUpdateWatchlistAlert").html(data.message);
  990. }
  991. },
  992. beforeSend: function () {
  993. $(".watchlist-loading").css("display", "block");
  994. },
  995. complete: function () {
  996. },
  997. error: function (data) {
  998. //请求出错处理
  999. console.log("insertOrUpdateWatchlist-submit error," + data);
  1000. }
  1001. });
  1002. }
  1003. function initOther4Popup(){
  1004. // 打开弹窗
  1005. $(".apis-quiet-div-button3").on("click", function () {
  1006. var selectedOption = $("select#apis-quiet-select").find("option:selected");
  1007. var url = selectedOption.attr("url");
  1008. var typetype = selectedOption.attr("typetype");
  1009. var nameEn = selectedOption.attr("nameEn");
  1010. var slideDiv = $(this).attr("slideDiv");
  1011. quietPop(url, nameEn, slideDiv, typetype);
  1012. $(".popup").fadeIn();
  1013. centerPopup(); // 调用居中函数
  1014. });
  1015. // 关闭弹窗
  1016. $(".close-btn").on("click", function () {
  1017. $(".popup").fadeOut();
  1018. });
  1019. // 阻止表单默认提交行为
  1020. $(".popup form").on("submit", function (e) {
  1021. e.preventDefault();
  1022. alert("表单已提交!");
  1023. $(".popup").fadeOut();
  1024. });
  1025. // 实现拖动功能
  1026. let isDragging = false;
  1027. let offsetX, offsetY;
  1028. $("#draggable-popup").on("mousedown", function (e) {
  1029. isDragging = true;
  1030. offsetX = e.clientX - $(this).offset().left;
  1031. offsetY = e.clientY - $(this).offset().top;
  1032. $(this).css("cursor", "grabbing"); // 改变鼠标指针样式
  1033. });
  1034. $(document).on("mousemove", function (e) {
  1035. if (isDragging) {
  1036. const left = e.clientX - offsetX;
  1037. const top = e.clientY - offsetY;
  1038. $("#draggable-popup").css({
  1039. left: `${left}px`,
  1040. top: `${top}px`,
  1041. });
  1042. }
  1043. });
  1044. $(document).on("mouseup", function () {
  1045. isDragging = false;
  1046. $("#draggable-popup").css("cursor", "move"); // 恢复鼠标指针样式
  1047. });
  1048. // 重置按钮的功能
  1049. $("#reset-button").on("click", function () {
  1050. $(".progress-container").fadeOut(); // 重置时隐藏进度条
  1051. $(".loading-icon").fadeOut(); // 重置时隐藏加载图标
  1052. });
  1053. }
  1054. // 计算并设置弹窗居中位置
  1055. function centerPopup() {
  1056. const popup = $("#draggable-popup");
  1057. const windowWidth = $(window).width();
  1058. const windowHeight = $(window).height();
  1059. const popupWidth = popup.outerWidth();
  1060. const popupHeight = popup.outerHeight();
  1061. // 计算弹窗的位置
  1062. const left = (windowWidth - popupWidth) / 2;
  1063. const top = (windowHeight - popupHeight) / 2;
  1064. // 设置弹窗的位置
  1065. popup.css({
  1066. left: `${left}px`,
  1067. top: `${top}px`,
  1068. });
  1069. }
  1070. /**
  1071. * quietPop
  1072. * @param pageNo
  1073. */
  1074. function quietPop(url, nameEn, slideDiv, typetype) {
  1075. if (nameEn === 'currentPlan' || nameEn === 'orderMarginCoinCurrent') {
  1076. } else if (nameEn === 'monitorCurrency') {
  1077. } else if (nameEn === 'allPositionv2') {
  1078. } else if (nameEn === 'orderHistoryProductType') {
  1079. } else if (nameEn === 'traderList') {
  1080. } else if (nameEn === 'watchlist') {
  1081. let formContent = "";
  1082. formContent += '<div class="form-item"><label for="symbol">名称:</label><input type="text" id="symbol" placeholder="不可为空"></div>';
  1083. formContent += '<div class="form-item"><label for="trackCategory">赛道分类:</label><input type="text" id="trackCategory" placeholder="可为空"></div>';
  1084. formContent += '<div class="form-item"><label for="trackCategory2">赛道分类2:</label><input type="text" id="trackCategory2" placeholder="可为空"></div>';
  1085. formContent += '<div class="form-item"><label for="issuingDate">发行日期:</label><input type="text" id="issuingDate" placeholder="可为空"></div>';
  1086. formContent += '<div class="form-item"><label for="cmcId">cmcId:</label><input type="text" id="cmcId" placeholder="可为空"></div>';
  1087. formContent += '<div class="form-item"><label for="coingeckoId">coingeckoId:</label><input type="text" id="coingeckoId" placeholder="可为空"></div>';
  1088. formContent += '<div class="form-item"><label for="coingeckoUrl">coingeckoUrl:</label><input type="text" id="coingeckoUrl" placeholder="可为空"></div>';
  1089. formContent += '<div class="form-item"><label for="feixiaohaoUrl">feixiaohaoUrl:</label><input type="text" id="feixiaohaoUrl" placeholder="可为空"></div>';
  1090. formContent += '<div class="form-item"><label for="filterFlag">filterFlag:</label><input type="text" id="filterFlag" placeholder="不可为空"></div>';
  1091. formContent += '<div class="form-item"><label for="crudType">crudType:</label><input type="text" id="crudType" placeholder="不可为空"></div>';
  1092. $("#form-container").html(formContent);
  1093. $(".quietpop-content").html("");
  1094. } else if (nameEn === 'image') {
  1095. } else if (nameEn === 'cmcmap') {
  1096. } else if (nameEn === 'music') {
  1097. } else if (nameEn === 'currentHolding') {
  1098. } else if (nameEn === 'bookmark') {
  1099. }
  1100. }