Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
factory_front
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qinjianhui
factory_front
Commits
aea9635c
Commit
aea9635c
authored
Jun 04, 2025
by
wuqian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
重置密码
parent
eeed6a29
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
2 deletions
+42
-2
src/api/auth.ts
+11
-1
src/views/UserPage.vue
+31
-1
No files found.
src/api/auth.ts
View file @
aea9635c
...
@@ -61,6 +61,14 @@ export function getDetailsByIdApi(id: number) {
...
@@ -61,6 +61,14 @@ export function getDetailsByIdApi(id: number) {
},
},
)
)
}
}
interface
ResetPasswordRespData
{
passWord
:
string
}
export
function
resetPasswordApi
(
id
:
number
)
{
return
axios
.
get
<
never
,
BaseRespData
<
ResetPasswordRespData
>>
(
`factory/factoryUser/resetPassword/
${
id
}
`
,
)
}
// 切换用户状态
// 切换用户状态
export
function
changeUserStatusApi
(
status
:
number
,
id
:
number
)
{
export
function
changeUserStatusApi
(
status
:
number
,
id
:
number
)
{
return
axios
.
get
<
never
,
BaseRespData
<
never
>>
(
return
axios
.
get
<
never
,
BaseRespData
<
never
>>
(
...
@@ -78,5 +86,7 @@ export function getUserNameSpaceList() {
...
@@ -78,5 +86,7 @@ export function getUserNameSpaceList() {
return
axios
.
get
<
never
,
BaseRespData
<
NameSpaceList
[]
>>
(
'dbDiyUser/getList'
)
return
axios
.
get
<
never
,
BaseRespData
<
NameSpaceList
[]
>>
(
'dbDiyUser/getList'
)
}
}
export
function
getUserMarkList
()
{
export
function
getUserMarkList
()
{
return
axios
.
get
<
never
,
BaseRespData
<
string
[]
>>
(
'factory/customJomallOrder/getUserMarkList'
)
return
axios
.
get
<
never
,
BaseRespData
<
string
[]
>>
(
'factory/customJomallOrder/getUserMarkList'
,
)
}
}
src/views/UserPage.vue
View file @
aea9635c
...
@@ -119,6 +119,14 @@
...
@@ -119,6 +119,14 @@
>
>
<Edit
/>
<Edit
/>
</el-icon>
</el-icon>
<el-icon
size=
"24"
title=
"重置密码"
color=
"#67C23A"
style=
"cursor: pointer; vertical-align: middle"
@
click
.
stop=
"resetPwd(scope.row)"
><RefreshLeft
/></el-icon>
</
template
>
</
template
>
</ElTableColumn>
</ElTableColumn>
</ElTable>
</ElTable>
...
@@ -202,13 +210,14 @@ import {
...
@@ -202,13 +210,14 @@ import {
deleteUserApi
,
deleteUserApi
,
getDetailsByIdApi
,
getDetailsByIdApi
,
changeUserStatusApi
,
changeUserStatusApi
,
resetPasswordApi
,
}
from
'@/api/auth'
}
from
'@/api/auth'
import
Icon
from
'@/components/Icon.vue'
import
Icon
from
'@/components/Icon.vue'
import
{
UserEditForm
,
userData
,
userSearchForm
}
from
'@/types/api/user'
import
{
UserEditForm
,
userData
,
userSearchForm
}
from
'@/types/api/user'
import
usePageList
from
'@/utils/hooks/usePageList'
import
usePageList
from
'@/utils/hooks/usePageList'
import
{
useValue
}
from
'@/utils/hooks/useValue'
import
{
useValue
}
from
'@/utils/hooks/useValue'
import
{
showConfirm
}
from
'@/utils/ui'
import
{
showConfirm
}
from
'@/utils/ui'
import
{
Edit
}
from
'@element-plus/icons-vue'
import
{
Edit
,
RefreshLeft
}
from
'@element-plus/icons-vue'
import
type
{
FormRules
}
from
'element-plus'
import
type
{
FormRules
}
from
'element-plus'
import
{
reactive
,
ref
}
from
'vue'
import
{
reactive
,
ref
}
from
'vue'
const
[
searchForm
,
resetSearchForm
]
=
useValue
<
userSearchForm
>
({})
const
[
searchForm
,
resetSearchForm
]
=
useValue
<
userSearchForm
>
({})
...
@@ -247,6 +256,27 @@ const rules = reactive<FormRules<UserEditForm>>({
...
@@ -247,6 +256,27 @@ const rules = reactive<FormRules<UserEditForm>>({
},
},
],
],
})
})
const
resetPwd
=
async
(
row
:
userData
)
=>
{
try
{
await
showConfirm
(
`确认要重置用户
${
row
.
account
}
的密码?`
,
{
confirmButtonText
:
'确认'
,
cancelButtonText
:
'取消'
,
type
:
'warning'
,
})
}
catch
{
return
}
try
{
const
res
=
await
resetPasswordApi
(
row
.
id
)
await
ElMessageBox
.
alert
(
'重置成功
\
n
\
r 新密码为:'
+
res
.
data
.
passWord
,
{
confirmButtonText
:
'确定'
,
type
:
'warning'
,
})
search
()
}
catch
(
e
)
{
search
()
}
}
const
editId
=
ref
<
number
|
undefined
>
(
undefined
)
const
editId
=
ref
<
number
|
undefined
>
(
undefined
)
const
addUser
=
()
=>
{
const
addUser
=
()
=>
{
editId
.
value
=
undefined
editId
.
value
=
undefined
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment