Ohm-Management - Projektarbeit B-ME
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

bookmark.js 2.4KB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. const BookmarkRouter = {
  2. template: `
  3. <div class="content">
  4. <div id="om-msg-cards" class="column pull-right-sm is-four-fifths-desktop">
  5. <h3>Gespeicherte Nachrichten </h3>
  6. <MsgCard
  7. v-for="id in msgDisplay"
  8. :key="id"
  9. :msg="messages[id] || {}"
  10. :isBookmark="bookmarkArray[id]"
  11. ></MsgCard>
  12. </div>
  13. </div>`,
  14. data: function () {
  15. return {
  16. messagelist: _messagelist,
  17. messages: _messages,
  18. isActive: true,
  19. messageId: '',
  20. bookmarkArray: auth.bookmarks,
  21. }
  22. },
  23. computed:{
  24. msgDisplay: function(){
  25. return (this.messagelist.slice().reverse());
  26. }
  27. },
  28. methods: {
  29. myFilter: function() {
  30. this.isActive = !this.isActive;
  31. },
  32. getMessageId: function(){
  33. },
  34. getMessages: function(){
  35. var arr = auth.bookmarks;
  36. console.log("arr: "+arr+" auth.bookmarks: "+auth.bookmarks);
  37. _messagelist.splice(0, _messagelist.length);
  38. _messagelist.push.apply(_messagelist, arr);
  39. for (var e in arr) {
  40. if (!_messages[arr[e]]) {
  41. //arr[e] =arr[e].replace(/\[/g, '').replace(/\"/g, '').replace(/\]/g, '')
  42. console.log("getinsertmessage: "+ arr[e]);
  43. get_insert_message(arr[e]);
  44. }
  45. }
  46. /*var _usrid = auth.user;
  47. $.ajax({
  48. url: "api/usr/id/" + _usrid,
  49. method: "GET"
  50. })
  51. .done(have_result).fail(have_error);
  52. function have_result(res) {
  53. var str = JSON.stringify(res[0].bookmarks).split(",");
  54. _messagelist.splice(0, _messagelist.length);
  55. for (var e in str) {
  56. if (!_messages[str[e]]) {
  57. str[e] =str[e].replace(/\[/g, '').replace(/\"/g, '').replace(/\]/g, '')
  58. get_insert_message(str[e]);
  59. }
  60. }
  61. _messagelist.push.apply(_messagelist, str);
  62. //console.log("bookmark str: "+str);
  63. }
  64. function have_error(err) {
  65. console.log("error: " + err.responseText);
  66. console.log(err);
  67. }*/
  68. }
  69. },
  70. beforeMount: function(){
  71. },
  72. mounted: function (){
  73. this.getMessages();
  74. },
  75. };