my-coin.js 51 KB

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