更新消息多次触发action
This commit is contained in:
@@ -1,15 +1,15 @@
|
||||
<template>
|
||||
<view class="body">
|
||||
<CustomNavbar @back="back" titke="申请消息"></CustomNavbar>
|
||||
<view v-for="(value,key) in data" class="newsList" @click="goList(value)" :key="key">
|
||||
<view v-for="(value, key) in messageList" class="newsList" @click="goList(value)" :key="key">
|
||||
<view class="newsIcon">
|
||||
<image :src="value.icon" mode=""></image>
|
||||
<view v-if="news_recruit.unread[value.id] > 0" class="point"></view>
|
||||
<!-- <view v-if="news_recruit.unread[value.id] > 0" class="point"></view> -->
|
||||
</view>
|
||||
<view class="newsListRight">
|
||||
<view class="head">
|
||||
<view class="head_left">
|
||||
{{value.title}}
|
||||
{{ value.title }}
|
||||
</view>
|
||||
<!-- <view class="head_right" v-if="value.data.length > 0">
|
||||
{{value.data[0][0][value.prop.time]}}
|
||||
@@ -26,169 +26,281 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
mapGetters
|
||||
} from 'vuex'
|
||||
import CustomTabbar from '@/components/CustomTabbar/custom_tabbar.vue'
|
||||
import CustomNavbar from '@/components/CustomNavbar/navbar.vue';
|
||||
import CustomTabbar from '@/components/CustomTabbar/custom_tabbar.vue'
|
||||
import CustomNavbar from '@/components/CustomNavbar/navbar.vue';
|
||||
|
||||
export default {
|
||||
components: {CustomTabbar,CustomNavbar},
|
||||
data() {
|
||||
return {
|
||||
loading: false
|
||||
}
|
||||
},
|
||||
onLoad() {},
|
||||
onShow() {
|
||||
if (!this.$store.state.user.token) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login"
|
||||
export default {
|
||||
components: { CustomTabbar, CustomNavbar },
|
||||
data() {
|
||||
return {
|
||||
loading: false,
|
||||
size: 20,
|
||||
messageList: [{
|
||||
id: "0",
|
||||
title: "消息通知",
|
||||
icon: "../../../static/img/notice.svg",
|
||||
page: {
|
||||
current: 0,
|
||||
size: this.size,
|
||||
total: this.size,
|
||||
},
|
||||
data: [],
|
||||
prop: {
|
||||
title: "title",
|
||||
desc: (value) => {
|
||||
if (value.data[0]) return value.data[0][0]["desc"];
|
||||
},
|
||||
time: "createTime",
|
||||
isRead: "isRead",
|
||||
listDesc: "desc",
|
||||
},
|
||||
navigateTo(item) {
|
||||
uni.$once("getNewsDetail", (cb) => {
|
||||
cb(item);
|
||||
});
|
||||
uni.navigateTo({
|
||||
url: "/pages/news/newsDetail?type=0",
|
||||
});
|
||||
},
|
||||
}, {
|
||||
id: "1",
|
||||
title: "任务申请",
|
||||
icon: "../../../static/img/renwu.png",
|
||||
page: {
|
||||
current: 0,
|
||||
size: this.size,
|
||||
total: this.size,
|
||||
},
|
||||
data: [],
|
||||
prop: {
|
||||
title: "missionTitle",
|
||||
desc: (value) => {
|
||||
if (value.data[0])
|
||||
return `您收到${value.data[0][0]["companyName"]}的任务`;
|
||||
},
|
||||
time: "createTime",
|
||||
isRead: "status",
|
||||
listDesc: "companyName",
|
||||
},
|
||||
navigateTo(item, dispatch) {
|
||||
// dispatch("readNew", {
|
||||
// key: "1",
|
||||
// id: item.id,
|
||||
// });
|
||||
uni.navigateTo({
|
||||
url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(
|
||||
item.missionNo
|
||||
)}&id=${encodeURIComponent(item.id)}`,
|
||||
});
|
||||
},
|
||||
}, {
|
||||
id: "1",
|
||||
title: "岗位申请",
|
||||
icon: "../../../static/img/job_recruit.svg",
|
||||
page: {
|
||||
current: 0,
|
||||
size: this.size,
|
||||
total: this.size,
|
||||
},
|
||||
data: [],
|
||||
prop: {
|
||||
title: "missionTitle",
|
||||
desc: (value) => {
|
||||
if (value.data[0])
|
||||
return `您收到${value.data[0][0]["companyName"]}的任务`;
|
||||
},
|
||||
time: "createTime",
|
||||
isRead: "status",
|
||||
listDesc: "companyName",
|
||||
},
|
||||
navigateTo(item, dispatch) {
|
||||
// dispatch("readNew", {
|
||||
// key: "1",
|
||||
// id: item.id,
|
||||
// });
|
||||
uni.navigateTo({
|
||||
url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(
|
||||
item.missionNo
|
||||
)}&id=${encodeURIComponent(item.id)}`,
|
||||
});
|
||||
},
|
||||
}, {
|
||||
id: "1",
|
||||
title: "个人户申请",
|
||||
icon: "../../../static/img/own_recruit.svg",
|
||||
page: {
|
||||
current: 0,
|
||||
size: this.size,
|
||||
total: this.size,
|
||||
},
|
||||
data: [],
|
||||
prop: {
|
||||
title: "missionTitle",
|
||||
desc: (value) => {
|
||||
if (value.data[0])
|
||||
return `您收到${value.data[0][0]["companyName"]}的任务`;
|
||||
},
|
||||
time: "createTime",
|
||||
isRead: "status",
|
||||
listDesc: "companyName",
|
||||
},
|
||||
navigateTo(item, dispatch) {
|
||||
// dispatch("readNew", {
|
||||
// key: "1",
|
||||
// id: item.id,
|
||||
// });
|
||||
uni.navigateTo({
|
||||
url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(
|
||||
item.missionNo
|
||||
)}&id=${encodeURIComponent(item.id)}`,
|
||||
});
|
||||
},
|
||||
},]
|
||||
}
|
||||
},
|
||||
onLoad() { },
|
||||
onShow() {
|
||||
if (!this.$store.state.user.token) {
|
||||
uni.redirectTo({
|
||||
url: "/pages/login/login"
|
||||
})
|
||||
} else {
|
||||
uni.$emit('newsReadChange')
|
||||
}
|
||||
},
|
||||
// onPullDownRefresh() {
|
||||
// this.loading = true
|
||||
// this.$store.dispatch("newsInit").then(() => {
|
||||
// this.loading = false
|
||||
// uni.stopPullDownRefresh();
|
||||
// }).catch(() => {
|
||||
// this.loading = false
|
||||
// uni.stopPullDownRefresh();
|
||||
// })
|
||||
// },
|
||||
methods: {
|
||||
goList(item) {
|
||||
// if (item.data.length === 0) {
|
||||
// uni.showToast({
|
||||
// title: '暂无消息',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
console.log(item.data)
|
||||
// 任务推送、岗位推送、政策推送
|
||||
if (item.title == '任务申请') {
|
||||
console.log('任务申请')
|
||||
uni.navigateTo({
|
||||
url: './taskProjectList'
|
||||
})
|
||||
} else if (item.title == '岗位申请') {
|
||||
console.log('岗位申请')
|
||||
uni.navigateTo({
|
||||
url: './jobProjectList'
|
||||
})
|
||||
} else if (item.title == '个人户申请') {
|
||||
console.log('个人户申请')
|
||||
uni.navigateTo({
|
||||
url: './policyList'
|
||||
})
|
||||
} else {
|
||||
uni.$emit('newsReadChange')
|
||||
uni.navigateTo({
|
||||
url: './newsList?type=' + item.id
|
||||
})
|
||||
}
|
||||
},
|
||||
onPullDownRefresh() {
|
||||
this.loading = true
|
||||
this.$store.dispatch("newsInit").then(() => {
|
||||
this.loading = false
|
||||
uni.stopPullDownRefresh();
|
||||
}).catch(() => {
|
||||
this.loading = false
|
||||
uni.stopPullDownRefresh();
|
||||
})
|
||||
back() {
|
||||
uni.reLaunch({ url: '/pages/my/my' })
|
||||
},
|
||||
methods: {
|
||||
goList(item) {
|
||||
// if (item.data.length === 0) {
|
||||
// uni.showToast({
|
||||
// title: '暂无消息',
|
||||
// icon: 'none'
|
||||
// });
|
||||
// return
|
||||
// }
|
||||
console.log(item.data)
|
||||
// 任务推送、岗位推送、政策推送
|
||||
if(item.title == '任务申请') {
|
||||
console.log('任务申请')
|
||||
uni.navigateTo({
|
||||
url: './taskProjectList'
|
||||
})
|
||||
} else if(item.title == '岗位申请') {
|
||||
console.log('岗位申请')
|
||||
uni.navigateTo({
|
||||
url: './jobProjectList'
|
||||
})
|
||||
} else if(item.title == '个人户申请') {
|
||||
console.log('个人户申请')
|
||||
uni.navigateTo({
|
||||
url: './policyList'
|
||||
})
|
||||
} else {
|
||||
uni.navigateTo({
|
||||
url: './newsList?type=' + item.id
|
||||
})
|
||||
}
|
||||
},
|
||||
back() {
|
||||
uni.reLaunch({ url: '/pages/my/my' })
|
||||
},
|
||||
},
|
||||
computed: {
|
||||
...mapGetters(['news_recruit']),
|
||||
data() {
|
||||
console.log(this.news_recruit.data,'--------------------==========');
|
||||
return this.news_recruit.data
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.content {
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
width: 560rpx;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
/*不换行*/
|
||||
text-overflow: ellipsis;
|
||||
/*超出部分文字以...显示*/
|
||||
}
|
||||
.content {
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 28rpx;
|
||||
color: #666666;
|
||||
width: 560rpx;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
/*不换行*/
|
||||
text-overflow: ellipsis;
|
||||
/*超出部分文字以...显示*/
|
||||
}
|
||||
|
||||
.head_right {
|
||||
float: right;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 24rpx;
|
||||
color: #CCCCCC;
|
||||
}
|
||||
.head_right {
|
||||
float: right;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 24rpx;
|
||||
color: #CCCCCC;
|
||||
}
|
||||
|
||||
.head_left {
|
||||
float: left;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
.head_left {
|
||||
float: left;
|
||||
font-family: PingFangSC-Regular;
|
||||
font-size: 36rpx;
|
||||
color: #333333;
|
||||
}
|
||||
|
||||
.head {
|
||||
overflow: hidden;
|
||||
width: 560rpx;
|
||||
}
|
||||
.head {
|
||||
overflow: hidden;
|
||||
width: 560rpx;
|
||||
}
|
||||
|
||||
.newsListRight {
|
||||
float: left;
|
||||
width: 560rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
.newsListRight {
|
||||
float: left;
|
||||
width: 560rpx;
|
||||
height: 50rpx;
|
||||
line-height: 50rpx;
|
||||
padding-left: 30rpx;
|
||||
}
|
||||
|
||||
.newsList .newsIcon {
|
||||
position: relative;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
}
|
||||
.newsList .newsIcon {
|
||||
position: relative;
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
display: inline-block;
|
||||
float: left;
|
||||
}
|
||||
|
||||
.newsList image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
.newsList image {
|
||||
width: 100rpx;
|
||||
height: 100rpx;
|
||||
}
|
||||
|
||||
.newsList .point {
|
||||
position: absolute;
|
||||
top: 5rpx;
|
||||
right: 10rpx;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
background: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
.newsList .point {
|
||||
position: absolute;
|
||||
top: 5rpx;
|
||||
right: 10rpx;
|
||||
width: 20rpx;
|
||||
height: 20rpx;
|
||||
background: red;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.newsList {
|
||||
border-bottom: 1rpx solid #dddddd;
|
||||
padding-bottom: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
padding-top: 30rpx;
|
||||
padding-left: 30rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
.newsList {
|
||||
border-bottom: 1rpx solid #dddddd;
|
||||
padding-bottom: 30rpx;
|
||||
padding-right: 30rpx;
|
||||
padding-top: 30rpx;
|
||||
padding-left: 30rpx;
|
||||
overflow: hidden;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.body {
|
||||
background-color: #fefefe;
|
||||
/* padding-left: 30rpx;
|
||||
.body {
|
||||
background-color: #fefefe;
|
||||
/* padding-left: 30rpx;
|
||||
|
||||
width: 720rpx; */
|
||||
}
|
||||
}
|
||||
|
||||
page {
|
||||
background: #f6f6f6;
|
||||
}
|
||||
page {
|
||||
background: #f6f6f6;
|
||||
}
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user