Update
This commit is contained in:
@@ -18,7 +18,6 @@
|
||||
|
||||
<backtotop-component></backtotop-component>
|
||||
|
||||
|
||||
{% endblock %}
|
||||
|
||||
{% block breadcrumb %}
|
||||
@@ -37,93 +36,85 @@
|
||||
<script type="text/javascript" src="/static/components/pagination.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var app = new Vue({
|
||||
el: '#app',
|
||||
data: {
|
||||
filter: '',
|
||||
menuitem: 'pages',
|
||||
user: {{ pagedata['user']|tojson|safe }},
|
||||
pages: [],
|
||||
pagination: {{ pagedata['pagination']|tojson|safe }},
|
||||
Object.assign(root.data, {
|
||||
menuitem: 'pages',
|
||||
user: {{ pagedata['user']|tojson|safe }},
|
||||
raw_pages: [],
|
||||
pagination: {{ pagedata['pagination']|tojson|safe }},
|
||||
});
|
||||
Object.assign(root.methods, {
|
||||
filterApply: function() {},
|
||||
filterPage: function(page) {
|
||||
let vm = this;
|
||||
if ( vm.filter.length<1 ) {
|
||||
return true;
|
||||
}
|
||||
if ( page.title.toLowerCase().includes(vm.filter.toLowerCase()) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
methods: {
|
||||
filterApply: function() {},
|
||||
filterClear: function() {
|
||||
/* Очистить фильтр */
|
||||
let vm = this;
|
||||
vm.filter = '';
|
||||
},
|
||||
filterPage: function(page) {
|
||||
let vm = this;
|
||||
if ( vm.filter.length<1 ) {
|
||||
return true;
|
||||
}
|
||||
if ( page.title.toLowerCase().includes(vm.filter.toLowerCase()) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
},
|
||||
getPages: function() {
|
||||
/* Получить список статей */
|
||||
let vm = this;
|
||||
axios.post(
|
||||
'/api',
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "pages",
|
||||
"params": {
|
||||
"page": vm.pagination.page
|
||||
},
|
||||
"id": 1
|
||||
}
|
||||
).then(
|
||||
function(response) {
|
||||
if ('result' in response.data) {
|
||||
vm.pages = response.data['result'];
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
created: function() {
|
||||
getPages: function() {
|
||||
/* Получить список статей */
|
||||
let vm = this;
|
||||
axios.post(
|
||||
'/api',
|
||||
[
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "user.pages",
|
||||
"params": {
|
||||
"id": vm.user.id,
|
||||
"page": vm.pagination.page
|
||||
},
|
||||
"id": 1
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "pages",
|
||||
"params": {
|
||||
"page": vm.pagination.page
|
||||
},
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "user.pages.count",
|
||||
"params": {
|
||||
"id": vm.user.id,
|
||||
},
|
||||
"id": 1
|
||||
}
|
||||
]
|
||||
"id": 1
|
||||
}
|
||||
).then(
|
||||
function(response) {
|
||||
if ('result' in response.data[0]) {
|
||||
vm.pages = response.data[0]['result'];
|
||||
}
|
||||
if ('result' in response.data[1]) {
|
||||
vm.pagination.size = response.data[1]['result'];
|
||||
if ('result' in response.data) {
|
||||
vm.raw_pages = response.data['result'];
|
||||
}
|
||||
}
|
||||
);
|
||||
},
|
||||
});
|
||||
root.created = function() {
|
||||
let vm = this;
|
||||
axios.post(
|
||||
'/api',
|
||||
[
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "user.pages",
|
||||
"params": {
|
||||
"id": vm.user.id,
|
||||
"page": vm.pagination.page
|
||||
},
|
||||
"id": 1
|
||||
},
|
||||
{
|
||||
"jsonrpc": "2.0",
|
||||
"method": "user.pages.count",
|
||||
"params": {
|
||||
"id": vm.user.id,
|
||||
},
|
||||
"id": 1
|
||||
}
|
||||
]
|
||||
).then(
|
||||
function(response) {
|
||||
if ('result' in response.data[0]) {
|
||||
vm.raw_pages = response.data[0]['result'];
|
||||
}
|
||||
if ('result' in response.data[1]) {
|
||||
vm.pagination.size = response.data[1]['result'];
|
||||
}
|
||||
}
|
||||
);
|
||||
};
|
||||
computed: {
|
||||
filteredPages: function() {
|
||||
pages: function() {
|
||||
/* Отфильтрованный список */
|
||||
let vm = this;
|
||||
var result = vm.pages.filter(vm.filterPage);
|
||||
var result = vm.raw_pages.filter(vm.filterPage);
|
||||
return result;
|
||||
},
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user