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 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  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 _usrid = "5d360f06b8f3ce67d12ccc92";
  35. $.ajax({
  36. url: "api/usr/id/" + _usrid,
  37. method: "GET"
  38. })
  39. .done(have_result).fail(have_error);
  40. function have_result(res) {
  41. var str = JSON.stringify(res[0].bookmarks).split(",");
  42. _messagelist.splice(0, _messagelist.length);
  43. for (var e in str) {
  44. if (!_messages[str[e]]) {
  45. str[e] =str[e].replace(/\[/g, '').replace(/\"/g, '').replace(/\]/g, '')
  46. get_insert_message(str[e]);
  47. }
  48. }
  49. _messagelist.push.apply(_messagelist, str);
  50. //console.log("bookmark str: "+str);
  51. }
  52. function have_error(err) {
  53. console.log("error: " + err.responseText);
  54. console.log(err);
  55. }
  56. }
  57. },
  58. mounted: function (){
  59. this.getMessages();
  60. }
  61. };