Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions admin/src/api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -808,7 +808,7 @@ export const deletePolicy = (id) => {
*/
export const getTourRoutePage = (current = 1, size = 10, keyword = '') => {
return request({
url: '/tourroute/admin/page',
url: '/tour/admin/page',
method: 'get',
params: {
current,
Expand All @@ -823,7 +823,7 @@ export const getTourRoutePage = (current = 1, size = 10, keyword = '') => {
*/
export const getTourRouteById = (id) => {
return request({
url: `/tourroute/${id}`,
url: `/tour/${id}`,
method: 'get'
})
}
Expand All @@ -833,7 +833,7 @@ export const getTourRouteById = (id) => {
*/
export const addTourRoute = (data) => {
return request({
url: '/tourroute/admin/create',
url: '/tour/admin/create',
method: 'post',
data
})
Expand All @@ -844,7 +844,7 @@ export const addTourRoute = (data) => {
*/
export const updateTourRoute = (id, data) => {
return request({
url: `/tourroute/admin/update/${id}`,
url: `/tour/admin/update/${id}`,
method: 'put',
data
})
Expand All @@ -855,7 +855,7 @@ export const updateTourRoute = (id, data) => {
*/
export const deleteTourRoute = (id) => {
return request({
url: `/tourroute/admin/delete/${id}`,
url: `/tour/admin/delete/${id}`,
method: 'delete'
})
}
49 changes: 36 additions & 13 deletions miniprogram/pages/filing/filing.vue
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,13 @@ export default {
const isSuccess = response.code === 200 || response.code === 0

if (isSuccess) {
// 新的响应格式:data直接是文件名
const fileUrl = response.data
// 确保文件URL是字符串格式
let fileUrl = response.data
if (typeof fileUrl === 'object') {
fileUrl = fileUrl.url || fileUrl.filename || fileUrl.path || JSON.stringify(fileUrl)
}
fileUrl = String(fileUrl)

// 根据field类型设置对应的后端字段
if (field === 'permit') {
this.form.shootPermit = fileUrl
Expand Down Expand Up @@ -518,7 +523,12 @@ export default {
duration: 3000
})
} finally {
uni.hideLoading()
// 安全地隐藏loading,避免"toast can't be found"错误
try {
uni.hideLoading()
} catch (e) {
console.warn('隐藏loading时出错:', e)
}
}
} else {
console.error('3. 文件路径未找到,无法上传')
Expand Down Expand Up @@ -614,13 +624,13 @@ export default {

this.submitting = true
try {
// 准备提交数据,使用后端期望的字段名
// 准备提交数据,确保数据类型与后端匹配
const reportData = {
name: this.form.name,
type: this.form.type,
genre: this.form.genre,
episodes: this.form.episodes,
investAmount: this.form.investAmount,
episodes: parseInt(this.form.episodes) || 0,
investAmount: parseFloat(this.form.investAmount) || 0,
mainCreators: this.form.mainCreators,
leadProducer: this.form.leadProducer,
producerUnit: this.form.producerUnit,
Expand All @@ -631,13 +641,13 @@ export default {
phoneNumber: this.form.phoneNumber,
crewPosition: this.form.crewPosition,
status: this.reportId ? undefined : 'PENDING', // 新增报备设置为'PENDING',编辑时保持原状态
// 使用后端期望的字段名
shootPermit: this.form.shootPermit,
thumbShootPermit: this.form.thumbShootPermit,
approvalFile: this.form.approvalFile,
thumbApprovalFile: this.form.thumbApprovalFile,
shootApply: this.form.shootApply || '',
thumbShootApply: this.form.thumbShootApply || ''
// 确保文件字段都是字符串类型
shootPermit: this.ensureString(this.form.shootPermit),
thumbShootPermit: this.ensureString(this.form.thumbShootPermit),
approvalFile: this.ensureString(this.form.approvalFile),
thumbApprovalFile: this.ensureString(this.form.thumbApprovalFile),
shootApply: this.ensureString(this.form.shootApply),
thumbShootApply: this.ensureString(this.form.thumbShootApply)
}

console.log('提交数据:', reportData)
Expand Down Expand Up @@ -689,6 +699,19 @@ export default {
this.submitting = false
}
},
// 确保值为字符串类型
ensureString(value) {
if (value === null || value === undefined) {
return ''
}
if (typeof value === 'string') {
return value
}
if (typeof value === 'object') {
return value.url || value.filename || value.path || JSON.stringify(value)
}
return String(value)
},
resetForm() {
this.form = {
name: '',
Expand Down
17 changes: 7 additions & 10 deletions miniprogram/pages/policy/policy.vue
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,9 @@ export default {
type: this.selectedType === '全部' ? undefined : this.selectedType
})

if (res.code === 200 && res.data) {
const newPolicies = res.data.map(item => ({
// 处理游标分页响应格式
if (res && res.records) {
const newPolicies = res.records.map(item => ({
id: item.id,
title: item.title,
type: item.type,
Expand All @@ -150,16 +151,12 @@ export default {
this.policies = [...this.policies, ...newPolicies]
}

// 更新分页信息
if (res.pagination) {
this.totalPages = res.pagination.totalPages
this.hasMore = this.currentPage < this.totalPages
} else {
this.hasMore = newPolicies.length >= this.pageSize
}
// 更新游标分页信息
this.hasMore = res.hasMore || false
} else {
console.error('政策数据格式错误:', res)
uni.showToast({
title: res.message || '加载失败',
title: '数据格式错误',
icon: 'none'
})
}
Expand Down
10 changes: 1 addition & 9 deletions miniprogram/pages/tourroute/tourroute.vue
Original file line number Diff line number Diff line change
Expand Up @@ -126,15 +126,7 @@ export default {
} else {
this.routes = [...this.routes, ...newRoutes]
}
]

try {
const res = await getTourPage({
current: this.currentPage,
size: this.pageSize,
keyword: this.keyword || undefined
})


this.nextCursor = res.nextCursor
this.hasMore = res.hasMore || false
} else {
Expand Down
8 changes: 4 additions & 4 deletions miniprogram/services/backend-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ export const getDramaById = (id: number) => {
* 获取旅游线路列表(分页)
*/
export const getTourPage = async (params: {
current?: number
cursor?: string
size?: number
keyword?: string
}) => {
try {
console.log('调用getTourPage API,URL: /tourroute/admin/page, 参数:', params)
const result = await http<PageResponse<any>>({
url: '/tourroute/admin/page',
console.log('调用getTourPage API,URL: /tour/page, 参数:', params)
const result = await http<any>({
url: '/tour/page',
method: 'GET',
data: params
})
Expand Down