Browse Source

Merge branch '815' into dev

# Conflicts:
#	pages/tabBar/work/index.vue
dev
wangyx 1 week ago
parent
commit
57d8f627da
  1. 17
      pages/api.js
  2. 367
      pages/tabBar/msg/index.vue
  3. 18
      pages/tabBar/work/index.vue
  4. 134
      pagesA/bsPage/bsReport.vue
  5. BIN
      static/img/icon01.png

17
pages/api.js

@ -262,3 +262,20 @@ export function getViewingCount() {
method: "get",
});
}
// 问题反馈
export function submitReport(data) {
return request({
url: "/bysmp/incidents/workSubmit",
method: "post",
data: data,
});
}
// 消息提醒
export function messageList(query) {
return request({
url: "/message/page",
method: "get",
params: query,
});
}

367
pages/tabBar/msg/index.vue

@ -1,35 +1,392 @@
<template>
<view class="content">
<view>暂无数据</view>
<!-- 下拉刷新容器 -->
<scroll-view
class="scroll-container"
scroll-y="true"
refresher-enabled="true"
:refresher-triggered="refreshing"
@refresherrefresh="onRefresh"
@scrolltolower="onLoadMore"
:style="{ height: 'calc(100vh - 0rpx)' }"
>
<!-- 提醒列表 -->
<view class="reminder-list">
<!-- 空状态 -->
<view v-if="reminderList.length === 0 && !loading" class="empty-state">
<text class="empty-icon">📭</text>
<text class="empty-text">暂无消息提醒</text>
</view>
<!-- 提醒项目列表 -->
<view
v-for="(item, index) in reminderList"
:key="index"
class="reminder-item"
@click="handleItemClick(item)"
>
<!-- 左侧图标 -->
<view class="icon-container">
<view class="bell-icon">
<u-icon
name="/static/img/icon01.png"
size="20"
color="#08B3B3"
></u-icon>
<view v-if="item.hasUnread" class="unread-dot"></view>
</view>
</view>
<!-- 右侧内容 -->
<view class="content-container">
<view class="header">
<text class="title">{{ item.title }}</text>
<text class="time">{{ item.createTime }}</text>
</view>
<view class="description">{{ item.content }}</view>
</view>
</view>
</view>
<!-- 加载更多提示 -->
<view v-if="loading" class="loading-more">
<text>加载中...</text>
</view>
<!-- 没有更多数据提示 -->
<view v-if="noMore && reminderList.length > 0" class="no-more">
<text>没有更多数据了</text>
</view>
</scroll-view>
</view>
</template>
<script>
import { messageList } from "@/pages/api";
import { getReminderList, markReminderRead } from "@/common/api.js";
export default {
data() {
return {
tabValue: 1,
}
refreshing: false,
loading: false,
noMore: false,
pageNum: 1,
pageSize: 10,
unreadCount: 0,
reminderList: [],
};
},
onLoad() {
this.loadReminderList();
},
onShow() {
//
this.refreshData();
},
computed: {
//
unreadCount() {
return this.reminderList.filter((item) => item.hasUnread).length;
},
},
methods: {
onChange(name) {
this.tabValue = name;
console.log(name);
},
//
refreshData() {
this.pageNum = 1;
this.noMore = false;
this.loadReminderList(true);
},
//
async loadReminderList(isRefresh = false) {
if (this.loading) return;
this.loading = true;
try {
// API
const res = await messageList({
pageNum: this.pageNum,
pageSize: this.pageSize,
});
if (res.code === 200) {
const data = res.data.records || [];
if (isRefresh) {
this.reminderList = data;
this.pageNum = 1;
} else {
this.reminderList = [...this.reminderList, ...data];
}
//
if (data.length < this.pageSize) {
this.noMore = true;
}
}
} catch (error) {
console.error("加载提醒列表失败:", error);
} finally {
this.loading = false;
this.refreshing = false;
}
},
//
async onRefresh() {
this.pageNum = 1;
this.refreshing = true;
this.noMore = false;
await this.loadReminderList(true);
},
//
async onLoadMore() {
if (this.noMore || this.loading) return;
this.pageNum++;
await this.loadReminderList();
},
//
async handleItemClick(item) {
console.log("点击提醒项目:", item);
try {
// API
if (item.hasUnread) {
await markReminderRead(item.id);
item.hasUnread = false;
}
} catch (error) {
console.error("标记已读失败:", error);
// 使API
item.hasUnread = false;
}
//
switch (item.type) {
case "appointment":
uni.navigateTo({
url: "/pagesA/bsPage/bsHandle",
});
break;
case "feedback":
uni.navigateTo({
url: "/pagesA/bxPage/bxHandle",
});
break;
case "checkout":
uni.navigateTo({
url: "/pagesA/checkout/list",
});
break;
case "release":
uni.navigateTo({
url: "/pagesA/release/list",
});
break;
case "water":
uni.navigateTo({
url: "/pagesA/sdPage/sfReport",
});
break;
default:
break;
}
},
//
formatTime(time) {
const now = new Date();
const targetTime = new Date(time);
const diff = now - targetTime;
const oneDay = 24 * 60 * 60 * 1000;
if (diff < oneDay && targetTime.toDateString() === now.toDateString()) {
return "今天";
} else {
return targetTime
.toLocaleString("zh-CN", {
year: "numeric",
month: "2-digit",
day: "2-digit",
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
})
.replace(/\//g, "-");
}
},
},
};
</script>
<style lang="scss" scoped>
.content {
width: 100%;
height: 100vh;
background-color: #f5f5f5;
}
.pageNum-header {
background-color: #fff;
padding: 20rpx 30rpx;
border-bottom: 1rpx solid #eee;
position: sticky;
top: 0;
z-index: 100;
position: relative;
}
.pageNum-title {
font-size: 32rpx;
font-weight: bold;
color: #333;
}
.unread-badge {
position: absolute;
top: 10rpx;
right: 30rpx;
background-color: #f44336;
color: #fff;
font-size: 20rpx;
padding: 4rpx 12rpx;
border-radius: 20rpx;
min-width: 32rpx;
text-align: center;
}
.scroll-container {
width: 100%;
}
.reminder-list {
padding: 20rpx;
box-sizing: border-box;
background-color: #fff;
border-radius: 16rpx;
margin: 20rpx;
box-shadow: 0 2rpx 8rpx rgba(0, 0, 0, 0.05);
}
.reminder-item {
display: flex;
align-items: flex-start;
padding: 24rpx;
background-color: transparent;
border-bottom: 1rpx solid #f0f0f0;
}
.reminder-item:last-child {
border-bottom: none;
}
.reminder-item-line {
height: 1rpx;
background-color: #f0f0f0;
width: 80%;
}
.reminder-item:active {
transform: scale(0.98);
box-shadow: 0 1rpx 4rpx rgba(0, 0, 0, 0.1);
}
.icon-container {
margin-right: 20rpx;
flex-shrink: 0;
}
.bell-icon {
position: relative;
width: 48rpx;
height: 48rpx;
display: flex;
align-items: center;
justify-content: center;
}
.bell-icon text {
color: #fff;
font-size: 24rpx;
}
.unread-dot {
position: absolute;
top: -4rpx;
right: -4rpx;
width: 16rpx;
height: 16rpx;
background-color: #f44336;
border-radius: 50%;
border: 2rpx solid #fff;
}
.content-container {
flex: 1;
min-width: 0;
}
.header {
display: flex;
justify-content: space-between;
align-items: flex-start;
margin-bottom: 12rpx;
}
.title {
font-size: 32rpx;
font-weight: bold;
color: #333;
flex: 1;
margin-right: 16rpx;
}
.time {
font-size: 24rpx;
color: #bfbfbf;
flex-shrink: 0;
}
.description {
font-size: 28rpx;
color: #999;
line-height: 1.5;
}
.loading-more,
.no-more {
text-align: center;
padding: 30rpx;
color: #999;
font-size: 26rpx;
}
.empty-state {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100%;
height: 100vh;
padding: 100rpx 30rpx;
color: #999;
}
.empty-icon {
font-size: 80rpx;
margin-bottom: 20rpx;
}
.empty-text {
font-size: 28rpx;
color: #999;
}
</style>

18
pages/tabBar/work/index.vue

@ -61,7 +61,7 @@
</view>
</view>
<view class="conItem" v-if="showBx">
<!-- <view class="conItem" v-if="showBx">
<view class="conItem-title">报修</view>
<view class="conItem-cont">
<view
@ -74,10 +74,10 @@
<text class="itemText">{{ item.text }}</text>
</view>
</view>
</view>
</view> -->
<view class="conItem" v-if="showBs">
<view class="conItem-title">报事</view>
<view class="conItem-title">问题反馈</view>
<view class="conItem-cont">
<view
class="conItem-cont-item"
@ -119,13 +119,13 @@ export default {
{ image: "/static/img/水费.png", text: "水量上报" },
{ image: "/static/img/电费.png", text: "电量上报" },
],
bxList: [
// { image: '/static/img/.png', text: '' },
{ image: '/static/img/处理.png', text: '处理' },
],
// bxList: [
// // { image: '/static/img/.png', text: '' },
// { image: '/static/img/.png', text: '' },
// ],
bsList: [
// { image: '/static/img/.png', text: '' },
{ image: '/static/img/处理.png', text: '处理' },
{ image: '/static/img/上报.png', text: '问题上报' },
{ image: '/static/img/处理.png', text: '问题处理' },
],
};
},

134
pagesA/bsPage/bsReport.vue

@ -5,7 +5,7 @@
<view class="conHead">
<u-cell-group :border="false">
<u-cell
title="反馈类型"
title="问题类型"
:isLink="true"
:border="false"
:value="form.feedbackTypeName"
@ -26,7 +26,7 @@
labelPosition="top"
>
<u--textarea
v-model="form.content"
v-model="form.faultDescribe"
placeholder="请输入内容"
border="none"
height="300rpx"
@ -69,7 +69,16 @@
</u-form-item>
</u-form>
</view>
<!-- 位置 输入-->
<view class="location">
<view class="location-title">位置</view>
<u-input
border="none"
inputAlign="right"
v-model="form.position"
placeholder="请输入位置"
/>
</view>
<view class="btn" @click="handleBtn">提交</view>
<u-action-sheet
@ -84,27 +93,24 @@
</template>
<script>
import { addFeedback } from "@/common/api";
import { uploadImage } from "@/pages/api";
import { mapState } from "vuex";
import { uploadImage, submitReport } from "@/pages/api";
export default {
data() {
return {
wtlxShow: false,
feedbackTypeList: [
{ dictValue: "1", name: "安全问题" },
{ dictValue: "2", name: "卫生问题" },
{ dictValue: "3", name: "服务问题" },
{ dictValue: "4", name: "噪音问题" },
{ dictValue: "5", name: "体验问题" },
{ dictValue: "6", name: "其他" },
{ dictValue: "1", name: "报修" },
{ dictValue: "2", name: "报事" },
{ dictValue: "3", name: "投诉" },
{ dictValue: "4", name: "建议" },
{ dictValue: "5", name: "其他" },
],
form: {
feedbackType: "",
feedbackTypeName: "",
content: "",
imageList: [],
faultDescribe: "",
images: [],
position: "",
},
fileList: [],
};
@ -115,9 +121,7 @@ export default {
this.$store.dispatch("user/setUserInfo", userInfo);
}
},
computed: {
...mapState("user", ["userInfo"]),
},
computed: {},
methods: {
chooseMedia() {
uni.chooseMedia({
@ -157,8 +161,8 @@ export default {
status: "success",
});
}
// form.imageList
this.form.imageList = this.fileList.map((v) => ({
// form.images
this.form.images = this.fileList.map((v) => ({
name: v.name || "",
format: v.type,
url: v.url,
@ -191,7 +195,7 @@ export default {
url: v.url,
});
});
this.form.imageList = arry;
this.form.images = arry;
},
handleBtn() {
@ -202,46 +206,49 @@ export default {
title: "请选择反馈类型",
});
return;
} else if (!this.form.content) {
} else if (!this.form.faultDescribe) {
uni.showToast({
icon: "none",
title: "请输入问题描述",
});
return;
}
let parmas = JSON.parse(JSON.stringify(this.form));
let parmas = {
...JSON.parse(JSON.stringify(this.form)),
identity: 2,
};
delete parmas.feedbackTypeName;
// addFeedback(parmas).then((res) => {
// if (res.code == 200) {
// uni.showToast({
// icon: "success",
// title: "!",
// success: () => {
// setTimeout(() => {
// uni.switchTab({
// url: "/pages/tabBar/work/index",
// success: () => {
// this.fileList = [];
// this.form = {
// feedbackType: "",
// feedbackTypeName: "",
// content: "",
// imageList: [],
// };
// },
// });
// }, 1500);
// },
// });
// } else {
// uni.showToast({
// title: res.msg || "",
// icon: "none",
// });
// }
// });
submitReport(parmas).then((res) => {
if (res.code == 200) {
uni.showToast({
icon: "success",
title: "提交成功!",
success: () => {
setTimeout(() => {
uni.switchTab({
url: "/pages/tabBar/work/index",
success: () => {
this.fileList = [];
this.form = {
feedbackType: "",
feedbackTypeName: "",
faultDescribe: "",
images: [],
position: "",
};
},
});
}, 1500);
},
});
} else {
uni.showToast({
title: res.msg || "提交失败",
icon: "none",
});
}
});
},
handleFeedbackSelect(e) {
@ -326,7 +333,7 @@ export default {
text-align: center;
margin: auto;
margin-top: 40rpx;
bottom: -120rpx;
bottom: -80rpx;
position: relative;
z-index: 1;
}
@ -378,6 +385,25 @@ export default {
margin-right: 16rpx;
margin-bottom: 16rpx;
}
.location {
display: flex;
width: calc(100% - 40rpx);
margin-left: 20rpx;
border-radius: 20rpx;
background: #fff;
padding: 20rpx 20rpx;
margin-top: 20rpx;
box-sizing: border-box;
position: relative;
z-index: 1;
align-items: center;
}
.location-title {
font-size: 28rpx;
color: #333;
margin-left: 20rpx;
margin-top: 20rpx;
}
</style>
<style lang="scss">

BIN
static/img/icon01.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

Loading…
Cancel
Save