1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- const BookmarkRouter = {
- template: `
- <div class="content">
- <div id="om-msg-cards" class="is-hidden-desktop">
- <MsgCard
- v-for="id in msgDisplay"
- :key="id"
- :msg="messages[id] || {}"
- :isBookmark="bookmarkArray[id]"
- ></MsgCard>
- </div>
-
-
- <div class="column is-three-quarters is-pulled-right is-hidden-touch content-desktop">
-
- </div>
- </div>`,
-
- data: function () {
- return {
- messagelist: _messagelist,
- messages: _messages,
- isActive: true,
- messageId: '',
- bookmarkArray: auth.bookmarks,
- }
- },
- computed:{
- msgDisplay: function(){
- return (this.messagelist.slice().reverse());
- }
- },
- methods: {
- myFilter: function() {
- this.isActive = !this.isActive;
- },
- getMessageId: function(){
-
- },
- getMessages: function(){
- var arr = auth.bookmarks;
- console.log("arr: "+arr+" auth.bookmarks: "+auth.bookmarks);
- _messagelist.splice(0, _messagelist.length);
- _messagelist.push.apply(_messagelist, arr);
- for (var e in arr) {
- if (!_messages[arr[e]]) {
- //arr[e] =arr[e].replace(/\[/g, '').replace(/\"/g, '').replace(/\]/g, '')
- console.log("getinsertmessage: "+ arr[e]);
- get_insert_message(arr[e]);
- }
- }
-
-
-
-
- /*var _usrid = auth.user;
- $.ajax({
- url: "api/usr/id/" + _usrid,
- method: "GET"
- })
- .done(have_result).fail(have_error);
-
- function have_result(res) {
- var str = JSON.stringify(res[0].bookmarks).split(",");
- _messagelist.splice(0, _messagelist.length);
- for (var e in str) {
- if (!_messages[str[e]]) {
- str[e] =str[e].replace(/\[/g, '').replace(/\"/g, '').replace(/\]/g, '')
- get_insert_message(str[e]);
- }
- }
- _messagelist.push.apply(_messagelist, str);
- //console.log("bookmark str: "+str);
- }
-
- function have_error(err) {
- console.log("error: " + err.responseText);
- console.log(err);
- }*/
- }
- },
- beforeMount: function(){
-
- },
- mounted: function (){
- this.getMessages();
- },
-
- };
|