Commit 2e3d155c authored by 杨硕's avatar 杨硕
parents 18fb8bf1 415b0dbd
import request from "../../../utils/request";
// 查询消息列表
export function getMessageList(params) {
return request({
url: '/messageInstance/queryMessageInstanceByPagination',
method: 'get',
params
})
}
// 标为已读
export function markRead(data) {
return request({
url: '/messageInstance/update',
method: 'put',
data,
headers: {
'Content-Type': 'application/json;charset=UTF-8'
}
})
}
// 逻辑删除
export function deleteLogical(id) {
return request({
url: '/messageInstance/deleteLogical/' + id,
method: 'delete'
})
}
// 查询详情
export function getMessageDetail(id) {
return request({
url: '/messageInstance/detail/' + id,
method: 'get'
})
}
\ No newline at end of file
<template>
<view class="message-detail">
<view class="message-title">龙徽1910文化创意产业园开园,文化大餐送到老街坊家门口</view>
<view class="message-title">{{form.title|| '-'}}</view>
<view class="message-body">
<view class="mes-form">园区推送</view>
<view class="mes-time">2022/08/24 10:28</view>
<view class="mes-time">{{form.createDate|| '-'}}</view>
</view>
<view class="mes-detail">7月29日,龙徽1910文化创意产业园完成改造升级正式开园,传承百年历史的老酒厂在城市更新进程中焕发新生,老街坊们在家门口就能畅享文化大餐。</view>
<view class="mes-detail">{{form.content || '-'}}</view>
</view>
</template>
<script>
import { getMessageDetail } from "../../api/my/myMessage/myMessage";
export default{
data(){
return{
id:'',
form: {}
}
},
onLoad(options) {
console.log("传参",options)
this.id = JSON.parse(options.id)
if (options != null) {
this.id = JSON.parse(decodeURIComponent(options.id))
console.log("传参的id", this.id)
getMessageDetail(this.id).then(res => {
console.log('消息表单',res)
if(res.code === 200) {
this.form = res.data
}
})
}
}
}
</script>
<style lang="scss" scoped>
......
<template>
<view class="message">
<u-sticky bgColor="#fff">
<u-tabs :list="list1" @click="click" lineColor="#D84848"
activeStyle="font-size: 38rpx;font-weight: bold;color: #D84848;width: calc(50vw - 34rpx);text-align: center;"
inactiveStyle="font-size: 19px;font-weight: bold;color: #222222;width: calc(50vw - 34rpx);text-align: center;"
lineWidth="42" lineHeight="6" itemStyle=" height: 64px;width:50vw;"></u-tabs>
</u-sticky>
<!-- <u-sticky bgColor="#fff">
<u-tabs :list="list1" @click="click"
lineColor="#f56c6c"
:activeStyle="{
......@@ -13,50 +19,62 @@
transform: 'scale(1)'
}"
itemStyle=" height: 34px;width:50vw;"></u-tabs>
</u-sticky>
</u-sticky> -->
<view class="noread" v-if="tabshow==0">
<view class="noread-card" v-for="index in 6">
<view class="noread-card" v-for="(item) in messageList">
<view class="card-title">
<image class="title-image" :src="baseURL+'/static/message/xiaoxi_icon_weidu@2x.png'">
<view class="title-content">这是消息内容标题这是消息内容消息这是消息内容消息</view>
<view class="title-content">{{item.title}}</view>
</view>
<view class="message-time">
消息时间:2022-10-11 10:49:23
消息时间:{{item.createDate || '-'}}
</view>
<view class="message-content">
消息内容:这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容
消息内容:{{item.content}}
</view>
<view class="card-bottom">
<view class="left" @click="gotodetail">查看</view>
<view class="right">标为已读</view>
<view class="left" @click="gotodetail(item)">查看</view>
<view class="right" @click="read(item)">标为已读</view>
</view>
</view>
<view class="nomore">~ 没有更多啦 ~</view>
</view>
<view class="noread" v-if="tabshow==1">
<view class="noread-card" v-for="index in 6">
<view class="noread-card" v-for="(item) in messageList">
<view class="card-title">
<image class="title-image" :src="baseURL+'/static/message/xiaoxi_icon_yidu@2x.png'">
<view class="title-content">这是消息内容标题这是消息内容消息这是消息内容消息</view>
<view class="title-content">{{item.title}}</view>
</view>
<view class="message-time">
消息时间:2022-10-11 10:49:23
消息时间:{{item.createDate || '-'}}
</view>
<view class="message-content">
消息内容:这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容这是消息内容
消息内容:{{item.content}}
</view>
<view class="card-bottom">
<view class="left">查看</view>
<view class="right">删除</view>
<view class="left" @click="gotodetail(item)">查看</view>
<view class="right" @click="deleteMessage(item)">删除</view>
</view>
</view>
<view class="nomore">~ 没有更多啦 ~</view>
</view>
</view>
</template>
<script>
import { getMessageList,markRead,deleteLogical } from "../../api/my/myMessage/myMessage";
export default {
data() {
return {
total:0,
queryParam:{
page: 1,
rows: 10,
readFlag:'0'
},
messageList:[],
// 已读消息列表
list1: [{
name: '未读',
}, {
......@@ -64,16 +82,99 @@ export default {
}],
tabshow:0,
baseURL: 'http://192.144.239.97:20043/file/',
allListItem:false // 是否还有更多数据
}
},
onShow() {
this.getList()
},
// 触底加载
onReachBottom() {
console.log("触底加载")
// 触底的时候请求数据,即为上拉加载更多
var allTotal = this.queryParam.page * this.queryParam.rows
//this.page为加载次数,this.pageSize为每一次加载的数据条数
if(allTotal < this.total){
//this.total为请求数据的总条数。只要现有条数小于总条数就就执行一下代码
this.allListItem = false;
this.queryParam.page ++;
//加载次数递加
this.getList() //请求更多数据列表
}else{
this.allListItem = true;
console.log('已加载全部数据')
}
},
methods: {
// 删除
deleteMessage(item) {
deleteLogical(item.businessId).then(res => {
if(res.code === 200) {
uni.showToast({
title: '操作成功',
icon: 'success'
})
this.queryParam.readFlag = '1'
this.getList()
}
})
},
// 标未已读
read(item){
console.log('整个对象',item)
let businessId = item.businessId
const obj = {
businessId:item.businessId,
readFlag: '1'
}
console.log('businessId',businessId)
console.log('obj',obj)
markRead(obj).then(res => {
console.log('标记已读',res)
if(res.code === 200) {
uni.showToast({
title: '操作成功',
icon: 'success'
})
this.queryParam.readFlag = '0'
this.getList()
}
})
},
getList(){
getMessageList(this.queryParam).then(res => {
console.log('消息列表',res)
this.total = res.total
this.messageList = res.rows
})
},
click(item) {
console.log('item', item);
this.tabshow=item.index
if (this.tabshow === 1) {
console.log('已读')
this.queryParam.readFlag = '1'
this.getList()
// getMessageList(this.queryParam).then(res => {
// console.log('消息列表',res)
// this.total = res.total
// this.readmessageList = res.rows
// })
} else{
console.log('未读')
this.queryParam.readFlag = '0'
this.getList()
// getMessageList(this.queryParam).then(res => {
// console.log('消息列表',res)
// this.total = res.total
// this.unreadMessageList = res.rows
// })
}
},
gotodetail(){
gotodetail(item){
console.log('跳转详情页')
uni.navigateTo({
url:'/pages/mine/myMessage/detail'
url:'/my/myMessage/detail'+'?id='+item.businessId
})
}
}
......@@ -84,6 +185,14 @@ export default {
.message{
padding-bottom: 32rpx;
.noread{
.nomore{
text-align: center;
padding: 42rpx 0;
font-size: 13px;
font-family: Source Han Sans CN-Regular, Source Han Sans CN;
font-weight: 400;
color: #B9B9B9;
}
.noread-card{
margin: 34rpx 34rpx 26rpx 34rpx;
background: #FFFFFF;
......
......@@ -97,7 +97,8 @@
{
"path": "myMessage/index",
"style": {
"navigationBarTitleText": "消息"
"navigationBarTitleText": "消息",
"enablePullDownRefresh": true
}
},
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment