90 lines
3.2 KiB
JavaScript
90 lines
3.2 KiB
JavaScript
![]() |
define(['jquery', 'bootstrap', 'backend', 'table', 'form'], function ($, undefined, Backend, Table, Form) {
|
|||
|
|
|||
|
var Controller = {
|
|||
|
index: function () {
|
|||
|
|
|||
|
var navIndex = new Vue({
|
|||
|
el: '#app',
|
|||
|
data: function() {
|
|||
|
return {
|
|||
|
nav: [],
|
|||
|
openIds:[],
|
|||
|
openIco:"/assets/addons/jdgw/images/dedeexplode.gif",
|
|||
|
closeIco:"/assets/addons/jdgw/images/dedecontract.gif"
|
|||
|
}
|
|||
|
},
|
|||
|
mounted() {
|
|||
|
var that = this
|
|||
|
that.navList();
|
|||
|
},
|
|||
|
updated(){
|
|||
|
var that = this
|
|||
|
$(function(){
|
|||
|
$(".btn-diyedit, .btn-diyadd").data("end", function(){
|
|||
|
that.navList();
|
|||
|
});
|
|||
|
});
|
|||
|
},
|
|||
|
methods:{
|
|||
|
open(viewIndex) {
|
|||
|
this.nav[viewIndex].open = !this.nav[viewIndex].open
|
|||
|
this.openIds = [];
|
|||
|
for (var i=0;i<this.nav.length;i++){
|
|||
|
if(this.nav[i].open){
|
|||
|
this.openIds.push(this.nav[i].id)
|
|||
|
}
|
|||
|
}
|
|||
|
},
|
|||
|
del(id){
|
|||
|
var that = this;
|
|||
|
Layer.confirm("确定删除此栏目?",
|
|||
|
{icon: 3, title: __('Warning'), shadeClose: true},
|
|||
|
function (index) {
|
|||
|
Fast.api.ajax({url:'jdgw/nav/del', data:{ids:id}}, function (data, ret) {
|
|||
|
that.navList();
|
|||
|
});
|
|||
|
Layer.close(index);
|
|||
|
}
|
|||
|
);
|
|||
|
},
|
|||
|
editSort(id, e){
|
|||
|
var that = this;
|
|||
|
var weigh = e.target.value;
|
|||
|
$.ajax({
|
|||
|
type: 'POST',
|
|||
|
url: 'jdgw/nav/editWeigh',
|
|||
|
data: {weigh: weigh, id: id},
|
|||
|
success: function(res) {
|
|||
|
that.navList()
|
|||
|
}});
|
|||
|
},
|
|||
|
navList(){
|
|||
|
var that = this;
|
|||
|
$.ajax({
|
|||
|
type: 'POST',
|
|||
|
data:{openIds:that.openIds},
|
|||
|
url: 'jdgw/nav/index',
|
|||
|
success:function(res){
|
|||
|
that.nav = res.data
|
|||
|
}
|
|||
|
});
|
|||
|
},
|
|||
|
}
|
|||
|
})
|
|||
|
|
|||
|
},
|
|||
|
add: function () {
|
|||
|
Controller.api.bindevent();
|
|||
|
},
|
|||
|
edit: function () {
|
|||
|
Controller.api.bindevent();
|
|||
|
|
|||
|
},
|
|||
|
api: {
|
|||
|
bindevent: function () {
|
|||
|
Form.api.bindevent($("form[role=form]"));
|
|||
|
}
|
|||
|
}
|
|||
|
};
|
|||
|
return Controller;
|
|||
|
});
|