Commit bb64ab0d by Lee Munkyeong

チャット画面UI

parent ed4601f6
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
<div class="col-4 pr-0"> <div class="col-4 pr-0">
<div class="nav-item"> <div class="nav-item">
<div class="nav_prev"> <div class="nav_prev">
<a href="#"><span>ホーム</span></a> <a href="#" class="home_btn"><span>ホーム</span></a>
</div> </div>
</div> </div>
</div> </div>
...@@ -55,7 +55,7 @@ ...@@ -55,7 +55,7 @@
<div class="chat_item d-flex flex-row align-items-center"> <div class="chat_item d-flex flex-row align-items-center">
<div class="chat_item_l"> <div class="chat_item_l">
<div class="thubnail"> <div class="thubnail">
<div class="img_wrap"><img id="myImg" src="img/noImage.png" alt="サムネイル画像" /></div> <div class="img_wrap"><img id="myImg" src="img/noImage.png" onError="this.src='./img/noImage.png'" /></div>
</div> </div>
</div> </div>
<div class="chat_item_m px-0"> <div class="chat_item_m px-0">
......
...@@ -42,6 +42,11 @@ input[name="tab_item"] { ...@@ -42,6 +42,11 @@ input[name="tab_item"] {
display: block; display: block;
} }
#tabGroup:checked ~ #tab1_content,
#tabDM:checked ~ #tab2_content{
display: block;
}
.tabs input:checked + .tab_item { .tabs input:checked + .tab_item {
background-color: #0070CA; background-color: #0070CA;
color: #fff; color: #fff;
...@@ -127,7 +132,7 @@ input[name="tab_item"] { ...@@ -127,7 +132,7 @@ input[name="tab_item"] {
} }
.chat_item_l .thubnail3 .img_wrap:nth-child(2) img, .chat_item_l .thubnail3 .img_wrap:nth-child(3) img { .chat_item_l .thubnail3 .img_wrap:nth-child(2) img, .chat_item_l .thubnail3 .img_wrap:nth-child(3) img {
width: 25px; width: 25px;
height: 25px; height: 30px;
} }
.chat_item_l .thubnail3 .img_wrap:nth-child(3) { .chat_item_l .thubnail3 .img_wrap:nth-child(3) {
width: 25px; width: 25px;
......
...@@ -1003,6 +1003,12 @@ CHAT_UI.refreshContactScreen = function() { ...@@ -1003,6 +1003,12 @@ CHAT_UI.refreshContactScreen = function() {
} }
CHAT_UI.refreshRoomList = function(roomType) { CHAT_UI.refreshRoomList = function(roomType) {
if (roomType == chatRoomType.DM) {
$('#tabDM').prop('checked', true);
} else {
$('#tabGroup').prop('checked', true);
}
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
android.updateRoomList(); android.updateRoomList();
} }
...@@ -1011,19 +1017,23 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1011,19 +1017,23 @@ CHAT_UI.refreshRoomList = function(roomType) {
activeRoomId = null; activeRoomId = null;
console.log(rooms); console.log(rooms);
// #36146に対応 // #36146に対応
$('.chat_list').empty(); $('#groupChatList').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') console.log('noRoom')
// 検索結果がない場合のメッセージを追加 // 検索結果がない場合のメッセージを追加
if (!keywordSearchMode) { let emptyListString = getLocalizedString("roomListEmptyString")
let emptyListString = getLocalizedString("roomListEmptyString") switch(roomType) {
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`); case chatRoomType.GROUP:
} else { $('#groupChatList').append(`<center class="text-secondary">${emptyListString}</center>`);
let emptyListString = getLocalizedString("searchRoomListEmptyString") break;
$('#room_list').append(`<center class="text-secondary">${emptyListString}</center>`); case chatRoomType.DM:
} $('#dmChatList').append(`<center class="text-secondary">${emptyListString}</center>`);
break;
default:
}
} }
var template; var template;
...@@ -1031,6 +1041,7 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1031,6 +1041,7 @@ 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) {
...@@ -1042,14 +1053,25 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1042,14 +1053,25 @@ CHAT_UI.refreshRoomList = function(roomType) {
//TODO 協業の場合処理追加必要 //TODO 協業の場合処理追加必要
if (room.messageType == messageType.TEXT || room.messageType == messageType.TEXT) displayMsg = room.message; if (room.messageType == messageType.TEXT || room.messageType == messageType.TEXT) displayMsg = room.message;
if (room.messageType == messageType.IMAGE || room.messageType == messageType.SYSTEM) displayMsg = getLocalizedString("image"); if (room.messageType == messageType.IMAGE || room.messageType == messageType.SYSTEM) displayMsg = getLocalizedString("image");
var attendUserName = [];
room.attendUsers.forEach(function(user) {
user.profileUrl = CHAT.getProfileImgUrl(user.profileUrl);
attendUserName.push(user.shopMemberName);
});
var thumbnailCount = room.attendUsers.length > 4 ? 4 : room.attendUsers.length;
if (room.chatRoomName == "") {
room.chatRoomName = attendUserName.join(', ');
}
let html = Mustache.render(template, { let html = Mustache.render(template, {
thumbnailCount: thumbnailCount,
roomName: room.chatRoomName, roomName: room.chatRoomName,
roomId: room.chatRoomId, roomId: room.chatRoomId,
profileImage: room.profileImagePath, profileImage: room.profileImagePath,
lastMessage: displayMsg , lastMessage: displayMsg ,
time: room.insertDate ? CHAT_UTIL.formatDate(room.insertDate).createdAt : '', time: room.insertDate ? CHAT_UTIL.formatDate(room.insertDate).createdAt : '',
unreadMsgCnt: room.unreadCount == 0 ? '' : room.unreadCount, unreadMsgCnt: room.unreadCount == 0 ? '' : room.unreadCount,
userCnt: room.userCount userCnt: room.attendUsers.length + 1,
attendUsers: room.attendUsers
}); });
// Click event // Click event
let obj = $(jQuery.parseHTML(html)).on('click', function() { let obj = $(jQuery.parseHTML(html)).on('click', function() {
...@@ -1058,13 +1080,15 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1058,13 +1080,15 @@ CHAT_UI.refreshRoomList = function(roomType) {
CHAT_UI.joinRoom(roomId,roomName);*/ CHAT_UI.joinRoom(roomId,roomName);*/
//TODO ルームに入る処理追加必要 //TODO ルームに入る処理追加必要
}); });
console.log(obj);
// ルームグループごとに追加。 // ルームグループごとに追加。
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:
console.log(roomType);
$('#dmChatList').append(obj); $('#dmChatList').append(obj);
break; break;
default: default:
...@@ -1155,21 +1179,20 @@ CHAT_UI.loadMessages = function(messages, roomId, roomName) { ...@@ -1155,21 +1179,20 @@ CHAT_UI.loadMessages = function(messages, roomId, roomName) {
}; };
$('#dmBtn').on('click', function(e) { $('#tabDM').on('click', function(e) {
CHAT_UI.refreshRoomList(chatRoomType.DM); CHAT_UI.refreshRoomList(chatRoomType.DM);
}); });
$('#groupBtn').on('click', function(e) { $('#tabGroup').on('click', function(e) {
CHAT_UI.refreshRoomList(chatRoomType.GROUP); CHAT_UI.refreshRoomList(chatRoomType.GROUP);
}); });
$('#myGroupBtn').on('click', function(e) { $('#tabAllGroup').on('click', function(e) {
$('#myGroupArea').show(); CHAT_UI.refreshAllGroupSearch('0');
$('#allGroupArea').hide();
}); });
$('#tabAllGroup').on('click', function(e) { $('#tabMyGroup').on('click', function(e) {
CHAT_UI.refesshAllGroupSearch('0') CHAT_UI.refreshContactScreen();
}); });
CHAT_UI.favoriteUserChange = function(shopMemberId, star) { CHAT_UI.favoriteUserChange = function(shopMemberId, star) {
...@@ -1217,7 +1240,7 @@ CHAT_UI.insertFavoriteGroup = function(groupId) { ...@@ -1217,7 +1240,7 @@ CHAT_UI.insertFavoriteGroup = function(groupId) {
}; };
//全グループ検索画面表示。 //全グループ検索画面表示。
CHAT_UI.refesshAllGroupSearch = function(groupId) { CHAT_UI.refreshAllGroupSearch = function(groupId) {
$('.cancel').addClass('none'); $('.cancel').addClass('none');
$('.search_form input').removeClass('focus'); $('.search_form input').removeClass('focus');
...@@ -1246,12 +1269,12 @@ CHAT_UI.refesshAllGroupSearch = function(groupId) { ...@@ -1246,12 +1269,12 @@ CHAT_UI.refesshAllGroupSearch = function(groupId) {
//上位グループ、トップグループ遷移ボタンのイベント追加。 //上位グループ、トップグループ遷移ボタンのイベント追加。
if (typeof result.parentGroupId !== 'undefined') { if (typeof result.parentGroupId !== 'undefined') {
$('#parentGroupBtn').on('click', function() { $('#parentGroupBtn').on('click', function() {
CHAT_UI.refesshAllGroupSearch(result.parentGroupId); CHAT_UI.refreshAllGroupSearch(result.parentGroupId);
}); });
} }
if (typeof result.rootGroupId !== 'undefined') { if (typeof result.rootGroupId !== 'undefined') {
$('#rootGroupBtn').on('click', function() { $('#rootGroupBtn').on('click', function() {
CHAT_UI.refesshAllGroupSearch(result.rootGroupId); CHAT_UI.refreshAllGroupSearch(result.rootGroupId);
}); });
} }
......
// アコーディオン // アコーディオン
$('.category').on('click',function () { $('.category').on('click', function() {
$(this).toggleClass("open"); $(this).toggleClass("open");
$(this).next().slideToggle(); $(this).next().slideToggle();
}); });
$('.home_btn').on('click', function() {
android.goHome();
});
$(function() { $(function() {
var h = $(window).height(); //画面の高さを取得 var h = $(window).height(); //画面の高さを取得
......
<li class="d-flex align-items-center"> <li class="d-flex align-items-center">
<a href="#" class="w-100" onclick="CHAT_UI.refesshAllGroupSearch({{id}});"> <a href="#" class="w-100" onclick="CHAT_UI.refreshAllGroupSearch({{id}});">
<div class="chat_item d-flex flex-row align-items-center"> <div class="chat_item d-flex flex-row align-items-center">
<div class="chat_item_l"> <div class="chat_item_l">
<div class="thubnail"> <div class="thubnail">
......
<a href="#" class="breadcrumb_item" onclick="CHAT_UI.refesshAllGroupSearch({{id}});"><span>{{name}}</span></a> <a href="#" class="breadcrumb_item" onclick="CHAT_UI.refreshAllGroupSearch({{id}});"><span>{{name}}</span></a>
\ No newline at end of file \ No newline at end of file
...@@ -2,11 +2,13 @@ ...@@ -2,11 +2,13 @@
<a href="chat_room.html" class="w-100"> <a href="chat_room.html" class="w-100">
<div class="chat_item d-flex flex-row align-items-center"> <div class="chat_item d-flex flex-row align-items-center">
<div class="chat_item_l"> <div class="chat_item_l">
<div class="thubnail4 thubnail"> <div class="thubnail{{thumbnailCount}} thubnail">
<div class="img_wrap"><img src="img/thumbnail.png" alt="サムネイル画像" /></div> {{#attendUsers}}
<div class="img_wrap"><img src="img/thumbnail.png" alt="サムネイル画像" /></div> <div class="img_wrap"><img src="{{profileUrl}}" onError="this.src='./img/noImage.png'"/></div>
<div class="img_wrap"><img src="img/thumbnail.png" alt="サムネイル画像" /></div> {{/attendUsers}}
<div class="img_wrap"><img src="img/thumbnail.png" alt="サムネイル画像" /></div> {{^attendUsers}}
<div class="img_wrap"><img src='./img/noImage.png'/></div>
{{/attendUsers}}
</div> </div>
</div> </div>
<div class="chat_item_m px-0"> <div class="chat_item_m px-0">
...@@ -15,9 +17,7 @@ ...@@ -15,9 +17,7 @@
<div class="chat_item_t "> <div class="chat_item_t ">
<span class="chat_item_ttl">{{roomName}}</span> <span class="chat_item_ttl">{{roomName}}</span>
</div> </div>
<span class="chat_item_num">({{userCnt}})</span> <span class="chat_item_num">({{userCnt}})</span>
</div> </div>
<div class="chat_item_desc"> <div class="chat_item_desc">
{{lastMessage}} {{lastMessage}}
......
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