| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085 |
- window.cccField = '';
- window.apisMoveDivButton2Timer = '';
- window.apisMoveDivButton2Timer4Custorm = [];
- window.actualFlag = false;
- window.stopFlag = false;
- $(function () {
- initOther();
- });
- /*var dragJob=false;
- $(document).on("mousedown", '.watchlistpreview-top', function (e) {
- dragJob = true;
- });
- document.onmousemove = function (e) {
- if (dragJob) {
- var e = e || window.event;
- var height = $(document.body).height();
- var width = $(window).width();
- var widthJob = $("#watchlistpreview").width();
- var heightJob = $("#watchlistpreview").height();
- var left = e.clientX - widthJob / 2;
- var top = e.clientY - 18 + $(document).scrollTop();
- if (top >= 0 && top < height - heightJob) {
- $("#watchlistpreview").css("top", top);
- }
- if (left >= 0 && left < width - widthJob) {
- $("#watchlistpreview").css("left", left);
- }
- return false;
- }
- };
- $(document).mouseup(function (e) {
- dragJob = false;
- });*/
- /**
- * 初始化其他操作
- */
- function initOther() {
- initOther4Select();
- handleSelectChange($("select#apis-move-select,select#apis-quiet-select"));
- $(".apis-move-div-button1,.apis-quiet-div-button1").click(function () {
- var aa = $(this).attr("slideDiv");
- var display = $('#' + aa);
- if (display.css('display') == 'block') {
- display.slideUp("slow");
- //display.css("display", "none");
- $(this).html('展开');
- } else {
- display.slideDown("slow");
- //display.css("display", "block");
- $(this).html('收起');
- }
- });
- $(".apis-move-div-button2").click(function () {
- var this_ = $(this);
- stopFlag = false;
- if (!actualFlag) {
- var selectedOption = $("select#apis-move-select").find("option:selected");
- var nameEn = selectedOption.attr("nameEn");
- if (nameEn === 'needCustom') {
- $.each($(".needCustomInput"), function (index, obj) {
- var url = $(obj).attr("url");
- var typetype = $(obj).attr("typetype");
- var nameEn2 = $(obj).attr("nameEn");
- var slideDiv = $(this_).attr("slideDiv") + '-' + $(obj).attr("id");
- apisMoveDivButton2Timer4Custorm[index] = setInterval(mainSearch, 3000, url, nameEn2, slideDiv, typetype, "1");
- });
- actualFlag = true;
- } else {
- var url = selectedOption.attr("url");
- var typetype = selectedOption.attr("typetype");
- var slideDiv = $(this).attr("slideDiv");
- apisMoveDivButton2Timer = setInterval(mainSearch, 3000, url, nameEn, slideDiv, typetype, "2");
- actualFlag = true;
- }
- }
- });
- $(".apis-quiet-div-button2").click(function () {
- stopFlag = false;
- var selectedOption = $("select#apis-quiet-select").find("option:selected");
- var url = selectedOption.attr("url");
- var typetype = selectedOption.attr("typetype");
- var nameEn = selectedOption.attr("nameEn");
- var slideDiv = $(this).attr("slideDiv");
- mainSearch(url, nameEn, slideDiv, typetype,"2");
- });
- $(".apis-move-div-button3").click(function () {
- ownClearInterval();
- });
- }
- function ownClearInterval() {
- if (actualFlag) {
- if (apisMoveDivButton2Timer != undefined && apisMoveDivButton2Timer != null) {
- clearInterval(apisMoveDivButton2Timer);
- }
- if (apisMoveDivButton2Timer4Custorm != undefined && apisMoveDivButton2Timer != null) {
- $.each(apisMoveDivButton2Timer4Custorm, function (index, obj) {
- clearInterval(obj);
- });
- }
- //$("#apis-move-content").find("tbody.contentTD").html('');
- //$("#apis-move-content").find("span.contentSPAN").html('');
- actualFlag = false;
- }
- }
- function initOther4Select() {
- $.ajax({
- url: "coin/findApiConfig", //请求的url地址
- dataType: "json", //返回格式为json
- type: "post", //请求方式
- contentType: "application/json;charset=utf-8",
- async: false, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- data = data.data;
- var quietStr = '';
- var moveStr = '';
- var move2Str = '';
- $.each(data, function (index, obj) {
- if (obj.type2 === 1) {
- if (obj.type === 0) {
- var nameEn = $('#' + obj.nameEn);
- nameEn.attr('nameEn', obj.nameEn);
- nameEn.attr('url', obj.url);
- nameEn.attr('typetype', obj.type);
- nameEn.attr('returnEn', obj.returnEn);
- nameEn.attr('returnCn', obj.returnCn);
- move2Str += obj.nameCn + '|';
- } else {
- moveStr += '<option type="9999" nameEn="' + obj.nameEn + '" url="' + obj.url + '" returnEn="' + obj.returnEn + '" returnCn="' + obj.returnCn + '" value="' + obj.nameEn + '-option">' + obj.nameCn + '</option>';
- }
- } else if (obj.type2 === 2) {
- quietStr += '<option typetype="' + obj.type + '" nameEn="' + obj.nameEn + '" url="' + obj.url + '" returnEn="' + obj.returnEn + '" returnCn="' + obj.returnCn + '" value="' + obj.nameEn + '-option">' + obj.nameCn + '</option>';
- }
- // watchlist
- if (obj.nameEn === 'watchlist') {
- var watchlistTrackCategoryStr = '';
- $.each(obj.trackCategoryList, function (index2, obj2) {
- watchlistTrackCategoryStr += '<option value="' + obj2 + '">' + obj2 + '</option>';
- });
- $("#apis-quiet-div-watchlist-trackCategoryField").append(watchlistTrackCategoryStr);
- var watchlistTrackCategory2Str = '';
- $.each(obj.trackCategory2List, function (index2, obj2) {
- watchlistTrackCategory2Str += '<option value="' + obj2 + '">' + obj2 + '</option>';
- });
- $("#apis-quiet-div-watchlist-trackCategory2Field").append(watchlistTrackCategory2Str);
- } else if (obj.nameEn === 'image') {
- var uploadImageCategoryStr = '';
- $.each(obj.otherAttrList, function (index2, obj2) {
- uploadImageCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
- });
- $("#apis-quiet-div-uploadImgs-categoryField").append(uploadImageCategoryStr);
- $("#apis-quiet-div-image-categoryField").append(uploadImageCategoryStr);
- } else if (obj.nameEn === 'music') {
- var uploadMusicCategoryStr = '';
- $.each(obj.musicCategoryList, function (index2, obj2) {
- uploadMusicCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
- });
- $("#apis-quiet-div-uploadMusics-categoryField").append(uploadMusicCategoryStr);
- $("#apis-quiet-div-music-categoryField").append(uploadMusicCategoryStr);
- // 初始化Select2并设置宽度
- $('#apis-quiet-div-uploadMusics-categoryField').select2({
- placeholder: '请选择分类', // 占位符
- allowClear: true, // 允许清除选择
- width: '160px' // 在初始化时设置宽度
- });
- } else if (obj.nameEn === 'currentHolding') {
- var exchangeCategoryStr = '';
- $.each(obj.exchangeCategoryList, function (index2, obj2) {
- exchangeCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
- });
- $("#apis-quiet-div-currentHolding-categoryField").append(exchangeCategoryStr);
- } else if (obj.nameEn === 'bookmark') {
- var categoryStr = '';
- $.each(obj.categoryList, function (index2, obj2) {
- categoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
- });
- $("#apis-quiet-div-bookmark-categoryField").append(categoryStr);
- }
- });
- move2Str = '<option nameEn="needCustom" type="9999">' + move2Str.substring(0, move2Str.length - 1) + '</option>';
- $("select#apis-move-select").html(move2Str + moveStr);
- $("select#apis-quiet-select").html(quietStr);
- $("select#apis-move-select,select#apis-quiet-select").change(function () {
- handleSelectChange($(this));
- stopFlag = true;
- });
- } else {
- //alert(data.message);
- }
- },
- beforeSend: function () {
- },
- complete: function () {
- },
- error: function (data) {
- //请求出错处理
- //alert('error:' + data);
- }
- });
- }
- function handleSelectChange(objj) {
- $.each(objj, function (index, obj) {
- var selectedOption = $(obj).find("option:selected");
- var type = selectedOption.attr("type");
- var nameEn = selectedOption.attr("nameEn");
- if ($(obj).attr("id") === 'apis-move-select') {
- ownClearInterval();
- }
- if (type === '9999') {
- $("#apis-move-content").find("div").slideUp("slow");
- if (nameEn === 'needCustom') {
- $.each($(".needCustomInput"), function (index, ob) {
- var returnEn = $(ob).attr("returnen").split(",");
- var returnCn = $(ob).attr("returncn").split(",");
- var theadStr = '';
- $.each(returnEn, function (index, o) {
- theadStr += '<th returnEn="' + o + '">' + returnCn[index] + '</th>';
- });
- $("#apis-move-content-" + $(ob).attr("id")).find("span.contentSPAN").html('0');
- $("#apis-move-content-" + $(ob).attr("id")).find("tr.contentTH").html(theadStr);
- $("#apis-move-content-" + $(ob).attr("id")).find("tbody.contentTD").html('');
- $("#apis-move-content-" + $(ob).attr("id")).slideDown("slow");
- });
- } else {
- var returnEn = selectedOption.attr("returnen").split(",");
- var returnCn = selectedOption.attr("returncn").split(",");
- var theadStr = '';
- $.each(returnEn, function (index, ob) {
- theadStr += '<th returnEn="' + obj + '">' + returnCn[index] + '</th>';
- });
- $("#apis-move-content-other").find("span.contentSPAN").html('0');
- $("#apis-move-content-other").find("tr.contentTH").html(theadStr);
- $("#apis-move-content-other").find("tbody.contentTD").html('');
- $("#apis-move-content-other").slideDown("slow");
- }
- } else {
- var returnEn = selectedOption.attr("returnen").split(",");
- var returnCn = selectedOption.attr("returncn").split(",");
- var theadStr = '';
- $.each(returnEn, function (index, obj) {
- theadStr += '<th returnEn="' + obj + '">' + returnCn[index] + '</th>';
- });
- if (nameEn === 'watchlist' || nameEn === 'image' || nameEn === 'music') {
- theadStr += '<th>操作</th>';
- }
- if (nameEn === 'music') {
- $("#apis-quiet-content > audio").css("display", "block");
- $("#apis-quiet-content > audio").on('ended', function () {
- let totalCount = $("div#apis-quiet-content").find("span.contentSPAN").text();
- if (totalCount === 0) {
- return;
- }
- let playRule = $("#apis-quiet-div-music-playRuleField").val();
- if (playRule === '1') {
- let randomNum = Math.floor(Math.random() * totalCount) + 1;
- let musicPageNo = $("#apis-quiet-div-music-pageNo").val();
- let musicPageSize = $("#apis-quiet-div-music-pageSize").val();
- if (randomNum >= (musicPageNo - 1) * musicPageSize + 1 && randomNum <= musicPageNo * musicPageSize) {
- let startNum = randomNum - ((musicPageNo - 1) * musicPageSize);
- $('#apis-quiet-content').find(".contentTD > tr").eq(startNum - 1).find("button.apis-quiet-div-music-play").click();
- } else {
- let toMusicPageNo = Math.floor(randomNum / musicPageSize + 1);
- $("#apis-quiet-div-music-pageNo").val(toMusicPageNo);
- $("#apis-quiet-div").find("button.apis-quiet-div-button2").click();
- let startNum = randomNum - ((toMusicPageNo - 1) * musicPageSize);
- setTimeout(function () {
- $('#apis-quiet-content').find(".contentTD > tr").eq(startNum - 1).find("button.apis-quiet-div-music-play").click();
- }, 3000);
- }
- } else if (playRule === '2') {
- let nextTr = $("#apis-quiet-content").find(".contentTD").find('td.music_highlight').parent("tr").next("tr");
- if (nextTr.length > 0) {
- $(this).find("button.apis-quiet-div-music-play").click();
- } else {
- let musicPageNo = $("#apis-quiet-div-music-pageNo").val();
- let musicPages = $("#apis-quiet-div-music-pages").val();
- if (musicPageNo < musicPages) {
- $("#apis-quiet-div-music").find("button[pageo='next']").click();
- } else {
- $("#apis-quiet-div-music-pageNo").val(1);
- $("#apis-quiet-div").find("button.apis-quiet-div-button2").click();
- }
- setTimeout(function () {
- $('#apis-quiet-content').find(".contentTD > tr").eq(0).find("button.apis-quiet-div-music-play").click();
- }, 3000);
- }
- } else if (playRule === '3') {
- $("#apis-quiet-content").find(".contentTD").find('td.music_highlight').parent("tr").find("button.apis-quiet-div-music-play").click();
- }
- });
- $("button.apis-quiet-div-music-start").click(function () {
- let totalCount = $("div#apis-quiet-content").find("span.contentSPAN").text();
- if (totalCount === 0) {
- return;
- }
- let playRule = $("#apis-quiet-div-music-playRuleField").val();
- if (playRule === '1') {
- let randomNum = Math.floor(Math.random() * totalCount) + 1;
- let musicPageNo = $("#apis-quiet-div-music-pageNo").val();
- let musicPageSize = $("#apis-quiet-div-music-pageSize").val();
- if (randomNum >= (musicPageNo - 1) * musicPageSize + 1 && randomNum <= musicPageNo * musicPageSize) {
- let startNum = randomNum - ((musicPageNo - 1) * musicPageSize);
- $('#apis-quiet-content').find(".contentTD > tr").eq(startNum - 1).find("button.apis-quiet-div-music-play").click();
- } else {
- let toMusicPageNo = Math.floor(randomNum / musicPageSize + 1);
- $("#apis-quiet-div-music-pageNo").val(toMusicPageNo);
- $("#apis-quiet-div").find("button.apis-quiet-div-button2").click();
- let startNum = randomNum - ((toMusicPageNo - 1) * musicPageSize);
- setTimeout(function () {
- $('#apis-quiet-content').find(".contentTD > tr").eq(startNum - 1).find("button.apis-quiet-div-music-play").click();
- }, 3000);
- }
- } else if (playRule === '2') {
- $('#apis-quiet-content').find(".contentTD > tr").eq(0).find("button.apis-quiet-div-music-play").click();
- } else if (playRule === '3') {
- $('#apis-quiet-content').find(".contentTD > tr").eq(0).find("button.apis-quiet-div-music-play").click();
- }
- });
- } else {
- $("#apis-quiet-content > audio").css("display", "none");
- $("#apis-quiet-content > audio > source").attr("src", "");
- $("#apis-quiet-content > audio")[0].load();
- }
- if (nameEn === 'currentHolding') {
- $("span.contentSPAN2").css("display", "inline");
- $("span.contentSPAN2").dblclick(function () {
- if ($(this).html().includes("***")) {
- $(this).html($(this).attr("realV"));
- } else {
- $(this).html(' | ' + "***");
- }
- });
- } else {
- $("span.contentSPAN2").css("display", "none");
- $("span.contentSPAN2").unbind("dblclick");
- }
- $(obj).parent("div").next("div").find("span.contentSPAN").html('0');
- $(obj).parent("div").next("div").find("tr.contentTH").html(theadStr);
- $(obj).parent("div").next("div").find("tbody.contentTD").html('');
- $("div[id^=apis-quiet-div-]").css("display", "none");
- $("#apis-quiet-div-" + nameEn).css("display", "block");
- $("#apis-quiet-div-" + nameEn).find("input[id$=pageNo]").val(1);
- $("div[id^=apis-quiet-div-]").find($("button.apis-quiet-div-button3")).unbind("click");
- $("div[id^=apis-quiet-div-]").find($("button.apis-quiet-div-button3")).click(function () {
- stopFlag = false;
- var url = selectedOption.attr("url");
- var typetype = selectedOption.attr("typetype");
- var slideDiv = $(this).attr("slideDiv");
- var pageNoVar = $("#" + $(this).parent().attr("id") + "-pageNo");
- var pageO = $(this).attr("pageO");
- var beforePageNo = $(pageNoVar).val();
- if (pageO === 'prev') {
- if (beforePageNo > 1) {
- $(pageNoVar).val(Number(beforePageNo) - 1);
- }
- } else if (pageO === 'next') {
- if (beforePageNo < Number($("#apis-quiet-div-" + nameEn).find("input[id$=pages]").val())) {
- $(pageNoVar).val(Number(beforePageNo) + 1);
- }
- }
- mainSearch(url, nameEn, slideDiv, typetype, "2");
- });
- // 对输入框、选择框加入对应事件,方便及时筛选查询操作
- $("div[id^=apis-quiet-div-]").find("input[id$=keyword]").unbind("keydown");
- $("#apis-quiet-div-" + nameEn).find("input[id$=keyword]").keydown(function (e) {
- if (e.keyCode == 13) {
- $(".apis-quiet-div-button2").click();
- }
- });
- $("div[id^=apis-quiet-div-]").find("select").unbind("change");
- $("#apis-quiet-div-" + nameEn).find("select").change(function (e) {
- if ($(this).attr("id") === 'apis-quiet-div-music-playRuleField') {
- return;
- }
- $(".apis-quiet-div-button2").click();
- });
- }
- });
- $(objj).parent("div").next("div").find(".contentTH").find("th").dblclick(function () {
- cccField = $(this).attr("returnEn");
- });
- }
- /**
- * 多条件搜索
- * @param pageNo
- */
- function mainSearch(url, nameEn, slideDiv, typetype, needCustomFlag) {
- var jsonData = {};
- jsonData.url = url;
- jsonData.nameEn = nameEn;
- if (nameEn === 'currentPlan' || nameEn === 'orderMarginCoinCurrent') {
- jsonData.chaRateSort = $("#chaRateSort").val();
- } else if (nameEn === 'monitorCurrency') {
- jsonData.changeUtcSort = $("#changeUtcSort").val();
- } else if (nameEn === 'allPositionv2') {
- jsonData.unrealizedPLSort = $("#unrealizedPLSort").val();
- } else if (nameEn === 'orderHistoryProductType') {
- jsonData.pageNo = $("#apis-quiet-div-orderHistoryProductType-pageNo").val();
- jsonData.pageSize = $("#apis-quiet-div-orderHistoryProductType-pageSize").val();
- jsonData.keyword = $("#apis-quiet-div-orderHistoryProductType-keyword").val();
- jsonData.sortField = $("#apis-quiet-div-orderHistoryProductType-sortField").val();
- jsonData.sort = $("#apis-quiet-div-orderHistoryProductType-sort").val();
- jsonData.side = $("#apis-quiet-div-orderHistoryProductType-side").val();
- } else if (nameEn === 'traderList') {
- jsonData.pageNo = $("#apis-quiet-div-traderList-pageNo").val();
- jsonData.pageSize = $("#apis-quiet-div-traderList-pageSize").val();
- jsonData.keyword = $("#apis-quiet-div-traderList-keyword").val();
- jsonData.sortField = $("#apis-quiet-div-traderList-sortField").val();
- jsonData.sort = $("#apis-quiet-div-traderList-sort").val();
- jsonData.canTrace = $("#apis-quiet-div-traderList-canTrace").val();
- } else if (nameEn === 'watchlist') {
- jsonData.pageNo = $("#apis-quiet-div-watchlist-pageNo").val();
- jsonData.pageSize = $("#apis-quiet-div-watchlist-pageSize").val();
- jsonData.keyword = $("#apis-quiet-div-watchlist-keyword").val();
- jsonData.sortField = $("#apis-quiet-div-watchlist-sortField").val();
- jsonData.sort = $("#apis-quiet-div-watchlist-sort").val();
- jsonData.filterField = $("#apis-quiet-div-watchlist-filterField").val();
- jsonData.trackCategoryField = $("#apis-quiet-div-watchlist-trackCategoryField").val();
- jsonData.trackCategory2Field = $("#apis-quiet-div-watchlist-trackCategory2Field").val();
- jsonData.cexFilterField = $("#apis-quiet-div-watchlist-cexFilterField").val();
- } else if (nameEn === 'image') {
- jsonData.pageNo = $("#apis-quiet-div-image-pageNo").val();
- jsonData.pageSize = $("#apis-quiet-div-image-pageSize").val();
- jsonData.keyword = $("#apis-quiet-div-image-keyword").val();
- jsonData.sortField = $("#apis-quiet-div-image-sortField").val();
- jsonData.sort = $("#apis-quiet-div-image-sort").val();
- jsonData.categoryField = $("#apis-quiet-div-image-categoryField").val();
- } else if (nameEn === 'cmcmap') {
- jsonData.pageNo = $("#apis-quiet-div-cmcmap-pageNo").val();
- jsonData.pageSize = $("#apis-quiet-div-cmcmap-pageSize").val();
- jsonData.keyword = $("#apis-quiet-div-cmcmap-keyword").val();
- jsonData.sortField = $("#apis-quiet-div-cmcmap-sortField").val();
- jsonData.sort = $("#apis-quiet-div-cmcmap-sort").val();
- jsonData.filterField = $("#apis-quiet-div-cmcmap-filterField").val();
- } else if (nameEn === 'music') {
- jsonData.pageNo = $("#apis-quiet-div-music-pageNo").val();
- jsonData.pageSize = $("#apis-quiet-div-music-pageSize").val();
- jsonData.keyword = $("#apis-quiet-div-music-keyword").val();
- jsonData.sortField = $("#apis-quiet-div-music-sortField").val();
- jsonData.sort = $("#apis-quiet-div-music-sort").val();
- jsonData.categoryField = $("#apis-quiet-div-music-categoryField").val();
- } else if (nameEn === 'currentHolding') {
- jsonData.pageNo = $("#apis-quiet-div-currentHolding-pageNo").val();
- jsonData.pageSize = $("#apis-quiet-div-currentHolding-pageSize").val();
- jsonData.keyword = $("#apis-quiet-div-currentHolding-keyword").val();
- jsonData.sortField = $("#apis-quiet-div-currentHolding-sortField").val();
- jsonData.sort = $("#apis-quiet-div-currentHolding-sort").val();
- jsonData.categoryField = $("#apis-quiet-div-currentHolding-categoryField").val();
- jsonData.status = $("#apis-quiet-div-currentHolding-status").val();
- } else if (nameEn === 'bookmark') {
- jsonData.pageNo = $("#apis-quiet-div-bookmark-pageNo").val();
- jsonData.pageSize = $("#apis-quiet-div-bookmark-pageSize").val();
- jsonData.keyword = $("#apis-quiet-div-bookmark-keyword").val();
- jsonData.sortField = $("#apis-quiet-div-bookmark-sortField").val();
- jsonData.sort = $("#apis-quiet-div-bookmark-sort").val();
- jsonData.categoryField = $("#apis-quiet-div-bookmark-categoryField").val();
- jsonData.subCategoryField = $("#apis-quiet-div-bookmark-subCategoryField").val();
- }
- $.ajax({
- url: "coin/mainSearch", //请求的url地址
- dataType: "json", //返回格式为json
- data: JSON.stringify(jsonData), //参数值
- type: "post", //请求方式
- contentType: "application/json;charset=utf-8",
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- if (stopFlag) {
- return;
- }
- if (nameEn === 'orderHistoryProductType' || nameEn === 'traderList' || nameEn === 'watchlist' || nameEn === 'image' || nameEn === 'cmcmap' || nameEn === 'music' || nameEn === 'currentHolding' || nameEn === 'bookmark') {
- $("#apis-quiet-div-" + nameEn).find("input[id$=pages]").val(data.data.pages);
- $('#' + slideDiv).find("span.contentSPAN").html(data.data.total);
- data = data.data.list;
- } else {
- data = data.data;
- $('#' + slideDiv).find("span.contentSPAN").html(data.length);
- }
- var returnEn = '';
- if (needCustomFlag === '1') {
- returnEn = $("#" + nameEn).attr("returnen").split(",");
- } else {
- var selectedOption = $('option[nameen="' + nameEn + '"]');
- returnEn = selectedOption.attr("returnen").split(",");
- }
- var str = '';
- var title = 'Coin主页|';
- for (var i = 0; i < data.length; i++) {
- var dataDetail = data[i];
- if (nameEn === 'allPositionv2') {
- var bbbField = $(".apis-move-div-input1").val();
- var symbol = dataDetail.symbol;
- if (cccField.length > 0 && bbbField.length > 0 && symbol.indexOf(bbbField) != -1) {
- title += bbbField + '|' + dataDetail[cccField];
- $("title").html(title);
- }
- }
- str += '<tr>';
- $.each(returnEn, function (index, obj) {
- var objStyle = dataDetail.hasOwnProperty(obj + 'Style') && dataDetail[obj + 'Style'] != null ? dataDetail[obj + 'Style'] : '';
- var objContent = dataDetail.hasOwnProperty(obj) ? dataDetail[obj] : '--';
- if (nameEn === 'currentHolding') {
- objContent = objContent != null ? objContent : '--';
- }else if (nameEn === 'bookmark') {
- objContent = objContent != null ? objContent : '--';
- }
- str += '<td' + objStyle + '>' + objContent + '</td>';
- });
- if (nameEn === 'watchlist') {
- str += '<td style="padding: 0px 10px 0px 10px;">';
- str += '<button class="apis-quiet-div-watchlist-detail" operationType="detail" symbolName="' + dataDetail.symbol + '">详情</button>';
- str += '<button class="apis-quiet-div-watchlist-update" operationType="update" symbolName="' + dataDetail.symbol + '">编辑</button>';
- str += '</td>';
- } else if (nameEn === 'image') {
- str += '<td style="padding: 0px 10px 0px 10px;">';
- str += '<button class="apis-quiet-div-image-delete" operationType="delete" symbolName="' + dataDetail.id + '">删除</button>';
- str += '</td>';
- } else if (nameEn === 'music') {
- str += '<td style="padding: 0px 10px 0px 10px;">';
- str += '<button class="apis-quiet-div-music-play" operationType="play" symbolName="' + dataDetail.lowQualityUrl + '">播放</button>';
- // str += '<button class="apis-quiet-div-music-pause" operationType="pause" symbolName="' + dataDetail.lowQualityUrl + '">暂停</button>';
- str += '<button class="apis-quiet-div-music-detail" operationType="detail" symbolName="' + dataDetail.id + '">详情</button>';
- str += '<button class="apis-quiet-div-music-update" operationType="update" symbolName="' + dataDetail.id + '">编辑</button>';
- str += '<button class="apis-quiet-div-music-delete" operationType="delete" symbolName="' + dataDetail.id + '">删除</button>';
- str += '</td>';
- }
- str += '</tr>';
- }
- if (nameEn === 'watchlist') {
- $(".apis-quiet-div-watchlist-detail").unbind("click");
- $(".apis-quiet-div-watchlist-update").unbind("click");
- $(".watchlistpreview-top-close").unbind("click");
- } else if (nameEn === 'image') {
- $(".apis-quiet-div-image-delete").unbind("click");
- } else if (nameEn === 'music') {
- $(".apis-quiet-div-music-delete").unbind("click");
- $(".apis-quiet-div-music-play").unbind("click");
- // $(".apis-quiet-div-music-pause").unbind("click");
- $(".apis-quiet-div-music-detail").unbind("click");
- $(".apis-quiet-div-music-update").unbind("click");
- }
- $('#' + slideDiv).find(".contentTD").html(str);
- initContentEvent(nameEn);
- } else {
- //alert(data.message);
- }
- },
- beforeSend: function () {
- if (typetype === '2') {
- $(".quiet-loading").css("display", "block");
- }
- },
- complete: function () {
- if (typetype === '2') {
- $(".quiet-loading").css("display", "none");
- }
- if (nameEn === 'currentHolding') {
- getCurrentHoldingTotalAmout(jsonData);
- }
- },
- error: function (data) {
- //请求出错处理
- //alert('error:' + data);
- }
- });
- }
- function getCurrentHoldingTotalAmout(jsonData) {
- $.ajax({
- url: "coin/getCurrentHoldingTotalAmout", //请求的url地址
- dataType: "json", //返回格式为json
- data: JSON.stringify(jsonData), //参数值
- type: "post", //请求方式
- contentType: "application/json;charset=utf-8",
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- let contentSPAN2 = $('#apis-quiet-content').find("span.contentSPAN2");
- contentSPAN2.attr("realV", ' | ' + data.data);
- contentSPAN2.html(' | ' + "***");
- } else {
- //alert(data.message);
- }
- },
- beforeSend: function () {
- },
- complete: function () {
- },
- error: function (data) {
- }
- });
- }
- /**
- * 初始化主内容事件
- */
- function initContentEvent(nameEn) {
- if ($(".apis-move-div-input1").val().length === 0) {
- $("title").html('Coin主页');
- }
- if (nameEn === 'watchlist') {
- $("ul li").click(function () {
- $.ajax({
- url: "coin/watchlistUpdate", //请求的url地址
- dataType: "json", //返回格式为json
- data: {
- "symbol": $(this).attr("id"),
- "score": $(this).attr("val")
- }, //参数值
- type: "post", //请求方式
- async: false, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $(".apis-quiet-div-button2").click();
- } else {
- console.log("watchlistUpdate-score success error," + data);
- }
- },
- beforeSend: function () {
- },
- complete: function () {
- },
- error: function (data) {
- //请求出错处理
- console.log("watchlistUpdate-score error," + data);
- }
- });
- });
- $(".apis-quiet-div-watchlist-detail,.apis-quiet-div-watchlist-update").click(function () {
- if ($("#watchlistpreview").css("display") === 'none') {
- $("#watchlistpreview").css("display", "block");
- } else if ($("#watchlistpreview").css("display") === 'block') {
- $("#watchlistpreview").css("display", "none");
- }
- $(".watchlistpreview-top-close").click(function () {
- if ($("#watchlistpreview").css("display") === 'none') {
- $("#watchlistpreview").css("display", "block");
- } else if ($("#watchlistpreview").css("display") === 'block') {
- $("#watchlistpreview").css("display", "none");
- }
- $(this).unbind("click");
- $(".watchlistpreview-top-submit").unbind("click");
- });
- $(".watchlistpreview-top-submit").click(function () {
- $.ajax({
- url: "coin/watchlistUpdate", //请求的url地址
- dataType: "json", //返回格式为json
- data: {"symbol": $(".watchlistpreview-content").find(".watchlistpreview-symbol").val(), "remark": $(".watchlistpreview-content").find("textarea").val()}, //参数值
- type: "post", //请求方式
- async: false, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $(".watchlistpreview-top-close").click();
- } else {
- console.log("watchlistpreview-top-submit success error," + data);
- }
- },
- beforeSend: function () {
- },
- complete: function () {
- },
- error: function (data) {
- //请求出错处理
- console.log("watchlistpreview-top-submit error," + data);
- }
- });
- });
- var operationType = $(this).attr("operationType");
- if (operationType === 'detail') {
- $(".watchlistpreview-top-submit").css("display", "none");
- } else if (operationType === 'update') {
- $(".watchlistpreview-top-submit").css("display", "block");
- }
- var symbol = $(this).attr("symbolName");
- $.ajax({
- url: "coin/watchlistDetail/" + symbol + "/" + operationType, //请求的url地址
- type: "get", //请求方式
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- data = data.data;
- if (operationType === 'detail') {
- $(".watchlistpreview-content").html(data);
- } else if (operationType === 'update') {
- var update4Text = '<textarea rows="4" cols="50" style="background: antiquewhite;width: 100%;height: 100%;">' + data + '</textarea>';
- update4Text += '<input type="hidden" class="watchlistpreview-symbol" value="' + symbol + '"/>';
- $(".watchlistpreview-content").html(update4Text);
- }
- } else {
- //alert(data.message);
- }
- },
- beforeSend: function () {
- $(".watchlistpreview-content").html("");
- $(".watchlistpreview-loading").css("display", "block");
- },
- complete: function () {
- $(".watchlistpreview-loading").css("display", "none");
- },
- error: function (data) {
- //请求出错处理
- alert('error:' + data);
- }
- });
- });
- } else if (nameEn === 'image') {
- $(".apis-quiet-div-image-delete").click(function () {
- var symbol = $(this).attr("symbolName");
- $.ajax({
- url: "pictureInfo/deleteImgs/" + symbol, //请求的url地址
- type: "get", //请求方式
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $(".apis-quiet-div-button2").click();
- } else {
- alert(data.message);
- }
- },
- beforeSend: function () {
- $(".quiet-loading").css("display", "block");
- },
- complete: function () {
- $(".quiet-loading").css("display", "none");
- },
- error: function (data) {
- //请求出错处理
- alert('error:' + data);
- }
- });
- });
- } else if (nameEn === 'music') {
- $("ul li").click(function () {
- $.ajax({
- url: "musicInfo/musicUpdate", //请求的url地址
- dataType: "json", //返回格式为json
- data: {
- "symbol": $(this).attr("id"),
- "score": $(this).attr("val")
- }, //参数值
- type: "post", //请求方式
- async: false, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $(".apis-quiet-div-button2").click();
- } else {
- console.log("musicUpdate-score success error," + data);
- }
- },
- beforeSend: function () {
- },
- complete: function () {
- },
- error: function (data) {
- //请求出错处理
- console.log("musicUpdate-score error," + data);
- }
- });
- });
- $(".apis-quiet-div-music-delete").click(function () {
- var symbol = $(this).attr("symbolName");
- $.ajax({
- url: "musicInfo/deleteMusics/" + symbol, //请求的url地址
- type: "get", //请求方式
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $(".apis-quiet-div-button2").click();
- } else {
- alert(data.message);
- }
- },
- beforeSend: function () {
- $(".quiet-loading").css("display", "block");
- },
- complete: function () {
- $(".quiet-loading").css("display", "none");
- },
- error: function (data) {
- //请求出错处理
- alert('error:' + data);
- }
- });
- });
- $(".apis-quiet-div-music-play").click(function () {
- var symbol = $(this).attr("symbolName");
- var currentSrc = $("#apis-quiet-content > audio > source").attr("src");
- if (currentSrc === symbol) {
- $("#apis-quiet-content > audio")[0].play();
- } else {
- $("#apis-quiet-content > audio > source").attr("src", symbol);
- $("#apis-quiet-content > audio")[0].load();
- $("#apis-quiet-content > audio")[0].play();
- }
- $("#apis-quiet-content").find(".contentTD > tr").find('td:nth-child(2)').removeClass("music_highlight");
- $(this).parent("td").parent("tr").find('td:nth-child(2)').addClass("music_highlight");
- });
- /*$(".apis-quiet-div-music-pause").click(function () {
- var symbol = $(this).attr("symbolName");
- $("#apis-quiet-content > audio")[0].pause();
- });*/
- $(".apis-quiet-div-music-detail,.apis-quiet-div-music-update").click(function () {
- if ($("#musicpreview").css("display") === 'none') {
- $("#musicpreview").css("display", "block");
- } else if ($("#musicpreview").css("display") === 'block') {
- $("#musictpreview").css("display", "none");
- }
- $(".musicpreview-top-close").click(function () {
- if ($("#musicpreview").css("display") === 'none') {
- $("#musicpreview").css("display", "block");
- } else if ($("#musicpreview").css("display") === 'block') {
- $("#musicpreview").css("display", "none");
- }
- $(this).unbind("click");
- $(".musicpreview-top-submit").unbind("click");
- });
- $(".musicpreview-top-submit").click(function () {
- $.ajax({
- url: "musicInfo/musicUpdate", //请求的url地址
- dataType: "json", //返回格式为json
- data: {"symbol": $(".musicpreview-content").find(".musicpreview-symbol").val(), "remark": $(".musicpreview-content").find("textarea").val()}, //参数值
- type: "post", //请求方式
- async: false, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $(".musicpreview-top-close").click();
- } else {
- console.log("musicpreview-top-submit success error," + data);
- }
- },
- beforeSend: function () {
- },
- complete: function () {
- },
- error: function (data) {
- //请求出错处理
- console.log("musicpreview-top-submit error," + data);
- }
- });
- });
- var operationType = $(this).attr("operationType");
- if (operationType === 'detail') {
- $(".musicpreview-top-submit").css("display", "none");
- } else if (operationType === 'update') {
- $(".musicpreview-top-submit").css("display", "block");
- }
- var symbol = $(this).attr("symbolName");
- $.ajax({
- url: "musicInfo/musicDetail/" + symbol + "/" + operationType, //请求的url地址
- type: "get", //请求方式
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- data = data.data;
- if (operationType === 'detail') {
- $(".musicpreview-content").html(data);
- } else if (operationType === 'update') {
- var update4Text = '<textarea rows="4" cols="50" style="background: antiquewhite;width: 100%;height: 100%;">' + data + '</textarea>';
- update4Text += '<input type="hidden" class="musicpreview-symbol" value="' + symbol + '"/>';
- $(".musicpreview-content").html(update4Text);
- }
- } else {
- //alert(data.message);
- }
- },
- beforeSend: function () {
- $(".musicpreview-content").html("");
- $(".musicpreview-loading").css("display", "block");
- },
- complete: function () {
- $(".musicpreview-loading").css("display", "none");
- },
- error: function (data) {
- //请求出错处理
- alert('error:' + data);
- }
- });
- });
- }
- if (nameEn === 'orderHistoryProductType' || nameEn === 'traderList' || nameEn === 'watchlist' || nameEn === 'image' || nameEn === 'cmcmap') {
- // 鼠标滑过 开启菜单
- $(".primary").mouseenter(function () {
- savIDMouseEnter($(this), nameEn);
- });
- // 鼠标离开 关闭菜单
- $(".primary").mouseleave(function () {
- savIDMouseLeave($(this), nameEn);
- });
- }
- }
- function uploadImgsSubmit(){
- var fromData = new FormData($("#uploadImgs")[0]);
- $.ajax({
- url: "pictureInfo/insertOrUpdateImg", //请求的url地址
- dataType: "json", //返回格式为json
- data: fromData, //参数值
- type: "post", //请求方式
- processData: false,// 告诉jQuery不要去处理发送的数据
- contentType: false,// 告诉jQuery不要去设置Content-Type请求头
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- $(".uploadImgs-loading").css("display", "none");
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $("#uploadImgsAlert").html(JSON.stringify(data.data));
- var quietSelectOption = $("#apis-quiet-select option:selected");
- if ($(quietSelectOption).attr("nameen") === 'image') {
- $(".apis-quiet-div-button2").click();
- }
- } else {
- $("#uploadImgsAlert").html(data.message);
- }
- },
- beforeSend: function () {
- $(".uploadImgs-loading").css("display", "block");
- },
- complete: function () {
- },
- error: function (data) {
- //请求出错处理
- console.log("uploadImgs-submit error," + data);
- }
- });
- }
- function uploadMusicsSubmit(){
- var fromData = new FormData($("#uploadMusics")[0]);
- $.ajax({
- url: "musicInfo/insertOrUpdateMusic", //请求的url地址
- dataType: "json", //返回格式为json
- data: fromData, //参数值
- type: "post", //请求方式
- processData: false,// 告诉jQuery不要去处理发送的数据
- contentType: false,// 告诉jQuery不要去设置Content-Type请求头
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- $(".uploadMusics-loading").css("display", "none");
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $("#uploadMusicsAlert").html(JSON.stringify(data.data));
- var quietSelectOption = $("#apis-quiet-select option:selected");
- if ($(quietSelectOption).attr("nameen") === 'music') {
- $(".apis-quiet-div-button2").click();
- }
- } else {
- $("#uploadMusicsAlert").html(data.message);
- }
- },
- beforeSend: function () {
- $(".uploadMusics-loading").css("display", "block");
- },
- complete: function () {
- },
- error: function (data) {
- //请求出错处理
- console.log("uploadMusics-submit error," + data);
- }
- });
- }
- function insertOrUpdateWatchlistSubmit(){
- var fromData = new FormData($("#insertOrUpdateWatchlist")[0]);
- $.ajax({
- url: "coin/insertOrUpdateWatchlist", //请求的url地址
- dataType: "json", //返回格式为json
- data: fromData, //参数值
- type: "post", //请求方式
- processData: false,// 告诉jQuery不要去处理发送的数据
- contentType: false,// 告诉jQuery不要去设置Content-Type请求头
- async: true, //请求是否异步,默认为异步,这也是ajax重要特性
- success: function (data) {
- $(".watchlist-loading").css("display", "none");
- //请求成功时处理
- if (data != null && $.trim(data) != "" && data.success) {
- $("#insertOrUpdateWatchlistAlert").html(JSON.stringify(data.data));
- var quietSelectOption = $("#apis-quiet-select option:selected");
- if ($(quietSelectOption).attr("nameen") === 'watchlist') {
- $(".apis-quiet-div-button2").click();
- }
- } else {
- $("#insertOrUpdateWatchlistAlert").html(data.message);
- }
- },
- beforeSend: function () {
- $(".watchlist-loading").css("display", "block");
- },
- complete: function () {
- },
- error: function (data) {
- //请求出错处理
- console.log("insertOrUpdateWatchlist-submit error," + data);
- }
- });
- }
|