|
|
@@ -5,6 +5,9 @@ window.actualFlag = false;
|
|
|
|
|
|
window.stopFlag = false;
|
|
|
|
|
|
+window.uploadImgsCategoryField = [];
|
|
|
+window.uploadMusicsCategoryField = [];
|
|
|
+window.uploadExchangeCategoryField = [];
|
|
|
$(function () {
|
|
|
initOther();
|
|
|
});
|
|
|
@@ -179,27 +182,24 @@ function initOther4Select() {
|
|
|
$.each(obj.otherAttrList, function (index2, obj2) {
|
|
|
uploadImageCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
|
|
|
});
|
|
|
- $("#apis-quiet-div-uploadImgs-categoryField").append(uploadImageCategoryStr);
|
|
|
+ // $("#apis-quiet-div-uploadImgs-categoryField").append(uploadImageCategoryStr);
|
|
|
+ uploadImgsCategoryField = obj.otherAttrList;
|
|
|
$("#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-uploadMusics-categoryField").append(uploadMusicCategoryStr);
|
|
|
+ uploadMusicsCategoryField = obj.musicCategoryList;
|
|
|
$("#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>';
|
|
|
});
|
|
|
+
|
|
|
+ uploadExchangeCategoryField = obj.exchangeCategoryList;
|
|
|
$("#apis-quiet-div-currentHolding-categoryField").append(exchangeCategoryStr);
|
|
|
} else if (obj.nameEn === 'bookmark') {
|
|
|
var categoryStr = '';
|
|
|
@@ -990,31 +990,38 @@ function initContentEvent(nameEn) {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-function uploadImgsSubmit(){
|
|
|
- var fromData = new FormData($("#uploadImgs")[0]);
|
|
|
+function insertOrUpdateImageSubmit(){
|
|
|
+ var formData = new FormData($("#popup-form")[0]);
|
|
|
+ formData.append("userName", getCookie('username'));
|
|
|
$.ajax({
|
|
|
url: "pictureInfo/insertOrUpdateImg", //请求的url地址
|
|
|
dataType: "json", //返回格式为json
|
|
|
- data: fromData, //参数值
|
|
|
+ data: formData, //参数值
|
|
|
type: "post", //请求方式
|
|
|
processData: false,// 告诉jQuery不要去处理发送的数据
|
|
|
contentType: false,// 告诉jQuery不要去设置Content-Type请求头
|
|
|
async: true, //请求是否异步,默认为异步,这也是ajax重要特性
|
|
|
success: function (data) {
|
|
|
- $(".uploadImgs-loading").css("display", "none");
|
|
|
+ //$(".uploadImgs-loading").css("display", "none");
|
|
|
//请求成功时处理
|
|
|
if (data != null && $.trim(data) != "" && data.success) {
|
|
|
- $("#uploadImgsAlert").html(JSON.stringify(data.data));
|
|
|
+ //$("#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);
|
|
|
+ //$("#uploadImgsAlert").html(data.message);
|
|
|
}
|
|
|
+
|
|
|
+ // 在请求成功后填充数据到结果区域
|
|
|
+ $("#result-content").text(JSON.stringify(data, null, 2));
|
|
|
+ $("#loading-icon").fadeOut();
|
|
|
+ $("#result-container").fadeIn(); // 显示结果区域
|
|
|
},
|
|
|
beforeSend: function () {
|
|
|
- $(".uploadImgs-loading").css("display", "block");
|
|
|
+ //$(".uploadImgs-loading").css("display", "block");
|
|
|
+ showLoading(); // 显示加载状态
|
|
|
},
|
|
|
complete: function () {
|
|
|
},
|
|
|
@@ -1025,31 +1032,38 @@ function uploadImgsSubmit(){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
-function uploadMusicsSubmit(){
|
|
|
- var fromData = new FormData($("#uploadMusics")[0]);
|
|
|
+function insertOrUpdateMusicSubmit(){
|
|
|
+ var formData = new FormData($("#popup-form")[0]);
|
|
|
+ formData.append("userName", getCookie('username'));
|
|
|
$.ajax({
|
|
|
url: "musicInfo/insertOrUpdateMusic", //请求的url地址
|
|
|
dataType: "json", //返回格式为json
|
|
|
- data: fromData, //参数值
|
|
|
+ data: formData, //参数值
|
|
|
type: "post", //请求方式
|
|
|
processData: false,// 告诉jQuery不要去处理发送的数据
|
|
|
contentType: false,// 告诉jQuery不要去设置Content-Type请求头
|
|
|
async: true, //请求是否异步,默认为异步,这也是ajax重要特性
|
|
|
success: function (data) {
|
|
|
- $(".uploadMusics-loading").css("display", "none");
|
|
|
+ //$(".uploadMusics-loading").css("display", "none");
|
|
|
//请求成功时处理
|
|
|
if (data != null && $.trim(data) != "" && data.success) {
|
|
|
- $("#uploadMusicsAlert").html(JSON.stringify(data.data));
|
|
|
+ //$("#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);
|
|
|
+ //$("#uploadMusicsAlert").html(data.message);
|
|
|
}
|
|
|
+
|
|
|
+ // 在请求成功后填充数据到结果区域
|
|
|
+ $("#result-content").text(JSON.stringify(data, null, 2));
|
|
|
+ $("#loading-icon").fadeOut();
|
|
|
+ $("#result-container").fadeIn(); // 显示结果区域
|
|
|
},
|
|
|
beforeSend: function () {
|
|
|
- $(".uploadMusics-loading").css("display", "block");
|
|
|
+ //$(".uploadMusics-loading").css("display", "block");
|
|
|
+ showLoading(); // 显示加载状态
|
|
|
},
|
|
|
complete: function () {
|
|
|
},
|
|
|
@@ -1061,31 +1075,37 @@ function uploadMusicsSubmit(){
|
|
|
}
|
|
|
|
|
|
function insertOrUpdateWatchlistSubmit(){
|
|
|
- var fromData = new FormData($("#insertOrUpdateWatchlist")[0]);
|
|
|
+ var formData = new FormData($("#popup-form")[0]);
|
|
|
formData.append("userName", getCookie('username'));
|
|
|
$.ajax({
|
|
|
url: "coin/insertOrUpdateWatchlist", //请求的url地址
|
|
|
dataType: "json", //返回格式为json
|
|
|
- data: fromData, //参数值
|
|
|
+ data: formData, //参数值
|
|
|
type: "post", //请求方式
|
|
|
processData: false,// 告诉jQuery不要去处理发送的数据
|
|
|
contentType: false,// 告诉jQuery不要去设置Content-Type请求头
|
|
|
async: true, //请求是否异步,默认为异步,这也是ajax重要特性
|
|
|
success: function (data) {
|
|
|
- $(".watchlist-loading").css("display", "none");
|
|
|
+ //$(".popup > .watchlist-loading").css("display", "none");
|
|
|
//请求成功时处理
|
|
|
if (data != null && $.trim(data) != "" && data.success) {
|
|
|
- $("#insertOrUpdateWatchlistAlert").html(JSON.stringify(data.data));
|
|
|
+ //$("#insertOrUpdateAlert").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);
|
|
|
+ //$("#insertOrUpdateAlert").html(data.message);
|
|
|
}
|
|
|
+
|
|
|
+ // 在请求成功后填充数据到结果区域
|
|
|
+ $("#result-content").text(JSON.stringify(data, null, 2));
|
|
|
+ $("#loading-icon").fadeOut();
|
|
|
+ $("#result-container").fadeIn(); // 显示结果区域
|
|
|
},
|
|
|
beforeSend: function () {
|
|
|
- $(".watchlist-loading").css("display", "block");
|
|
|
+ //$(".popup > .watchlist-loading").css("display", "block");
|
|
|
+ showLoading(); // 显示加载状态
|
|
|
},
|
|
|
complete: function () {
|
|
|
},
|
|
|
@@ -1096,9 +1116,53 @@ function insertOrUpdateWatchlistSubmit(){
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+function insertOrUpdateCurrentHoldingSubmit(){
|
|
|
+ var formData = new FormData($("#popup-form")[0]);
|
|
|
+ formData.append("userName", getCookie('username'));
|
|
|
+
|
|
|
+ const jsonData = {};
|
|
|
+ formData.forEach((value, key) => {
|
|
|
+ jsonData[key] = value;
|
|
|
+ });
|
|
|
+
|
|
|
+ $.ajax({
|
|
|
+ url: "coin/insertOrUpdateCurrentHolding", //请求的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) {
|
|
|
+ var quietSelectOption = $("#apis-quiet-select option:selected");
|
|
|
+ if ($(quietSelectOption).attr("nameen") === 'currentHolding') {
|
|
|
+ $(".apis-quiet-div-button2").click();
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //$("#uploadMusicsAlert").html(data.message);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 在请求成功后填充数据到结果区域
|
|
|
+ $("#result-content").text(JSON.stringify(data, null, 2));
|
|
|
+ $("#loading-icon").fadeOut();
|
|
|
+ $("#result-container").fadeIn(); // 显示结果区域
|
|
|
+ },
|
|
|
+ beforeSend: function () {
|
|
|
+ showLoading(); // 显示加载状态
|
|
|
+ },
|
|
|
+ complete: function () {
|
|
|
+ },
|
|
|
+ error: function (data) {
|
|
|
+ //请求出错处理
|
|
|
+ console.log("insertOrUpdateCurrentHolding error," + data);
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
function initOther4Popup(){
|
|
|
// 打开弹窗
|
|
|
- $(".apis-quiet-div-button3").on("click", function () {
|
|
|
+ $(".apis-quiet-div-button4").on("click", function () {
|
|
|
var selectedOption = $("select#apis-quiet-select").find("option:selected");
|
|
|
var url = selectedOption.attr("url");
|
|
|
var typetype = selectedOption.attr("typetype");
|
|
|
@@ -1106,6 +1170,10 @@ function initOther4Popup(){
|
|
|
var slideDiv = $(this).attr("slideDiv");
|
|
|
quietPop(url, nameEn, slideDiv, typetype);
|
|
|
|
|
|
+ if (nameEn != 'watchlist' && nameEn != 'image' && nameEn != 'music' && nameEn != 'currentHolding') {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
$(".popup").fadeIn();
|
|
|
centerPopup(); // 调用居中函数
|
|
|
});
|
|
|
@@ -1118,15 +1186,29 @@ function initOther4Popup(){
|
|
|
// 阻止表单默认提交行为
|
|
|
$(".popup form").on("submit", function (e) {
|
|
|
e.preventDefault();
|
|
|
- alert("表单已提交!");
|
|
|
- $(".popup").fadeOut();
|
|
|
+
|
|
|
+ var nameEn = $("#popup-form-hidden-nameEn").val();
|
|
|
+ if (nameEn === 'watchlist') {
|
|
|
+ insertOrUpdateWatchlistSubmit();
|
|
|
+ } else if (nameEn === 'image') {
|
|
|
+ insertOrUpdateImageSubmit();
|
|
|
+ } else if (nameEn === 'music') {
|
|
|
+ insertOrUpdateMusicSubmit();
|
|
|
+ } else if (nameEn === 'currentHolding') {
|
|
|
+ insertOrUpdateCurrentHoldingSubmit();
|
|
|
+ }
|
|
|
});
|
|
|
|
|
|
// 实现拖动功能
|
|
|
let isDragging = false;
|
|
|
let offsetX, offsetY;
|
|
|
|
|
|
- $("#draggable-popup").on("mousedown", function (e) {
|
|
|
+ $("#draggable-popup h2").on("mousedown", function (e) {
|
|
|
+ // 判断如果点击在 input 或 select 上,不触发拖动
|
|
|
+ if ($(e.target).closest("input, select, label").length) {
|
|
|
+ return; // 如果按在 input 或 select 上,不启动拖动
|
|
|
+ }
|
|
|
+
|
|
|
isDragging = true;
|
|
|
offsetX = e.clientX - $(this).offset().left;
|
|
|
offsetY = e.clientY - $(this).offset().top;
|
|
|
@@ -1151,11 +1233,23 @@ function initOther4Popup(){
|
|
|
|
|
|
// 重置按钮的功能
|
|
|
$("#reset-button").on("click", function () {
|
|
|
- $(".progress-container").fadeOut(); // 重置时隐藏进度条
|
|
|
+ $("#result-container").fadeOut(); // 隐藏请求结果区域
|
|
|
$(".loading-icon").fadeOut(); // 重置时隐藏加载图标
|
|
|
+
|
|
|
+ var nameEn = $("#popup-form-hidden-nameEn").val();
|
|
|
+ if (nameEn === 'currentHolding') {
|
|
|
+ $("#form-container-2").html("");
|
|
|
+ }
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+// 显示加载图标
|
|
|
+function showLoading() {
|
|
|
+ $("#result-content").text(""); // 清空内容
|
|
|
+ $("#result-container").hide(); // 使用 hide() 快速隐藏
|
|
|
+ $("#loading-icon").fadeIn(); // 显示加载图标
|
|
|
+}
|
|
|
+
|
|
|
// 计算并设置弹窗居中位置
|
|
|
function centerPopup() {
|
|
|
const popup = $("#draggable-popup");
|
|
|
@@ -1166,7 +1260,7 @@ function centerPopup() {
|
|
|
|
|
|
// 计算弹窗的位置
|
|
|
const left = (windowWidth - popupWidth) / 2;
|
|
|
- const top = (windowHeight - popupHeight) / 2;
|
|
|
+ const top = (windowHeight - popupHeight) / 4;
|
|
|
|
|
|
// 设置弹窗的位置
|
|
|
popup.css({
|
|
|
@@ -1187,22 +1281,133 @@ function quietPop(url, nameEn, slideDiv, typetype) {
|
|
|
} else if (nameEn === 'traderList') {
|
|
|
} else if (nameEn === 'watchlist') {
|
|
|
let formContent = "";
|
|
|
- formContent += '<div class="form-item"><label for="symbol">名称:</label><input type="text" id="symbol" placeholder="不可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="trackCategory">赛道分类:</label><input type="text" id="trackCategory" placeholder="可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="trackCategory2">赛道分类2:</label><input type="text" id="trackCategory2" placeholder="可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="issuingDate">发行日期:</label><input type="text" id="issuingDate" placeholder="可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="cmcId">cmcId:</label><input type="text" id="cmcId" placeholder="可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="coingeckoId">coingeckoId:</label><input type="text" id="coingeckoId" placeholder="可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="coingeckoUrl">coingeckoUrl:</label><input type="text" id="coingeckoUrl" placeholder="可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="feixiaohaoUrl">feixiaohaoUrl:</label><input type="text" id="feixiaohaoUrl" placeholder="可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="filterFlag">filterFlag:</label><input type="text" id="filterFlag" placeholder="不可为空"></div>';
|
|
|
- formContent += '<div class="form-item"><label for="crudType">crudType:</label><input type="text" id="crudType" placeholder="不可为空"></div>';
|
|
|
- $("#form-container").html(formContent);
|
|
|
- $(".quietpop-content").html("");
|
|
|
+ formContent += '<div class="form-item"><label for="symbol">名称:</label><input type="text" name="symbol" placeholder="不可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="trackCategory">赛道分类:</label><input type="text" name="trackCategory" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="trackCategory2">赛道分类2:</label><input type="text" name="trackCategory2" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="issuingDate">发行日期:</label><input type="text" name="issuingDate" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="cmcId">cmcId:</label><input type="text" name="cmcId" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="coingeckoId">coingeckoId:</label><input type="text" name="coingeckoId" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="coingeckoUrl">coingeckoUrl:</label><input type="text" name="coingeckoUrl" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="feixiaohaoUrl">feixiaohaoUrl:</label><input type="text" name="feixiaohaoUrl" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="filterFlag">filterFlag:</label><select id="apis-quiet-div-watchlist-filterFlagField" name="filterFlag"><option value="2">已过滤</option><option value="1">未过滤</option><option value="3">哈哈哈</option></select></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="crudType">crudType:</label><select id="apis-quiet-div-watchlist-crudType" name="crudType"><option value="1">insert</option><option value="2">update</option></select></div>';
|
|
|
+ $("#form-container-2").html(formContent);
|
|
|
+
|
|
|
+ $("#popup-form-hidden-nameEn").val(nameEn);
|
|
|
+
|
|
|
+ $("#draggable-popup > h2").text("InsertOrUpdateWatchlist");
|
|
|
} else if (nameEn === 'image') {
|
|
|
+ let formContent = "";
|
|
|
+ formContent += '<div class="form-item"><label for="id">Id:</label><input type="text" name="id" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="categoryId">分类:</label><select id="apis-quiet-div-uploadImgs-categoryField" name="categoryId"><option value="">--</option></select></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="createDate">创建日期:</label><input type="text" name="createDate" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="remark">备注:</label><input type="text" name="remark" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="file">文件:</label><input type="file" name="file" multiple/></div>';
|
|
|
+ $("#form-container-2").html(formContent);
|
|
|
+
|
|
|
+ var uploadImageCategoryStr = '';
|
|
|
+ $.each(uploadImgsCategoryField, function (index2, obj2) {
|
|
|
+ uploadImageCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
|
|
|
+ });
|
|
|
+ $("#apis-quiet-div-uploadImgs-categoryField").append(uploadImageCategoryStr);
|
|
|
+
|
|
|
+ $("#popup-form-hidden-nameEn").val(nameEn);
|
|
|
+
|
|
|
+ $("#draggable-popup > h2").text("InsertOrUpdateImage");
|
|
|
} else if (nameEn === 'cmcmap') {
|
|
|
} else if (nameEn === 'music') {
|
|
|
+ let formContent = "";
|
|
|
+ formContent += '<div class="form-item"><label for="id">Id:</label><input type="text" name="id" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="title">标题:</label><input type="text" name="title" placeholder="ID为空时不可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="categoryId">分类:</label><select id="apis-quiet-div-uploadMusics-categoryField" name="categoryId" multiple><option value="">--</option></select></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="singer">歌手:</label><input type="text" name="singer" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="issuingDate">发行时间:</label><input type="text" name="issuingDate" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="collectionDate">收藏日期:</label><input type="text" name="collectionDate" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="remark">备注:</label><input type="text" name="remark" placeholder="可为空"></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="qualityType">qualityType:</label><select id="apis-quiet-div-uploadMusics-qualityType" name="qualityType"><option value="low">低品质</option><option value="high">高品质</option><option value="lyric">歌词</option></select></div>';
|
|
|
+ formContent += '<div class="form-item"><label for="file">文件:</label><input type="file" name="file" multiple/></div>';
|
|
|
+ $("#form-container-2").html(formContent);
|
|
|
+
|
|
|
+ var uploadMusicCategoryStr = '';
|
|
|
+ $.each(uploadMusicsCategoryField, function (index2, obj2) {
|
|
|
+ uploadMusicCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
|
|
|
+ });
|
|
|
+ $("#apis-quiet-div-uploadMusics-categoryField").append(uploadMusicCategoryStr);
|
|
|
+
|
|
|
+ // 初始化Select2并设置宽度
|
|
|
+ setTimeout(function () {
|
|
|
+ $('#apis-quiet-div-uploadMusics-categoryField').select2({
|
|
|
+ placeholder: "请选择分类", // 占位符
|
|
|
+ allowClear: false, // 添加清空选择的按钮
|
|
|
+ width: "100%" // 下拉框宽度
|
|
|
+ });
|
|
|
+ }, 100); // 延迟100毫秒初始化
|
|
|
+
|
|
|
+ $("#popup-form-hidden-nameEn").val(nameEn);
|
|
|
+
|
|
|
+ $("#draggable-popup > h2").text("InsertOrUpdateMusic");
|
|
|
} else if (nameEn === 'currentHolding') {
|
|
|
+ let formContent = "";
|
|
|
+
|
|
|
+ formContent += '<div class="form-item"><label for="operationType">操作类型:</label><select name="operationType"><option value="">--</option><option value="buy">买入</option><option value="sell">卖出</option><option value="transfer">转账</option><option value="modifyCurrentAmount">调整当前总额</option></select></div>';
|
|
|
+ formContent += '<hr/>';
|
|
|
+ $("#form-container-1").html(formContent);
|
|
|
+ $("#form-container-2").html("");
|
|
|
+
|
|
|
+ // 操作类型添加事件
|
|
|
+ $("#popup-form").find("select[name='operationType']").change(function (e) {
|
|
|
+ let operationType = $(this).val();
|
|
|
+ let formContent2 = "";
|
|
|
+ if (operationType === 'buy') {
|
|
|
+ formContent2 += '<div class="form-item"><label for="symbol">名称:</label><input type="text" name="symbol" placeholder="不可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="buyPrice">入场价格:</label><input type="text" name="buyPrice" placeholder="不可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="buyQuantity">入场数量:</label><input type="text" name="buyQuantity" placeholder="不可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="currentQuantity">当前数量:</label><input type="text" name="currentQuantity" placeholder="不可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="exchangeCategory">交易平台:</label><select name="exchangeCategory" id="apis-quiet-div-CurrentHolding-exchangeCategoryField"><option value="">--</option></select></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="coingeckoId">coingeckoId:</label><input type="text" name="coingeckoId" placeholder="可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="buyTime">买入时间:</label><input type="text" name="buyTime" placeholder="可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="remark">备注:</label><input type="text" name="remark" placeholder="可为空"></div>';
|
|
|
+
|
|
|
+ $("#form-container-2").html(formContent2);
|
|
|
+
|
|
|
+ var exchangeCategoryStr = '';
|
|
|
+ $.each(uploadExchangeCategoryField, function (index2, obj2) {
|
|
|
+ exchangeCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
|
|
|
+ });
|
|
|
+ $("#apis-quiet-div-CurrentHolding-exchangeCategoryField").append(exchangeCategoryStr);
|
|
|
+ } else if (operationType === 'sell') {
|
|
|
+ formContent2 += '<div class="form-item"><label for="id">ID:</label><input type="text" name="id" placeholder="不可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="sellPrice">卖出价格:</label><input type="text" name="sellPrice" placeholder="不可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="sellTime">卖出时间:</label><input type="text" name="sellTime" placeholder="可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="sellAmount">卖出金额:</label><input type="text" name="sellAmount" placeholder="可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="remark">备注:</label><input type="text" name="remark" placeholder="可为空"></div>';
|
|
|
+
|
|
|
+ $("#form-container-2").html(formContent2);
|
|
|
+ } else if (operationType === 'transfer') {
|
|
|
+ formContent2 += '<div class="form-item"><label for="remitter">汇款人:</label><select name="remitter" id="apis-quiet-div-CurrentHolding-remitterField"><option value="">--</option></select></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="payee">收款人:</label><select name="payee" id="apis-quiet-div-CurrentHolding-payeeField"><option value="">--</option></select></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="amount">金额:</label><input type="text" name="amount" placeholder="不可为空"></div>';
|
|
|
+
|
|
|
+ $("#form-container-2").html(formContent2);
|
|
|
+
|
|
|
+ var exchangeCategoryStr = '';
|
|
|
+ $.each(uploadExchangeCategoryField, function (index2, obj2) {
|
|
|
+ exchangeCategoryStr += '<option value="' + obj2.id + '">' + obj2.categoryName + '</option>';
|
|
|
+ });
|
|
|
+ $("#apis-quiet-div-CurrentHolding-remitterField,#apis-quiet-div-CurrentHolding-payeeField").append(exchangeCategoryStr);
|
|
|
+ } else if (operationType === 'modifyCurrentAmount') {
|
|
|
+ formContent2 += '<div class="form-item"><label for="id">ID:</label><input type="text" name="id" placeholder="不可为空"></div>';
|
|
|
+ formContent2 += '<div class="form-item"><label for="currentAmount">当前总额:</label><input type="text" name="currentAmount" placeholder="不可为空"></div>';
|
|
|
+
|
|
|
+ $("#form-container-2").html(formContent2);
|
|
|
+ } else {
|
|
|
+ $("#form-container-2").html("");
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ $("#popup-form-hidden-nameEn").val(nameEn);
|
|
|
+
|
|
|
+ $("#draggable-popup > h2").text("InsertOrUpdateCurrentHolding");
|
|
|
} else if (nameEn === 'bookmark') {
|
|
|
}
|
|
|
}
|