zhgdyunapp/pages/messageCenter/messageCenter.vue

138 lines
3.1 KiB
Vue
Raw Normal View History

2022-06-08 15:48:09 +08:00
<template>
<view>
<headers :showBack="true">
<view class="headerName">
消息中心
</view>
</headers>
<view class="centerContent">
<view class="uni-form-item">
<input class="uni-input" name="searchName" v-model="searchName" @input="searchFile"
placeholder="请输入搜索内容" />
<uni-icons class="search-icon" type="search" @click="loadData"></uni-icons>
</view>
<view v-if="centerContentList.length > 0" class="centerContentBox">
<view v-for="(item,index) in centerContentList" :key="index" class="centerContent_item">
<view class="itemImgBox">
<image v-if="item.imageUrl" @click="previewImg(item.imageUrl)" :src="item.imageUrl" class="itemImg"></image>
</view>
<view class="itemBox">
<view class="title">标题{{ item.title }}</view>
<view class="content">内容{{ item.msg }}</view>
<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>
</view>
</template>
<script>
import headers from '../../components/headers/headers.vue'
export default {
components: {
headers
},
data() {
return {
searchName: '',
centerContentList: ''
}
},
mounted() {
console.log(JSON.parse(uni.getStorageSync('userInfo')).userId)
this.loadData()
},
methods: {
previewImg(imgUrl){
console.log(imgUrl)
//urls为数组数据里有多少图片链接则显示多少张若只想预览一张的话直接传只有一个图片地址的数组即可
let imgurl=imgUrl
let imgArr=[]
imgArr[0] = imgurl
uni.previewImage({
current:0,
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
}
var that = this
this.sendRequest({
url: "xmgl/notice/list",
data: json,
method: "POST",
success(res) {
that.centerContentList = res.result.records
console.log(res.result.records)
}
})
},
}
}
</script>
<style lang="scss" scoped>
.centerContentBox{
border-top: 1px solid rgba(221, 221, 221, 0.8);
}
.centerContent_item{
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;
.itemBox{
.content{
margin-top: 3px;
}
.time{
margin-top: 3px;
}
}
}
.itemImgBox{
margin-right: 10px;
.itemImg{
width: 60px;
height: 60px;
}
}
.uni-form-item {
position: relative;
.search-icon {
position: absolute;
top: 50%;
right: 50rpx;
transform: translateY(-50%);
}
}
.uni-input {
border-radius: 15px;
margin: 10px 20px;
background-color: #f2f2f2;
height: 30px;
line-height: 30px;
padding: 0 20px;
font-size: 14px;
}
</style>