rewrite axios && mock data

This commit is contained in:
Pan
2017-05-15 17:56:45 +08:00
parent 1d05d661bc
commit 5aa22731c8
17 changed files with 137 additions and 204 deletions

View File

@@ -96,8 +96,8 @@
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.list = response.items;
this.total = response.total;
this.list = response.data.items;
this.total = response.data.total;
this.listLoading = false;
this.olderList = this.list.map(v => v.id);
this.newList = this.olderList.slice();
@@ -124,6 +124,7 @@
.drag-handler{
width: 30px;
height: 30px;
cursor: pointer;
}
.show-d{
margin-top: 15px;

View File

@@ -237,9 +237,9 @@
},
getRemoteUserList(query) {
userSearch(query).then(response => {
if (!response.items) return;
if (!response.data.items) return;
console.log(response)
this.userLIstOptions = response.items.map(v => ({
this.userLIstOptions = response.data.items.map(v => ({
key: v.name
}));
})

View File

@@ -59,7 +59,6 @@
data() {
return {
list: null,
total: null,
listLoading: true,
listQuery: {
page: 1,
@@ -84,11 +83,10 @@
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.list = response.items.map(v => {
this.list = response.data.items.map(v => {
v.edit = false;
return v
});
this.total = response.total;
this.listLoading = false;
})
}

View File

@@ -227,8 +227,8 @@
getList() {
this.listLoading = true;
fetchList(this.listQuery).then(response => {
this.list = response.items;
this.total = response.total;
this.list = response.data.items;
this.total = response.data.total;
this.listLoading = false;
})
},

View File

@@ -24,7 +24,7 @@
watch: {
role(val) {
this.$store.commit('SET_ROLES', [val]);
window.location.reload()
this.$router.push({ path: '/permission/index?' + +new Date() });
}
}
}