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

新增刷新动效

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