Skip to content

Commit 33d93ac

Browse files
authored
错误处理及其他一些优化 (#29)
1 parent 5645785 commit 33d93ac

File tree

28 files changed

+254
-869
lines changed

28 files changed

+254
-869
lines changed

public/goldapadmin.ico

4.31 KB
Binary file not shown.

public/index.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
66
<meta name="renderer" content="webkit">
77
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
8-
<link rel="icon" href="<%= BASE_URL %>webmini.svg">
8+
<link rel="icon" href="<%= BASE_URL %>goldapadmin.ico">
99
<title><%= webpackConfig.name %></title>
1010
</head>
1111
<body>

public/webmini.svg

-1
This file was deleted.

src/assets/GithubImages/api.PNG

-96.5 KB
Binary file not shown.

src/assets/GithubImages/login.PNG

-2.31 MB
Binary file not shown.

src/assets/GithubImages/menu.PNG

-86.6 KB
Binary file not shown.

src/assets/GithubImages/role.PNG

-64 KB
Binary file not shown.
-71.8 KB
Binary file not shown.

src/assets/GithubImages/user.PNG

-69.3 KB
Binary file not shown.
49.6 KB
Loading

src/assets/sidebar-logo/webmini.png

-7.61 KB
Binary file not shown.

src/layout/components/Sidebar/Logo.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ export default {
2424
},
2525
data() {
2626
return {
27-
title: 'Go Web Mini',
28-
logo: require('@/assets/sidebar-logo/webmini.png')
27+
title: 'Go Ldap Admin',
28+
logo: require('@/assets/sidebar-logo/goldapadmin.png')
2929
}
3030
}
3131
}

src/layout/components/TagsView/index.vue

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
</router-link>
1818
</scroll-pane>
1919
<ul v-show="visible" :style="{left:left+'px',top:top+'px'}" class="contextmenu">
20-
<li @click="refreshSelectedTag(selectedTag)">Refresh</li>
21-
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">Close</li>
22-
<li @click="closeOthersTags">Close Others</li>
23-
<li @click="closeAllTags(selectedTag)">Close All</li>
20+
<li @click="refreshSelectedTag(selectedTag)">刷新</li>
21+
<li v-if="!isAffix(selectedTag)" @click="closeSelectedTag(selectedTag)">关闭当前</li>
22+
<li @click="closeOthersTags">关闭其他</li>
23+
<li @click="closeAllTags(selectedTag)">关闭所有</li>
2424
</ul>
2525
</div>
2626
</template>

src/settings.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module.exports = {
2-
title: 'Go Web Mini',
2+
title: 'Go Ldap Admin',
33

44
/**
55
* @type {boolean} true | false

src/utils/request.js

+10-2
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,21 @@ service.interceptors.response.use(
4646
*/
4747
response => {
4848
const res = response.data
49-
return res
49+
if (res.code==0 || res.code==200){
50+
return res
51+
}else{
52+
Message({
53+
message: res.msg,
54+
type: 'error'
55+
})
56+
return false
57+
}
5058
},
5159
error => {
5260
if (error.response.status === 401) {
5361
if (error.response.data.message.indexOf('JWT认证失败') !== -1) {
5462
MessageBox.confirm(
55-
'登录超时, 重新登录或继续停留在当前页?',
63+
'登录失败,用户名或密码错误,重新登录或继续停留在当前页?',
5664
'登录状态已失效',
5765
{
5866
confirmButtonText: '重新登录',

src/views/changePassword/index.vue

+3-6
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ export default {
2626
async submit() {
2727
try {
2828
const { msg, code } = await emailPass({ mail: this.mail })
29-
3029
if (code === 0) {
31-
this.$message({
30+
Message({
3231
showClose: true,
3332
message: msg,
3433
type: 'success'
@@ -38,16 +37,14 @@ export default {
3837
this.$router.replace({ path: '/login' })
3938
}, 1500)
4039
} else {
41-
this.$message({
40+
Message({
4241
showClose: true,
4342
message: msg,
4443
type: 'error'
4544
})
4645
return false
4746
}
48-
} finally {
49-
console.log('finally')
50-
}
47+
} finally {}
5148
}
5249
5350
}

src/views/dashboard/components/PanelGroup.vue

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,22 @@
11
<template>
22
<el-row :gutter="40" class="panel-group">
33
<el-col v-for="item in dataInfo" :key="item.dataType" :xs="8" :sm="8" :lg="8" class="card-panel-col">
4+
<a :href="item.path">
45
<div class="card-panel" @click="handleSetLineChartData(item.dataType)">
56
<div class="card-panel-icon-wrapper icon-people">
67
<svg-icon :icon-class="item.icon" class-name="card-panel-icon" />
8+
<!-- <el-link :href="item.path"><svg-icon :icon-class="item.icon" class-name="card-panel-icon" /></el-link> -->
79
</div>
810
<div class="card-panel-description">
911
<div class="card-panel-text">
10-
{{ item.dataName }}
12+
<!-- <el-link :href="item.path"> -->
13+
{{ item.dataName }}
14+
<!-- </el-link> -->
1115
</div>
1216
<count-to :start-val="0" :end-val="item.dataCount" :duration="2600" class="card-panel-num" />
1317
</div>
1418
</div>
19+
</a>
1520
</el-col>
1621
</el-row>
1722
</template>

src/views/groupUser/userList/index.vue

+16-22
Original file line numberDiff line numberDiff line change
@@ -156,31 +156,33 @@ export default {
156156
handleSelectionChange(val) {
157157
this.multipleSelection = val
158158
},
159+
// 判断结果
160+
judgeResult(res){
161+
if (res.code==0){
162+
Message({
163+
showClose: true,
164+
message: "操作成功",
165+
type: 'success'
166+
})
167+
}
168+
},
159169
// 移除操作
160170
async batchDelete() {
161171
const userRoles = []
162172
this.multipleSelection.forEach(x => {
163173
userRoles.push(x.userId)
164174
})
165175
this.loading = true
166-
let message = ''
167-
168176
try {
169-
const { msg } = await delGroup({ groupId: Number(this.transParams.groupId), userIds: userRoles })
170-
// this.$message({message: '设置成功', type: 'success'});
171-
message = msg
177+
await delGroup({ groupId: Number(this.transParams.groupId), userIds: userRoles }).then(res =>{
178+
this.judgeResult(res)
179+
})
172180
} finally {
173181
this.loading = false
174182
}
175183
setTimeout(function() {
176184
window.location.reload()
177185
}, 500)
178-
179-
this.$message({
180-
showClose: true,
181-
message: message,
182-
type: 'success'
183-
})
184186
},
185187
// batchAdd 添加操作
186188
async batchAdd() {
@@ -189,24 +191,16 @@ export default {
189191
userRoles.push(x.userId)
190192
})
191193
this.loading = true
192-
let message = ''
193-
194194
try {
195-
const { msg } = await groupInfo({ groupId: Number(this.transParams.groupId), userIds: userRoles })
196-
// this.$message({message: '设置成功', type: 'success'});
197-
message = msg
195+
await groupInfo({ groupId: Number(this.transParams.groupId), userIds: userRoles }).then(res => {
196+
this.judgeResult(res)
197+
})
198198
} finally {
199199
this.loading = false
200200
}
201201
setTimeout(function() {
202202
window.location.reload()
203203
}, 500)
204-
205-
this.$message({
206-
showClose: true,
207-
message: message,
208-
type: 'success'
209-
})
210204
}
211205
}
212206
}

src/views/log/operation-log/index.vue

+20-22
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
</template>
3434
</el-table-column>
3535
<el-table-column show-overflow-tooltip sortable prop="startTime" label="发起时间">
36-
<template slot-scope="scope">
36+
<!-- <template slot-scope="scope">
3737
{{ parseGoTime(scope.row.startTime) }}
38-
</template>
38+
</template> -->
3939
</el-table-column>
4040
<el-table-column show-overflow-tooltip sortable prop="timeCost" label="请求耗时(ms)" align="center">
4141
<template slot-scope="scope">
@@ -141,14 +141,24 @@ export default {
141141
this.loading = true
142142
try {
143143
const { data } = await getOperationLogs(this.params)
144-
145144
this.tableData = data.logs
146145
this.total = data.total
147146
} finally {
148147
this.loading = false
149148
}
150149
},
151150
151+
// 判断结果
152+
judgeResult(res){
153+
if (res.code==0){
154+
Message({
155+
showClose: true,
156+
message: "操作成功",
157+
type: 'success'
158+
})
159+
}
160+
},
161+
152162
// 批量删除
153163
batchDelete() {
154164
this.$confirm('此操作将永久删除, 是否继续?', '提示', {
@@ -161,22 +171,16 @@ export default {
161171
this.multipleSelection.forEach(x => {
162172
operationLogIds.push(x.ID)
163173
})
164-
let msg = ''
165174
try {
166-
const { message } = await batchDeleteOperationLogByIds({ operationLogIds: operationLogIds })
167-
msg = message
175+
await batchDeleteOperationLogByIds({ operationLogIds: operationLogIds }).then(res =>{
176+
this.judgeResult(res)
177+
})
168178
} finally {
169179
this.loading = false
170180
}
171-
172181
this.getTableData()
173-
this.$message({
174-
showClose: true,
175-
message: msg,
176-
type: 'success'
177-
})
178182
}).catch(() => {
179-
this.$message({
183+
Message({
180184
showClose: true,
181185
type: 'info',
182186
message: '已取消删除'
@@ -192,20 +196,14 @@ export default {
192196
// 单个删除
193197
async singleDelete(Id) {
194198
this.loading = true
195-
let message = ''
196199
try {
197-
const { msg} = await batchDeleteOperationLogByIds({ operationLogIds: [Id] })
198-
message = msg
200+
await batchDeleteOperationLogByIds({ operationLogIds: [Id] }).then(res =>{
201+
this.judgeResult(res)
202+
})
199203
} finally {
200204
this.loading = false
201205
}
202-
203206
this.getTableData()
204-
this.$message({
205-
showClose: true,
206-
message: message,
207-
type: 'success'
208-
})
209207
},
210208
211209
// 分页

src/views/personnel/fieldRelation/index.vue

+10-26
Original file line numberDiff line numberDiff line change
@@ -654,10 +654,9 @@ export default {
654654
},
655655
// 查询
656656
search() {
657-
// 初始化表格数据
658-
this.infoTableData = JSON.parse(JSON.stringify(this.tableData))
659-
this.infoTableData = this.deal(this.infoTableData, (node) =>
660-
// console.log(node,997)
657+
// 初始化表格数据
658+
this.infoTableData = JSON.parse(JSON.stringify(this.tableData))
659+
this.infoTableData = this.deal(this.infoTableData, (node) =>
661660
node.Flag.includes(this.params.flag)
662661
)
663662
},
@@ -792,39 +791,35 @@ export default {
792791
}
793792
this.$refs['dialogForm'].validate(async(valid) => {
794793
if (valid) {
795-
let message = ''
796794
this.submitLoading = true
797795
try {
798796
if (this.dialogType === 'create') {
799-
const { msg } = await relationAdd({
797+
await relationAdd({
800798
flag: flag,
801799
attributes: attributes
802800
})
803-
message = msg
804801
} else {
805-
const { msg } = await relationUp({
802+
await relationUp({
806803
id: this.updateId,
807804
flag: flag,
808805
attributes: attributes
809806
})
810-
message = msg
811807
}
812808
} finally {
813809
this.submitLoading = false
814810
}
815-
816811
this.resetForm()
817812
this.getTableData()
818813
this.$message({
819814
showClose: true,
820-
message: message,
815+
message: "操作成功",
821816
type: 'success'
822817
})
823818
} else {
824819
this.$message({
825820
showClose: true,
826821
message: '表单校验失败',
827-
type: 'error'
822+
type: 'warn'
828823
})
829824
return false
830825
}
@@ -859,18 +854,15 @@ export default {
859854
this.multipleSelection.forEach((x) => {
860855
groupIds.push(x.ID)
861856
})
862-
let message = ''
863857
try {
864-
const { msg } = await relationDel({ fieldRelationIds: groupIds })
865-
message = msg
858+
await relationDel({ fieldRelationIds: groupIds })
866859
} finally {
867860
this.loading = false
868861
}
869-
870862
this.getTableData()
871863
this.$message({
872864
showClose: true,
873-
message: message,
865+
message: "删除成功",
874866
type: 'success'
875867
})
876868
})
@@ -885,20 +877,12 @@ export default {
885877
// 单个删除
886878
async singleDelete(Id) {
887879
this.loading = true
888-
let message = ''
889880
try {
890-
const { msg } = await relationDel({ fieldRelationIds: [Id] })
891-
message = msg
881+
await relationDel({ fieldRelationIds: [Id] })
892882
} finally {
893883
this.loading = false
894884
}
895-
896885
this.getTableData()
897-
this.$message({
898-
showClose: true,
899-
message: message,
900-
type: 'success'
901-
})
902886
},
903887
904888
// 表格多选

0 commit comments

Comments
 (0)