148 lines
3.3 KiB
Vue
148 lines
3.3 KiB
Vue
<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"
|
||
placeholder="请输入搜索内容" />
|
||
<!-- <uni-icons2 class="search-icon" type="search" @click="loadData"></uni-icons2> -->
|
||
<button class="mini-btn" type="primary" size="mini" @click="loadData">搜索</button>
|
||
</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',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: 30rpx;
|
||
box-sizing: border-box;
|
||
.itemBox{
|
||
.content{
|
||
margin-top: 6rpx;
|
||
}
|
||
.time{
|
||
margin-top: 6rpx;
|
||
}
|
||
}
|
||
}
|
||
.itemImgBox{
|
||
margin-right: 20rpx;
|
||
.itemImg{
|
||
width: 120rpx;
|
||
height: 120rpx;
|
||
}
|
||
}
|
||
.uni-form-item {
|
||
position: relative;
|
||
|
||
.search-icon {
|
||
position: absolute;
|
||
top: 50%;
|
||
right: 50rpx;
|
||
transform: translateY(-50%);
|
||
}
|
||
}
|
||
|
||
.uni-input {
|
||
border-radius: 30rpx;
|
||
margin: 20rpx 20rpx;
|
||
background-color: #f2f2f2;
|
||
height: 60rpx;
|
||
line-height: 60rpx;
|
||
padding: 0 40rpx;
|
||
font-size: 28rpx;
|
||
width: 65%;
|
||
}
|
||
.mini-btn{
|
||
position: absolute;
|
||
right: 6px;
|
||
top: 0px;
|
||
border-radius: 30rpx;
|
||
height: 60rpx;
|
||
line-height: 60rpx;
|
||
}
|
||
</style>
|