Commit df36c80e by Lee Munkyeong

コード整理

parent 4c630ccd
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
<div class="col-4 pl-0"> <div class="col-4 pl-0">
<div class="nav-item text-right"> <div class="nav-item text-right">
<a href="#" class="search_menu"><img src="icon/icon_search.png" alt="検索"></a> <a href="#" class="search_menu"><img src="icon/icon_search.png" alt="検索"></a>
<a href="#" data-toggle="modal" data-target="#menuModalCenter"><img src="icon/icon_room_menu.png" alt="メニュー"></a> <a href="#" data-toggle="modal" data-target="#menuModalCenter" id="roomMenu" class="none"><img src="icon/icon_room_menu.png" alt="メニュー"></a>
</div> </div>
</div><!-- .col --> </div><!-- .col -->
</div><!-- .row --> </div><!-- .row -->
...@@ -111,15 +111,16 @@ ...@@ -111,15 +111,16 @@
<div class="footer_content_t"> <div class="footer_content_t">
<div class="d-flex flex-row h-100"> <div class="d-flex flex-row h-100">
<div class="footer_item attach_file"> <div class="footer_item attach_file">
<img src="icon/icon_camera.png" alt="写真アイコン" id="fileUploadButton"> <img src="icon/icon_camera.png" alt="写真アイコン" id="imageInputButton">
<form id="image-form"> <form id="image-form">
<input class="d-none" type="file" name="image" id="imageInputTag" accept="image/x-png,image/jpeg"> <input class="d-none" type="file" name="image" id="imageInputTag" accept="image/x-png,image/jpeg">
</form> </form>
</div> </div>
<div class="footer_item attach_file"> <div class="footer_item attach_file">
<a href="#"> <img src="icon/icon_videocam.png" alt="動画アイコン" id="videoUploadButton">
<img src="icon/icon_videocam.png" alt="動画アイコン"> <form id="video-form">
</a> <input class="d-none" type="file" name="image" id="videoInputTag" accept="video/mp4">
</form>
</div> </div>
<input type="text" name="message" class="message_input_form" id="messageInput" placeholder="メッセージを入力してください"> <input type="text" name="message" class="message_input_form" id="messageInput" placeholder="メッセージを入力してください">
<button type="button" name="button" class="message_input_send none" id="messageSend" onclick="CHAT_UI.sendMessage(this);">送信</button> <button type="button" name="button" class="message_input_send none" id="messageSend" onclick="CHAT_UI.sendMessage(this);">送信</button>
......
...@@ -7,20 +7,17 @@ CHAT_DB.getRoomList = function(roomType, keyWord) { ...@@ -7,20 +7,17 @@ CHAT_DB.getRoomList = function(roomType, keyWord) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要 //TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList(roomType, keyWord)); return JSON.parse(android.getRoomList(roomType, keyWord));
} }
}; };
//ロカールDBからログインしたユーザのデータを取得する。 //ロカールDBからログインしたユーザのデータを取得する。
CHAT_DB.getMyInfo = function(input) { CHAT_DB.getMyInfo = function(input) {
var result = JSON.parse(android.getMyInfo());
CHAT.globalLoginParameter.shopMemberId = result.shopMemberId;
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要 //TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn //String形式をJsonに変更してReturn
return result; return JSON.parse(android.getMyInfo());
} }
}; };
...@@ -65,7 +62,6 @@ CHAT_DB.getGroupInfo = function(groupId) { ...@@ -65,7 +62,6 @@ CHAT_DB.getGroupInfo = function(groupId) {
//TODO IOS処理追加必要 //TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn //String形式をJsonに変更してReturn
console.log(JSON.parse(android.getGroupInfo(groupId)));
return JSON.parse(android.getGroupInfo(groupId)); return JSON.parse(android.getGroupInfo(groupId));
} }
}; };
...@@ -74,8 +70,6 @@ CHAT_DB.getNameCardData = function(shopMemberId) { ...@@ -74,8 +70,6 @@ CHAT_DB.getNameCardData = function(shopMemberId) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要 //TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
console.log(android.getNameCardData(shopMemberId));
return JSON.parse(android.getNameCardData(shopMemberId)); return JSON.parse(android.getNameCardData(shopMemberId));
} }
}; };
...@@ -114,4 +108,4 @@ CHAT_DB.getUsersInRoom = function(roomId) { ...@@ -114,4 +108,4 @@ CHAT_DB.getUsersInRoom = function(roomId) {
//String形式をJsonに変更してReturn //String形式をJsonに変更してReturn
return JSON.parse(android.getUsersInRoom(roomId)); return JSON.parse(android.getUsersInRoom(roomId));
} }
} }
\ No newline at end of file
var lastscrollvalue; var lastscrollvalue;
window.onscroll = function() { window.onscroll = function() {
console.log('scroll');
var a = $('#messages'); var a = $('#messages');
if (lastscrollvalue == undefined) { if (lastscrollvalue == undefined) {
console.log('first')
lastscrollvalue = a.scrollTop; lastscrollvalue = a.scrollTop;
// sets lastscrollvalue // sets lastscrollvalue
} else if (a.scrollTop > lastscrollvalue) { } else if (a.scrollTop > lastscrollvalue) {
console.log('up');
// downscroll rules will be here // downscroll rules will be here
lastscrollvalue = a.scrollTop; lastscrollvalue = a.scrollTop;
} else if (a.scrollTop < lastscrollvalue) { } else if (a.scrollTop < lastscrollvalue) {
console.log('down');
// upscroll rules will be here // upscroll rules will be here
lastscrollvalue = a.scrollTop; lastscrollvalue = a.scrollTop;
} }
......
...@@ -192,13 +192,11 @@ CHAT_UI.setOrientation = function(isLandscapeMode) { ...@@ -192,13 +192,11 @@ CHAT_UI.setOrientation = function(isLandscapeMode) {
} }
CHAT_UI.sendMessage = function(e) { CHAT_UI.sendMessage = function(e) {
console.log('messageSend');
const messageTextBox = $('#messageInput'); const messageTextBox = $('#messageInput');
const message = messageTextBox.val().length > 0 ? encodeURIComponent(messageTextBox.val() + " ") : ""; const message = messageTextBox.val().length > 0 ? encodeURIComponent(messageTextBox.val() + " ") : "";
messageTextBox.val(''); messageTextBox.val('');
if (message.length > 0) { if (message.length > 0) {
console.log(message);
socket.emit( socket.emit(
//'createMessage', { text: '['+encodedText+'<&split>'+messageType.TEXT+']'; } //'createMessage', { text: '['+encodedText+'<&split>'+messageType.TEXT+']'; }
'createMessage', { text: message } 'createMessage', { text: message }
...@@ -216,27 +214,24 @@ $('#messageInput').on('keypress', function(event) { ...@@ -216,27 +214,24 @@ $('#messageInput').on('keypress', function(event) {
}); });
// 写真アップロード // 写真アップロード
$('#fileUploadButton').on('click', function() { $('#imageInputButton').on('click', function() {
console.log('onclickPhoto');
$('#imageInputTag').click(); $('#imageInputTag').click();
}); });
// 動画アップロード // 動画アップロード
$('#fileUploadButton2').on('click', function() { $('#videoUploadButton').on('click', function() {
$('#imageInputTag2').click(); $('#videoInputTag').click();
}); });
$('#imageInputTag').on('change', function() { $('#imageInputTag').on('change', function() {
console.log('onchangePhoto');
$('#image-form').submit(); $('#image-form').submit();
}); });
$('#imageInputTag2').on('change', function() { $('#videoInputTag').on('change', function() {
$('#image-form2').submit(); $('#video-form').submit();
}); });
$('#image-form').on('submit', function(e) { $('#image-form').on('submit', function(e) {
console.log('onSubmitPhoto');
e.preventDefault(); e.preventDefault();
const imageInputTag = $('#imageInputTag'); const imageInputTag = $('#imageInputTag');
const file = imageInputTag.prop('files')[0]; const file = imageInputTag.prop('files')[0];
...@@ -260,10 +255,10 @@ $('#image-form').on('submit', function(e) { ...@@ -260,10 +255,10 @@ $('#image-form').on('submit', function(e) {
} }
}); });
$('#image-form2').on('submit', function(e) { $('#video-form').on('submit', function(e) {
e.preventDefault(); e.preventDefault();
const imageInputTag2 = $('#imageInputTag2'); const videoInputTag = $('#videoInputTag');
const file = imageInputTag2.prop('files')[0]; const file = videoInputTag.prop('files')[0];
if (file) { if (file) {
$('.overlay').addClass('active undismissable'); $('.overlay').addClass('active undismissable');
$('.loader').addClass('active'); $('.loader').addClass('active');
...@@ -1021,14 +1016,12 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1021,14 +1016,12 @@ CHAT_UI.refreshRoomList = function(roomType) {
var rooms = CHAT_DB.getRoomList(roomType, null); var rooms = CHAT_DB.getRoomList(roomType, null);
CHAT.globalIsInvite = false; CHAT.globalIsInvite = false;
activeRoomId = null; activeRoomId = null;
console.log(rooms);
// #36146に対応 // #36146に対応
$('#groupChatList').empty(); $('#groupChatList').empty();
$('#dmChatList').empty(); $('#dmChatList').empty();
let roomListTitle = getLocalizedString("roomListTitle"); let roomListTitle = getLocalizedString("roomListTitle");
$('#chatTitle').text(roomListTitle); $('#chatTitle').text(roomListTitle);
if (rooms.length === 0) { if (rooms.length === 0) {
console.log('noRoom')
// 検索結果がない場合のメッセージを追加 // 検索結果がない場合のメッセージを追加
let emptyListString = getLocalizedString("roomListEmptyString") let emptyListString = getLocalizedString("roomListEmptyString")
switch(roomType) { switch(roomType) {
...@@ -1047,7 +1040,6 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1047,7 +1040,6 @@ CHAT_UI.refreshRoomList = function(roomType) {
, function(text) { , function(text) {
template = text; template = text;
}); });
console.log(rooms);
rooms.forEach(function(room) { rooms.forEach(function(room) {
room.profileImagePath = ASSET_PATH + 'images/user-profile.png' room.profileImagePath = ASSET_PATH + 'images/user-profile.png'
if (room.message) { if (room.message) {
...@@ -1089,7 +1081,6 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1089,7 +1081,6 @@ CHAT_UI.refreshRoomList = function(roomType) {
// ルームグループごとに追加。 // ルームグループごとに追加。
switch(roomType) { switch(roomType) {
case chatRoomType.GROUP: case chatRoomType.GROUP:
console.log(roomType);
$('#groupChatList').append(obj); $('#groupChatList').append(obj);
break; break;
case chatRoomType.DM: case chatRoomType.DM:
...@@ -1111,20 +1102,19 @@ CHAT_UI.joinRoom = function(roomId,roomName) { ...@@ -1111,20 +1102,19 @@ CHAT_UI.joinRoom = function(roomId,roomName) {
}; };
CHAT_UI.loadMessages = function(roomId, roomName) { CHAT_UI.loadMessages = function(roomId, roomName) {
console.log('loadMessages] START--');
console.log(CHAT.globalLoginParameter);
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
CHAT_SOCKET.connectSocket(); CHAT_SOCKET.connectSocket();
console.log('loadMessages] isOnline--');
android.updateMessages(roomId); android.updateMessages(roomId);
socket.emit('exitRoom',roomId); socket.emit('exitRoom',roomId);
socket.emit('joinRoom', roomId, roomName, function() { socket.emit('joinRoom', roomId, roomName, function() {
console.log('loadMessages] Seccess Emit Soket (joinRoom)');
}); });
} }
var roomType = android.getRoomType();
if (roomType == chatRoomType.DM) {
$('#roomMenu').removeClass('none');
}
var messages = CHAT_DB.getMessages(roomId); var messages = CHAT_DB.getMessages(roomId);
var usersInRoom = CHAT_DB.getUsersInRoom(roomId); var usersInRoom = CHAT_DB.getUsersInRoom(roomId);
console.log(usersInRoom);
$('#roomTitle').text(roomName).data('roomName', roomName); $('#roomTitle').text(roomName).data('roomName', roomName);
let jQueryMessages = $('#messages'); let jQueryMessages = $('#messages');
...@@ -1392,14 +1382,12 @@ CHAT_UI.startChat = function(userShopMemberId,userName) { ...@@ -1392,14 +1382,12 @@ CHAT_UI.startChat = function(userShopMemberId,userName) {
}; };
CHAT_UI.startVoice = function() { CHAT_UI.startVoice = function() {
console.log("VoiceClick");
}; };
CHAT_UI.makeNameCard = function(shopMemberId) { CHAT_UI.makeNameCard = function(shopMemberId) {
var nameCardInfo = CHAT_DB.getNameCardData(shopMemberId); var nameCardInfo = CHAT_DB.getNameCardData(shopMemberId);
console.log(nameCardInfo);
var namecardTemplate; var namecardTemplate;
$.get({ url: "./template/template_user_name_card.html", async: false } $.get({ url: "./template/template_user_name_card.html", async: false }
, function(text) { , function(text) {
......
...@@ -206,7 +206,6 @@ function setSocketAction () { ...@@ -206,7 +206,6 @@ function setSocketAction () {
}); });
// イメージの場合、img tagを追加する // イメージの場合、img tagを追加する
html = message.text.includes('attachedImages') || message.text.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html; html = message.text.includes('attachedImages') || message.text.includes('attachedVideos') ? CHAT_UTIL.htmlDecode(html) : html;
console.log(html);
$('#messages').append(html); $('#messages').append(html);
// 画像、動画の描画を待ってからスクロール // 画像、動画の描画を待ってからスクロール
......
...@@ -87,10 +87,8 @@ CHAT.createVideoThumbnailAndUpload = function(sourceImage, callback) { ...@@ -87,10 +87,8 @@ CHAT.createVideoThumbnailAndUpload = function(sourceImage, callback) {
// Ajaxでイメージをアップロードする // Ajaxでイメージをアップロードする
CHAT.uploadImage = function(formData) { CHAT.uploadImage = function(formData) {
console.log('uploadImage');
formData.append('roomId', CHAT.globalLoginParameter.roomId); formData.append('roomId', CHAT.globalLoginParameter.roomId);
formData.append('sid', CHAT.globalLoginParameter.sid); formData.append('sid', CHAT.globalLoginParameter.sid);
console.log(formData);
jQuery.ajax({ jQuery.ajax({
async: true, async: true,
url: CMS_SERVER_URL+"/chatapi/file/upload", url: CMS_SERVER_URL+"/chatapi/file/upload",
...@@ -99,9 +97,6 @@ CHAT.uploadImage = function(formData) { ...@@ -99,9 +97,6 @@ CHAT.uploadImage = function(formData) {
contentType: false, contentType: false,
processData: false processData: false
}).done(function(res) { }).done(function(res) {
// 8
console.log('DONE');
console.log(res);
var imgPath = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.fileName + '&roomId=' + CHAT.globalLoginParameter.roomId; var imgPath = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.fileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
var imageName = res.fileName var imageName = res.fileName
...@@ -137,10 +132,10 @@ CHAT.uploadImage = function(formData) { ...@@ -137,10 +132,10 @@ CHAT.uploadImage = function(formData) {
} else { // 動画の処理 } else { // 動画の処理
if (res.thumbnailPath && res.thumbnailPath.length > 0) { if (res.thumbnailPath && res.thumbnailPath.length > 0) {
imgPath = CMS_SERVER_URL + '/file/getImage?fileName=' + res.thumbImageFileName + '&roomId=' + CHAT.globalLoginParameter.roomId; imgPath = CMS_SERVER_URL + '/chatapi/file/getImage?fileName=' + res.thumbImageFileName + '&roomId=' + CHAT.globalLoginParameter.roomId;
} }
let downloadPath = CMS_SERVER_URL + '/file/download?fileName=' + imageName + '&roomId=' + CHAT.globalLoginParameter.roomId; let downloadPath = CMS_SERVER_URL + '/chatapi/file/download?fileName=' + imageName + '&roomId=' + CHAT.globalLoginParameter.roomId;
const aTag = $('<a/>', {id:"attachedImages"}) const aTag = $('<a/>', {id:"attachedImages"})
const image = $('<img/>',{src:imgPath, width:'auto',style:'max-width:100%'}); const image = $('<img/>',{src:imgPath, width:'auto',style:'max-width:100%'});
const downloadIcon = $('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName}); const downloadIcon = $('<a/>',{href:downloadPath, class:'fa fa-download', download:res.fileName});
...@@ -157,7 +152,8 @@ CHAT.uploadImage = function(formData) { ...@@ -157,7 +152,8 @@ CHAT.uploadImage = function(formData) {
} }
socket.emit('createMessage', { socket.emit('createMessage', {
text: '['+encodedText+'<&split>'+messageType.VIDEO+']' //text: '['+encodedText+'<&split>'+messageType.VIDEO+']'
text: encodedText
}, 1); }, 1);
} }
...@@ -341,10 +337,8 @@ $(function() { ...@@ -341,10 +337,8 @@ $(function() {
// チャットメンバー検索 // チャットメンバー検索
$('#chat .search_form input[type="search"]').keyup(function(){ $('#chat .search_form input[type="search"]').keyup(function(){
console.log($('#chat .search_form input[type="search"]').val());
var keyword = $('#chat .search_form input[type="search"]').val(); var keyword = $('#chat .search_form input[type="search"]').val();
var rooms = CHAT_DB.getRoomList(chatRoomType.ALL, keyword); var rooms = CHAT_DB.getRoomList(chatRoomType.ALL, keyword);
console.log(rooms);
let roomListTitle = getLocalizedString("room_search_placeholder"); let roomListTitle = getLocalizedString("room_search_placeholder");
$('#chatTitle').text(roomListTitle); $('#chatTitle').text(roomListTitle);
var template; var template;
......
...@@ -51,18 +51,14 @@ $(function() { ...@@ -51,18 +51,14 @@ $(function() {
}); });
$('.message_input_form').click(function(){ $('.message_input_form').click(function(){
console.log('ONCLICK---');
$('.message_input_send').removeClass('none'); $('.message_input_send').removeClass('none');
$('.attach_file').addClass('none'); $('.attach_file').addClass('none');
}); });
$('.message_input_form').on('focusout',function(e){ $('.message_input_form').on('focusout',function(e){
console.log('OUTFOCUS---');
console.log(e);
if($(e.relatedTarget).hasClass('message_input_send')){ if($(e.relatedTarget).hasClass('message_input_send')){
CHAT_UI.sendMessage(); CHAT_UI.sendMessage();
} }
console.log(e.relatedTarget)
$('.message_input_send').addClass('none'); $('.message_input_send').addClass('none');
$('.attach_file').removeClass('none'); $('.attach_file').removeClass('none');
}); });
......
...@@ -2,7 +2,6 @@ $(function() { ...@@ -2,7 +2,6 @@ $(function() {
// メンバー検索 // メンバー検索
$('#contact .search_form input[type="search"]').keyup(function(e){ $('#contact .search_form input[type="search"]').keyup(function(e){
console.log(e);
var isAllGroup = $('#tabAllGroup').is(':checked'); var isAllGroup = $('#tabAllGroup').is(':checked');
$('.overlay_src_msg').empty(); $('.overlay_src_msg').empty();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment