123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187 |
- <template>
- <view class="Body">
- <navbar :config="config" backColor="#999999"></navbar>
- <view class="list">
- <view class="item" v-for="(v,i) in list" :key="i" :class="!v.read?'dian':''">
- <view class="item_t">
- <view class="item_t_l">
- <image :src="$getImgPath(v.icon)" mode=""></image>
- {{v.name||'--'}}
- </view>
- <view class="item_t_r">{{v.createTime?v.createTime.substr(0,16):''}}</view>
- </view>
- <view class="item_c">
- <view class="item_c_title">{{v.title}}</view>
- <view class="item_c_des">{{v.content}}</view>
- </view>
- <view class="item_b" @click="goDetails(v)">
- <view>查看详情</view>
- <view><u-icon name="arrow-right" size="32rpx" color="#999"></u-icon></view>
- </view>
- </view>
- <u-loadmore :status="status" />
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- config: {
- back: true, //false是tolbar页面 是则不写
- title: '应用消息',
- color: '#000',
- //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
- // backgroundColor: [0, '#2cba28'],
- rightSlot: true,
- },
- param: {
- pageSize: 10,
- pageNum: 1
- },
- total: 0,
- list: [],
- // 加载前值为loadmore,加载中为loading,没有数据为nomore
- status: 'loadmore',
- }
- },
- onLoad(options) {
- this.param.type=options.type
- },
- onShow() {
- this.getList()
- },
- //上拉触底函数
- onReachBottom() {
- if (this.status == 'loadmore') { //此处进行判断上锁,防止重复请求
- this.status = 'loading'
- this.param.pageNum += 1 //页数加1
- this.getList()
- }
- },
- onPullDownRefresh() {
- if (this.status != 'loading') {
- this.status = 'loading'
- this.param.pageNum = 1
- this.getList()
- }
- },
- methods: {
- getList() {
- this.$yghttp.get('/message/page', this.param).then(res => {
- if (this.param.pageNum == 1) {
- this.list = res.rows;
- } else {
- this.list.push(...res.rows)
- }
- this.total = res.total;
- if (this.total <= this.list.length) {
- this.status = 'nomore'
- } else {
- this.status = 'loadmore'
- }
- uni.stopPullDownRefresh();
- })
- },
- goDetails(item) {
- this.$yghttp.get(`/message/info/${item.id}`).then(res=>{
- this.$openMessage(item)
- })
- }
- }
- }
- </script>
- <style>
- page {
- background-color: #F8F8F8;
- }
- </style>
- <style lang="scss">
- .Body {
- .list {
- padding: 30rpx;
- .item {
- background: #fff;
- padding: 20rpx 30rpx;
- border-radius: 10rpx;
- margin-bottom: 30rpx;
- .item_t {
- display: flex;
- justify-content: space-between;
- align-items: center;
- border-bottom: 3rpx solid rgb(239, 239, 239);
- padding-bottom: 20rpx;
- margin-bottom: 20rpx;
- .item_t_l {
- display: flex;
- align-items: center;
- font-weight: 700;
- font-size: 30rpx;
- position: relative;
- image {
- width: 60rpx;
- height: 60rpx;
- margin-right: 20rpx;
- }
- &:before{
- content: "";
- display: block;
- width: 100rpx;
- height: 10rpx;
- background: #fff;
- position: absolute;
- bottom: -28rpx;
- left: 0;
- }
- }
- .item_t_r {
- color: rgb(142, 142, 142);
- }
- }
- .item_c {
- padding-bottom: 20rpx;
- border-bottom: 3rpx solid rgb(239, 239, 239);
- .item_c_title {
- font-size: 32rpx;
- line-height: 60rpx;
- font-weight: 700;
- }
- .item_c_des {
- line-height: 46rpx;
- color: rgb(142, 142, 142);
- }
- }
- .item_b {
- padding: 30rpx 0 20rpx 0;
- display: flex;
- justify-content: space-between;
- color: #3EBCD0;
- }
- }
- }
- }
- .dian{
- position: relative;
- &::before{
- content: "";
- display: block;
- width: 15rpx;
- height: 15rpx;
- border-radius: 50%;
- background: rgb(240,74,62);
- position: absolute;
- top: 10rpx;
- right: 10rpx;
- }
- }
- </style>
|