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 () => {
|
const loadCustomerList = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getCustomerList({ current: 1, size: 1000 })
|
const res = await getCustomerList({ current: 1, size: 1000 })
|
||||||
customerList.value = res.data.records
|
customerList.value = res.records
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('加载客户列表失败')
|
ElMessage.error('加载客户列表失败')
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ const loadTableData = async () => {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await getContactList(searchForm.customerId)
|
const res = await getContactList(searchForm.customerId)
|
||||||
let contacts = res.data || []
|
let contacts = res || []
|
||||||
|
|
||||||
// 根据姓名过滤
|
// 根据姓名过滤
|
||||||
if (searchForm.contactName) {
|
if (searchForm.contactName) {
|
||||||
|
|||||||
@ -188,7 +188,7 @@ const buildMenuTree = (menus) => {
|
|||||||
const loadTableData = async () => {
|
const loadTableData = async () => {
|
||||||
try {
|
try {
|
||||||
const res = await getMenuList()
|
const res = await getMenuList()
|
||||||
tableData.value = buildMenuTree(res.data)
|
tableData.value = buildMenuTree(res)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('加载数据失败')
|
ElMessage.error('加载数据失败')
|
||||||
}
|
}
|
||||||
|
|||||||
@ -185,8 +185,8 @@ const loadTableData = async () => {
|
|||||||
status: searchForm.status
|
status: searchForm.status
|
||||||
}
|
}
|
||||||
const res = await getRoleList(params)
|
const res = await getRoleList(params)
|
||||||
tableData.value = res.data.records
|
tableData.value = res.records
|
||||||
page.total = res.data.total
|
page.total = res.total
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ElMessage.error('加载数据失败')
|
ElMessage.error('加载数据失败')
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user