Merge branch 'master' of https://gitee.com/beijing_hongye_huicheng/lilishop-uniapp
commit
2abbee0a49
|
@ -48,6 +48,24 @@ export function messageMarkAsRead(ids) {
|
|||
});
|
||||
}
|
||||
|
||||
//读取站内消息
|
||||
export function editMessages(message_id,params){
|
||||
return http.request({
|
||||
url:`/message/member/${message_id}`,
|
||||
method:Method.PUT,
|
||||
needToken:true,
|
||||
params
|
||||
})
|
||||
}
|
||||
//获取站内消息
|
||||
export function messages(params) {
|
||||
return http.request({
|
||||
url: "/message/member",
|
||||
method: Method.GET,
|
||||
needToken: true,
|
||||
params,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取物流消息列表
|
||||
|
|
|
@ -26,6 +26,12 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/home/title",
|
||||
"style": {
|
||||
"navigationBarTitleText": "消息"
|
||||
}
|
||||
},
|
||||
{
|
||||
"path": "pages/tabbar/cart/cartList",
|
||||
"style": {
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
<u-icon name="search"></u-icon>
|
||||
{{ res.list[0].title }}
|
||||
</div>
|
||||
<div slot="right" open-type="contact" class="navbar-right message" @click="linkMsgDetail" style="border-style:none;background:rgb(234,234,234);" >
|
||||
<image style="width:53rpx;height:53rpx;margin-top:6rpx;" src="@/static/img/title.png"></image>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
|
@ -11,6 +14,11 @@ export default {
|
|||
title:"搜索栏",
|
||||
props: ["res"],
|
||||
methods: {
|
||||
linkMsgDetail(){
|
||||
uni.navigateTo({
|
||||
url:`/pages/tabbar/home/title`
|
||||
})
|
||||
},
|
||||
handleSearch() {
|
||||
uni.navigateTo({
|
||||
url: "/pages/navigation/search/searchPage",
|
||||
|
@ -34,5 +42,14 @@ export default {
|
|||
.layout {
|
||||
background: #fff;
|
||||
padding: 0 16rpx;
|
||||
position: relative;
|
||||
}
|
||||
.navbar-right{
|
||||
position: absolute;
|
||||
top: 0;
|
||||
// right: 0;
|
||||
}
|
||||
.message{
|
||||
right:40rpx;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -0,0 +1,182 @@
|
|||
<template>
|
||||
<view>
|
||||
<view>
|
||||
<u-tabs :list="list" :is-scroll="false" :current="current" @change="change"></u-tabs>
|
||||
<u-cell-group v-if="current == 0">
|
||||
<view v-for="(item,index) in lists" :key="index">
|
||||
<u-cell-item :arrow="false" v-if="item.status =='UN_READY'" style="position: relative;"
|
||||
@click="linkMsgDetail(item)">
|
||||
<template slot="label">
|
||||
<view style="display: inline-block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
font-family: Gibson;
|
||||
font-size: 25rpx;
|
||||
word-break: break-all;
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
|
||||
white-space: pre-wrap;">{{item.title}}
|
||||
<view style="width:400rpx;padding: 10rpx 0;">{{item.createTime}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#000000;color:white;">未读</button> -->
|
||||
</u-cell-item>
|
||||
</view>
|
||||
|
||||
</u-cell-group>
|
||||
<u-cell-group v-if="current == 1">
|
||||
<view v-for="(item,index) in lists" :key="index">
|
||||
<u-cell-item :arrow="false" v-if="item.status == 'ALREADY_READY'" style="position: relative;"
|
||||
@click="linkMsgDetail(item)">
|
||||
<template slot="label">
|
||||
<view style="display: inline-block;
|
||||
width: 100%;
|
||||
height: auto;
|
||||
font-family: Gibson;
|
||||
font-size: 25rpx;
|
||||
word-break: break-all;
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
|
||||
white-space: pre-wrap;">{{item.title}}
|
||||
<view style="width:400rpx;padding: 10rpx 0;">{{item.createTime}}</view>
|
||||
</view>
|
||||
</template>
|
||||
<!-- <button style="width:100rpx;height:60rpx;float:right;font-size:20rpx;line-height:60rpx;background:#F3F3FA;color:black;">已读</button> -->
|
||||
</u-cell-item>
|
||||
</view>
|
||||
</u-cell-group>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
messages,
|
||||
editMessages
|
||||
} from "@/api/message.js"
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
params: {
|
||||
pageSize: 20,
|
||||
pageNumber: 1,
|
||||
memberId: "",
|
||||
messageId: "",
|
||||
status:"UN_READY"
|
||||
},
|
||||
loadText: {
|
||||
loadmore: '轻轻上拉',
|
||||
loading: '努力加载中',
|
||||
nomore: '实在没有了'
|
||||
},
|
||||
list: [{
|
||||
name: "未读"
|
||||
}, {
|
||||
name: "已读"
|
||||
}],
|
||||
current: 0,
|
||||
lists: [],
|
||||
status: "loadmore"
|
||||
}
|
||||
},
|
||||
onShow() {
|
||||
this.getMessage()
|
||||
},
|
||||
onReachBottom() {
|
||||
this.params.pageNumber++;
|
||||
this.statuss = "loading";
|
||||
this.getMessage()
|
||||
},
|
||||
methods: {
|
||||
linkMsgDetail(v) {
|
||||
|
||||
if (v.status == 'UN_READY') {
|
||||
let params = {}
|
||||
params.messageId = v.memberId
|
||||
editMessages(v.id, params).then(res => {
|
||||
if (res.data.success) {
|
||||
console.log( this.lists)
|
||||
this.lists.forEach((item,index)=>{
|
||||
console.log(item)
|
||||
if(item.id == v.id){
|
||||
this.lists.splice(index, 1)
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// uni.navigateTo({
|
||||
// url:`/pages/tabbar/home/messageDetail?data=${encodeURIComponent(JSON.stringify(v))}`
|
||||
// })
|
||||
|
||||
|
||||
},
|
||||
/**
|
||||
* 返回
|
||||
*/
|
||||
back() {
|
||||
if (getCurrentPages().length == 1) {
|
||||
uni.switchTab({
|
||||
url: "/pages/tabbar/home/index",
|
||||
});
|
||||
} else {
|
||||
uni.navigateBack();
|
||||
}
|
||||
},
|
||||
change(e) {
|
||||
console.log(e)
|
||||
this.current = e;
|
||||
if (e == 0) {
|
||||
this.params.status = "UN_READY"
|
||||
this.params.pageNumber = 1;
|
||||
} else if (e == 1) {
|
||||
this.params.status = "ALREADY_READY"
|
||||
this.params.pageNumber = 1;
|
||||
}
|
||||
this.lists = []
|
||||
this.getMessage()
|
||||
},
|
||||
getMessage() {
|
||||
this.params.memberId = this.$options.filters.isLogin().id;
|
||||
|
||||
messages(this.params).then(res => {
|
||||
console.log(res)
|
||||
if (res.data.success) {
|
||||
if (res.data.result.records == '') {
|
||||
console.log(11111)
|
||||
this.status = "nomore"
|
||||
}
|
||||
res.data.result.records.forEach(item => {
|
||||
this.lists.push(item)
|
||||
let obj = {};
|
||||
this.lists = this.lists.reduce(
|
||||
(cur, next) => {
|
||||
//对象去重
|
||||
if (next.id != undefined) {
|
||||
obj[next.id] ?
|
||||
"" :
|
||||
(obj[next.id] = true && cur.push(next));
|
||||
}
|
||||
console.log(cur);
|
||||
return cur;
|
||||
},
|
||||
[]
|
||||
)
|
||||
})
|
||||
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
<style>
|
||||
.foot {
|
||||
position: fixed;
|
||||
bottom: 0;
|
||||
}
|
||||
</style>
|
Binary file not shown.
After Width: | Height: | Size: 7.6 KiB |
Loading…
Reference in New Issue