修复图标打包问题,清除log

This commit is contained in:
zjf committed 2025-10-10 14:39:53 +08:00
1 parent 80681f3a3e
commit 60fec60061
8 files changed
+21 -104

No files matched your search

+1 -1
View File
@@ -202,7 +202,7 @@ export default {
<style lang="scss">
@import "@/sheep/scss/global.scss";
@import url(@/uni_modules/tm-ui/css/remixicon.min.css);
@import "@/uni_modules/tm-ui/css/remixicon.min.css";
$theme-green: #06be36;
$theme-blue: #0094ff;
+12 -17
View File
@@ -14,9 +14,11 @@
<image
v-for="(img, idx) in imageList"
:key="idx"
:src="img.startsWith('http') ? img : filePath(img)"
:src="img.startsWith('http') || img.startsWith('https') ? img : filePath(img)"
class="feedback-img"
mode="aspectFill"
@error="handleImageError(img)"
@load="handleImageLoad(img)"
/>
</view>
</view>
@@ -40,36 +42,26 @@ const typeOptionsLoaded = ref(false)
async function loadTypeOptions() {
try {
const res: any = await feedbackApi.getFeedbackType()
console.log('反馈类型API响应:', res)
if (res.code === 0 && res.data && Array.isArray(res.data)) {
typeOptions.value = res.data.map(item => ({
value: item.id,
label: item.label
}))
console.log('处理后的反馈类型选项:', typeOptions.value)
typeOptionsLoaded.value = true
} else {
console.error('获取反馈类型失败:', res.msg)
typeOptionsLoaded.value = true
}
} catch (e) {
console.error('获取反馈类型异常:', e)
typeOptionsLoaded.value = true
}
}
function getTypeLabel(type) {
console.log('获取类型标签 - 输入类型:', type, '类型:', typeof type)
console.log('获取类型标签 - 类型选项:', typeOptions.value)
if (!typeOptions.value.length || !type) {
console.log('获取类型标签 - 无选项或无类型,返回:', type || '')
return type || ''
}
const option = typeOptions.value.find(item => String(item.value) === String(type))
console.log('获取类型标签 - 找到的选项:', option)
const result = option ? option.label : type
console.log('获取类型标签 - 最终结果:', result)
return result
return option ? option.label : type
}
function getTypeClass(type: string) {
@@ -108,6 +100,14 @@ function formatTime(time: string) {
return new Date(time).toLocaleString()
}
function handleImageError(img: string) {
// 图片加载失败处理
}
function handleImageLoad(img: string) {
// 图片加载成功处理
}
// 计算图片数组
const imageList = computed(() => {
if (!detail.value.picUrl) return []
@@ -116,7 +116,6 @@ const imageList = computed(() => {
onLoad(async (options: any) => {
const id = options.id
console.log('页面参数:', options)
if (!id) {
uni.showToast({ title: '缺少反馈ID', icon: 'none' })
return
@@ -127,7 +126,6 @@ onLoad(async (options: any) => {
// 先获取反馈详情
const response: any = await feedbackApi.getFeedbackDetail(id)
console.log('反馈详情响应:', response)
if (response.code === 0) {
// 处理不同的数据结构
@@ -136,11 +134,9 @@ onLoad(async (options: any) => {
} else if (response.data && typeof response.data === 'object') {
detail.value = response.data
} else {
console.error('数据结构异常:', response.data)
uni.showToast({ title: '数据格式错误', icon: 'none' })
return
}
console.log('反馈详情数据:', detail.value)
} else {
uni.showToast({ title: response.msg || '获取详情失败', icon: 'none' })
return
@@ -151,7 +147,6 @@ onLoad(async (options: any) => {
uni.hideLoading()
} catch (error) {
console.error('获取详情失败:', error)
uni.hideLoading()
uni.showToast({ title: '获取详情失败', icon: 'none' })
}
+3 -11
View File
@@ -119,21 +119,17 @@ const canSubmit = computed(() => {
async function loadTypeOptions() {
try {
const res: any = await feedbackApi.getFeedbackType()
console.log('反馈类型API响应:', res)
if (res.code === 0 && res.data && Array.isArray(res.data)) {
typeOptions.value = res.data.map(item => ({
value: item.id,
label: item.label
}))
console.log('处理后的反馈类型选项:', typeOptions.value)
typeOptionsLoaded.value = true
} else {
console.error('获取反馈类型失败:', res.msg)
uni.showToast({ title: res.msg || '获取反馈类型失败', icon: 'none' })
typeOptionsLoaded.value = true
}
} catch (e) {
console.error('获取反馈类型异常:', e)
uni.showToast({ title: '获取反馈类型失败', icon: 'none' })
typeOptionsLoaded.value = true
}
@@ -144,17 +140,11 @@ function onTypeChange(e: any) {
}
function getTypeLabel(type: string) {
console.log('列表页获取类型标签 - 输入类型:', type, '类型:', typeof type)
console.log('列表页获取类型标签 - 类型选项:', typeOptions.value)
if (!typeOptions.value.length || !type) {
console.log('列表页获取类型标签 - 无选项或无类型,返回:', type || '')
return type || ''
}
const option = typeOptions.value.find(item => String(item.value) === String(type))
console.log('列表页获取类型标签 - 找到的选项:', option)
const result = option ? option.label : type
console.log('列表页获取类型标签 - 最终结果:', result)
return result
return option ? option.label : type
}
function getTypeClass(type: string) {
@@ -220,6 +210,8 @@ async function submitFeedback() {
description.value = ''
contact.value = ''
typeIndex.value = 0
// 使用 nextTick 确保在下一个 DOM 更新周期清空上传列表
await nextTick()
uploadList.value = []
// 刷新列表
loadFeedbackList()
+2 -49
View File
@@ -200,7 +200,6 @@ const handleDateChange = async (index: number) => {
// 获取时间段数据
const fetchTimeSlots = async (date: string) => {
if (!roomId.value) {
console.log('No roomId available for API request')
uni.showToast({
title: '会议室ID不存在',
icon: 'none'
@@ -208,26 +207,19 @@ const fetchTimeSlots = async (date: string) => {
return
}
console.log('Making API request with roomId:', roomId.value)
try {
const res = await meetingRoomApi.getTimeSlots(roomId.value, date)
console.log('Raw API response:', res)
const response = res as unknown as ApiResponse<TimeSlotItem[]>
console.log('Parsed response:', response)
if (response.code === 0 && response.data) {
console.log('Time slots data:', response.data)
timeSlots.value = response.data
} else {
console.error('Invalid response:', response)
uni.showToast({
title: response.msg || '获取时间段失败',
icon: 'none'
})
}
} catch (error) {
console.error('API request failed:', error)
uni.showToast({
title: '获取时间段失败',
icon: 'none'
@@ -239,18 +231,12 @@ const fetchTimeSlots = async (date: string) => {
const fetchDeskLayouts = async () => {
try {
const res = await meetingRoomApi.getMeetingDeskLayout('')
console.log('Desk layouts response:', res)
const response = res as unknown as ApiResponse<any[]>
if (response.code === 0 && response.data) {
deskLayouts.value = response.data
console.log('Desk layouts data:', deskLayouts.value)
console.log('First layout item structure:', deskLayouts.value[0])
} else {
console.error('Failed to fetch desk layouts:', response)
}
} catch (error) {
console.error('API request failed:', error)
// 获取桌子摆放形态失败
}
}
@@ -303,29 +289,20 @@ function selectService(value: string) {
// 选择桌子摆放形态
function selectLayout(layoutId: string) {
console.log('selectLayout called with layoutId:', layoutId)
selectedLayout.value = layoutId
console.log('selectedLayout.value set to:', selectedLayout.value)
}
// 获取选中的桌子摆放形态名称
const getSelectedLayoutName = () => {
console.log('getSelectedLayoutName - selectedLayout.value:', selectedLayout.value)
console.log('getSelectedLayoutName - deskLayouts.value:', deskLayouts.value)
if (!selectedLayout.value) {
console.log('No layout selected, returning 未选择')
return '未选择'
}
const selectedLayoutItem = deskLayouts.value.find(layout => layout.id === selectedLayout.value)
console.log('Found selected layout item:', selectedLayoutItem)
if (selectedLayoutItem) {
console.log('Returning layout name:', selectedLayoutItem.layoutName)
return selectedLayoutItem.layoutName
} else {
console.log('Layout item not found, returning 未选择')
return '未选择'
}
}
@@ -357,8 +334,6 @@ async function confirmReserve() {
const endSlot = timeSlots.value[selectedTime.value[selectedTime.value.length - 1]]
const deskLayoutName = getSelectedLayoutName()
console.log('选中的桌子摆放形态ID:', selectedLayout.value)
console.log('桌子摆放形态名称:', deskLayoutName)
const res = await meetingRoomApi.bookMeetingRoom(roomId.value, {
date,
@@ -370,19 +345,12 @@ async function confirmReserve() {
need_service: needService.value,
deskLayout: deskLayoutName
})
console.log('预约接口响应:', res)
console.log('响应类型:', typeof res)
console.log('响应内容:', JSON.stringify(res))
// 处理响应数据
const responseData = res as any
// 检查业务错误(HTTP 200 但 code !== 0)
if (responseData && responseData.code !== undefined) {
console.log('检测到响应码:', responseData.code)
console.log('检测到响应消息:', responseData.msg)
if (responseData.code === 0) {
// 成功:隐藏loading,显示成功提示
uni.hideLoading()
@@ -396,7 +364,6 @@ async function confirmReserve() {
// 失败:隐藏loading,关闭弹窗,显示错误信息
uni.hideLoading()
isBooking.value = false
console.log('预约失败,错误信息:', responseData.msg)
// 先关闭弹窗,再显示错误信息
hideModal()
@@ -414,7 +381,6 @@ async function confirmReserve() {
// 响应格式异常:隐藏loading,显示错误信息
uni.hideLoading()
isBooking.value = false
console.log('响应格式异常:', responseData)
uni.showToast({
title: '预约失败,响应格式异常',
icon: 'none',
@@ -425,12 +391,10 @@ async function confirmReserve() {
// 确保在异常情况下也隐藏loading
uni.hideLoading()
isBooking.value = false
console.error('预约失败:', error)
// 处理HTTP错误(如500错误)
const errorData = error as any
if (errorData?.data?.msg) {
console.log('HTTP错误信息:', errorData.data.msg)
uni.showToast({
title: errorData.data.msg,
icon: 'none',
@@ -448,15 +412,9 @@ async function confirmReserve() {
// 初始化数据
onMounted(() => {
console.log('Detail page mounted, props:', props)
console.log('roomId from props:', props.roomId)
// 从props获取roomId
if (props.roomId) {
roomId.value = props.roomId
console.log('roomId set to:', roomId.value)
} else {
console.log('No roomId found in props')
}
// 接收列表页传递的会议室信息
@@ -464,20 +422,17 @@ onMounted(() => {
const eventChannel = currentPage ? (currentPage as any).getOpenerEventChannel() : undefined
if (eventChannel) {
eventChannel.on('acceptRoomInfo', (data: any) => {
console.log('detail.vue: Received raw room info from eventChannel:', data)
// 字段映射
room.value.name = data.roomName || '未知会议室'
room.value.capacity = data.capacity || 0
room.value.address = data.location || '未知地址'
room.value.img = data.picUrl || '/static/meeting/default.jpg'
room.value.tags = data.equipmentNames ? data.equipmentNames.map((eq: { name: string, quantity?: number }) => eq.quantity ? `${eq.name} x${eq.quantity}` : eq.name) : []
console.log('detail.vue: Room.value after mapping:', room.value)
})
}
// 获取当天的时间段
const today = getDateString(0)
console.log('Fetching time slots for date:', today)
fetchTimeSlots(today)
// 获取桌子摆放形态数据
@@ -493,12 +448,10 @@ onMounted(() => {
if (userInfoData.data.sysUser.userId) {
currentUser.value.id = userInfoData.data.sysUser.userId.toString()
}
console.log('detail.vue: Current user name set from localStorage:', currentUser.value.name)
console.log('detail.vue: Current user ID set from localStorage:', currentUser.value.id)
}
}
} catch (e) {
console.error('detail.vue: Failed to parse user_info from localStorage:', e)
// 解析用户信息失败
}
})
-8
View File
@@ -87,33 +87,25 @@ async function fetchMeetingRooms() {
loading.value = true
error.value = ""
try {
console.log('开始获取会议室列表...')
const res: any = await meetingRoomApi.getMeetingRoomList({ current: 1, size: 10 })
console.log('会议室列表API响应:', res)
if (res.code === 0) {
meetingRooms.value = res.data.records || []
console.log('会议室列表数据:', meetingRooms.value)
} else {
error.value = res.msg || '获取会议室列表失败'
console.error('获取会议室列表失败:', res.msg)
}
} catch (err) {
error.value = '网络请求失败'
console.error('获取会议室列表异常:', err)
} finally {
loading.value = false
}
}
function goDetail(room) {
console.log("index.vue: Navigating to detail page with room:", room)
console.log("index.vue: Room ID being passed:", room.id)
uni.navigateTo({
url: `/pages/integrated/meeting/detail?roomId=${room.id}`,
success: function (res) {
// 通过 eventChannel 传递 room 对象
res.eventChannel.emit("acceptRoomInfo", room)
console.log("index.vue: Room object emitted via eventChannel:", room)
},
})
}
@@ -119,7 +119,6 @@ function cancelBooking(item: any) {
} catch (error) {
uni.hideLoading()
uni.showToast({ title: "操作失败,请重试", icon: "none" })
console.error("取消预约失败:", error)
}
}
},
@@ -166,7 +165,6 @@ function endMeeting(item: any) {
} catch (error) {
uni.hideLoading()
uni.showToast({ title: "操作失败,请重试", icon: "none" })
console.error("结束会议失败:", error)
}
}
},
-8
View File
@@ -71,7 +71,6 @@ const urgencyOptions = [
async function loadTypeOptions() {
try {
const response: any = await maintenanceApi.getFeedbackType()
console.log('维修类型响应:', response)
if (response.code === 0 && response.data) {
// 处理API返回的数据格式
if (Array.isArray(response.data)) {
@@ -86,10 +85,8 @@ async function loadTypeOptions() {
label: value
}))
}
console.log('处理后的维修类型选项:', typeOptions.value)
typeOptionsLoaded.value = true
} else {
console.error('获取维修类型失败:', response.msg)
// 使用默认选项作为后备
typeOptions.value = [
{ value: '1', label: '电气设备' },
@@ -101,7 +98,6 @@ async function loadTypeOptions() {
typeOptionsLoaded.value = true
}
} catch (error) {
console.error('获取维修类型失败:', error)
// 使用默认选项作为后备
typeOptions.value = [
{ value: '1', label: '电气设备' },
@@ -157,7 +153,6 @@ const imageList = computed(() => {
onLoad(async (options: any) => {
const id = options.id
console.log('维修详情页面参数:', options)
if (!id) {
uni.showToast({ title: '缺少维修ID', icon: 'none' })
return
@@ -171,18 +166,15 @@ onLoad(async (options: any) => {
// 再加载维修详情
const response: any = await maintenanceApi.getRepairDetail(id)
console.log('维修详情响应:', response)
if (response.code === 0 && response.data) {
detail.value = response.data
console.log('维修详情数据:', detail.value)
} else {
uni.showToast({ title: response.msg || '获取详情失败', icon: 'none' })
}
uni.hideLoading()
} catch (error) {
console.error('获取维修详情失败:', error)
uni.hideLoading()
uni.showToast({ title: '获取详情失败', icon: 'none' })
}
+3 -8
View File
@@ -156,7 +156,6 @@ function beforeComplete(uploadFile: any) {
async function loadTypeOptions() {
try {
const response: any = await maintenanceApi.getFeedbackType()
console.log('维修类型响应:', response)
if (response.code === 0 && response.data) {
// 处理API返回的数据格式
if (Array.isArray(response.data)) {
@@ -171,10 +170,8 @@ async function loadTypeOptions() {
label: value
}))
}
console.log('处理后的维修类型选项:', typeOptions.value)
typeOptionsLoaded.value = true
} else {
console.error('获取维修类型失败:', response.msg)
// 使用默认选项作为后备
typeOptions.value = [
{ value: 1, label: '电气设备' },
@@ -186,7 +183,6 @@ async function loadTypeOptions() {
typeOptionsLoaded.value = true
}
} catch (error) {
console.error('获取维修类型失败:', error)
// 使用默认选项作为后备
typeOptions.value = [
{ value: 1, label: '电气设备' },
@@ -270,9 +266,7 @@ async function submitRepair() {
urgency: String(urgencyOptions[urgencyIndex.value].value),
maintainType: typeOptions.value[typeIndex.value].value
}
console.log('提交的维修数据:', data)
const response: any = await maintenanceApi.submitRepair(data)
console.log('维修提交响应:', response)
uni.hideLoading()
if (response.code === 0) {
uni.showToast({ title: '提交成功', icon: 'success' })
@@ -281,9 +275,11 @@ async function submitRepair() {
location.value = ''
description.value = ''
dateFound.value = ''
uploadFileUrl.value = []
typeIndex.value = -1
urgencyIndex.value = 0
// 使用 nextTick 确保在下一个 DOM 更新周期清空上传列表
await nextTick()
uploadFileUrl.value = []
// 刷新列表
if (activeTab.value === 1) {
loadRepairList()
@@ -292,7 +288,6 @@ async function submitRepair() {
uni.showToast({ title: response.msg || '提交失败', icon: 'none' })
}
} catch (error) {
console.error('维修提交失败:', error)
uni.hideLoading()
uni.showToast({ title: '提交失败', icon: 'none' })
}