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.3KB

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