提交 ab446195 authored 作者: wangyizheng's avatar wangyizheng

新增刷新动效

上级 87296d54
......@@ -10,6 +10,22 @@ const before = new BeforeEnter()
Vue.use(ElementUI)
Vue.prototype.openLoading = function() {
const loading = this.$loading({
lock: true,
text: '正在努力加载中...',
spinner: 'el-icon-loading',
background: 'rgba(0, 0, 0, 0.3)',
target: '.sub-main',
body: true,
customClass: 'mask'
})
setTimeout(function () {
loading.close()
}, 5000)
return loading
}
/* 导航守卫 */
router.beforeEach((to, from, next) => {
before.update(to, from, next)
......
......@@ -448,14 +448,17 @@ export default {
this.list({ page: val, limit: this.limit })
},
list(params = {}) {
const rLoading = this.openLoading()
casesApi.case2s(params).then(res => {
if (res.code === 0) {
this.tableData = res.data.data
this.currentPage = res.data.current_page
this.totalPage = res.data.total
rLoading.close()
return true
} else {
this.$message.error(res.message)
rLoading.close()
return false
}
})
......@@ -518,13 +521,16 @@ export default {
},
handleDelete(id) {
this.$confirm('确认删除?', '提示').then(_ => {
const rLoading = this.openLoading()
casesApi.deleteCase2(id).then(res => {
if (res.code === 0) {
this.$message.success('删除成功')
this.list({ page: this.currentPage, limit: this.limit })
rLoading.close()
return true
} else {
this.$message.error(res.message)
rLoading.close()
return false
}
})
......@@ -585,6 +591,7 @@ export default {
.then(_ => {
this.loading = true
// 提交表单
const rLoading = this.openLoading()
casesApi.createCase2(this.addForm).then(res => {
if (res.code === 0 && res.message === 'SUCCESS') {
this.list({ page: this.currentPage, limit: this.limit })
......@@ -593,6 +600,7 @@ export default {
} else {
this.$message.warning(res.message)
}
rLoading.close()
})
this.timer = setTimeout(() => {
done()
......
......@@ -350,14 +350,16 @@ export default {
this.$message.error('文件上传失败')
},
list(params = {}) {
const rLoading = this.openLoading()
categoryApi.categories(params).then(res => {
if (res.code === 0) {
this.tableData = res.data.data
this.currentPage = res.data.current_page
this.totalPage = res.data.total
rLoading.close()
} else {
this.$message.error(res.message)
return false
rLoading.close()
}
})
},
......@@ -380,19 +382,18 @@ export default {
},
handleDelete(id) {
this.$confirm('确认删除?', '提示').then(_ => {
const rLoading = this.openLoading()
categoryApi.deleteCategory(id).then(res => {
if (res.code === 0) {
this.$message.success('删除成功')
this.list({ page: this.currentPage, limit: this.limit })
rLoading.close()
return true
} else {
this.$message.error(res.message)
rLoading.close()
return false
}
}).catch(error => {
console.log(error)
this.$message.error('删除失败')
return false
})
})
},
......@@ -423,6 +424,7 @@ export default {
}
},
add() {
const rLoading = this.openLoading()
categoryApi.addCategory(this.mainForm).then(res => {
if (res.code === -1) {
this.$message.error(res.message)
......@@ -431,9 +433,11 @@ export default {
this.$message.success(res.message)
this.mainCategoryDialogFormVisible = false
this.list()
rLoading.close()
})
},
addChild() {
const rLoading = this.openLoading()
categoryApi.addCategory(this.childForm).then(res => {
if (res.code === -1) {
this.$message.error(res.message)
......@@ -444,6 +448,7 @@ export default {
this.childForm.order = 0
this.childCategoryDialogFormVisible = false
this.list({ page: this.currentPage, limit: this.limit })
rLoading.close()
})
}
}
......
......@@ -416,13 +416,16 @@ export default {
})
},
list(params = {}) {
const rLoading = this.openLoading()
characteristicsApi.characteristics2List(params).then(res => {
if (res.code === 0) {
this.tableData = res.data.data
this.currentPage = res.data.current_page
this.totalPage = res.data.total
rLoading.close()
return true
} else {
rLoading.close()
this.$message.error(res.message)
return false
}
......@@ -455,15 +458,17 @@ export default {
.then(_ => {
this.loading = true
// 提交表单
console.log(this.addForm)
const rLoading = this.openLoading()
characteristicsApi.createCharacteristic2(this.addForm).then(res => {
if (res.code === 0) {
this.list({ page: 1, limit: this.limit })
this.caseList({ page: 1, limit: 10 })
this.AZkey = this.A_Z()
rLoading.close()
this.$message.success(res.message)
return true
} else {
rLoading.close()
this.$message.error(res.message)
return false
}
......
......@@ -204,12 +204,15 @@ export default {
},
delete(id) {
this.$confirm('确认删除?', '提示').then(_ => {
const rLoading = this.openLoading()
reachSchemeApi.deleteReachScheme(id).then(res => {
if (res.code === 0) {
this.$message.success('删除成功')
this.list({ page: this.currentPage, limit: this.limit })
rLoading.close()
return true
} else {
rLoading.close()
this.$message.error(res.message)
return false
}
......@@ -217,13 +220,16 @@ export default {
})
},
list(params = {}) {
const rLoading = this.openLoading()
reachSchemeApi.reachSchemeList(params).then(res => {
if (res.code === 0) {
this.tableData = res.data.data
this.currentPage = res.current_page
this.totalPage = res.data.total
rLoading.close()
return true
} else {
rLoading.close()
this.$message.error(res.message)
return false
}
......@@ -254,7 +260,7 @@ export default {
.then(_ => {
this.loading = true
// 提交表单
console.log(this.addForm)
const rLoading = this.openLoading()
reachSchemeApi.createReachScheme(this.addForm).then(res => {
if (res.code === 0) {
this.list({ page: 1, limit: this.limit })
......@@ -268,9 +274,11 @@ export default {
}
]
}
rLoading.close()
this.$message.success(res.message)
return true
} else {
rLoading.close()
this.$message.error(res.message)
return false
}
......
......@@ -213,13 +213,16 @@ export default {
})
},
list(params = {}) {
const rLoading = this.openLoading()
userUseConfigApi.userUseConfigList(params).then(res => {
if (res.code === 0) {
this.tableData = res.data.data
this.currentPage = res.data.current_page
this.totalPage = res.data.total
rLoading.close()
return true
} else {
rLoading.close()
this.$message.error(res.message)
return false
}
......@@ -266,14 +269,16 @@ export default {
.then(_ => {
this.loading = true
// 提交表单
console.log(this.addForm)
const rLoading = this.openLoading()
userUseConfigApi.createUserUseConfig(this.addForm).then(res => {
if (res.code === 0) {
this.list({ page: 1, limit: this.limit })
this.caseList({ page: 1, limit: 10 })
rLoading.close()
this.$message.success(res.message)
return true
} else {
rLoading.close()
this.$message.error(res.message)
return false
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论