更新申请消息

This commit is contained in:
dengxin
2024-03-19 11:53:24 +08:00
parent 1b38166ba3
commit 723210a121
7 changed files with 402 additions and 15 deletions

View File

@@ -247,7 +247,7 @@
{ {
"path": "pages/recruit/subPage/MessageList", "path": "pages/recruit/subPage/MessageList",
"style": { "style": {
"navigationBarTitleText": "消息", "navigationBarTitleText": "申请消息",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }

View File

@@ -1,9 +1,10 @@
<template> <template>
<view class="body"> <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 data" class="newsList" @click="goList(value)" :key="key">
<view class="newsIcon"> <view class="newsIcon">
<image :src="'../'+value.icon" mode=""></image> <image :src="value.icon" mode=""></image>
<view v-if="news.unread[value.id] > 0" class="point"></view> <view v-if="news_recruit.unread[value.id] > 0" class="point"></view>
</view> </view>
<view class="newsListRight"> <view class="newsListRight">
<view class="head"> <view class="head">
@@ -20,6 +21,7 @@
</view> </view>
</view> </view>
<cs-button></cs-button> <cs-button></cs-button>
<CustomTabbar :currentpage="2"></CustomTabbar>
</view> </view>
</template> </template>
@@ -27,8 +29,11 @@
import { import {
mapGetters mapGetters
} from 'vuex' } from 'vuex'
import CustomTabbar from '@/components/CustomTabbar/custom_tabbar.vue'
import CustomNavbar from '@/components/CustomNavbar/navbar.vue';
export default { export default {
components: {CustomTabbar,CustomNavbar},
data() { data() {
return { return {
loading: false loading: false
@@ -65,18 +70,18 @@
// } // }
console.log(item.data) console.log(item.data)
// 任务推送、岗位推送、政策推送 // 任务推送、岗位推送、政策推送
if(item.title == '任务推送') { if(item.title == '任务申请') {
console.log('任务推送') console.log('任务申请')
uni.navigateTo({ uni.navigateTo({
url: './taskProjectList' url: './taskProjectList'
}) })
} else if(item.title == '岗位推送') { } else if(item.title == '岗位申请') {
console.log('岗位推送') console.log('岗位申请')
uni.navigateTo({ uni.navigateTo({
url: './jobProjectList' url: './jobProjectList'
}) })
} else if(item.title == '政策推送') { } else if(item.title == '个人户申请') {
console.log('政策推送') console.log('个人户申请')
uni.navigateTo({ uni.navigateTo({
url: './policyList' url: './policyList'
}) })
@@ -85,13 +90,16 @@
url: './newsList?type=' + item.id url: './newsList?type=' + item.id
}) })
} }
} },
back() {
uni.reLaunch({ url: '/pages/my/my' })
},
}, },
computed: { computed: {
...mapGetters(['news']), ...mapGetters(['news_recruit']),
data() { data() {
console.log(this.news.data,'--------------------=========='); console.log(this.news_recruit.data,'--------------------==========');
return this.news.data return this.news_recruit.data
} }
} }
} }
@@ -165,6 +173,7 @@
padding-bottom: 30rpx; padding-bottom: 30rpx;
padding-right: 30rpx; padding-right: 30rpx;
padding-top: 30rpx; padding-top: 30rpx;
padding-left: 30rpx;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
align-items: center; align-items: center;
@@ -172,9 +181,9 @@
.body { .body {
background-color: #fefefe; background-color: #fefefe;
padding-left: 30rpx; /* padding-left: 30rpx;
width: 720rpx; width: 720rpx; */
} }
page { page {

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1710819524825" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="15721" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M512 0a512 512 0 1 0 512 512 512 512 0 0 0-512-512z m5.888 845.568c-20.16 0-181.312-82.368-181.312-102.848s103.616-362.688 103.616-362.688L360.448 249.6s-19.84-24.832 27.904-24.832h259.008c47.744 0 23.872 24.448 23.872 24.448L595.584 380.032s103.616 344.32 103.616 362.688a564.096 564.096 0 0 1-181.312 102.848z m227.584-268.16l-36.16 42.496-83.2-239.872 120.832 167.616a25.216 25.216 0 0 1-1.472 29.76z" fill="#2ea4fe" p-id="15722"></path></svg>

After

Width:  |  Height:  |  Size: 780 B

View File

@@ -0,0 +1 @@
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1710819568639" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="19281" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M640.766712 362.494964c0-71.386864-58.078767-129.464607-129.464607-129.464607-71.386864 0-129.464607 58.077743-129.464607 129.464607s58.077743 129.464607 129.464607 129.464607C582.687946 491.959571 640.766712 433.881828 640.766712 362.494964zM829.65164 195.676611C744.998635 111.023606 632.445186 64.402799 512.727571 64.402799c-119.718639 0-232.272088 46.62183-316.925093 131.274836C111.148449 280.33064 64.527642 392.884089 64.527642 512.602727c0 119.717615 46.62183 232.272088 131.274836 316.925093 84.654029 84.655052 197.207477 131.275859 316.925093 131.275859 119.717615 0 232.272088-46.620807 316.925093-131.275859 84.655052-84.653005 131.275859-197.207477 131.275859-316.925093C960.927499 392.884089 914.306692 280.33064 829.65164 195.676611zM732.97581 764.003478c-11.04966 0-20.008706-8.959046-20.008706-20.008706 0-111.199615-90.466408-201.666022-201.664999-201.666022S309.637106 632.795157 309.637106 743.994772c0 11.04966-8.958022 20.008706-20.008706 20.008706-11.050684 0-20.008706-8.959046-20.008706-20.008706 0-107.011222 69.916373-197.986213 166.462243-229.684146-55.807027-27.76332-94.262874-85.36932-94.262874-151.816684 0-93.452415 76.029604-169.483042 169.483042-169.483042 93.452415 0 169.483042 76.029604 169.483042 169.483042 0 66.446341-38.455847 124.052341-94.262874 151.816684 96.54587 31.697933 166.462243 122.6719 166.462243 229.684146C752.984516 755.044432 744.025471 764.003478 732.97581 764.003478z" fill="#2ea4fe" p-id="19282"></path></svg>

After

Width:  |  Height:  |  Size: 1.8 KiB

View File

@@ -5,6 +5,7 @@ const getters = {
userChecked:state=>state.user.userChecked, userChecked:state=>state.user.userChecked,
area: state => state.area, area: state => state.area,
news: state=> state.news, news: state=> state.news,
news_recruit: state=> state.news_recruit,
auth: state => state.auth, auth: state => state.auth,
authPass: (state,getters) => getters.auth.laborState && getters.auth.realNameState && getters.auth.bankCardState && getters.auth.insureState, authPass: (state,getters) => getters.auth.laborState && getters.auth.realNameState && getters.auth.bankCardState && getters.auth.insureState,
authInfo: state => state.auth.authInfo, authInfo: state => state.auth.authInfo,

View File

@@ -6,6 +6,7 @@ import user from './models/user.js'
import area from './models/area.js' import area from './models/area.js'
import auth from './models/auth.js' import auth from './models/auth.js'
import news from './models/news.js' import news from './models/news.js'
import news_recruit from './models/news_recruit.js'
import vip from './models/vip.js' import vip from './models/vip.js'
import face from './models/face.js' import face from './models/face.js'
import authentication from './models/authentication.js' import authentication from './models/authentication.js'
@@ -17,6 +18,7 @@ const store = new Vuex.Store({
area, area,
auth, auth,
news, news,
news_recruit,
vip, vip,
face, face,
authentication authentication

View File

@@ -0,0 +1,373 @@
import {
inviteCount,
inviteList,
inviteRead,
inviteRemove,
noticeCount,
noticeList,
noticeRead,
noticeRemove
} from '@/api/news.js'
import website from '@/config/website.js'
const size = 20
const handler = {
'0': {
count: noticeCount,
getList: noticeList,
read: noticeRead,
remove: noticeRemove
},
'1': {
count: inviteCount,
getList: inviteList,
read: inviteRead,
remove: inviteRemove
}
}
function getCount(data) {
let sum = 0
for (let key in data) {
sum += data[key]
}
return sum
}
let refreshTimer = null;
function startRefreshToken(dispatch) {
refreshTimer = setInterval(() => {
dispatch("newsInit");
}, website.newsRefreshTime);
}
function stopRefreshToken() {
clearInterval(refreshTimer)
}
const news = {
state: {
count: 0,
data: {
// "0": {
// id: "0",
// title: "消息通知",
// icon: "../../static/img/notice.svg",
// page: {
// current: 0,
// size,
// total: 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"
// })
// }
// },
"1": {
id: "1",
title: "任务申请",
icon: "../../../static/img/renwu.png",
page: {
current: 0,
size,
total: 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)}`
})
}
},
"2": {
id: "1",
title: "岗位申请",
icon: "../../../static/img/job_recruit.svg",
page: {
current: 0,
size,
total: 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)}`
})
}
},
// "3": {
// id: "1",
// title: "技能推送",
// icon: "../../static/img/jineng.svg",
// page: {
// current: 0,
// size,
// total: 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)}`
// })
// }
// },
"4": {
id: "1",
title: "个人户申请",
icon: "../../../static/img/own_recruit.svg",
page: {
current: 0,
size,
total: 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)}`
})
}
}
},
unread: {
"0": 0,
"1": 0
},
allUnread: 0,
dic: {}
},
actions: {
newsInit({
dispatch
}) {
const ps = []
ps.push(dispatch('getUnreadNum'))
for (let key in handler) {
ps.push(dispatch('newsReload', key))
}
return Promise.all(ps)
},
newsReload({
dispatch,
commit
}, id) {
commit('CLEAR_NEWS_DATA', id)
return dispatch('newsGetNextPage', id)
},
getUnreadNum({
commit
}) {
for (let key in handler) {
handler[key].count().then((result) => {
commit('SET_UNREADNUM', {
id: key,
count: result
})
})
}
},
newsGetNextPage({
state,
commit
}, id) {
const item = state.data[id]
const page = item.page
const current = page.current + 1
return new Promise((resolve, reject) => {
if (parseInt(page.total / page.size) + 1 < current) {
resolve()
return
}
handler[id].getList(current, page.size).then(res => {
const data = res.data.data;
commit('ADD_NEWS_DATA', {
id,
data: data.records,
current,
total: data.total
})
resolve(res)
}).catch(reject)
})
},
removeNew({
commit
}, {
id,
key,
group,
index
}) {
return new Promise((resolve, reject) => {
commit('REMOVE_NEWS', {
id,
key,
group,
index
})
handler[key].remove(id).then(resolve, reject)
})
},
readNew({
commit
}, {
key,
id
}) {
return new Promise((resolve, reject) => {
commit('READ_NEWS', {
key,
id
})
handler[key].read(id).then(resolve, reject)
})
},
endRefreshNewsTimer(){
stopRefreshToken()
},
startRefreshNewsTimer({
state,
commit,
dispatch
}) {
dispatch('newsInit').then(() => {
startRefreshToken(dispatch);
})
}
},
mutations: {
SET_UNREADNUM: (state, {
id,
count
}) => {
state.unread[id] = count
state.allUnread = getCount(state.unread)
},
CLEAR_NEWS_DATA: (state, id) => {
state.data[id].page = {
current: 0,
size
}
state.data[id].data = []
},
ADD_NEWS_DATA: (state, {
id,
data,
current,
total
}) => {
data.forEach(item => {
state.dic[item.id] = item
})
state.data[id].page.total = total
state.data[id].page.current = current
if (data.length > 0) {
state.data[id].data.push(data)
}
},
REMOVE_NEWS: (state, {
id,
key,
group,
index
}) => {
const readProp = state.data[key].prop['isRead']
if (state.dic[id][readProp] === 0) {
state.unread[key]--
state.allUnread--
}
state.dic[id] = undefined
const data = state.data[key].data
data[group].splice(index, 1)
if (data[group].length === 0) {
data.splice(group, 1)
}
},
READ_NEWS: (state, {
key,
id
}) => {
const readProp = state.data[key].prop['isRead']
if (state.dic[id][readProp] === 0) {
state.dic[id][readProp] = 1
state.unread[key]--
state.allUnread--
}
}
},
getters: {
}
};
export default news;