feat(api): 添加重置用户密码接口
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.keywords"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.keywords"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.keywords"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.keywords"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="work">
|
||||
<view class="page page--padding page--tabbar">
|
||||
<template v-for="(item, index) in visibleGridList" :key="index">
|
||||
<wd-card :title="item.title">
|
||||
<wd-grid clickable :column="4">
|
||||
@@ -87,15 +87,3 @@ function handleNavClick(item: any) {
|
||||
"layout": "tabbar"
|
||||
}
|
||||
</route>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
/* stylelint-disable selector-type-no-unknown */
|
||||
page {
|
||||
background: #f8f8f8;
|
||||
}
|
||||
/* stylelint-enable selector-type-no-unknown */
|
||||
|
||||
.work {
|
||||
padding: 40rpx 0;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.keywords"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.keywords"
|
||||
@@ -19,7 +19,7 @@
|
||||
>
|
||||
<!-- 自定义节点内容:ID + 名称 + 状态 -->
|
||||
<template #content="{ node }">
|
||||
<view class="flex-1 flex flex-nowrap items-center gap-16rpx">
|
||||
<view class="menu-node">
|
||||
<text class="w-120rpx text-24rpx color-text-secondary">{{ node.id }}</text>
|
||||
<wd-icon v-if="node.icon" :name="node.icon" size="16" class="color-primary" />
|
||||
<text class="flex-1 truncate">{{ node.name }}</text>
|
||||
@@ -401,4 +401,12 @@ export default { options: { styleIsolation: "shared" } };
|
||||
gap: 24rpx;
|
||||
margin-top: 32rpx;
|
||||
}
|
||||
|
||||
.menu-node {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
flex-wrap: nowrap;
|
||||
gap: 16rpx;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.title"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.keywords"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<template>
|
||||
<view class="page page--padding page--pt">
|
||||
<view class="page page--padding">
|
||||
<view>
|
||||
<wd-search
|
||||
v-model="queryParams.keywords"
|
||||
@@ -389,6 +389,12 @@ function showUserActions(item: UserPageVO) {
|
||||
const actions: string[] = [];
|
||||
const actionMap: Record<string, () => void> = {};
|
||||
|
||||
// 重置密码
|
||||
if (hasPermission("sys:user:reset-password")) {
|
||||
actions.push("重置密码");
|
||||
actionMap["重置密码"] = () => handleResetPassword(item);
|
||||
}
|
||||
|
||||
// 编辑
|
||||
if (hasPermission("sys:user:update")) {
|
||||
actions.push("编辑");
|
||||
@@ -425,6 +431,28 @@ function showUserActions(item: UserPageVO) {
|
||||
});
|
||||
}
|
||||
|
||||
// 重置密码
|
||||
async function handleResetPassword(item: UserPageVO) {
|
||||
const { confirm, content: password } = await uni.showModal({
|
||||
title: "重置密码",
|
||||
editable: true,
|
||||
placeholderText: `请输入用户「${item.username}」的新密码`,
|
||||
});
|
||||
if (!confirm || !password) return;
|
||||
|
||||
if (password.length < 6) {
|
||||
toast.error("密码至少需要6位字符");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
await UserAPI.resetPassword(item.id, password);
|
||||
toast.success("密码重置成功");
|
||||
} catch (error) {
|
||||
// API 已处理错误提示
|
||||
}
|
||||
}
|
||||
|
||||
onReachBottom(() => {
|
||||
if (queryParams.pageNum * queryParams.pageSize < total.value) {
|
||||
fetchUserList();
|
||||
|
||||
Reference in New Issue
Block a user