Browse Source

1、密码策略增加更新预警期,用户增加冻结状态

hella_online_20240913
bjang03 2 months ago
parent
commit
c780b75553
  1. 5
      src/api/system/user/index.ts
  2. 1
      src/locales/zh-CN.ts
  3. 39
      src/views/login/components/LoginForm.vue
  4. 16
      src/views/system/passwordRule/index.vue
  5. 19
      src/views/system/user/index.vue

5
src/api/system/user/index.ts

@ -54,7 +54,10 @@ export const updateUser = (data : UserVO) => {
export const deleteUser = (id : number) => {
return request.delete({ url: '/system/user/delete?id=' + id })
}
// 解冻用户
export const unLockUser = (id : number) => {
return request.get({ url: '/system/user/unLockUser?id=' + id })
}
// 导出用户
export const exportUser = (params) => {
return request.download({ url: '/system/user/export', params })

1
src/locales/zh-CN.ts

@ -53,6 +53,7 @@ export default {
status: '状态',
createTime: '创建时间',
updateTime: '更新时间',
unLockSuccess: '解冻成功',
copy: '复制',
copySuccess: '复制成功',
copyError: '复制失败',

39
src/views/login/components/LoginForm.vue

@ -258,15 +258,36 @@
}
console.log('登陆res',res)
const msg = await PassWordApi.validateResetTime(res.userId)
if(msg){
await ElMessageBox.alert(
'<strong>'+msg+'</strong>',
'重要提示',
{
dangerouslyUseHTMLString: true,
}
)
const differenceDays = await PassWordApi.validateResetTime(res.userId)
switch (differenceDays){
case -1:
await ElMessageBox.alert(
'<strong>密码即将到期,请尽快修改。</strong>',
'重要提示',
{
dangerouslyUseHTMLString: true,
}
)
break
case 0:
await ElMessageBox.alert(
'<strong>密码到期,请立即修改</strong>',
'重要提示',
{
dangerouslyUseHTMLString: true,
}
)
router.push({path:"/updatePasswordNewTips",query:{username:loginData.loginForm.username}})
return
case 1:
await ElMessageBox.alert(
'<strong>密码过期账号已冻结,请联系管理员解冻</strong>',
'重要提示',
{
dangerouslyUseHTMLString: true,
}
)
return
}
if (!res) {
console.log('登录-195')

16
src/views/system/passwordRule/index.vue

@ -1,13 +1,18 @@
<template>
<!-- 搜索 -->
<div v-loading="loading" class="box">
<el-form ref="formSmsLogin" :model="data" :rules="rules" label-width="70px" size="large">
<el-form ref="formSmsLogin" :model="data" :rules="rules" label-width="90px" size="large">
<div
class="title"
style="font-size: 20px; text-align: center; margin-bottom: 20px; font-weight: bold"
>密码策略</div
>
<el-row type="flex" justify="center" align="middle">
<el-col>
<el-form-item label="是否开启" prop="status">
<el-switch v-model="passwordConfig.status" />
</el-form-item>
</el-col>
<el-col>
<el-form-item label="密码难度" prop="ruleLevel" align="center">
<el-select v-model="passwordConfig.ruleLevel" placeholder="请选择密码难度">
@ -51,8 +56,13 @@
</el-form-item>
</el-col>
<el-col>
<el-form-item label="是否开启" prop="status">
<el-switch v-model="passwordConfig.status" />
<el-form-item label="更新预警期" prop="updateRemind">
<el-input-number
v-model="passwordConfig.updateRemind"
:min="0"
:precision="0"
style="margin-right: 10px"
/>
</el-form-item>
</el-col>
</el-row>

19
src/views/system/user/index.vue

@ -65,7 +65,7 @@
</template>
</el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180" />
<el-table-column label="操作" align="center" width="300" fixed="right">
<el-table-column label="操作" align="center" width="370" fixed="right">
<template #default="scope">
<div class="flex items-center justify-center">
<el-button type="primary" link @click="openForm('update', scope.row.id)"
@ -80,6 +80,9 @@
v-hasPermi="['system:permission:assign-user-role']">
<Icon icon="ep:circle-check" />分配角色
</el-button>
<el-button type="primary" link @click="handleFree(scope.row.id)">
<Icon icon="ep:edit" />解冻
</el-button>
<el-button type="danger" link @click="handleDelete(scope.row.id)" v-hasPermi="['system:user:delete']">
<Icon icon="ep:delete" />删除
</el-button>
@ -226,6 +229,9 @@ const handleCommand = (command: string, row: UserApi.UserVO) => {
case 'handleRole':
handleRole(row)
break
case 'handleFree':
handleFree(row.id)
break
default:
break
}
@ -243,7 +249,16 @@ const handleDelete = async (id: number) => {
await getList()
} catch { }
}
/** 解冻按钮操作 */
const handleFree = async (id: number) => {
try {
//
await UserApi.unLockUser(id)
message.success(t('common.unLockSuccess'))
//
await getList()
} catch { }
}
/** 重置密码 */
const handleResetPwd = async (row: UserApi.UserVO) => {
try {

Loading…
Cancel
Save