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

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