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) => { export const deleteUser = (id : number) => {
return request.delete({ url: '/system/user/delete?id=' + id }) 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) => { export const exportUser = (params) => {
return request.download({ url: '/system/user/export', params }) return request.download({ url: '/system/user/export', params })

1
src/locales/zh-CN.ts

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

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

@ -258,15 +258,36 @@
} }
console.log('登陆res',res) console.log('登陆res',res)
const msg = await PassWordApi.validateResetTime(res.userId) const differenceDays = await PassWordApi.validateResetTime(res.userId)
if(msg){ switch (differenceDays){
await ElMessageBox.alert( case -1:
'<strong>'+msg+'</strong>', await ElMessageBox.alert(
'重要提示', '<strong>密码即将到期,请尽快修改。</strong>',
{ '重要提示',
dangerouslyUseHTMLString: true, {
} 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) { if (!res) {
console.log('登录-195') console.log('登录-195')

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

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

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

@ -65,7 +65,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="创建时间" align="center" prop="createTime" :formatter="dateFormatter" width="180" /> <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"> <template #default="scope">
<div class="flex items-center justify-center"> <div class="flex items-center justify-center">
<el-button type="primary" link @click="openForm('update', scope.row.id)" <el-button type="primary" link @click="openForm('update', scope.row.id)"
@ -80,6 +80,9 @@
v-hasPermi="['system:permission:assign-user-role']"> v-hasPermi="['system:permission:assign-user-role']">
<Icon icon="ep:circle-check" />分配角色 <Icon icon="ep:circle-check" />分配角色
</el-button> </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']"> <el-button type="danger" link @click="handleDelete(scope.row.id)" v-hasPermi="['system:user:delete']">
<Icon icon="ep:delete" />删除 <Icon icon="ep:delete" />删除
</el-button> </el-button>
@ -226,6 +229,9 @@ const handleCommand = (command: string, row: UserApi.UserVO) => {
case 'handleRole': case 'handleRole':
handleRole(row) handleRole(row)
break break
case 'handleFree':
handleFree(row.id)
break
default: default:
break break
} }
@ -243,7 +249,16 @@ const handleDelete = async (id: number) => {
await getList() await getList()
} catch { } } 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) => { const handleResetPwd = async (row: UserApi.UserVO) => {
try { try {

Loading…
Cancel
Save