Commit 4c630ccd by Lee Munkyeong

バグ修正、チャットUI

parent 5cb24459
...@@ -45,16 +45,16 @@ ...@@ -45,16 +45,16 @@
<!-- ユーザー検索 --> <!-- ユーザー検索 -->
<div class="search_form"> <div class="search_form">
<form> <form>
<input type="search" name="search" placeholder="ユーザー検索"> <input type="search" name="search" placeholder="ルーム検索">
<span class="src_icon"></span> <span class="src_icon"></span>
<a href="#" class="cancel none">キャンセル</a> <a href="#" class="cancel none">キャンセル</a>
</form> </form>
</div> </div>
<!-- タブ --> <!-- タブ -->
<div class="content tabs"> <div class="content tabs">
<input id="tabGroup" type="radio" name="tab_item"> <input id="tabGroup" type="radio" name="tab_item" checked>
<label class="tab_item" for="tabGroup">グループ</label> <label class="tab_item" for="tabGroup">グループ</label>
<input id="tabDM" type="radio" name="tab_item" checked> <input id="tabDM" type="radio" name="tab_item">
<label class="tab_item" for="tabDM">DM</label> <label class="tab_item" for="tabDM">DM</label>
<div class="tab_content" id="tab1_content"> <div class="tab_content" id="tab1_content">
<div class="chat_list" id="groupChatList"> <div class="chat_list" id="groupChatList">
...@@ -68,6 +68,8 @@ ...@@ -68,6 +68,8 @@
<!-- オーバーレイ --> <!-- オーバーレイ -->
<div class="chat_list"> <div class="chat_list">
<ul class="overlay_src_msg"> <ul class="overlay_src_msg">
</ul> </ul>
</div> </div>
</main> </main>
...@@ -139,7 +141,7 @@ ...@@ -139,7 +141,7 @@
IS_MOBILE = isMobile; IS_MOBILE = isMobile;
IS_ONLINE = isOnline; IS_ONLINE = isOnline;
console.log("onChat"); console.log("onChat");
CHAT_UI.refreshRoomList(chatRoomType.DM); CHAT_UI.refreshRoomList(chatRoomType.GROUP);
}; };
</script> </script>
</body> </body>
......
...@@ -189,6 +189,7 @@ ...@@ -189,6 +189,7 @@
<script src="./js/chat-util.js"></script> <script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script> <script src="./js/chat-db.js"></script>
<script src="./js/chat-websocket.js"></script> <script src="./js/chat-websocket.js"></script>
<script src="./js/chat-room.js"></script>
<script> <script>
String.prototype.replaceAll = function(org, dest) { String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest); return this.split(org).join(dest);
......
...@@ -51,7 +51,7 @@ ...@@ -51,7 +51,7 @@
<div class="content chat_list"> <div class="content chat_list">
<ul class="p-0 chat_make_room_list"> <ul class="p-0 chat_make_room_list">
<li class="d-flex align-items-center"> <li class="d-flex align-items-center">
<a href="#" data-toggle="modal" data-target="#myNameCard" style="width: 100%;"> <a href="#" style="width: 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="thubnail"> <div class="thubnail">
......
...@@ -3,12 +3,12 @@ var CHAT_DB = {}; ...@@ -3,12 +3,12 @@ var CHAT_DB = {};
//ロカールDBからルーム一覧情報を取得 //ロカールDBからルーム一覧情報を取得
CHAT_DB.getRoomList = function(roomType) { 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 //String形式をJsonに変更してReturn
return JSON.parse(android.getRoomList(roomType)); return JSON.parse(android.getRoomList(roomType, keyWord));
} }
}; };
...@@ -75,6 +75,7 @@ CHAT_DB.getNameCardData = function(shopMemberId) { ...@@ -75,6 +75,7 @@ CHAT_DB.getNameCardData = function(shopMemberId) {
//TODO IOS処理追加必要 //TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) { } else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn //String形式をJsonに変更してReturn
console.log(android.getNameCardData(shopMemberId));
return JSON.parse(android.getNameCardData(shopMemberId)); return JSON.parse(android.getNameCardData(shopMemberId));
} }
}; };
......
var lastscrollvalue;
window.onscroll = function() {
console.log('scroll');
var a = $('#messages');
if (lastscrollvalue == undefined) {
console.log('first')
lastscrollvalue = a.scrollTop;
// sets lastscrollvalue
} else if (a.scrollTop > lastscrollvalue) {
console.log('up');
// downscroll rules will be here
lastscrollvalue = a.scrollTop;
} else if (a.scrollTop < lastscrollvalue) {
console.log('down');
// upscroll rules will be here
lastscrollvalue = a.scrollTop;
}
}
\ No newline at end of file
...@@ -1018,7 +1018,7 @@ CHAT_UI.refreshRoomList = function(roomType) { ...@@ -1018,7 +1018,7 @@ CHAT_UI.refreshRoomList = function(roomType) {
if (IS_ONLINE == 'true') { if (IS_ONLINE == 'true') {
android.updateRoomList(); android.updateRoomList();
} }
var rooms = CHAT_DB.getRoomList(roomType); var rooms = CHAT_DB.getRoomList(roomType, null);
CHAT.globalIsInvite = false; CHAT.globalIsInvite = false;
activeRoomId = null; activeRoomId = null;
console.log(rooms); console.log(rooms);
...@@ -1286,7 +1286,7 @@ CHAT_UI.insertFavoriteGroup = function(groupId) { ...@@ -1286,7 +1286,7 @@ CHAT_UI.insertFavoriteGroup = function(groupId) {
//全グループ検索画面表示。 //全グループ検索画面表示。
CHAT_UI.refreshAllGroupSearch = function(groupId) { CHAT_UI.refreshAllGroupSearch = function(groupId) {
$('#userNameCard').modal('hide');
$('.cancel').addClass('none'); $('.cancel').addClass('none');
$('.search_form input').removeClass('focus'); $('.search_form input').removeClass('focus');
$('.search_form input').val(''); $('.search_form input').val('');
...@@ -1399,16 +1399,16 @@ CHAT_UI.startVoice = function() { ...@@ -1399,16 +1399,16 @@ CHAT_UI.startVoice = function() {
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) {
namecardTemplate = text; namecardTemplate = text;
}); });
nameCardInfo.profileUrl = CHAT.getProfileImgUrl(nameCardInfo.profileUrl);
let namecardHtml = Mustache.render(namecardTemplate, { let namecardHtml = Mustache.render(namecardTemplate, {
shopMemberId: nameCardInfo.shopMemberId, shopMemberId: nameCardInfo.shopMemberId,
profileImage: nameCardInfo.profileImagePath, profileUrl: nameCardInfo.profileUrl,
name: nameCardInfo.shopMemberName, name: nameCardInfo.shopMemberName,
groupPathList: nameCardInfo.groupPathList, groupPathList: nameCardInfo.groupPathList,
chat: getLocalizedString("chat"), chat: getLocalizedString("chat"),
......
...@@ -275,19 +275,6 @@ CHAT.leaveRoom = function() { ...@@ -275,19 +275,6 @@ CHAT.leaveRoom = function() {
}); });
} }
CHAT.requestMyinfo = function() {
jQuery.ajax({
async: true,
url: CMS_SERVER_URL + "/chatapi/user?sid=" + CHAT.globalLoginParameter.sid + "&cmd=" + userAPICmd.MYINFO,
type: "get",
processData: false,
contentType: false
}).done(function(res) {
console.log(res);
return res;
})
}
$(function() { $(function() {
// ルーム開設メンバー数カウント // ルーム開設メンバー数カウント
$('input:checkbox').change(function() { $('input:checkbox').change(function() {
...@@ -354,13 +341,56 @@ $(function() { ...@@ -354,13 +341,56 @@ $(function() {
// チャットメンバー検索 // チャットメンバー検索
$('#chat .search_form input[type="search"]').keyup(function(){ $('#chat .search_form input[type="search"]').keyup(function(){
$.ajax({ console.log($('#chat .search_form input[type="search"]').val());
url: 'search_message_user_list.html', var keyword = $('#chat .search_form input[type="search"]').val();
type: 'POST', var rooms = CHAT_DB.getRoomList(chatRoomType.ALL, keyword);
datatype: 'html' console.log(rooms);
}).done(function (data) { let roomListTitle = getLocalizedString("room_search_placeholder");
$('.overlay_src_msg').html(data); $('#chatTitle').text(roomListTitle);
}) var template;
$.get({ url: "./template/template_room_list.html", async: false }
, function(text) {
template = text;
});
rooms.forEach(function(room) {
room.profileImagePath = ASSET_PATH + 'images/user-profile.png'
if (room.message) {
room.message = room.message.toString()
} else {
room.message = getLocalizedString("noMessages")
}
var displayMsg;
if (room.messageType == messageType.TEXT || room.messageType == messageType.TEXT) displayMsg = room.message;
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, {
thumbnailCount: thumbnailCount,
roomName: room.chatRoomName,
roomId: room.chatRoomId,
profileImage: room.profileImagePath,
lastMessage: displayMsg ,
time: room.insertDate ? CHAT_UTIL.formatDate(room.insertDate).createdAt : '',
unreadMsgCnt: room.unreadCount == 0 ? '' : room.unreadCount,
userCnt: room.attendUsers.length + 1,
attendUsers: room.attendUsers
});
// Click event
let obj = $(jQuery.parseHTML(html)).on('click', function() {
});
$('.overlay_src_msg').append(obj);
});
if (CHAT_UI.isLandscapeMode()) {
$(".chat_list").removeClass("col-12").addClass("col-6");
}
}); });
// ルームメンバー検索 // ルームメンバー検索
$('#chat_room .search_form input[type="search"]').keyup(function(){ $('#chat_room .search_form input[type="search"]').keyup(function(){
......
...@@ -23,7 +23,8 @@ const userAPICmd = { ...@@ -23,7 +23,8 @@ const userAPICmd = {
const chatRoomType = { const chatRoomType = {
DM : "1", DM : "1",
GROUP : "0" GROUP : "0",
ALL : "2"
} }
const nameCardAreaId = { const nameCardAreaId = {
......
$(function() { $(function() {
// メンバー検索 // メンバー検索
$('#contact .search_form input[type="search"]').keyup(function(){ $('#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();
//全グループ検索画面 //全グループ検索画面
if (isAllGroup) { if (isAllGroup) {
var keyword = $('#contact .search_form input[type="search"]').val(); var keyword = $('#contact .search_form input[type="search"]').val();
if (keyword == '') { if (keyword == '' || keyword.leght < 2) {
return; return;
} }
......
...@@ -4,7 +4,7 @@ $.lang.ja = { ...@@ -4,7 +4,7 @@ $.lang.ja = {
"room_search_placeholder":" ルーム検索", "room_search_placeholder":" ルーム検索",
"participants":"メンバーリスト", "participants":"メンバーリスト",
"exitRoom":"退出 ", "exitRoom":"退出 ",
"roomListTitle":"ルーム一覧", "roomListTitle":"チャット",
"deleteRoomTitle":"ルーム削除", "deleteRoomTitle":"ルーム削除",
"inviteUsersButton":"招待", "inviteUsersButton":"招待",
"inviteUsersTitle":"メンバー追加", "inviteUsersTitle":"メンバー追加",
......
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
</div> </div>
<div class="modal-body"> <div class="modal-body">
{{#groupPathList}} {{#groupPathList}}
<li><b>{{.}}</b></li> <li onclick="CHAT_UI.refreshAllGroupSearch({{groupId}});"><b>{{groupPath}}</b></li>
{{/groupPathList}} {{/groupPathList}}
</div> </div>
<div class="modal-footer border-0 justify-content-center"> <div class="modal-footer border-0 justify-content-center">
......
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