Commit 4c630ccd by Lee Munkyeong

バグ修正、チャットUI

parent 5cb24459
......@@ -45,16 +45,16 @@
<!-- ユーザー検索 -->
<div class="search_form">
<form>
<input type="search" name="search" placeholder="ユーザー検索">
<input type="search" name="search" placeholder="ルーム検索">
<span class="src_icon"></span>
<a href="#" class="cancel none">キャンセル</a>
</form>
</div>
<!-- タブ -->
<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>
<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>
<div class="tab_content" id="tab1_content">
<div class="chat_list" id="groupChatList">
......@@ -68,6 +68,8 @@
<!-- オーバーレイ -->
<div class="chat_list">
<ul class="overlay_src_msg">
</ul>
</div>
</main>
......@@ -139,7 +141,7 @@
IS_MOBILE = isMobile;
IS_ONLINE = isOnline;
console.log("onChat");
CHAT_UI.refreshRoomList(chatRoomType.DM);
CHAT_UI.refreshRoomList(chatRoomType.GROUP);
};
</script>
</body>
......
......@@ -189,6 +189,7 @@
<script src="./js/chat-util.js"></script>
<script src="./js/chat-db.js"></script>
<script src="./js/chat-websocket.js"></script>
<script src="./js/chat-room.js"></script>
<script>
String.prototype.replaceAll = function(org, dest) {
return this.split(org).join(dest);
......
......@@ -51,7 +51,7 @@
<div class="content chat_list">
<ul class="p-0 chat_make_room_list">
<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_l">
<div class="thubnail">
......
......@@ -3,12 +3,12 @@ var CHAT_DB = {};
//ロカールDBからルーム一覧情報を取得
CHAT_DB.getRoomList = function(roomType) {
CHAT_DB.getRoomList = function(roomType, keyWord) {
if (CHAT_UTIL.isIOS()) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//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) {
//TODO IOS処理追加必要
} else if (CHAT_UTIL.isAndroid()) {
//String形式をJsonに変更してReturn
console.log(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) {
if (IS_ONLINE == 'true') {
android.updateRoomList();
}
var rooms = CHAT_DB.getRoomList(roomType);
var rooms = CHAT_DB.getRoomList(roomType, null);
CHAT.globalIsInvite = false;
activeRoomId = null;
console.log(rooms);
......@@ -1286,7 +1286,7 @@ CHAT_UI.insertFavoriteGroup = function(groupId) {
//全グループ検索画面表示。
CHAT_UI.refreshAllGroupSearch = function(groupId) {
$('#userNameCard').modal('hide');
$('.cancel').addClass('none');
$('.search_form input').removeClass('focus');
$('.search_form input').val('');
......@@ -1399,16 +1399,16 @@ CHAT_UI.startVoice = function() {
CHAT_UI.makeNameCard = function(shopMemberId) {
var nameCardInfo = CHAT_DB.getNameCardData(shopMemberId);
console.log(nameCardInfo);
var namecardTemplate;
$.get({ url: "./template/template_user_name_card.html", async: false }
, function(text) {
namecardTemplate = text;
});
nameCardInfo.profileUrl = CHAT.getProfileImgUrl(nameCardInfo.profileUrl);
let namecardHtml = Mustache.render(namecardTemplate, {
shopMemberId: nameCardInfo.shopMemberId,
profileImage: nameCardInfo.profileImagePath,
profileUrl: nameCardInfo.profileUrl,
name: nameCardInfo.shopMemberName,
groupPathList: nameCardInfo.groupPathList,
chat: getLocalizedString("chat"),
......
......@@ -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() {
// ルーム開設メンバー数カウント
$('input:checkbox').change(function() {
......@@ -354,13 +341,56 @@ $(function() {
// チャットメンバー検索
$('#chat .search_form input[type="search"]').keyup(function(){
$.ajax({
url: 'search_message_user_list.html',
type: 'POST',
datatype: 'html'
}).done(function (data) {
$('.overlay_src_msg').html(data);
})
console.log($('#chat .search_form input[type="search"]').val());
var keyword = $('#chat .search_form input[type="search"]').val();
var rooms = CHAT_DB.getRoomList(chatRoomType.ALL, keyword);
console.log(rooms);
let roomListTitle = getLocalizedString("room_search_placeholder");
$('#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(){
......
......@@ -23,7 +23,8 @@ const userAPICmd = {
const chatRoomType = {
DM : "1",
GROUP : "0"
GROUP : "0",
ALL : "2"
}
const nameCardAreaId = {
......
$(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');
$('.overlay_src_msg').empty();
//全グループ検索画面
if (isAllGroup) {
var keyword = $('#contact .search_form input[type="search"]').val();
if (keyword == '') {
if (keyword == '' || keyword.leght < 2) {
return;
}
......
......@@ -4,7 +4,7 @@ $.lang.ja = {
"room_search_placeholder":" ルーム検索",
"participants":"メンバーリスト",
"exitRoom":"退出 ",
"roomListTitle":"ルーム一覧",
"roomListTitle":"チャット",
"deleteRoomTitle":"ルーム削除",
"inviteUsersButton":"招待",
"inviteUsersTitle":"メンバー追加",
......
......@@ -12,7 +12,7 @@
</div>
<div class="modal-body">
{{#groupPathList}}
<li><b>{{.}}</b></li>
<li onclick="CHAT_UI.refreshAllGroupSearch({{groupId}});"><b>{{groupPath}}</b></li>
{{/groupPathList}}
</div>
<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