Commit 9225ef32 by Takatoshi Miura

db連携

parent c751d446
...@@ -114,7 +114,7 @@ ...@@ -114,7 +114,7 @@
<script id="archive-template" type="text/template"> <script id="archive-template" type="text/template">
<li class="d-flex align-items-center"> <li class="d-flex align-items-center">
<a href="archive_detail.html?archiveId=1" class="w-100"> <a href="archive_detail.html?archiveId={{archiveId}}" class="w-100">
<div class="archive_item d-flex flex-row align-items-center w-100"> <div class="archive_item d-flex flex-row align-items-center w-100">
<div class="arhive_img"> <div class="arhive_img">
<div class="img_wrap bg_blue"> <div class="img_wrap bg_blue">
......
$(function() { $(function() {
// アーカイブ検索 // アーカイブ検索
$('#archive .search_form input[type="search"]').keyup(function(){ $('#archive .search_form input[type="search"]').keyup(function(){
$.ajax({ $('.overlay_src_msg').empty();
url: 'search_message_archive_list.html',
type: 'POST', var keyword = $('#archive .search_form input[type="search"]').val();
datatype: 'html' if (keyword == '') {
}).done(function (data) { return;
$('.overlay_src_msg').html(data); }
})
// 検索
var archiveList = CHAT_DB.getArchiveByName(keyword);
var archiveTemplate;
$.get({ url: "./template/template_archive_list.html", async: false }
, function(text) {
archiveTemplate = text;
});
archiveList.forEach(function(archive) {
var typeImage = "";
switch(archive.archiveType) {
case 0: // 画像
typeImage = "icon/icon_collabo_picture.png";
break;
case 1: // 動画
typeImage = "icon/icon_collabo_videocam.png";
break;
case 2: // 音声
typeImage = "icon/icon_collabo_headset.png";
break;
case 3: // 文書
typeImage = "icon/icon_collabo_document.png";
break;
default: // その他
typeImage = "";
}
let html = Mustache.render(archiveTemplate, {
archiveId: archive.archiveId,
fileName: archive.archiveName,
insertDate: archive.archiveDate,
typeImage: typeImage
});
let obj = jQuery.parseHTML(html);
$('.overlay_src_msg').append(obj);
});
}); });
}); });
...@@ -104,3 +104,47 @@ CHAT_DB.getGroupByName = function(groupName) { ...@@ -104,3 +104,47 @@ CHAT_DB.getGroupByName = function(groupName) {
return JSON.parse(android.getGroupByName(groupName)); return JSON.parse(android.getGroupByName(groupName));
} }
}; };
// アーカイブ一覧
CHAT_DB.getArchiveList = function() {
if (CHAT_UTIL.isIOS()) {
// String形式をJsonに変更してReturn
webkit.messageHandlers.getArchiveList.postMessage();
return JSON.parse(iosArchiveList);
} else if (CHAT_UTIL.isAndroid()) {
// TODO
}
};
CHAT_DB.updateArchiveList = function() {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveList.postMessage();
} else if (CHAT_UTIL.isAndroid()) {
// TODO
}
};
CHAT_DB.getArchiveByName = function(archiveName) {
if (CHAT_UTIL.isIOS()) {
// TODO IOS処理
} else if (CHAT_UTIL.isAndroid()) {
// TODO
}
};
// アーカイブ詳細
CHAT_DB.getArchiveDetail = function(archiveId) {
if (CHAT_UTIL.isIOS()) {
// TODO IOS処理
} else if (CHAT_UTIL.isAndroid()) {
// TODO
}
};
CHAT_DB.updateArchiveDetail = function(archiveId) {
if (CHAT_UTIL.isIOS()) {
webkit.messageHandlers.updateArchiveDetail.postMessage({archiveId});
} else if (CHAT_UTIL.isAndroid()) {
// TODO
}
};
...@@ -1417,14 +1417,13 @@ CHAT_UI.refreshArchiveScreen = function() { ...@@ -1417,14 +1417,13 @@ CHAT_UI.refreshArchiveScreen = function() {
// } // }
// let html = Mustache.render(archiveTemplate, { // let html = Mustache.render(archiveTemplate, {
// archiveId: archive.archiveId,
// fileName: archive.archiveName, // fileName: archive.archiveName,
// insertDate: archive.archiveDate, // insertDate: archive.archiveDate,
// typeImage: typeImage // typeImage: typeImage
// }); // });
// let obj = $(jQuery.parseHTML(html)).on('click', function() { // let obj = $(jQuery.parseHTML(html)).on('click', function() {
// // データの受け渡し
// CHAT_UI.refreshArchiveDetailScreen(archive.archiveId);
// }); // });
// $('#archiveList').append(obj); // $('#archiveList').append(obj);
...@@ -1455,14 +1454,13 @@ CHAT_UI.refreshArchiveScreen = function() { ...@@ -1455,14 +1454,13 @@ CHAT_UI.refreshArchiveScreen = function() {
} }
let html = Mustache.render(archiveTemplate, { let html = Mustache.render(archiveTemplate, {
archiveId: 1,
fileName: "ファイル名", fileName: "ファイル名",
insertDate: "2021/03/03 16:14", insertDate: "2021/03/03 16:14",
typeImage: typeImage typeImage: typeImage
}); });
let obj = $(jQuery.parseHTML(html)).on('click', function() { let obj = $(jQuery.parseHTML(html)).on('click', function() {
// データの受け渡し
CHAT_UI.refreshArchiveDetailScreen(1);
}); });
$('#archiveList').append(obj); $('#archiveList').append(obj);
......
<li class="d-flex align-items-center">
<a href="archive_detail.html?archiveId={{archiveId}}" class="w-100">
<div class="archive_item d-flex flex-row align-items-center w-100">
<div class="arhive_img">
<div class="img_wrap bg_blue">
<img src="{{typeImage}}" alt="動画" />
</div>
</div>
<div class="archive_desc">
<div class="archive_name">
<span>{{fileName}}</span>
</div>
<div class="archive_date">
<span>{{insertDate}}</span>
</div>
</div>
</div>
</a>
</li>
\ No newline at end of file
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