zhgdyunapp/pages/messageCenter/messageCenter.vue

278 lines
6.7 KiB
Vue
Raw Normal View History

2022-06-08 15:48:09 +08:00
<template>
<view>
2024-05-05 14:10:07 +08:00
<headers :showBack="false">
2022-06-08 15:48:09 +08:00
<view class="headerName">
消息中心
</view>
</headers>
2024-05-05 14:10:07 +08:00
<view class="tab flex2">
2024-05-06 09:10:40 +08:00
<view class="tabType" @click="changeTab(0)" :class="checkedTab==0?'checkedTab':'noCheckTab'">全部</view>
<view class="tabType" @click="changeTab(2)" :class="checkedTab==2?'checkedTab':'noCheckTab'">质量</view>
<view class="tabType" @click="changeTab(3)" :class="checkedTab==3?'checkedTab':'noCheckTab'">安全</view>
<view class="tabType" @click="changeTab(4)" :class="checkedTab==4?'checkedTab':'noCheckTab'">AI</view>
2024-05-05 14:10:07 +08:00
</view>
2022-06-08 15:48:09 +08:00
<view class="centerContent">
<view class="uni-form-item">
<input class="uni-input" name="searchName" v-model="searchName" @input="searchFile"
2024-05-09 20:29:41 +08:00
placeholder="请输入标题" />
2023-03-20 18:43:57 +08:00
<!-- <uni-icons class="search-icon" type="search" @click="loadData"></uni-icons> -->
2024-05-06 09:10:40 +08:00
<button class="mini-btn" type="primary" size="mini" @click="loadData">搜索</button>
2022-06-08 15:48:09 +08:00
</view>
<view v-if="centerContentList.length > 0" class="centerContentBox">
2024-05-06 09:10:40 +08:00
<view v-for="(item,index) in centerContentList" :key="index" class="centerContent_item"
@click="goList(item)">
2022-06-08 15:48:09 +08:00
<view class="itemImgBox">
2024-05-06 09:10:40 +08:00
<image v-if="item.imageUrl" @click.stop="previewImg(item.imageUrl)" :src="item.imageUrl"
class="itemImg"></image>
2022-06-08 15:48:09 +08:00
</view>
<view class="itemBox">
<view class="title">标题{{ item.title }}</view>
<view class="content">内容{{ item.msg }}</view>
2022-06-08 15:48:09 +08:00
<view class="time">发送时间{{item.sendTime}}</view>
</view>
</view>
</view>
<view class="placeholderBox" v-else>
<image src="/static/noData.png" class="noDataImg"></image>
<view class="text">
暂无数据
</view>
</view>
</view>
2024-05-05 14:10:07 +08:00
<footers :activeTab="'mssage'" v-if="accountType == 5 || accountType == 6 || accountType == 10"></footers>
2022-06-08 15:48:09 +08:00
</view>
</template>
<script>
import headers from '../../components/headers/headers.vue'
2024-05-05 14:10:07 +08:00
import footers from '../../components/footers/footers.vue'
2022-06-08 15:48:09 +08:00
export default {
components: {
headers
},
data() {
return {
2024-05-05 14:10:07 +08:00
checkedTab: 0,
accountType: 1,
2022-06-08 15:48:09 +08:00
searchName: '',
centerContentList: ''
}
},
mounted() {
console.log(JSON.parse(uni.getStorageSync('userInfo')).userId)
this.loadData()
},
2024-05-05 14:10:07 +08:00
onLoad() {
var userInfo = JSON.parse(uni.getStorageSync('userInfo'))
this.accountType = userInfo.accountType
},
2022-06-08 15:48:09 +08:00
methods: {
2024-05-07 22:58:01 +08:00
//去指定页
2024-05-06 09:10:40 +08:00
goList(obj) {
2024-05-07 22:58:01 +08:00
let payLoadParams = eval("(" + obj.payload + ")")
console.log(payLoadParams)
if (obj.type == 10) { // 安全
this.sendRequest({
url: "xmgl/xzSecurityQualityInspectionRecord/selectQualityInspectionRecordById",
data: {
id: payLoadParams.data.id
},
method: "POST",
success(res) {
2024-05-09 00:59:04 +08:00
if (!res.result || res.result.status == 6) {
2024-05-07 22:58:01 +08:00
uni.showToast({
2024-05-09 00:59:04 +08:00
title: '检查单已撤回',
2024-05-07 22:58:01 +08:00
icon: "none"
})
return;
}
uni.navigateTo({
url: '/pages/projectEnd/safeSame/details?id=' + payLoadParams.data.id + '&type=' +
payLoadParams.data.status
})
}
2024-05-06 09:10:40 +08:00
})
2024-05-07 22:58:01 +08:00
} else if (obj.type == 11) { // 质量
this.sendRequest({
url: "xmgl/qualityInspectionRecord/selectQualityInspectionRecordById",
data: {
id: payLoadParams.data.id
},
method: "POST",
success(res) {
console.log(res)
2024-05-09 00:59:04 +08:00
if (!res.result || res.result.status == 6) {
2024-05-07 22:58:01 +08:00
uni.showToast({
2024-05-09 00:59:04 +08:00
title: '检查单已撤回',
2024-05-07 22:58:01 +08:00
icon: "none"
})
return;
}
uni.navigateTo({
url: '/pages/projectEnd/qualityManage/details?id=' + payLoadParams.data.id + '&type=' +
payLoadParams.data.status
})
}
2024-05-06 09:10:40 +08:00
})
2024-05-07 22:58:01 +08:00
} else if (obj.type == 8) { // AI
2024-05-06 09:10:40 +08:00
uni.navigateTo({
2024-05-07 22:58:01 +08:00
url: "/pages/alarmPage/disposition/disposition?item=" + encodeURIComponent(JSON.stringify(
payLoadParams.data))
});
2024-05-06 09:10:40 +08:00
}
2024-05-07 22:58:01 +08:00
// if (obj.type == 11) {
// uni.navigateTo({
// url: '/pages/projectEnd/qualityManage/list?type=1'
// })
// } else if (obj.type == 10) {
// uni.navigateTo({
// url: '/pages/projectEnd/safeSame/list?type=1'
// })
// } else if (obj.type == 8) {
// uni.navigateTo({
// url: '/pages/alarmPage/indexTwo'
// })
// }
2024-05-06 09:10:40 +08:00
},
2024-05-05 14:10:07 +08:00
//切换tab
changeTab(type) {
2024-05-06 09:10:40 +08:00
this.checkedTab = type;
this.loadData()
2024-05-05 14:10:07 +08:00
},
2024-05-06 09:10:40 +08:00
previewImg(imgUrl) {
2022-06-08 15:48:09 +08:00
console.log(imgUrl)
2024-05-06 09:10:40 +08:00
//urls为数组数据里有多少图片链接则显示多少张若只想预览一张的话直接传只有一个图片地址的数组即可
let imgurl = imgUrl
let imgArr = []
2022-06-08 15:48:09 +08:00
imgArr[0] = imgurl
uni.previewImage({
2024-05-06 09:10:40 +08:00
current: 0,
2022-06-08 15:48:09 +08:00
urls: imgArr
})
},
searchFile(e) {
this.searchName = e.detail.value
},
loadData() {
var json = {
accountId: JSON.parse(uni.getStorageSync('userInfo')).userId,
pageNo: 1,
title: this.searchName,
pageSize: 100
}
2024-05-06 09:10:40 +08:00
if (this.checkedTab == 2) {
json.type = 11
} else if (this.checkedTab == 3) {
json.type = 10
} else if (this.checkedTab == 4) {
json.type = 8
}
2022-06-08 15:48:09 +08:00
var that = this
this.sendRequest({
url: "xmgl/notice/list",
data: json,
method: "POST",
success(res) {
that.centerContentList = res.result.records
2024-05-06 09:10:40 +08:00
console.log('res.result.records', res.result.records)
2022-06-08 15:48:09 +08:00
}
})
},
}
}
</script>
<style lang="scss" scoped>
2024-05-05 14:10:07 +08:00
.flex2 {
2024-05-06 09:10:40 +08:00
display: flex;
align-items: center;
justify-content: space-between;
2024-05-05 14:10:07 +08:00
}
2024-05-06 09:10:40 +08:00
2024-05-05 14:10:07 +08:00
.tab {
2024-05-06 09:10:40 +08:00
width: 100%;
height: 45px;
text-align: center;
box-shadow: 0 0 10px rgba(194, 194, 194, 0.5);
.tabType {
width: 33%;
line-height: 43px;
border-bottom: 1px solid rgba(194, 194, 194, 0.2);
}
.checkedTab {
color: #4181FE;
border-bottom: 2px solid #4181FE;
}
.noCheckTab {
padding-bottom: 2px;
}
2024-05-05 14:10:07 +08:00
}
2024-05-06 09:10:40 +08:00
.centerContentBox {
2022-06-08 15:48:09 +08:00
border-top: 1px solid rgba(221, 221, 221, 0.8);
}
2024-05-06 09:10:40 +08:00
.centerContent_item {
2022-06-08 15:48:09 +08:00
border-bottom: 1px solid rgba(221, 221, 221, 0.8);
display: flex;
align-items: center;
min-height: 100px;
padding: 20rpx 40rpx;
font-size: 15px;
box-sizing: border-box;
2024-05-06 09:10:40 +08:00
.itemBox {
.content {
2022-06-08 15:48:09 +08:00
margin-top: 3px;
}
2024-05-06 09:10:40 +08:00
.time {
2022-06-08 15:48:09 +08:00
margin-top: 3px;
}
}
}
2024-05-06 09:10:40 +08:00
.itemImgBox {
2022-06-08 15:48:09 +08:00
margin-right: 10px;
2024-05-06 09:10:40 +08:00
.itemImg {
2022-06-08 15:48:09 +08:00
width: 60px;
height: 60px;
}
}
2024-05-06 09:10:40 +08:00
2022-06-08 15:48:09 +08:00
.uni-form-item {
position: relative;
.search-icon {
position: absolute;
top: 50%;
right: 50rpx;
transform: translateY(-50%);
}
}
.uni-input {
border-radius: 15px;
2023-03-20 18:43:57 +08:00
margin: 10px 10px;
2022-06-08 15:48:09 +08:00
background-color: #f2f2f2;
height: 30px;
line-height: 30px;
padding: 0 20px;
font-size: 14px;
2023-03-20 18:43:57 +08:00
width: 65%;
}
2024-05-06 09:10:40 +08:00
.mini-btn {
2023-03-20 18:43:57 +08:00
position: absolute;
2024-05-06 09:10:40 +08:00
right: 6px;
top: 0px;
border-radius: 15px;
height: 30px;
line-height: 30px;
2022-06-08 15:48:09 +08:00
}
2024-05-06 09:10:40 +08:00
</style>