parent
7dce237ac8
commit
2f30eee0f7
@ -0,0 +1,133 @@
|
||||
<#include "/m/include/index_top.ftl">
|
||||
|
||||
<body><!--grey_bg / blue_w_bg /blue_g_bg-->
|
||||
<div class="wrap">
|
||||
<header class="header_wrapper">
|
||||
<a href="javascript:back.return_url()" class="side_Lbtn hidden pre_btn">이전으로</a>
|
||||
<h1 class="header_title">음악 설정</h1>
|
||||
<a href="#" class="side_Rbtn hidden"></a>
|
||||
</header>
|
||||
<main class="m_set_lighting_time">
|
||||
<header>
|
||||
<h2>
|
||||
음악 설정
|
||||
</h2>
|
||||
</header>
|
||||
<div class="cont">
|
||||
<form id="frmUpdate" name="frmUpdate" method="post" ecntype="multipart/form-data" onsubmit="return false">
|
||||
<input type="hidden" id="delList" name="delList" value="">
|
||||
<div class="set_list_wrap">
|
||||
<#list model['music_list'] as item>
|
||||
<div name="list_item" class="list_item item_order">
|
||||
<label class="radio-label">${item['music_name']!}</label>
|
||||
<input type="hidden" name="music_list" value="${URL_ROOT}/music/${item['music_file_path']!}">
|
||||
<input type="button" key="${item['idx']!}" onclick="fncRemove(this)" value="삭제">
|
||||
</div>
|
||||
</#list>
|
||||
</div>
|
||||
|
||||
<input type="button" value="추가" onclick="fncAddItem()">
|
||||
<br/>
|
||||
<br/>
|
||||
<audio src="/m/" controls id="audio_control" onended="fncNextPlay()"></audio>
|
||||
<button type="button" onclick="fncSave()" id="" name="" class="btns blue_btn">저장</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<#include "/m/include/index_bottom_info.ftl">
|
||||
</main>
|
||||
</div>
|
||||
<script>
|
||||
var delList = "";
|
||||
var music_idx = 0;
|
||||
|
||||
$("#audio_control").attr("src", $("input[name='music_list']").eq(0).val());
|
||||
|
||||
function fncNextPlay() {
|
||||
$("#audio_control").get(0).src = $("input[name='music_list']").eq(music_idx).val();
|
||||
$("#audio_control").get(0).play();
|
||||
|
||||
if( music_idx >= $("input[name='music_list']").length-1) {
|
||||
music_idx = 0;
|
||||
} else {
|
||||
music_idx++;
|
||||
}
|
||||
}
|
||||
|
||||
function fncSave() {
|
||||
var formData = new FormData($("#frmUpdate")[0]);
|
||||
var delList = $("#delList").val();
|
||||
|
||||
if(delList.length > 0) {
|
||||
$("#delList").val( delList.substring(0, delList.length-1) );
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: "${URL_ROOT}/m/member_env/saveMusicFile.do",
|
||||
processData: false,
|
||||
contentType: false,
|
||||
data: formData,
|
||||
type: 'POST',
|
||||
async : false,
|
||||
success: function(response){
|
||||
Swal.fire({text: '저장 되었습니다.'}).then((result)=>{ location.reload(); })
|
||||
// callback(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
$(function(){
|
||||
env.init()
|
||||
})
|
||||
|
||||
function fncAddItem() {
|
||||
var size = $("input[name='attachFile']").length;
|
||||
|
||||
if(size >=5) {
|
||||
Swal.fire({text: '음악파일은 5개까지 설정 가능합니다.'});
|
||||
return;
|
||||
}
|
||||
|
||||
$(".set_list_wrap").append("<div class='list_item'>" +
|
||||
"<input type='file' onchange='fn_M_my_fileSave(this);' name='file'>")
|
||||
}
|
||||
|
||||
function fncModify(e) {
|
||||
$(e).parent().find(".fileSpan").show();
|
||||
}
|
||||
|
||||
function fncRemove(e) {
|
||||
delList += $(e).attr("key") + ",";
|
||||
$(e).parent().remove();
|
||||
|
||||
$("#delList").val(delList);
|
||||
}
|
||||
|
||||
|
||||
// 동영상 업로드 파일 DB에 저장하기
|
||||
function fn_M_my_fileSave(th) {
|
||||
try {
|
||||
var name = $(th)[0].files[0].name;
|
||||
var ext = name.split('.').pop().toLowerCase();
|
||||
if($.inArray(ext, ['mp3','mp4']) == -1) {
|
||||
Swal.fire({text: '음약 파일(mp3)을 업로드 해 주세요.'}).then((result)=>{ $(th).parent().remove(); })
|
||||
return;
|
||||
}
|
||||
|
||||
var size = $(th)[0].files[0].size;
|
||||
var size2 = Number(size)/(1024*1024);
|
||||
|
||||
if(size2 > 7){
|
||||
Swal.fire({text: '7M 이하 파일을 업로드 해 주세요.'}).then((result)=>{ $(th).parent().remove(); })
|
||||
return;
|
||||
}
|
||||
} catch (e) { console.log(e); }
|
||||
}
|
||||
|
||||
</script>
|
||||
|
||||
<#include "/m/member_env/include_return_url.ftl">
|
||||
|
||||
</body>
|
||||
<#include "/m/include/index_bottom.ftl">
|
Loading…
Reference in new issue