密码重置功能优化
This commit is contained in:
@@ -290,7 +290,7 @@ import { ref, reactive, onMounted, computed } from 'vue'
|
||||
import { message } from 'ant-design-vue'
|
||||
import type { FormInstance } from 'ant-design-vue'
|
||||
import { PlusOutlined } from '@ant-design/icons-vue'
|
||||
import { adminCouponApi, adminTagApi, adminShopApi, type Shop } from '@/api/admin'
|
||||
import { adminCouponApi, adminTagApi, adminShopApi, userApi, type Shop } from '@/api/admin'
|
||||
import type { Coupon } from '@/api/coupon'
|
||||
import dayjs from 'dayjs'
|
||||
|
||||
@@ -687,15 +687,24 @@ const handleDelete = (record: Coupon) => {
|
||||
// 加载用户列表
|
||||
const fetchUsers = async () => {
|
||||
try {
|
||||
// 这里应该调用获取用户列表的API
|
||||
// 暂时使用模拟数据
|
||||
const currentUser = getCurrentUserInfo()
|
||||
const shopId = (currentUser && currentUser.shopId) ? currentUser.shopId : undefined
|
||||
// 调用真实的用户列表API
|
||||
const res = await userApi.listUsers({
|
||||
page: 1,
|
||||
size: 100,
|
||||
shopId: shopId,
|
||||
status: 1 // 只获取激活状态的用户
|
||||
})
|
||||
userList.value = res.list || []
|
||||
} catch (error) {
|
||||
console.error('获取用户列表失败:', error)
|
||||
// 如果API调用失败,使用模拟数据作为 fallback
|
||||
userList.value = [
|
||||
{ id: 1, nickname: '用户1', account: 'user1' },
|
||||
{ id: 2, nickname: '用户2', account: 'user2' },
|
||||
{ id: 3, nickname: '用户3', account: 'user3' }
|
||||
]
|
||||
} catch (error) {
|
||||
console.error('获取用户列表失败:', error)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -515,7 +515,7 @@ const handleStatusChange = async (record: UserVO, checked: boolean) => {
|
||||
const handleResetPassword = (record: UserVO) => {
|
||||
Modal.confirm({
|
||||
title: '确认重置密码',
|
||||
content: `确定要将用户 ${record.nickname} 的密码重置为 88888888 吗?`,
|
||||
content: `确定要将用户 ${record.nickname} 的密码重置为 888888 吗?`,
|
||||
onOk: async () => {
|
||||
try {
|
||||
await userApi.resetPassword(record.id)
|
||||
|
||||
Reference in New Issue
Block a user