维修,意见反馈,公告页面

This commit is contained in:
zjf committed 2025-06-27 23:05:26 +08:00
1 parent 7a12dba8b4
commit 334b2d39a7
11 files changed
+2826 -125

No files matched your search

+42
View File
@@ -467,6 +467,48 @@
"navigationBarTitleText": "意见反馈"
}
},
{
"path": "feedback/detail",
"style": {
"navigationBarTitleText": "反馈详情"
}
},
{
"path": "repair/index",
"style": {
"navigationBarTitleText": "维修上报"
}
},
{
"path": "repair/detail",
"style": {
"navigationBarTitleText": "维修详情"
}
},
{
"path": "notice/index",
"style": {
"navigationBarTitleText": "通知公告"
}
},
{
"path": "notice/detail",
"style": {
"navigationBarTitleText": "公告详情"
}
},
{
"path": "visitor/index",
"style": {
"navigationBarTitleText": "访客管理"
}
},
{
"path": "visitor/detail",
"style": {
"navigationBarTitleText": "访客详情"
}
},
{
"path": "meeting/detail",
"style": {
+217
View File
@@ -0,0 +1,217 @@
<template>
<view class="feedback-detail">
<view class="detail-header">
<view class="detail-title">{{ detail.title }}</view>
<view v-if="typeOptions.length && detail.type" class="detail-type">反馈类型:{{ getTypeLabel(detail.type) }}</view>
</view>
<view class="detail-content">
<view class="content-text">{{ detail.description }}</view>
</view>
<view class="detail-footer">
<text class="create-time">提交时间:{{ formatTime(detail.createTime) }}</text>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import meetingRoomApi from '@/sheep/api/meetingRoom'
const detail = ref<any>({})
const typeOptions = ref<{ value: string; label: string }[]>([])
async function loadTypeOptions() {
const res: any = await meetingRoomApi.getFeedbackType()
if (res.data && Array.isArray(res.data.data)) {
typeOptions.value = res.data.data.map(item => ({
value: item.id,
label: item.label
}))
}
}
function getTypeLabel(type) {
if (!typeOptions.value.length || !type) return ''
const option = typeOptions.value.find(item => String(item.value) === String(type))
return option ? option.label : type
}
function getTypeClass(type: string) {
const classMap: Record<string, string> = {
'1': 'type-suggestion',
'2': 'type-problem',
'3': 'type-ui',
'4': 'type-other'
}
return classMap[type] || 'type-other'
}
function getStatusText(status: string) {
const statusMap: Record<string, string> = {
'1': '待处理',
'2': '处理中',
'3': '已处理',
'4': '已关闭'
}
return statusMap[status] || '未知'
}
function getStatusClass(status: string) {
const classMap: Record<string, string> = {
'1': 'status-pending',
'2': 'status-processing',
'3': 'status-completed',
'4': 'status-closed'
}
return classMap[status] || 'status-pending'
}
function formatTime(time: string) {
if (!time) return ''
return new Date(time).toLocaleString()
}
onLoad(async (options: any) => {
await loadTypeOptions()
const id = options.id
if (!id) return
try {
const response: any = await meetingRoomApi.getFeedbackDetail(id)
if (response.code === 0 && Array.isArray(response.data) && response.data.length > 0) {
detail.value = response.data[0]
}
} catch (error) {
uni.showToast({ title: '获取详情失败', icon: 'none' })
}
})
</script>
<style lang="scss" scoped>
.feedback-detail {
padding: 32rpx;
background: #f5f5f5;
min-height: 100vh;
}
.detail-header {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
.type-tag {
padding: 12rpx 24rpx;
border-radius: 24rpx;
font-size: 26rpx;
&.type-suggestion {
background: #e3f2fd;
color: #1976d2;
}
&.type-problem {
background: #ffebee;
color: #d32f2f;
}
&.type-ui {
background: #f3e5f5;
color: #7b1fa2;
}
&.type-other {
background: #f5f5f5;
color: #666;
}
}
.status-tag {
padding: 12rpx 24rpx;
border-radius: 24rpx;
font-size: 26rpx;
&.status-pending {
background: #fff3e0;
color: #f57c00;
}
&.status-processing {
background: #e8f5e8;
color: #388e3c;
}
&.status-completed {
background: #e3f2fd;
color: #1976d2;
}
&.status-closed {
background: #f5f5f5;
color: #999;
}
}
}
.detail-content {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.content-text {
font-size: 30rpx;
color: #333;
line-height: 1.6;
margin-bottom: 24rpx;
}
.contact-info {
font-size: 26rpx;
color: #666;
padding-top: 24rpx;
border-top: 1rpx solid #f0f0f0;
}
}
.reply-section {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.reply-title {
font-size: 30rpx;
font-weight: bold;
color: #333;
margin-bottom: 16rpx;
}
.reply-content {
font-size: 28rpx;
color: #666;
line-height: 1.6;
margin-bottom: 16rpx;
}
.reply-time {
font-size: 24rpx;
color: #999;
text-align: right;
}
}
.detail-footer {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.create-time {
font-size: 26rpx;
color: #999;
}
}
</style>
+394 -123
View File
@@ -1,151 +1,422 @@
<template>
<view class="min-h-screen bg-white px-30rpx pb-30rpx">
<!-- 顶部导航 -->
<view class="flex items-center h-88rpx relative">
<view class="absolute left-0 h-88rpx flex items-center pr-20rpx" @tap="goBack">
<text class="text-36rpx text-gray-800">&lt;</text>
<text class="text-28rpx text-gray-800 ml-4rpx">返回</text>
</view>
<view class="flex-1 text-center text-34rpx font-500">问题反馈</view>
<view class="feedback-container">
<view class="feedback-tabs">
<view :class="['tab', {active: activeTab === 0} ]" @click="activeTab = 0">提交反馈</view>
<view :class="['tab', {active: activeTab === 1} ]" @click="activeTab = 1">我的反馈</view>
</view>
<!-- 问题分类 -->
<view class="mt-40rpx">
<view class="text-32rpx font-500 mb-24rpx">问题分类</view>
<view class="flex flex-wrap gap-24rpx">
<view
v-for="(item, index) in categories"
:key="index"
:class="[
'px-32rpx py-12rpx rounded-20rpx text-28rpx transition-colors duration-200',
selectedCategory === item ? 'bg-blue-200 text-blue-600' : 'bg-gray-100',
]"
@tap="selectedCategory = item"
>
{{ item }}
<view v-if="activeTab === 0">
<!-- 反馈表单 -->
<view class="feedback-form">
<view class="form-title">提交反馈</view>
<view class="form-item">
<view class="label">标题</view>
<input v-model="title" placeholder="请输入反馈标题" class="title-input" />
</view>
<view class="form-item">
<view class="label">反馈类型</view>
<picker @change="onTypeChange" :value="typeIndex" :range="typeOptions" range-key="label">
<view class="picker">{{ typeOptions[typeIndex]?.label || '请选择类型' }}</view>
</picker>
</view>
<view class="form-item">
<view class="label">反馈描述</view>
<textarea
v-model="description"
placeholder="请详细描述您的问题或建议..."
class="content-textarea"
maxlength="500"
/>
<view class="char-count">{{ description.length }}/500</view>
</view>
<view class="form-item">
<view class="label">联系方式</view>
<input v-model="contact" placeholder="手机号或邮箱(选填)" class="contact-input" />
</view>
<button @click="submitFeedback" class="submit-btn" :disabled="!canSubmit">
提交反馈
</button>
</view>
</view>
<!-- 详细描述 -->
<view class="mt-40rpx">
<view class="text-32rpx font-500 mb-24rpx">
详细描述
<text class="text-red-500 ml-8rpx">*</text>
</view>
<view class="w-full bg-gray-50 rounded-16rpx p-20rpx box-border">
<textarea
v-model="description"
placeholder="您在哪个页面,遇到了什么问题,详细描述有助于帮您快速解决"
placeholder-style="color: #999999;"
:maxlength="200"
class="w-full h-240rpx bg-gray-50 text-28rpx leading-40rpx p-0 box-border"
/>
<view class="text-right text-gray-400 text-24rpx mt-8rpx">{{ description.length }}/200</view>
</view>
</view>
<!-- 图片上传 -->
<view class="mt-40rpx">
<view class="text-32rpx font-500 mb-24rpx">上传图片 ({{ images.length }}/3)</view>
<view class="flex flex-wrap gap-24rpx">
<view v-for="(img, index) in images" :key="index" class="relative w-160rpx h-160rpx">
<image :src="img" mode="aspectFill" class="w-full h-full rounded-16rpx" />
<view
class="absolute -right-12rpx -top-12rpx w-40rpx h-40rpx bg-black bg-opacity-60 text-white rounded-full flex items-center justify-center active:bg-opacity-80"
@tap="deleteImage(index)"
<view v-else>
<!-- 我的反馈列表 -->
<view class="feedback-list">
<view class="list-title">我的反馈</view>
<view v-if="feedbackList.length === 0" class="empty-tip">
暂无反馈记录
</view>
<view v-else>
<view
v-for="item in feedbackList"
:key="item.id"
class="feedback-item"
@click="viewDetail(item)"
>
×
<view class="item-header">
<view class="type-tag" :class="getTypeClass(item.type)">{{ getTypeLabel(item.type) }}</view>
<view class="status-tag" :class="getStatusClass(item.status)">{{ getStatusText(item.status) }}</view>
</view>
<view class="item-content">
<view class="item-title">{{ item.title }}</view>
<view class="item-desc">{{ item.description }}</view>
<image v-if="item.picUrl" :src="item.picUrl" class="item-img" mode="aspectFill" />
</view>
<view class="item-footer">
<text class="time">{{ formatTime(item.createTime) }}</text>
<text v-if="item.reply" class="reply-count">已回复</text>
</view>
</view>
</view>
<view
v-if="images.length < 3"
class="w-160rpx h-160rpx rounded-16rpx border border-dashed border-gray-200 flex items-center justify-center active:bg-gray-50"
@tap="handleUpload"
>
<view class="text-48rpx text-gray-400">+</view>
</view>
</view>
</view>
<!-- 联系方式 -->
<view class="mt-40rpx">
<view class="text-32rpx font-500 mb-24rpx">联系方式</view>
<view class="w-full bg-gray-50 rounded-16rpx px-20rpx box-border">
<input
v-model="contact"
placeholder="手机号/邮箱/微信号"
placeholder-style="color: #999999;"
class="w-full h-88rpx text-28rpx bg-gray-50"
/>
</view>
</view>
<!-- 邮箱联系我们 -->
<view class="mt-48rpx flex items-center justify-between text-28rpx">
<view class="text-gray-800">邮箱联系我们</view>
<view class="flex items-center gap-16rpx">
<text class="text-gray-600">user_service@36kr.com</text>
<view class="px-24rpx py-8rpx bg-gray-100 rounded-8rpx text-28rpx active:bg-gray-200" @tap="copyEmail"> 复制 </view>
</view>
</view>
<!-- 提交按钮 -->
<view
class="my-64rpx h-88rpx bg-blue-500 text-white rounded-20rpx flex items-center justify-center text-32rpx active:bg-blue-600 transition-colors duration-200"
@tap="handleSubmit"
>
提 交
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from "vue"
import { ref, onMounted, computed } from 'vue'
import meetingRoomApi from '@/sheep/api/meetingRoom'
const categories = ["产品建议", "功能Bug", "内容订正", "其他"]
const selectedCategory = ref("产品建议")
const description = ref("")
const images = ref<string[]>([])
const contact = ref("")
const typeOptions = ref<{ value: string; label: string }[]>([])
const typeIndex = ref(0)
const title = ref('')
const description = ref('')
const contact = ref('')
const feedbackList = ref<any[]>([])
const activeTab = ref(0)
const goBack = () => {
uni.navigateBack()
const canSubmit = computed(() => {
return title.value.trim() && description.value.trim()
})
async function loadTypeOptions() {
try {
const res: any = await meetingRoomApi.getFeedbackType()
if (res.data && Array.isArray(res.data.data)) {
typeOptions.value = res.data.data.map(item => ({
value: item.id,
label: item.label
}))
}
} catch (e) {
uni.showToast({ title: '获取反馈类型失败', icon: 'none' })
}
}
const handleUpload = () => {
uni.chooseImage({
count: 3 - images.value.length,
success: (res) => {
images.value = [...images.value, ...res.tempFilePaths]
},
})
function onTypeChange(e: any) {
typeIndex.value = e.detail.value
}
const deleteImage = (index: number) => {
images.value.splice(index, 1)
function getTypeLabel(type: string) {
const option = typeOptions.value.find(item => item.value === type)
return option ? option.label : type
}
const copyEmail = () => {
uni.setClipboardData({
data: "user_service@36kr.com",
success: () => {
uni.showToast({
title: "复制成功",
icon: "none",
})
},
})
function getTypeClass(type: string) {
const classMap: Record<string, string> = {
'投诉': 'type-complain',
'建议': 'type-suggest',
'BUG报告': 'type-bug',
'功能需求': 'type-feature'
}
return classMap[type] || 'type-other'
}
const handleSubmit = () => {
if (!description.value) {
uni.showToast({
title: "请填写详细描述",
icon: "none",
})
function getStatusText(status: string) {
const statusMap: Record<string, string> = {
'1': '待处理',
'2': '处理中',
'3': '已处理',
'4': '已关闭'
}
return statusMap[status] || '未知'
}
function getStatusClass(status: string) {
const classMap: Record<string, string> = {
'1': 'status-pending',
'2': 'status-processing',
'3': 'status-completed',
'4': 'status-closed'
}
return classMap[status] || 'status-pending'
}
function formatTime(time: string) {
if (!time) return ''
return new Date(time).toLocaleDateString()
}
async function submitFeedback() {
if (!canSubmit.value) {
uni.showToast({ title: '请填写完整信息', icon: 'none' })
return
}
// 实现提交逻辑
try {
uni.showLoading({ title: '提交中...' })
const data = {
title: title.value.trim(),
type: typeOptions.value[typeIndex.value].value,
description: description.value.trim(),
contact: contact.value.trim()
}
const response: any = await meetingRoomApi.submitFeedback(data)
uni.hideLoading()
if (response.code === 0) {
uni.showToast({ title: '提交成功', icon: 'success' })
// 清空表单
title.value = ''
description.value = ''
contact.value = ''
typeIndex.value = 0
// 刷新列表
loadFeedbackList()
} else {
uni.showToast({ title: response.msg || '提交失败', icon: 'none' })
}
} catch (error) {
uni.hideLoading()
uni.showToast({ title: '提交失败', icon: 'none' })
}
}
function viewDetail(item: any) {
uni.navigateTo({
url: `/pages/integrated/feedback/detail?id=${item.id}`
})
}
async function loadFeedbackList() {
try {
const response: any = await meetingRoomApi.getFeedbackList({
current: 1,
size: 20
})
if (response.code === 0 && response.data) {
feedbackList.value = response.data.records || []
}
} catch (error) {
console.error('加载反馈列表失败:', error)
}
}
onMounted(() => {
loadTypeOptions().then(() => {
loadFeedbackList()
})
})
</script>
<style lang="scss" scoped>
.feedback-container {
padding: 24rpx;
background: #f5f5f5;
min-height: 100vh;
}
.feedback-tabs {
display: flex;
background: #fff;
border-radius: 16rpx 16rpx 0 0;
overflow: hidden;
margin-bottom: 24rpx;
.tab {
flex: 1;
text-align: center;
padding: 28rpx 0;
font-size: 30rpx;
color: #888;
background: #f7f8fa;
&.active {
color: #1777FF;
background: #fff;
font-weight: bold;
border-bottom: 4rpx solid #1777FF;
}
}
}
.feedback-form {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.form-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.form-item {
margin-bottom: 24rpx;
.label {
font-size: 28rpx;
color: #333;
margin-bottom: 12rpx;
}
.title-input {
height: 80rpx;
padding: 0 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
}
.picker {
height: 80rpx;
line-height: 80rpx;
padding: 0 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
}
.content-textarea {
width: 100%;
height: 200rpx;
padding: 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
box-sizing: border-box;
}
.char-count {
text-align: right;
font-size: 24rpx;
color: #999;
margin-top: 8rpx;
}
.contact-input {
height: 80rpx;
padding: 0 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
}
}
.submit-btn {
width: 100%;
height: 88rpx;
background: #007aff;
color: #fff;
border-radius: 8rpx;
font-size: 32rpx;
&:disabled {
background: #ccc;
}
}
}
.feedback-list {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.list-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.empty-tip {
text-align: center;
color: #999;
font-size: 28rpx;
padding: 60rpx 0;
}
.feedback-item {
border-bottom: 1rpx solid #f0f0f0;
padding: 24rpx 0;
&:last-child {
border-bottom: none;
}
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
.type-tag {
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 24rpx;
&.type-complain {
background: #ffebee;
color: #d32f2f;
}
&.type-suggest {
background: #e3f2fd;
color: #1976d2;
}
&.type-bug {
background: #f3e5f5;
color: #7b1fa2;
}
&.type-feature {
background: #e8f5e8;
color: #388e3c;
}
&.type-other {
background: #f5f5f5;
color: #666;
}
}
.status-tag {
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 24rpx;
&.status-pending {
background: #fff3e0;
color: #f57c00;
}
&.status-processing {
background: #e8f5e8;
color: #388e3c;
}
&.status-completed {
background: #e3f2fd;
color: #1976d2;
}
&.status-closed {
background: #f5f5f5;
color: #999;
}
}
}
.item-content {
.item-title {
font-size: 28rpx;
color: #222;
font-weight: bold;
margin-bottom: 8rpx;
}
.item-desc {
font-size: 26rpx;
color: #333;
margin-bottom: 8rpx;
line-height: 1.5;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
.item-img {
width: 120rpx;
height: 120rpx;
border-radius: 8rpx;
margin-top: 8rpx;
background: #f7f8fa;
}
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
.time {
font-size: 24rpx;
color: #999;
}
.reply-count {
font-size: 24rpx;
color: #007aff;
}
}
}
}
</style>
+26 -2
View File
@@ -17,9 +17,9 @@
<script setup lang="ts">
const services = [
{
name: 'water-query',
name: 'meeting-booking',
label: '会议预定',
icon: '/static/service/water-query.png',
icon: '/static/service/meeting-booking.png',
url: '/pages/integrated/meeting/index'
},
{
@@ -27,6 +27,30 @@ const services = [
label: '失物招领',
icon: '/static/service/lost-and-found.png',
url: '/pages/integrated/lostAndFound/index'
},
{
name: 'feedback',
label: '意见反馈',
icon: '/static/service/feedback.png',
url: '/pages/integrated/feedback/index'
},
{
name: 'repair-report',
label: '维修上报',
icon: '/static/service/repair-report.png',
url: '/pages/integrated/repair/index'
},
{
name: 'notice',
label: '通知公告',
icon: '/static/service/notice.png',
url: '/pages/integrated/notice/index'
},
{
name: 'visitor',
label: '访客管理',
icon: '/static/service/visitor.png',
url: '/pages/integrated/visitor/index'
}
]
+211
View File
@@ -0,0 +1,211 @@
<template>
<view class="notice-detail">
<view class="detail-header">
<view class="title">{{ detail.title }}</view>
<view class="meta">
<text class="type-tag" :class="getTypeClass(detail.type)">{{ getTypeLabel(detail.type) }}</text>
<text class="time">{{ formatTime(detail.createTime) }}</text>
</view>
</view>
<view class="detail-content">
<view class="content-text">{{ detail.content }}</view>
</view>
<view v-if="detail.attachments && detail.attachments.length > 0" class="attachments">
<view class="attachment-title">附件</view>
<view
v-for="(file, index) in detail.attachments"
:key="index"
class="attachment-item"
@click="downloadFile(file)"
>
<text class="file-name">{{ file.name }}</text>
<text class="file-size">{{ formatFileSize(file.size) }}</text>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import meetingRoomApi from '@/sheep/api/meetingRoom'
const detail = ref<any>({})
function getTypeLabel(type: string) {
const typeMap: Record<string, string> = {
'1': '重要',
'2': '一般',
'3': '活动'
}
return typeMap[type] || '一般'
}
function getTypeClass(type: string) {
const classMap: Record<string, string> = {
'1': 'type-important',
'2': 'type-general',
'3': 'type-activity'
}
return classMap[type] || 'type-general'
}
function formatTime(time: string) {
if (!time) return ''
return new Date(time).toLocaleString()
}
function formatFileSize(size: number) {
if (size < 1024) {
return size + 'B'
} else if (size < 1024 * 1024) {
return (size / 1024).toFixed(1) + 'KB'
} else {
return (size / (1024 * 1024)).toFixed(1) + 'MB'
}
}
function downloadFile(file: any) {
uni.downloadFile({
url: file.url,
success: (res) => {
if (res.statusCode === 200) {
uni.openDocument({
filePath: res.tempFilePath,
success: () => {
console.log('打开文档成功')
},
fail: () => {
uni.showToast({ title: '无法打开此文件', icon: 'none' })
}
})
}
},
fail: () => {
uni.showToast({ title: '下载失败', icon: 'none' })
}
})
}
onLoad(async (options: any) => {
const id = options.id
if (!id) return
try {
const response: any = await meetingRoomApi.getNoticeDetail(id)
if (response.code === 0 && response.data) {
detail.value = response.data
}
} catch (error) {
console.error('获取公告详情失败:', error)
uni.showToast({ title: '获取详情失败', icon: 'none' })
}
})
</script>
<style lang="scss" scoped>
.notice-detail {
padding: 32rpx;
background: #f5f5f5;
min-height: 100vh;
}
.detail-header {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.title {
font-size: 36rpx;
font-weight: bold;
color: #333;
line-height: 1.4;
margin-bottom: 16rpx;
}
.meta {
display: flex;
justify-content: space-between;
align-items: center;
.type-tag {
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 24rpx;
&.type-important {
background: #ffebee;
color: #d32f2f;
}
&.type-general {
background: #f5f5f5;
color: #666;
}
&.type-activity {
background: #e8f5e8;
color: #388e3c;
}
}
.time {
font-size: 24rpx;
color: #999;
}
}
}
.detail-content {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.content-text {
font-size: 30rpx;
color: #333;
line-height: 1.8;
}
}
.attachments {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.attachment-title {
font-size: 30rpx;
font-weight: bold;
color: #333;
margin-bottom: 16rpx;
}
.attachment-item {
display: flex;
justify-content: space-between;
align-items: center;
padding: 16rpx 0;
border-bottom: 1rpx solid #f0f0f0;
&:last-child {
border-bottom: none;
}
.file-name {
font-size: 28rpx;
color: #007aff;
flex: 1;
margin-right: 16rpx;
}
.file-size {
font-size: 24rpx;
color: #999;
}
}
}
</style>
+309
View File
@@ -0,0 +1,309 @@
<template>
<view class="notice-container">
<!-- 公告分类标签 -->
<view class="notice-tabs">
<view
v-for="(tab, index) in tabs"
:key="index"
:class="['tab-item', { active: activeTab === index }]"
@click="switchTab(index)"
>
{{ tab.label }}
</view>
</view>
<!-- 公告列表 -->
<view class="notice-list">
<view v-if="noticeList.length === 0" class="empty-tip">
暂无公告
</view>
<view v-else>
<view
v-for="item in noticeList"
:key="item.id"
class="notice-item"
@click="viewDetail(item)"
>
<view class="item-header">
<view class="title">{{ item.title }}</view>
<view class="type-tag" :class="getTypeClass(item.type)">{{ getTypeLabel(item.type) }}</view>
</view>
<view class="item-content">{{ item.content }}</view>
<view class="item-footer">
<text class="time">{{ formatTime(item.createTime) }}</text>
<text v-if="item.isTop" class="top-tag">置顶</text>
<text v-if="item.isRead" class="read-tag">已读</text>
</view>
</view>
</view>
</view>
<!-- 加载更多 -->
<view v-if="hasMore" class="load-more" @click="loadMore">
<text>加载更多</text>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import meetingRoomApi from '@/sheep/api/meetingRoom'
const tabs = [
{ value: 'all', label: '全部' },
{ value: 'important', label: '重要' },
{ value: 'general', label: '一般' },
{ value: 'activity', label: '活动' }
]
const activeTab = ref(0)
const noticeList = ref<any[]>([])
const currentPage = ref(1)
const hasMore = ref(true)
function switchTab(index: number) {
activeTab.value = index
currentPage.value = 1
hasMore.value = true
loadNoticeList(true)
}
function getTypeLabel(type: string) {
const typeMap: Record<string, string> = {
'1': '重要',
'2': '一般',
'3': '活动'
}
return typeMap[type] || '一般'
}
function getTypeClass(type: string) {
const classMap: Record<string, string> = {
'1': 'type-important',
'2': 'type-general',
'3': 'type-activity'
}
return classMap[type] || 'type-general'
}
function formatTime(time: string) {
if (!time) return ''
const date = new Date(time)
const now = new Date()
const diff = now.getTime() - date.getTime()
const days = Math.floor(diff / (1000 * 60 * 60 * 24))
if (days === 0) {
return '今天'
} else if (days === 1) {
return '昨天'
} else if (days < 7) {
return `${days}天前`
} else {
return date.toLocaleDateString()
}
}
function viewDetail(item: any) {
// 标记为已读
if (!item.isRead) {
markAsRead(item.id)
}
uni.navigateTo({
url: `/pages/integrated/notice/detail?id=${item.id}`
})
}
async function markAsRead(id: string) {
try {
const response: any = await meetingRoomApi.markNoticeRead(id)
if (response.code === 0) {
console.log('标记已读成功:', id)
}
} catch (error) {
console.error('标记已读失败:', error)
}
}
async function loadNoticeList(reset = false) {
try {
const params = {
current: currentPage.value,
size: 10,
type: tabs[activeTab.value].value
}
const response: any = await meetingRoomApi.getNoticeList(params)
if (response.code === 0 && response.data) {
const records = response.data.records || []
if (reset) {
noticeList.value = records
} else {
noticeList.value = [...noticeList.value, ...records]
}
// 检查是否还有更多数据
hasMore.value = records.length === 10
}
} catch (error) {
console.error('加载公告列表失败:', error)
}
}
function loadMore() {
if (!hasMore.value) return
currentPage.value++
loadNoticeList()
}
onMounted(() => {
loadNoticeList(true)
})
</script>
<style lang="scss" scoped>
.notice-container {
background: #f5f5f5;
min-height: 100vh;
}
.notice-tabs {
display: flex;
background: #fff;
padding: 0 24rpx;
border-bottom: 1rpx solid #f0f0f0;
.tab-item {
flex: 1;
height: 88rpx;
line-height: 88rpx;
text-align: center;
font-size: 28rpx;
color: #666;
position: relative;
&.active {
color: #007aff;
font-weight: bold;
&::after {
content: '';
position: absolute;
bottom: 0;
left: 50%;
transform: translateX(-50%);
width: 40rpx;
height: 4rpx;
background: #007aff;
border-radius: 2rpx;
}
}
}
}
.notice-list {
padding: 24rpx;
.empty-tip {
text-align: center;
color: #999;
font-size: 28rpx;
padding: 120rpx 0;
}
.notice-item {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.item-header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 16rpx;
.title {
flex: 1;
font-size: 32rpx;
font-weight: bold;
color: #333;
line-height: 1.4;
margin-right: 16rpx;
}
.type-tag {
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 24rpx;
white-space: nowrap;
&.type-important {
background: #ffebee;
color: #d32f2f;
}
&.type-general {
background: #f5f5f5;
color: #666;
}
&.type-activity {
background: #e8f5e8;
color: #388e3c;
}
}
}
.item-content {
font-size: 28rpx;
color: #666;
line-height: 1.5;
margin-bottom: 16rpx;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
overflow: hidden;
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
.time {
font-size: 24rpx;
color: #999;
}
.top-tag {
font-size: 24rpx;
color: #d32f2f;
background: #ffebee;
padding: 4rpx 12rpx;
border-radius: 12rpx;
margin-left: 12rpx;
}
.read-tag {
font-size: 24rpx;
color: #999;
background: #f5f5f5;
padding: 4rpx 12rpx;
border-radius: 12rpx;
margin-left: 12rpx;
}
}
}
}
.load-more {
text-align: center;
padding: 32rpx;
color: #007aff;
font-size: 28rpx;
}
</style>
+252
View File
@@ -0,0 +1,252 @@
<template>
<view class="repair-detail">
<view class="detail-header">
<view class="equipment-info">
<text class="equipment-name">{{ detail.equipmentName }}</text>
<text class="location">{{ detail.location }}</text>
</view>
<view class="status-tag" :class="getStatusClass(detail.status)">{{ getStatusText(detail.status) }}</view>
</view>
<view class="detail-content">
<view class="info-row">
<text class="label">维修类型:</text>
<text class="value">{{ getTypeLabel(detail.type) }}</text>
</view>
<view class="info-row">
<text class="label">紧急程度:</text>
<text class="value">{{ getUrgencyLabel(detail.urgency) }}</text>
</view>
<view class="info-row">
<text class="label">联系电话:</text>
<text class="value">{{ detail.phone }}</text>
</view>
<view class="description-section">
<text class="label">故障描述:</text>
<text class="description">{{ detail.description }}</text>
</view>
</view>
<view v-if="detail.repairResult" class="result-section">
<view class="result-title">维修结果</view>
<view class="result-content">{{ detail.repairResult }}</view>
<view class="result-time">{{ formatTime(detail.repairTime) }}</view>
</view>
<view class="detail-footer">
<text class="create-time">申请时间:{{ formatTime(detail.createTime) }}</text>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import meetingRoomApi from '@/sheep/api/meetingRoom'
const detail = ref<any>({})
const typeOptions = [
{ value: '1', label: '电气设备' },
{ value: '2', label: '网络设备' },
{ value: '3', label: '办公设备' },
{ value: '4', label: '空调设备' },
{ value: '5', label: '其他' }
]
const urgencyOptions = [
{ value: '1', label: '高' },
{ value: '2', label: '中' },
{ value: '3', label: '低' }
]
function getTypeLabel(type: string) {
const option = typeOptions.find(item => item.value === type)
return option ? option.label : '其他'
}
function getUrgencyLabel(urgency: string) {
const option = urgencyOptions.find(item => item.value === String(urgency))
return option ? option.label : '--'
}
function getStatusText(status: string) {
const statusMap: Record<string, string> = {
'1': '待处理',
'2': '处理中',
'3': '已完成',
'4': '已取消'
}
return statusMap[status] || '未知'
}
function getStatusClass(status: string) {
const classMap: Record<string, string> = {
'1': 'status-pending',
'2': 'status-processing',
'3': 'status-completed',
'4': 'status-cancelled'
}
return classMap[status] || 'status-pending'
}
function formatTime(time: string) {
if (!time) return ''
return new Date(time).toLocaleString()
}
onLoad(async (options: any) => {
const id = options.id
if (!id) return
try {
const response: any = await meetingRoomApi.getRepairDetail(id)
if (response.code === 0 && response.data) {
detail.value = response.data
}
} catch (error) {
console.error('获取维修详情失败:', error)
uni.showToast({ title: '获取详情失败', icon: 'none' })
}
})
</script>
<style lang="scss" scoped>
.repair-detail {
padding: 32rpx;
background: #f5f5f5;
min-height: 100vh;
}
.detail-header {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
.equipment-info {
.equipment-name {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-right: 16rpx;
}
.location {
font-size: 26rpx;
color: #666;
}
}
.status-tag {
padding: 12rpx 24rpx;
border-radius: 24rpx;
font-size: 26rpx;
&.status-pending {
background: #fff3e0;
color: #f57c00;
}
&.status-processing {
background: #e8f5e8;
color: #388e3c;
}
&.status-completed {
background: #e3f2fd;
color: #1976d2;
}
&.status-cancelled {
background: #f5f5f5;
color: #999;
}
}
}
.detail-content {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.info-row {
display: flex;
margin-bottom: 16rpx;
.label {
font-size: 28rpx;
color: #666;
width: 160rpx;
flex-shrink: 0;
}
.value {
font-size: 28rpx;
color: #333;
flex: 1;
}
}
.description-section {
margin-top: 24rpx;
padding-top: 24rpx;
border-top: 1rpx solid #f0f0f0;
.label {
font-size: 28rpx;
color: #666;
display: block;
margin-bottom: 12rpx;
}
.description {
font-size: 28rpx;
color: #333;
line-height: 1.6;
}
}
}
.result-section {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.result-title {
font-size: 30rpx;
font-weight: bold;
color: #333;
margin-bottom: 16rpx;
}
.result-content {
font-size: 28rpx;
color: #666;
line-height: 1.6;
margin-bottom: 16rpx;
}
.result-time {
font-size: 24rpx;
color: #999;
text-align: right;
}
}
.detail-footer {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.create-time {
font-size: 26rpx;
color: #999;
}
}
</style>
+550
View File
@@ -0,0 +1,550 @@
<template>
<view class="repair-container">
<view class="repair-tabs">
<view :class="['tab', {active: activeTab === 0} ]" @click="activeTab = 0">维修申请</view>
<view :class="['tab', {active: activeTab === 1} ]" @click="activeTab = 1">维修记录</view>
</view>
<view v-if="activeTab === 0">
<!-- 维修申请表单 -->
<view class="repair-form">
<view class="form-title">维修申请</view>
<view class="form-item">
<view class="label">维修类型</view>
<picker @change="onTypeChange" :value="typeIndex" :range="typeOptions" range-key="label">
<view class="picker">{{ typeOptions[typeIndex].label }}</view>
</picker>
</view>
<view class="form-item">
<view class="label">设备名称</view>
<input v-model="title" placeholder="请输入设备名称" class="equipment-input" />
</view>
<view class="form-item">
<view class="label">设备位置</view>
<input v-model="location" placeholder="请输入设备具体位置" class="location-input" />
</view>
<view class="form-item">
<view class="label">发现日期</view>
<picker mode="date" :value="dateFound" @change="onDateChange">
<view class="picker">{{ dateFound || '请选择日期' }}</view>
</picker>
</view>
<view class="form-item">
<view class="label">图片</view>
<view class="image-upload">
<image v-if="picUrl" :src="picUrl" class="feedback-img" mode="aspectFill" @click="previewImage" />
<view v-else class="upload-btn" @click="chooseImage">上传图片</view>
</view>
</view>
<view class="form-item">
<view class="label">故障描述</view>
<textarea
v-model="description"
placeholder="请详细描述设备故障情况..."
class="description-textarea"
maxlength="300"
/>
<view class="char-count">{{ description.length }}/300</view>
</view>
<view class="form-item">
<view class="label">紧急程度</view>
<picker @change="onUrgencyChange" :value="urgencyIndex" :range="urgencyOptions" range-key="label">
<view class="picker">{{ urgencyOptions[urgencyIndex].label }}</view>
</picker>
</view>
<button @click="submitRepair" class="submit-btn" :disabled="!canSubmit">
提交申请
</button>
</view>
</view>
<view v-else>
<!-- 维修记录列表 -->
<view class="repair-list">
<view class="list-title">维修记录</view>
<view v-if="repairList.length === 0" class="empty-tip">
暂无维修记录
</view>
<view v-else>
<view
v-for="item in repairList"
:key="item.id"
class="repair-item"
@click="viewDetail(item)"
>
<view class="item-header">
<view class="type-tag" :class="getTypeClass(item.type)">{{ getTypeLabel(item.type) }}</view>
<view class="status-tag" :class="getStatusClass(item.status)">{{ getStatusText(item.status) }}</view>
</view>
<view class="item-content">
<view class="equipment-info">
<text class="equipment-name">{{ item.equipmentName }}</text>
<text class="location">{{ item.location }}</text>
</view>
<view class="description">{{ item.description }}</view>
</view>
<view class="item-footer">
<text class="time">{{ formatTime(item.createTime) }}</text>
<text v-if="item.urgency === '1'" class="urgency-tag">紧急</text>
</view>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import meetingRoomApi from '@/sheep/api/meetingRoom'
const typeOptions = [
{ value: 1, label: '电气设备' },
{ value: 2, label: '网络设备' },
{ value: 3, label: '办公设备' },
{ value: 4, label: '空调设备' },
{ value: 5, label: '其他' }
]
const urgencyOptions = [
{ value: 1, label: '高' },
{ value: 2, label: '中' },
{ value: 3, label: '低' }
]
const typeIndex = ref(0)
const urgencyIndex = ref(0)
const title = ref('')
const location = ref('')
const description = ref('')
const dateFound = ref('')
const picUrl = ref('')
const repairList = ref<any[]>([])
const activeTab = ref(0)
const canSubmit = computed(() => {
return title.value.trim() && location.value.trim() && description.value.trim() && dateFound.value
})
function onTypeChange(e: any) {
typeIndex.value = e.detail.value
}
function onUrgencyChange(e: any) {
urgencyIndex.value = e.detail.value
}
function onDateChange(e: any) {
dateFound.value = e.detail.value
}
function chooseImage() {
uni.chooseImage({
count: 1,
success: (res) => {
if (res.tempFilePaths && res.tempFilePaths.length > 0) {
picUrl.value = res.tempFilePaths[0]
}
}
})
}
function previewImage() {
if (picUrl.value) {
uni.previewImage({
urls: [picUrl.value]
})
}
}
async function uploadImageIfNeeded() {
if (!picUrl.value || picUrl.value.startsWith('http')) {
return picUrl.value
}
return new Promise<string>((resolve, reject) => {
uni.uploadFile({
url: '/file/upload',
filePath: picUrl.value,
name: 'file',
success: (res) => {
try {
const data = JSON.parse(res.data)
if (data.code === 0 && data.data && data.data.url) {
resolve(data.data.url)
} else {
uni.showToast({ title: '图片上传失败', icon: 'none' })
reject()
}
} catch {
uni.showToast({ title: '图片上传失败', icon: 'none' })
reject()
}
},
fail: () => {
uni.showToast({ title: '图片上传失败', icon: 'none' })
reject()
}
})
})
}
function getTypeLabel(type: number) {
const option = typeOptions.find(item => item.value === type)
return option ? option.label : '其他'
}
function getTypeClass(type: number) {
const classMap: Record<number, string> = {
1: 'type-electrical',
2: 'type-network',
3: 'type-office',
4: 'type-ac',
5: 'type-other'
}
return classMap[type] || 'type-other'
}
function getStatusText(status: string) {
const statusMap: Record<string, string> = {
'1': '待处理',
'2': '处理中',
'3': '已完成',
'4': '已取消'
}
return statusMap[status] || '未知'
}
function getStatusClass(status: string) {
const classMap: Record<string, string> = {
'1': 'status-pending',
'2': 'status-processing',
'3': 'status-completed',
'4': 'status-cancelled'
}
return classMap[status] || 'status-pending'
}
function formatTime(time: string) {
if (!time) return ''
return new Date(time).toLocaleDateString()
}
async function submitRepair() {
if (!canSubmit.value) {
uni.showToast({ title: '请填写完整信息', icon: 'none' })
return
}
try {
uni.showLoading({ title: '提交中...' })
let uploadedPicUrl = picUrl.value
if (picUrl.value && !picUrl.value.startsWith('http')) {
uploadedPicUrl = await uploadImageIfNeeded()
}
const data = {
title: title.value.trim(),
picUrl: uploadedPicUrl,
description: description.value.trim(),
dateFound: dateFound.value,
location: location.value.trim(),
urgency: String(urgencyOptions[urgencyIndex.value].value),
maintainType: typeOptions[typeIndex.value].value
}
const response: any = await meetingRoomApi.submitRepair(data)
uni.hideLoading()
if (response.code === 0) {
uni.showToast({ title: '提交成功', icon: 'success' })
// 清空表单
title.value = ''
location.value = ''
description.value = ''
dateFound.value = ''
picUrl.value = ''
typeIndex.value = 0
urgencyIndex.value = 0
// 刷新列表
loadRepairList()
} else {
uni.showToast({ title: response.msg || '提交失败', icon: 'none' })
}
} catch (error) {
uni.hideLoading()
uni.showToast({ title: '提交失败', icon: 'none' })
}
}
function viewDetail(item: any) {
uni.navigateTo({
url: `/pages/integrated/repair/detail?id=${item.id}`
})
}
async function loadRepairList() {
try {
const response: any = await meetingRoomApi.getRepairList({
current: 1,
size: 20
})
if (response.code === 0 && response.data) {
repairList.value = response.data.records || []
}
} catch (error) {
console.error('加载维修记录失败:', error)
}
}
onMounted(() => {
loadRepairList()
})
</script>
<style lang="scss" scoped>
.repair-container {
padding: 24rpx;
background: #f5f5f5;
min-height: 100vh;
}
.repair-tabs {
display: flex;
background: #fff;
border-radius: 16rpx 16rpx 0 0;
overflow: hidden;
margin-bottom: 24rpx;
.tab {
flex: 1;
text-align: center;
padding: 28rpx 0;
font-size: 30rpx;
color: #888;
background: #f7f8fa;
&.active {
color: #1777FF;
background: #fff;
font-weight: bold;
border-bottom: 4rpx solid #1777FF;
}
}
}
.repair-form {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.form-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.form-item {
margin-bottom: 24rpx;
.label {
font-size: 28rpx;
color: #333;
margin-bottom: 12rpx;
}
.picker {
height: 80rpx;
line-height: 80rpx;
padding: 0 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
}
.location-input,
.equipment-input,
.phone-input {
height: 80rpx;
padding: 0 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
}
.description-textarea {
width: 100%;
height: 160rpx;
padding: 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
box-sizing: border-box;
}
.char-count {
text-align: right;
font-size: 24rpx;
color: #999;
margin-top: 8rpx;
}
}
.submit-btn {
width: 100%;
height: 88rpx;
background: #007aff;
color: #fff;
border-radius: 8rpx;
font-size: 32rpx;
&:disabled {
background: #ccc;
}
}
}
.repair-list {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.list-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.empty-tip {
text-align: center;
color: #999;
font-size: 28rpx;
padding: 60rpx 0;
}
.repair-item {
border-bottom: 1rpx solid #f0f0f0;
padding: 24rpx 0;
&:last-child {
border-bottom: none;
}
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
.type-tag {
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 24rpx;
&.type-electrical {
background: #fff3e0;
color: #f57c00;
}
&.type-network {
background: #e3f2fd;
color: #1976d2;
}
&.type-office {
background: #f3e5f5;
color: #7b1fa2;
}
&.type-ac {
background: #e8f5e8;
color: #388e3c;
}
&.type-other {
background: #f5f5f5;
color: #666;
}
}
.status-tag {
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 24rpx;
&.status-pending {
background: #fff3e0;
color: #f57c00;
}
&.status-processing {
background: #e8f5e8;
color: #388e3c;
}
&.status-completed {
background: #e3f2fd;
color: #1976d2;
}
&.status-cancelled {
background: #f5f5f5;
color: #999;
}
}
}
.item-content {
margin-bottom: 16rpx;
.equipment-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 8rpx;
.equipment-name {
font-size: 28rpx;
font-weight: bold;
color: #333;
}
.location {
font-size: 24rpx;
color: #666;
}
}
.description {
font-size: 26rpx;
color: #666;
line-height: 1.5;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
overflow: hidden;
}
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
.time {
font-size: 24rpx;
color: #999;
}
.urgency-tag {
font-size: 24rpx;
color: #d32f2f;
background: #ffebee;
padding: 4rpx 12rpx;
border-radius: 12rpx;
}
}
}
}
</style>
+236
View File
@@ -0,0 +1,236 @@
<template>
<view class="visitor-detail">
<view class="detail-header">
<view class="visitor-info">
<text class="visitor-name">{{ detail.visitorName }}</text>
<text class="visitor-phone">{{ detail.visitorPhone }}</text>
</view>
<view class="status-tag" :class="getStatusClass(detail.status)">{{ getStatusText(detail.status) }}</view>
</view>
<view class="detail-content">
<view class="info-row">
<text class="label">来访目的:</text>
<text class="value">{{ getPurposeLabel(detail.purpose) }}</text>
</view>
<view class="info-row">
<text class="label">被访人:</text>
<text class="value">{{ detail.hostName }}</text>
</view>
<view class="info-row">
<text class="label">来访时间:</text>
<text class="value">{{ formatVisitTime(detail.visitDate, detail.visitTime) }}</text>
</view>
<view v-if="detail.remark" class="info-row">
<text class="label">备注说明:</text>
<text class="value">{{ detail.remark }}</text>
</view>
</view>
<view v-if="detail.rejectReason" class="reject-section">
<view class="reject-title">拒绝原因</view>
<view class="reject-content">{{ detail.rejectReason }}</view>
</view>
<view class="detail-footer">
<text class="apply-time">申请时间:{{ formatTime(detail.createTime) }}</text>
</view>
</view>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import meetingRoomApi from '@/sheep/api/meetingRoom'
const detail = ref<any>({})
const purposeOptions = [
{ value: '1', label: '商务洽谈' },
{ value: '2', label: '技术交流' },
{ value: '3', label: '面试' },
{ value: '4', label: '参观访问' },
{ value: '5', label: '其他' }
]
const timeOptions = [
{ value: '1', label: '上午 (9:00-12:00)' },
{ value: '2', label: '下午 (14:00-18:00)' },
{ value: '3', label: '全天 (9:00-18:00)' }
]
function getPurposeLabel(purpose: string) {
const option = purposeOptions.find(item => item.value === purpose)
return option ? option.label : '其他'
}
function getStatusText(status: string) {
const statusMap: Record<string, string> = {
'1': '待审核',
'2': '已通过',
'3': '已拒绝',
'4': '已取消',
'5': '已完成'
}
return statusMap[status] || '未知'
}
function getStatusClass(status: string) {
const classMap: Record<string, string> = {
'1': 'status-pending',
'2': 'status-approved',
'3': 'status-rejected',
'4': 'status-cancelled',
'5': 'status-completed'
}
return classMap[status] || 'status-pending'
}
function formatVisitTime(date: string, time: string) {
const timeLabel = timeOptions.find(item => item.value === time)?.label || ''
return `${date} ${timeLabel}`
}
function formatTime(time: string) {
if (!time) return ''
return new Date(time).toLocaleString()
}
onLoad(async (options: any) => {
const id = options.id
if (!id) return
try {
const response: any = await meetingRoomApi.getVisitorDetail(id)
if (response.code === 0 && response.data) {
detail.value = response.data
}
} catch (error) {
console.error('获取访客详情失败:', error)
uni.showToast({ title: '获取详情失败', icon: 'none' })
}
})
</script>
<style lang="scss" scoped>
.visitor-detail {
padding: 32rpx;
background: #f5f5f5;
min-height: 100vh;
}
.detail-header {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
display: flex;
justify-content: space-between;
align-items: center;
.visitor-info {
.visitor-name {
font-size: 32rpx;
font-weight: bold;
color: #333;
margin-right: 16rpx;
}
.visitor-phone {
font-size: 26rpx;
color: #666;
}
}
.status-tag {
padding: 12rpx 24rpx;
border-radius: 24rpx;
font-size: 26rpx;
&.status-pending {
background: #fff3e0;
color: #f57c00;
}
&.status-approved {
background: #e8f5e8;
color: #388e3c;
}
&.status-rejected {
background: #ffebee;
color: #d32f2f;
}
&.status-cancelled {
background: #f5f5f5;
color: #999;
}
&.status-completed {
background: #e3f2fd;
color: #1976d2;
}
}
}
.detail-content {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.info-row {
display: flex;
margin-bottom: 16rpx;
&:last-child {
margin-bottom: 0;
}
.label {
font-size: 28rpx;
color: #666;
width: 160rpx;
flex-shrink: 0;
}
.value {
font-size: 28rpx;
color: #333;
flex: 1;
}
}
}
.reject-section {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.reject-title {
font-size: 30rpx;
font-weight: bold;
color: #d32f2f;
margin-bottom: 16rpx;
}
.reject-content {
font-size: 28rpx;
color: #666;
line-height: 1.6;
}
}
.detail-footer {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.apply-time {
font-size: 26rpx;
color: #999;
}
}
</style>
+438
View File
@@ -0,0 +1,438 @@
<template>
<view class="visitor-container">
<!-- 访客申请表单 -->
<view class="visitor-form">
<view class="form-title">访客申请</view>
<view class="form-item">
<view class="label">访客姓名</view>
<input v-model="visitorName" placeholder="请输入访客姓名" class="name-input" />
</view>
<view class="form-item">
<view class="label">访客手机号</view>
<input v-model="visitorPhone" placeholder="请输入访客手机号" class="phone-input" />
</view>
<view class="form-item">
<view class="label">来访目的</view>
<picker @change="onPurposeChange" :value="purposeIndex" :range="purposeOptions" range-key="label">
<view class="picker">{{ purposeOptions[purposeIndex].label }}</view>
</picker>
</view>
<view class="form-item">
<view class="label">来访时间</view>
<picker mode="date" @change="onDateChange" :value="visitDate">
<view class="picker">{{ visitDate || '请选择来访日期' }}</view>
</picker>
</view>
<view class="form-item">
<view class="label">来访时段</view>
<picker @change="onTimeChange" :value="timeIndex" :range="timeOptions" range-key="label">
<view class="picker">{{ timeOptions[timeIndex].label }}</view>
</picker>
</view>
<view class="form-item">
<view class="label">被访人</view>
<input v-model="hostName" placeholder="请输入被访人姓名" class="host-input" />
</view>
<view class="form-item">
<view class="label">备注说明</view>
<textarea
v-model="remark"
placeholder="请输入备注说明(选填)"
class="remark-textarea"
maxlength="200"
/>
<view class="char-count">{{ remark.length }}/200</view>
</view>
<button @click="submitVisitor" class="submit-btn" :disabled="!canSubmit">
提交申请
</button>
</view>
<!-- 访客记录列表 -->
<view class="visitor-list">
<view class="list-title">访客记录</view>
<view v-if="visitorList.length === 0" class="empty-tip">
暂无访客记录
</view>
<view v-else>
<view
v-for="item in visitorList"
:key="item.id"
class="visitor-item"
@click="viewDetail(item)"
>
<view class="item-header">
<view class="visitor-info">
<text class="visitor-name">{{ item.visitorName }}</text>
<text class="visitor-phone">{{ item.visitorPhone }}</text>
</view>
<view class="status-tag" :class="getStatusClass(item.status)">{{ getStatusText(item.status) }}</view>
</view>
<view class="item-content">
<view class="purpose">来访目的:{{ getPurposeLabel(item.purpose) }}</view>
<view class="host">被访人:{{ item.hostName }}</view>
<view class="time">来访时间:{{ formatVisitTime(item.visitDate, item.visitTime) }}</view>
</view>
<view class="item-footer">
<text class="apply-time">申请时间:{{ formatTime(item.createTime) }}</text>
<text v-if="item.remark" class="has-remark">有备注</text>
</view>
</view>
</view>
</view>
</view>
</template>
<script setup lang="ts">
import { ref, computed, onMounted } from 'vue'
import meetingRoomApi from '@/sheep/api/meetingRoom'
const purposeOptions = [
{ value: '1', label: '商务洽谈' },
{ value: '2', label: '技术交流' },
{ value: '3', label: '面试' },
{ value: '4', label: '参观访问' },
{ value: '5', label: '其他' }
]
const timeOptions = [
{ value: '1', label: '上午 (9:00-12:00)' },
{ value: '2', label: '下午 (14:00-18:00)' },
{ value: '3', label: '全天 (9:00-18:00)' }
]
const visitorName = ref('')
const visitorPhone = ref('')
const purposeIndex = ref(0)
const visitDate = ref('')
const timeIndex = ref(0)
const hostName = ref('')
const remark = ref('')
const visitorList = ref<any[]>([])
const canSubmit = computed(() => {
return visitorName.value.trim() &&
visitorPhone.value.trim() &&
visitDate.value &&
hostName.value.trim()
})
function onPurposeChange(e: any) {
purposeIndex.value = e.detail.value
}
function onDateChange(e: any) {
visitDate.value = e.detail.value
}
function onTimeChange(e: any) {
timeIndex.value = e.detail.value
}
function getPurposeLabel(purpose: string) {
const option = purposeOptions.find(item => item.value === purpose)
return option ? option.label : '其他'
}
function getStatusText(status: string) {
const statusMap: Record<string, string> = {
'1': '待审核',
'2': '已通过',
'3': '已拒绝',
'4': '已取消',
'5': '已完成'
}
return statusMap[status] || '未知'
}
function getStatusClass(status: string) {
const classMap: Record<string, string> = {
'1': 'status-pending',
'2': 'status-approved',
'3': 'status-rejected',
'4': 'status-cancelled',
'5': 'status-completed'
}
return classMap[status] || 'status-pending'
}
function formatVisitTime(date: string, time: string) {
const timeLabel = timeOptions.find(item => item.value === time)?.label || ''
return `${date} ${timeLabel}`
}
function formatTime(time: string) {
if (!time) return ''
return new Date(time).toLocaleDateString()
}
async function submitVisitor() {
if (!canSubmit.value) {
uni.showToast({ title: '请填写完整信息', icon: 'none' })
return
}
// 验证手机号格式
const phoneRegex = /^1[3-9]\d{9}$/
if (!phoneRegex.test(visitorPhone.value)) {
uni.showToast({ title: '请输入正确的手机号', icon: 'none' })
return
}
try {
uni.showLoading({ title: '提交中...' })
const data = {
visitorName: visitorName.value.trim(),
visitorPhone: visitorPhone.value.trim(),
purpose: purposeOptions[purposeIndex.value].value,
visitDate: visitDate.value,
visitTime: timeOptions[timeIndex.value].value,
hostName: hostName.value.trim(),
remark: remark.value.trim()
}
const response: any = await meetingRoomApi.submitVisitor(data)
uni.hideLoading()
if (response.code === 0) {
uni.showToast({ title: '提交成功', icon: 'success' })
// 清空表单
visitorName.value = ''
visitorPhone.value = ''
purposeIndex.value = 0
visitDate.value = ''
timeIndex.value = 0
hostName.value = ''
remark.value = ''
// 刷新列表
loadVisitorList()
} else {
uni.showToast({ title: response.msg || '提交失败', icon: 'none' })
}
} catch (error) {
uni.hideLoading()
uni.showToast({ title: '提交失败', icon: 'none' })
}
}
function viewDetail(item: any) {
uni.navigateTo({
url: `/pages/integrated/visitor/detail?id=${item.id}`
})
}
async function loadVisitorList() {
try {
const response: any = await meetingRoomApi.getVisitorList({
current: 1,
size: 20
})
if (response.code === 0 && response.data) {
visitorList.value = response.data.records || []
}
} catch (error) {
console.error('加载访客记录失败:', error)
}
}
onMounted(() => {
loadVisitorList()
})
</script>
<style lang="scss" scoped>
.visitor-container {
padding: 24rpx;
background: #f5f5f5;
min-height: 100vh;
}
.visitor-form {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
margin-bottom: 24rpx;
.form-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.form-item {
margin-bottom: 24rpx;
.label {
font-size: 28rpx;
color: #333;
margin-bottom: 12rpx;
}
.picker {
height: 80rpx;
line-height: 80rpx;
padding: 0 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
}
.name-input,
.phone-input,
.host-input {
height: 80rpx;
padding: 0 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
}
.remark-textarea {
width: 100%;
height: 120rpx;
padding: 24rpx;
background: #f7f8fa;
border-radius: 8rpx;
font-size: 28rpx;
box-sizing: border-box;
}
.char-count {
text-align: right;
font-size: 24rpx;
color: #999;
margin-top: 8rpx;
}
}
.submit-btn {
width: 100%;
height: 88rpx;
background: #007aff;
color: #fff;
border-radius: 8rpx;
font-size: 32rpx;
&:disabled {
background: #ccc;
}
}
}
.visitor-list {
background: #fff;
border-radius: 16rpx;
padding: 32rpx;
.list-title {
font-size: 32rpx;
font-weight: bold;
margin-bottom: 24rpx;
}
.empty-tip {
text-align: center;
color: #999;
font-size: 28rpx;
padding: 60rpx 0;
}
.visitor-item {
border-bottom: 1rpx solid #f0f0f0;
padding: 24rpx 0;
&:last-child {
border-bottom: none;
}
.item-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 16rpx;
.visitor-info {
.visitor-name {
font-size: 30rpx;
font-weight: bold;
color: #333;
margin-right: 16rpx;
}
.visitor-phone {
font-size: 26rpx;
color: #666;
}
}
.status-tag {
padding: 8rpx 16rpx;
border-radius: 20rpx;
font-size: 24rpx;
&.status-pending {
background: #fff3e0;
color: #f57c00;
}
&.status-approved {
background: #e8f5e8;
color: #388e3c;
}
&.status-rejected {
background: #ffebee;
color: #d32f2f;
}
&.status-cancelled {
background: #f5f5f5;
color: #999;
}
&.status-completed {
background: #e3f2fd;
color: #1976d2;
}
}
}
.item-content {
margin-bottom: 16rpx;
.purpose,
.host,
.time {
font-size: 26rpx;
color: #666;
margin-bottom: 8rpx;
line-height: 1.4;
}
}
.item-footer {
display: flex;
justify-content: space-between;
align-items: center;
.apply-time {
font-size: 24rpx;
color: #999;
}
.has-remark {
font-size: 24rpx;
color: #007aff;
background: #e3f2fd;
padding: 4rpx 12rpx;
border-radius: 12rpx;
}
}
}
}
</style>
+151
View File
@@ -56,4 +56,155 @@ export default {
url: `/integrated/meetingRoom/app/booking-detail/${id}`,
method: 'GET',
}),
// ========== 意见反馈相关接口 ==========
/**
* 提交意见反馈
*/
submitFeedback: (data: {
title: string;
description: string;
picUrl?: string;
type: string;
contact?: string;
}) =>
request({
url: '/integrated/feedback/app/save',
method: 'POST',
data,
}),
/**
* 获取我的反馈列表
*/
getFeedbackList: (params: { current: number; size: number }) =>
request({
url: '/integrated/feedback/app/page',
method: 'GET',
params,
}),
/**
* 获取反馈详情
*/
getFeedbackDetail: (id: string) =>
request({
url: '/integrated/feedback/app/getDetails',
method: 'GET',
params: { id },
}),
/**
* 获取反馈类型字典
*/
getFeedbackType: () =>
request({
url: '/integrated/feedback/app/getFeedbackType',
method: 'GET',
}),
// ========== 维修上报相关接口 ==========
/**
* 提交维修申请
*/
submitRepair: (data: {
title: string;
picUrl?: string;
description: string;
dateFound: string;
location: string;
urgency: string;
maintainType: number;
}) =>
request({
url: '/integrated/maintenanceOrder/app/apply',
method: 'POST',
data,
}),
/**
* 获取我的维修记录列表
*/
getRepairList: (params: { current: number; size: number }) =>
request({
url: '/integrated/maintenanceOrder/app/my',
method: 'GET',
params,
}),
/**
* 获取维修详情
*/
getRepairDetail: (id: string | number) =>
request({
url: `/integrated/maintenanceOrder/app/my/${id}`,
method: 'GET',
}),
// ========== 通知公告相关接口 ==========
/**
* 获取公告列表
*/
getNoticeList: (params: { current: number; size: number; type?: string }) =>
request({
url: '/integrated/notice/list',
method: 'GET',
params,
}),
/**
* 获取公告详情
*/
getNoticeDetail: (id: string) =>
request({
url: `/integrated/notice/detail/${id}`,
method: 'GET',
}),
/**
* 标记公告已读
*/
markNoticeRead: (id: string) =>
request({
url: `/integrated/notice/read/${id}`,
method: 'POST',
}),
// ========== 访客管理相关接口 ==========
/**
* 提交访客申请
*/
submitVisitor: (data: {
visitorName: string;
visitorPhone: string;
purpose: string;
visitDate: string;
visitTime: string;
hostName: string;
remark?: string;
}) =>
request({
url: '/integrated/visitor/submit',
method: 'POST',
data,
}),
/**
* 获取访客记录列表
*/
getVisitorList: (params: { current: number; size: number }) =>
request({
url: '/integrated/visitor/my-list',
method: 'GET',
params,
}),
/**
* 获取访客详情
*/
getVisitorDetail: (id: string) =>
request({
url: `/integrated/visitor/detail/${id}`,
method: 'GET',
}),
}