fix: 修复前端页面数据加载问题
问题原因: - request.js 响应拦截器已经提取了 res.data - 但页面代码中还在使用 res.data.records/res.data.total - 导致实际访问的是 undefined 修复内容: - role.vue: res.data.records -> res.records - menu.vue: res.data -> res - contact.vue: res.data.records -> res.records, res.data -> res 现在页面可以正确加载数据了
This commit is contained in:
parent
bf63820546
commit
db4d89144d
@ -191,7 +191,7 @@ const rules = {
|
||||
const loadCustomerList = async () => {
|
||||
try {
|
||||
const res = await getCustomerList({ current: 1, size: 1000 })
|
||||
customerList.value = res.data.records
|
||||
customerList.value = res.records
|
||||
} catch (error) {
|
||||
ElMessage.error('加载客户列表失败')
|
||||
}
|
||||
@ -205,7 +205,7 @@ const loadTableData = async () => {
|
||||
|
||||
try {
|
||||
const res = await getContactList(searchForm.customerId)
|
||||
let contacts = res.data || []
|
||||
let contacts = res || []
|
||||
|
||||
// 根据姓名过滤
|
||||
if (searchForm.contactName) {
|
||||
|
||||
@ -188,7 +188,7 @@ const buildMenuTree = (menus) => {
|
||||
const loadTableData = async () => {
|
||||
try {
|
||||
const res = await getMenuList()
|
||||
tableData.value = buildMenuTree(res.data)
|
||||
tableData.value = buildMenuTree(res)
|
||||
} catch (error) {
|
||||
ElMessage.error('加载数据失败')
|
||||
}
|
||||
|
||||
@ -185,8 +185,8 @@ const loadTableData = async () => {
|
||||
status: searchForm.status
|
||||
}
|
||||
const res = await getRoleList(params)
|
||||
tableData.value = res.data.records
|
||||
page.total = res.data.total
|
||||
tableData.value = res.records
|
||||
page.total = res.total
|
||||
} catch (error) {
|
||||
ElMessage.error('加载数据失败')
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user