Commit 8fc5ddaf by Lee Munkyeong

チャット詳細実装

parent b994ba6e
...@@ -680,3 +680,25 @@ a.article:hover { ...@@ -680,3 +680,25 @@ a.article:hover {
#errorEnd{ #errorEnd{
margin-top: 15vh; margin-top: 15vh;
} }
.collapsible {
height: 40px;
background-color: #eee;
color: #444;
cursor: pointer;
width: 100%;
border: none;
text-align: left;
outline: none;
font-size: 15px;
}
.collapsible-active, .collapsible:hover {
background-color: #ccc;
}
.collapsible-content {
display: none;
overflow: hidden;
background-color: #f1f1f1;
}
\ No newline at end of file
...@@ -236,11 +236,16 @@ ...@@ -236,11 +236,16 @@
</div> </div>
<div id="my_info" class="inbox_user row"> <div id="my_info" class="inbox_user row">
</div> </div>
<div class="collapsible-content">
<div id="favorite_list" class="inbox_user row"> <div id="favorite_list" class="inbox_user row">
</div> </div>
</div>
<div class="collapsible-content">
<div id="my_group_list" class="inbox_user row"> <div id="my_group_list" class="inbox_user row">
</div> </div>
</div> </div>
</div>
</div> </div>
<div class="tab-pane fade" id="pills-group" role="tabpanel" aria-labelledby="pills-group-tab"> <div class="tab-pane fade" id="pills-group" role="tabpanel" aria-labelledby="pills-group-tab">
...@@ -354,7 +359,7 @@ ...@@ -354,7 +359,7 @@
</li> </li>
</ul> </ul>
</div> </div>
<nav class="navbar navbar-expand navbar-dark fixed-bottom flex-md-nowrap p-2 bg-footer talign-center border footer-nav"> <nav class="navbar navbar-expand navbar-dark fixed-bottom flex-md-nowrap p-2 bg-footer talign-center border footer-nav" id="bottomNav">
<div class="col-4"> <div class="col-4">
<img src="./icon/ic_communication_meeting_gray.png" style="width: 35%;" id="contactButton"> <img src="./icon/ic_communication_meeting_gray.png" style="width: 35%;" id="contactButton">
</div> </div>
......
...@@ -13,11 +13,38 @@ CHAT_DB.getRoomList = function(input) { ...@@ -13,11 +13,38 @@ CHAT_DB.getRoomList = function(input) {
}; };
//ロカールDBからログインしたユーザのデータを取得する。 //ロカールDBからログインしたユーザのデータを取得する。
CHAT_DB.getMyinfo = function(input) { CHAT_DB.getMyInfo = function(input) {
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 JSON.parse(android.getMyinfo()); return JSON.parse(android.getMyInfo());
}
};
CHAT_DB.getMessages = function(roomId) {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getMessageList(roomId));
}
};
CHAT_DB.getFavoriteUsers = function() {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteUsers());
}
};
CHAT_DB.getFavoriteGroups = function() {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
return JSON.parse(android.getFavoriteGroups());
} }
}; };
\ No newline at end of file
...@@ -73,7 +73,7 @@ $('#roomDeleteButton').on('click', function(e) { ...@@ -73,7 +73,7 @@ $('#roomDeleteButton').on('click', function(e) {
$('#messages').html(''); $('#messages').html('');
$('.titleRoomName').text(roomName).data('roomName', roomName); $('.titleRoomName').text(roomName).data('roomName', roomName);
$('#pills-chat-tab').tab('show'); $('#pills-chat-tab').tab('show');
$("#message-search").attr("placeholder", $("#message-search").attr("placeholder")+getLocalizedString("chat_search_placeholder")); $("#message-search").attr("placeholder", getLocalizedString("chat_search_placeholder"));
}); });
}); });
...@@ -147,10 +147,11 @@ $('#messages').scroll(function(){ ...@@ -147,10 +147,11 @@ $('#messages').scroll(function(){
// ローディングアイコンを追加する // ローディングアイコンを追加する
let loader = $('<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>') let loader = $('<div id="chatLoader" class="text-center"><div class="spinner-grow spinner-grow-sm" role="status" /></div>')
$('#messages').prepend(loader) $('#messages').prepend(loader)
socket.emit('getMessages', $(this).children().length, function() {
// ローディングアイコンを削除する
loader.remove(); loader.remove();
}); // socket.emit('getMessages', $(this).children().length, function() {
// // ローディングアイコンを削除する
// loader.remove();
// });
} }
} }
}); });
...@@ -390,18 +391,18 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) { ...@@ -390,18 +391,18 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
$('#newRoomName').val(''); $('#newRoomName').val('');
$('#userSelectionLength').text(''); $('#userSelectionLength').text('');
CHAT.globalSelectedUserList = []; CHAT.globalSelectedUserList = [];
$('#bottomNav').hide();
$('#backButton').off().on('click', function() { $('#backButton').off().on('click', function() {
//loadingIndicatorを表示 //loadingIndicatorを表示
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
socket.emit('leaveRoom', function() {
CHAT.saveRoomInfo(); CHAT.saveRoomInfo();
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
socket.emit('leaveRoom', function() {
android.updateRoomList(); android.updateRoomList();
});
}
CHAT_UI.refreshRoomList(); CHAT_UI.refreshRoomList();
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
}
});
}); });
console.log("show #pills-chat") console.log("show #pills-chat")
//loadingIndicatorを表示しない //loadingIndicatorを表示しない
...@@ -414,7 +415,7 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) { ...@@ -414,7 +415,7 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
$('#room-search').val(''); $('#room-search').val('');
// set Title // set Title
let roomListTitle = getLocalizedString("roomListTitle") let roomListTitle = getLocalizedString("roomListTitle")
$('#bottomNav').show();
$('.titleRoomName').text(roomListTitle); $('.titleRoomName').text(roomListTitle);
$('#newRoomName').val(''); $('#newRoomName').val('');
$('#userSelectionLength').text(''); $('#userSelectionLength').text('');
...@@ -430,12 +431,14 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) { ...@@ -430,12 +431,14 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
$('#my_info').show(); $('#my_info').show();
$('#room_list').hide(); $('#room_list').hide();
$('#room-search').hide(); $('#room-search').hide();
$('#bottomNav').show();
break; break;
case '#pills-user': case '#pills-user':
$("#backButton").show(); $("#backButton").show();
$("#userSelectionDeleteBtn").hide(); $("#userSelectionDeleteBtn").hide();
$('#homeButton').hide(); $('#homeButton').hide();
$('#bottomNav').hide();
//loadingIndicatorを表示しない //loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
break; break;
...@@ -443,6 +446,7 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) { ...@@ -443,6 +446,7 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
$("#backButton").show(); $("#backButton").show();
$("#userSelectionDeleteBtn").hide(); $("#userSelectionDeleteBtn").hide();
$('#homeButton').hide(); $('#homeButton').hide();
$('#bottomNav').hide();
//loadingIndicatorを表示しない //loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
break; break;
...@@ -451,11 +455,13 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) { ...@@ -451,11 +455,13 @@ $('a[data-toggle="pill"]').on('show.bs.tab', function (e) {
//loadingIndicatorを表示しない //loadingIndicatorを表示しない
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
$('#homeButton').hide(); $('#homeButton').hide();
$('#bottomNav').hide();
$('.user_people').css("paddingLeft", "0px"); $('.user_people').css("paddingLeft", "0px");
break; break;
case '#pills-communication': // コミュニケーションのタブ case '#pills-communication': // コミュニケーションのタブ
case '#pills-setting': // 設定のタブ case '#pills-setting': // 設定のタブ
case '#pills-profile': // ユーザプロファイルのタブ case '#pills-profile': // ユーザプロファイルのタブ
$('#bottomNav').hide();
$('.titleRoomName').show(); $('.titleRoomName').show();
$('.roomListIcon, .chatRoomIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide(); $('.roomListIcon, .chatRoomIcon, #userSelectionConfirmBtn, #newRoomName, #userSelectionDeleteBtn').hide();
$('#backButton').hide(); $('#backButton').hide();
...@@ -662,7 +668,6 @@ CHAT_UI.showConfirmView = function(isInvite) { ...@@ -662,7 +668,6 @@ CHAT_UI.showConfirmView = function(isInvite) {
android.createChatRoom("1",userIdList.join(','),newRoomName); android.createChatRoom("1",userIdList.join(','),newRoomName);
/*socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) { /*socket.emit('createNewRoom', userIdList, encodedRoomName, function(newRoomId) {
socket.emit('joinRoom', newRoomId, newRoomName, function () { socket.emit('joinRoom', newRoomId, newRoomName, function () {
CHAT.saveRoomInfo(newRoomId, newRoomName); CHAT.saveRoomInfo(newRoomId, newRoomName);
...@@ -800,7 +805,7 @@ CHAT_UI.htmlElementTextInitialize = function(languageCode) { ...@@ -800,7 +805,7 @@ CHAT_UI.htmlElementTextInitialize = function(languageCode) {
setLanguage(languageCode); setLanguage(languageCode);
$(".titleRoomName").text(getLocalizedString("roomListTitle")); $(".titleRoomName").text(getLocalizedString("roomListTitle"));
$("#message-form").attr("placeholder", getLocalizedString("chat_placeholder")); $("#message-form").attr("placeholder", getLocalizedString("chat_placeholder"));
$("#message-search").attr("placeholder",$("#message-search").attr("placeholder")+getLocalizedString("chat_search_placeholder")); $("#message-search").attr("placeholder",getLocalizedString("chat_search_placeholder"));
$("#exitRoom").text(getLocalizedString("exitRoom")).append("<i class='fas fa-door-open'></i>") $("#exitRoom").text(getLocalizedString("exitRoom")).append("<i class='fas fa-door-open'></i>")
$("#participants").text(getLocalizedString("participants")) $("#participants").text(getLocalizedString("participants"))
...@@ -843,8 +848,14 @@ CHAT_UI.waitForLoadingImage = function(div, callback) { ...@@ -843,8 +848,14 @@ CHAT_UI.waitForLoadingImage = function(div, callback) {
} }
$('#contactButton').on('click', function(event){ $('#contactButton').on('click', function(event){
CHAT_UI.refreshContactScreen();
});
CHAT_UI.refreshContactScreen = function() {
//loadingIndicatorを表示 //loadingIndicatorを表示
$('#my_info').html('');
$('#favorite_list').html('');
$('#my_group_list').html('');
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
$('#pills-contact-tab').tab('show'); $('#pills-contact-tab').tab('show');
...@@ -858,18 +869,18 @@ $('#contactButton').on('click', function(event){ ...@@ -858,18 +869,18 @@ $('#contactButton').on('click', function(event){
// ユーザの様式を読み込む // ユーザの様式を読み込む
const userTemplate = $('#user-template').html(); const userTemplate = $('#user-template').html();
if (IS_ONLINE == 'true') {
android.updateGroupInfo(); android.updateGroupInfo();
android.updateMyInfo(); android.updateMyInfo();
}
var myInfo = CHAT.requestMyinfo(); var myInfo = CHAT_DB.getMyInfo();
console.log(myInfo);
if (IS_ONLINE == 'true') {
} myInfo.profileImagePath = CHAT.getProfileImgUrl(myInfo.profileUrl)
myInfo.profileImagePath = CHAT.getProfileImgUrl(myInfo.profileImagePath)
//TODO get my Info
let html = Mustache.render(userTemplate, { let html = Mustache.render(userTemplate, {
id: myInfo.shopMemberId, id: myInfo.shopMemberId,
profileImage: myInfo.profileImagePath, profileImage: myInfo.profileImagePath,
...@@ -887,9 +898,7 @@ $('#contactButton').on('click', function(event){ ...@@ -887,9 +898,7 @@ $('#contactButton').on('click', function(event){
//TODO get my group user list //TODO get my group user list
console.log('LOAD DONE CONTACT SCREEN'); console.log('LOAD DONE CONTACT SCREEN');
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
}
});
CHAT_UI.refreshRoomList = function() { CHAT_UI.refreshRoomList = function() {
var rooms = CHAT_DB.getRoomList(); var rooms = CHAT_DB.getRoomList();
...@@ -979,24 +988,22 @@ CHAT_UI.joinRoom = function(roomId,roomName) { ...@@ -979,24 +988,22 @@ CHAT_UI.joinRoom = function(roomId,roomName) {
console.log(roomId); console.log(roomId);
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
android.updateMessages(roomId); android.updateMessages(roomId);
socket.emit('joinRoom', roomId, roomName, function() {
// socket.emit('joinRoom', roomId, roomName, function() { });
// $('#messages').html('');
// $('.titleRoomName').text(roomName).data('roomName', roomName);
// $('#pills-chat-tab').tab('show');
// $("#message-search").attr("placeholder", $("#message-search").attr("placeholder")+getLocalizedString("chat_search_placeholder"));
// });
} else { } else {
} }
//var roomInfo = android.getMessages(roomId); var messages = CHAT_DB.getMessages(roomId);
//ui.loadMessages(); console.log(messages);
CHAT_UI.loadMessages(messages, roomId, roomName)
}; };
CHAT_UI.loadMessages = function(messages, shopMemberId, users, roomId, roomName) { CHAT_UI.loadMessages = function(messages, roomId, roomName) {
$('#messages').html(''); $('#messages').html('');
$('.titleRoomName').text(roomName).data('roomName', roomName); $('.titleRoomName').text(roomName).data('roomName', roomName);
$('#pills-chat-tab').tab('show'); $('#pills-chat-tab').tab('show');
$("#message-search").attr("placeholder", $("#message-search").attr("placeholder")+getLocalizedString("chat_search_placeholder")); $("#message-search").attr("placeholder", getLocalizedString("chat_search_placeholder"));
let jQueryMessages = $('#messages'); let jQueryMessages = $('#messages');
// スクロールの変化を防ぐため以前画面の高さを保存する // スクロールの変化を防ぐため以前画面の高さを保存する
let beforeHeight = jQueryMessages.prop('scrollHeight'); let beforeHeight = jQueryMessages.prop('scrollHeight');
...@@ -1004,23 +1011,16 @@ CHAT_UI.loadMessages = function(messages, shopMemberId, users, roomId, roomName) ...@@ -1004,23 +1011,16 @@ CHAT_UI.loadMessages = function(messages, shopMemberId, users, roomId, roomName)
let workVal = ""; let workVal = "";
messages.forEach(function(message) { messages.forEach(function(message) {
let template = $('#message-template').html(); let template = $('#message-template').html();
if (message.shopMemberId == shopMemberId) { if (message.selfFlg == 1) {
template = $('#message-template-me').html(); template = $('#message-template-me').html();
} }
let messageTime = CHAT_UTIL.formatDate(message.time.time); let messageTime = CHAT_UTIL.formatDate(message.insertDate);
if (users != undefined) {
let user = users.find((user) => user.loginId == message.loginId)
// userProfilePathが使えるpathかをcheckして使えないpathの場合、default画像の経路に変更 if (message.profileUrl) {
if (user) { message.profileImagePath = CHAT.getProfileImgUrl(message.profileUrl)
message.profileImagePath = CHAT.getProfileImgUrl(user.profileImagePath)
} else { } else {
message.profileImagePath = CHAT.getProfileImgUrl("") message.profileImagePath = CHAT.getProfileImgUrl("")
} }
} else {
message.profileImagePath = CHAT.getProfileImgUrl(message.profileImagePath)
}
// #36147 // #36147
message.message = message.message.toString(); message.message = message.message.toString();
...@@ -1062,3 +1062,18 @@ CHAT_UI.loadMessages = function(messages, shopMemberId, users, roomId, roomName) ...@@ -1062,3 +1062,18 @@ CHAT_UI.loadMessages = function(messages, shopMemberId, users, roomId, roomName)
// チャットに遷移する // チャットに遷移する
$('#pills-chat-tab').tab('show'); $('#pills-chat-tab').tab('show');
}; };
var coll = document.getElementsByClassName("collapsible");
var i;
for (i = 0; i < coll.length; i++) {
coll[i].addEventListener("click", function() {
this.classList.toggle("collapsible-active");
var content = this.nextElementSibling;
if (content.style.display === "block") {
content.style.display = "none";
} else {
content.style.display = "block";
}
});
}
\ No newline at end of file
...@@ -17,10 +17,11 @@ function connectSocket(isOnline) { ...@@ -17,10 +17,11 @@ function connectSocket(isOnline) {
if (CHAT_UTIL.isIOS()) { if (CHAT_UTIL.isIOS()) {
//TODO IOSの場合 //TODO IOSの場合
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
$('.overlay').removeClass('active undismissable'); //$('.overlay').removeClass('active undismissable');
// loadingIndicatorを表示 // loadingIndicatorを表示
CHAT_UI.showLoadingIndicator(); CHAT_UI.showLoadingIndicator();
android.getLoginParameter(); android.getLoginParameter();
console.log('init')
CHAT_UI.refreshRoomList(); CHAT_UI.refreshRoomList();
CHAT_UI.dismissLoadingIndicator(); CHAT_UI.dismissLoadingIndicator();
$('#createChatRoom').show(); $('#createChatRoom').show();
......
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