falt:暂存

This commit is contained in:
Apcallover
2024-04-29 11:01:41 +08:00
parent e1580de161
commit 4d8d0335fb
10 changed files with 710 additions and 578 deletions

View File

@@ -7,7 +7,17 @@ import {
//轮播图 //轮播图
export const getEmploymentSurveyManage = (params) => request({ export const getEmploymentSurveyManage = (params) => request({
url: '/api/jobslink-api/content/employmentSurveyManage/list', url: '/api/jobslink-api/content/questionnaireSurveyInfo/list',
method: 'get', method: 'get',
params params
}); });
export const queryByIdQuestionnaireSurveyInfo = (params) => request({
url: '/api/jobslink-api/content/questionnaireSurveyInfo/queryById',
method: 'get',
params
});
export const replyQuestionnaireSurveyInfo = (params) => request({
url: '/api/jobslink-api/content/questionnaireSurveyInfo/reply',
method: 'post',
data: params
});

View File

@@ -1,16 +1,19 @@
<template> <template>
<view class=""> <view>
<block v-for="(item, index) in dataSource" :key="item.id"> <view v-if="dataSource.length">
<view class="search-item" @click="toDetail(item)"> <block v-for="(item, index) in dataSource" :key="item.id">
{{item.surveyTitle}} <view class="search-item" @click="toDetail(item)">
<view style="flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{ item.workname }} {{item.surveyTitle}}
<view style="flex:1;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;">{{ item.workname }}
</view>
<image src="../../static/img/eyeopen.svg" style="width: 32rpx;height: 32rpx;margin-right: 10rpx;"
mode="">
</image>
<view class="baddd"></view>
</view> </view>
<image src="../../static/img/eyeopen.svg" style="width: 32rpx;height: 32rpx;margin-right: 10rpx;" </block>
mode=""> </view>
</image> <empty v-else content="暂无问卷" mrTop="300"></empty>
<view class="baddd"></view>
</view>
</block>
</view> </view>
</template> </template>
@@ -28,9 +31,15 @@
created() { created() {
this.getList("refresh"); this.getList("refresh");
}, },
onReachBottom() {
this.getList();
},
onPullDownRefresh() {
this.getList("refresh");
},
methods: { methods: {
toDetail() { toDetail(row) {
this.navTo(`/pageMy/setUserBase/sub/appliRecordsDeatil?id=${row.id}`)
}, },
async getList(type = 'add') { async getList(type = 'add') {
if (type === "refresh") { if (type === "refresh") {
@@ -41,6 +50,7 @@
page: this.pageNumber page: this.pageNumber
} }
let resData = await getEmploymentSurveyManage(params) let resData = await getEmploymentSurveyManage(params)
uni.stopPullDownRefresh()
if (resData.data.code === 200) { if (resData.data.code === 200) {
const { const {
current, current,

View File

@@ -113,6 +113,8 @@
addComplaint() { addComplaint() {
if (this.isNext) { if (this.isNext) {
this.isNext = false this.isNext = false
} else {
return
} }
this.$refs.uForm.validate().then(async (res) => { this.$refs.uForm.validate().then(async (res) => {
let params = { let params = {

View File

@@ -15,8 +15,6 @@
<u-form-item label="咨询人电话:" prop="consultPhone" labelWidth="80" borderBottom> <u-form-item label="咨询人电话:" prop="consultPhone" labelWidth="80" borderBottom>
<u--input v-model="fromData.consultPhone" border="surround" placeholder="请输入11位电话号码"></u--input> <u--input v-model="fromData.consultPhone" border="surround" placeholder="请输入11位电话号码"></u--input>
</u-form-item> </u-form-item>
</u--form> </u--form>
<view class="btn_add"> <view class="btn_add">
<u-button type="primary" size="large" text="发送信件" @click="addConsult"></u-button> <u-button type="primary" size="large" text="发送信件" @click="addConsult"></u-button>
@@ -84,7 +82,10 @@
addConsult() { addConsult() {
if (this.isNext) { if (this.isNext) {
this.isNext = false this.isNext = false
} else {
return
} }
this.$refs.uForm.validate().then(async (res) => { this.$refs.uForm.validate().then(async (res) => {
uni.showLoading({ uni.showLoading({
title: '请求中' title: '请求中'

View File

@@ -0,0 +1,101 @@
<template>
<view class="app_cotainer">
<view class="content">
<p>描述{{infoMation.surveyContent}}</p>
</view>
<u--form labelPosition="left" :fromData="fromData" :model="fromData" :rules="rules" ref="uForm1">
<u-form-item label="" prop="replyContent" labelWidth="80" borderBottom>
<u--textarea v-model="fromData.replyContent" placeholder="回复内容"></u--textarea>
</u-form-item>
</u--form>
<view class="btn_add">
<u-button type="primary" size="large" text="发送信件" @click="submit"></u-button>
</view>
</view>
</template>
<script>
const rules = {
'replyContent': {
type: 'string',
required: true,
message: '请填写投诉标题',
trigger: ['blur', 'change']
},
}
import {
queryByIdQuestionnaireSurveyInfo,
replyQuestionnaireSurveyInfo
} from '@/api/help.js'
export default {
data() {
return {
infoMation: {},
fromData: {},
rules: Object.assign({}, rules),
isNext: true,
}
},
onLoad({
id
}) {
this.getDetail(id)
},
created() {
},
methods: {
async submit() {
if (this.isNext) {
this.isNext = false
} else {
return
}
if (!this.fromData.replyContent) {
this.isNext = true
return this.$api.mag('请输入回复内容')
}
console.log('submit', this.fromData)
let params = {
surveyId: this.infoMation.id,
...this.fromData,
}
uni.showLoading({
title: '请求中'
})
let resData = await replyQuestionnaireSurveyInfo(params)
uni.hideLoading()
this.isNext = true
if (resData.data?.code === 200) {
uni.$u.toast(resData.data.msg)
this.$api.sleep(1000).then(() => {
uni.navigateBack(1)
})
}
},
getDetail(id) {
return new Promise(async (resolve, reject) => {
let resData = await queryByIdQuestionnaireSurveyInfo({
id
})
if (resData.data.code === 200) {
this.infoMation = resData.data.data
resolve(resData.data.data)
} else {
reject()
}
})
}
}
}
</script>
<style scoped>
.app_cotainer {
padding: 24rpx;
}
.content {
margin-bottom: 100rpx;
}
</style>

View File

@@ -707,13 +707,21 @@
} }
}, },
{ {
"path": "help/mailbox", "path": "setUserBase/applicationsRecord",
"style": { "style": {
"navigationBarTitleText": "咨询信箱列表", "navigationBarTitleText": "问卷调查列表",
"navigationBarBackgroundColor": "#FFFFFF", "navigationBarBackgroundColor": "#FFFFFF",
"enablePullDownRefresh": true "enablePullDownRefresh": true
} }
}, },
{
"path": "setUserBase/sub/appliRecordsDeatil",
"style": {
"navigationBarTitleText": "问卷调查",
"navigationBarBackgroundColor": "#FFFFFF",
"enablePullDownRefresh": false
}
},
{ {
"path": "help/questions/questionDetail", "path": "help/questions/questionDetail",
"style": { "style": {

View File

@@ -62,7 +62,7 @@
咨询信箱 咨询信箱
<image src="../../static/img/right.svg" mode=""></image> <image src="../../static/img/right.svg" mode=""></image>
</view> </view>
<view class="btnList" @click="navTo('/pageMy/help/mailbox')"> <view class="btnList" @click="navTo('/pageMy/setUserBase/applicationsRecord')">
<image src="../../static/img/phone.svg" mode=""></image> <image src="../../static/img/phone.svg" mode=""></image>
问卷调查 问卷调查
<image src="../../static/img/right.svg" mode=""></image> <image src="../../static/img/right.svg" mode=""></image>

View File

@@ -1,183 +1,183 @@
<template> <template>
<view class="body"> <view class="body">
<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.unread[value.id] > 0" class="point"></view>
</view> </view>
<view class="newsListRight"> <view class="newsListRight">
<view class="head"> <view class="head">
<view class="head_left"> <view class="head_left">
{{value.title}} {{value.title}}
</view> </view>
<view class="head_right" v-if="value.data.length > 0"> <view class="head_right" v-if="value.data.length > 0">
{{value.data[0][0][value.prop.time]}} {{value.data[0][0][value.prop.time]}}
</view> </view>
</view> </view>
<view class="content" v-if="value.data.length > 0"> <view class="content" v-if="value.data.length > 0">
{{value.prop.desc(value)}} {{value.prop.desc(value)}}
</view> </view>
</view> </view>
</view> </view>
<cs-button></cs-button> <cs-button></cs-button>
</view> </view>
</template> </template>
<script> <script>
import { import {
mapGetters mapGetters
} from 'vuex' } from 'vuex'
export default { export default {
data() { data() {
return { return {
loading: false loading: false
} }
}, },
onLoad() {}, onLoad() {},
onShow() { onShow() {
if (!this.$store.state.user.token) { if (!this.$store.state.user.token) {
uni.redirectTo({ uni.redirectTo({
url: "/pages/login/login" url: "/pages/login/login"
}) })
} else { } else {
uni.$emit('newsReadChange') uni.$emit('newsReadChange')
} }
}, },
onPullDownRefresh() { onPullDownRefresh() {
this.loading = true this.loading = true
this.$store.dispatch("newsInit").then(() => { this.$store.dispatch("newsInit").then(() => {
this.loading = false this.loading = false
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}).catch(() => { }).catch(() => {
this.loading = false this.loading = false
uni.stopPullDownRefresh(); uni.stopPullDownRefresh();
}) })
}, },
methods: { methods: {
goList(item) { goList(item) {
// if (item.data.length === 0) { // if (item.data.length === 0) {
// uni.showToast({ // uni.showToast({
// title: '暂无消息', // title: '暂无消息',
// icon: 'none' // icon: 'none'
// }); // });
// return // return
// } // }
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'
}) })
} else { } else {
uni.navigateTo({ uni.navigateTo({
url: './newsList?type=' + item.id url: './newsList?type=' + item.id
}) })
} }
} }
}, },
computed: { computed: {
...mapGetters(['news']), ...mapGetters(['news']),
data() { data() {
console.log(this.news.data,'-----------------------------'); console.log(this.news.data, '-----------------------------');
return this.news.data return this.news.data
} }
} }
} }
</script> </script>
<style> <style>
.content { .content {
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-size: 28rpx; font-size: 28rpx;
color: #666666; color: #666666;
width: 560rpx; width: 560rpx;
overflow: hidden; overflow: hidden;
white-space: nowrap; white-space: nowrap;
/*不换行*/ /*不换行*/
text-overflow: ellipsis; text-overflow: ellipsis;
/*超出部分文字以...显示*/ /*超出部分文字以...显示*/
} }
.head_right { .head_right {
float: right; float: right;
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-size: 24rpx; font-size: 24rpx;
color: #CCCCCC; color: #CCCCCC;
} }
.head_left { .head_left {
float: left; float: left;
font-family: PingFangSC-Regular; font-family: PingFangSC-Regular;
font-size: 36rpx; font-size: 36rpx;
color: #333333; color: #333333;
} }
.head { .head {
overflow: hidden; overflow: hidden;
width: 560rpx; width: 560rpx;
} }
.newsListRight { .newsListRight {
float: left; float: left;
width: 560rpx; width: 560rpx;
height: 50rpx; height: 50rpx;
line-height: 50rpx; line-height: 50rpx;
padding-left: 30rpx; padding-left: 30rpx;
} }
.newsList .newsIcon { .newsList .newsIcon {
position: relative; position: relative;
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
display: inline-block; display: inline-block;
float: left; float: left;
} }
.newsList image { .newsList image {
width: 100rpx; width: 100rpx;
height: 100rpx; height: 100rpx;
} }
.newsList .point { .newsList .point {
position: absolute; position: absolute;
top: 5rpx; top: 5rpx;
right: 10rpx; right: 10rpx;
width: 20rpx; width: 20rpx;
height: 20rpx; height: 20rpx;
background: red; background: red;
border-radius: 50%; border-radius: 50%;
} }
.newsList { .newsList {
border-bottom: 1rpx solid #dddddd; border-bottom: 1rpx solid #dddddd;
padding-bottom: 30rpx; padding-bottom: 30rpx;
padding-right: 30rpx; padding-right: 30rpx;
padding-top: 30rpx; padding-top: 30rpx;
overflow: hidden; overflow: hidden;
display: flex; display: flex;
align-items: center; align-items: center;
} }
.body { .body {
background-color: #fefefe; background-color: #fefefe;
padding-left: 30rpx; padding-left: 30rpx;
width: 720rpx; width: 720rpx;
} }
page { page {
background: #f6f6f6; background: #f6f6f6;
} }
</style> </style>

View File

@@ -1,374 +1,374 @@
import { import {
inviteCount, inviteCount,
inviteList, inviteList,
inviteRead, inviteRead,
inviteRemove, inviteRemove,
noticeCount, noticeCount,
noticeList, noticeList,
noticeRead, noticeRead,
noticeRemove noticeRemove
} from '@/api/news.js' } from '@/api/news.js'
import website from '@/config/website.js' import website from '@/config/website.js'
const size = 20 const size = 20
const handler = { const handler = {
'0': { '0': {
count: noticeCount, count: noticeCount,
getList: noticeList, getList: noticeList,
read: noticeRead, read: noticeRead,
remove: noticeRemove remove: noticeRemove
}, },
'1': { '1': {
count: inviteCount, count: inviteCount,
getList: inviteList, getList: inviteList,
read: inviteRead, read: inviteRead,
remove: inviteRemove remove: inviteRemove
} }
} }
function getCount(data) { function getCount(data) {
let sum = 0 let sum = 0
for (let key in data) { for (let key in data) {
sum += data[key] sum += data[key]
} }
return sum return sum
} }
let refreshTimer = null; let refreshTimer = null;
function startRefreshToken(dispatch) { function startRefreshToken(dispatch) {
refreshTimer = setInterval(() => { refreshTimer = setInterval(() => {
dispatch("newsInit"); dispatch("newsInit");
}, website.newsRefreshTime); }, website.newsRefreshTime);
} }
function stopRefreshToken() { function stopRefreshToken() {
clearInterval(refreshTimer) clearInterval(refreshTimer)
} }
const news = { const news = {
state: { state: {
count: 0, count: 0,
data: { data: {
"0": { "0": {
id: "0", id: "0",
title: "消息通知", title: "消息通知",
icon: "../../static/img/notice.svg", icon: "../../static/img/notice.svg",
page: { page: {
current: 0, current: 0,
size, size,
total: size total: size
}, },
data: [], data: [],
prop: { prop: {
title: 'title', title: 'title',
desc: (value) => { desc: (value) => {
if (value.data[0]) if (value.data[0])
return value.data[0][0]['desc'] return value.data[0][0]['desc']
}, },
time: 'createTime', time: 'createTime',
isRead: 'isRead', isRead: 'isRead',
listDesc: 'desc', listDesc: 'desc',
}, },
navigateTo(item) { navigateTo(item) {
uni.$once('getNewsDetail', (cb) => { uni.$once('getNewsDetail', (cb) => {
cb(item) cb(item)
}) })
uni.navigateTo({ uni.navigateTo({
url: "/pages/news/newsDetail?type=0" url: "/pages/news/newsDetail?type=0"
}) })
} }
}, },
"1": { "1": {
id: "1", id: "1",
title: "岗位推送", title: "岗位推送",
icon: "../../static/img/renwu.png", icon: "../../static/img/renwu.png",
page: { page: {
current: 0, current: 0,
size, size,
total: size total: size
}, },
data: [], data: [],
prop: { prop: {
title: 'missionTitle', title: 'missionTitle',
desc: (value) => { desc: (value) => {
if (value.data[0]) if (value.data[0])
return `您收到${value.data[0][0]['companyName']}岗位` return `您收到${value.data[0][0]['companyName']}岗位`
}, },
time: 'createTime', time: 'createTime',
isRead: 'status', isRead: 'status',
listDesc: 'companyName', listDesc: 'companyName',
}, },
navigateTo(item, dispatch) { navigateTo(item, dispatch) {
dispatch('readNew', { dispatch('readNew', {
key: '1', key: '1',
id: item.id id: item.id
}) })
uni.navigateTo({ uni.navigateTo({
url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(item.missionNo)}&id=${encodeURIComponent(item.id)}` url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(item.missionNo)}&id=${encodeURIComponent(item.id)}`
}) })
} }
}, },
"2": { "2": {
id: "1", id: "1",
title: "岗位推送", title: "岗位推送",
icon: "../../static/img/gangwei.svg", icon: "../../static/img/gangwei.svg",
page: { page: {
current: 0, current: 0,
size, size,
total: size total: size
}, },
data: [], data: [],
prop: { prop: {
title: 'missionTitle', title: 'missionTitle',
desc: (value) => { desc: (value) => {
if (value.data[0]) if (value.data[0])
return `您收到${value.data[0][0]['companyName']}的岗位` return `您收到${value.data[0][0]['companyName']}的岗位`
}, },
time: 'createTime', time: 'createTime',
isRead: 'status', isRead: 'status',
listDesc: 'companyName', listDesc: 'companyName',
}, },
navigateTo(item, dispatch) { navigateTo(item, dispatch) {
dispatch('readNew', { dispatch('readNew', {
key: '1', key: '1',
id: item.id id: item.id
}) })
uni.navigateTo({ uni.navigateTo({
url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(item.missionNo)}&id=${encodeURIComponent(item.id)}` url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(item.missionNo)}&id=${encodeURIComponent(item.id)}`
}) })
} }
}, },
// "3": { // "3": {
// id: "1", // id: "1",
// title: "技能推送", // title: "技能推送",
// icon: "../../static/img/jineng.svg", // icon: "../../static/img/jineng.svg",
// page: { // page: {
// current: 0, // current: 0,
// size, // size,
// total: size // total: size
// }, // },
// data: [], // data: [],
// prop: { // prop: {
// title: 'missionTitle', // title: 'missionTitle',
// desc: (value) => { // desc: (value) => {
// if (value.data[0]) // if (value.data[0])
// return `您收到${value.data[0][0]['companyName']}的任务` // return `您收到${value.data[0][0]['companyName']}的任务`
// }, // },
// time: 'createTime', // time: 'createTime',
// isRead: 'status', // isRead: 'status',
// listDesc: 'companyName', // listDesc: 'companyName',
// }, // },
// navigateTo(item, dispatch) { // navigateTo(item, dispatch) {
// dispatch('readNew', { // dispatch('readNew', {
// key: '1', // key: '1',
// id: item.id // id: item.id
// }) // })
// uni.navigateTo({ // uni.navigateTo({
// url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(item.missionNo)}&id=${encodeURIComponent(item.id)}` // url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(item.missionNo)}&id=${encodeURIComponent(item.id)}`
// }) // })
// } // }
// }, // },
"4": { "4": {
id: "1", id: "1",
title: "政策推送", title: "政策推送",
icon: "../../static/img/zhengce.svg", icon: "../../static/img/zhengce.svg",
page: { page: {
current: 0, current: 0,
size, size,
total: size total: size
}, },
data: [], data: [],
prop: { prop: {
title: 'missionTitle', title: 'missionTitle',
desc: (value) => { desc: (value) => {
if (value.data[0]) if (value.data[0])
return `您收到${value.data[0][0]['companyName']}的岗位` return `您收到${value.data[0][0]['companyName']}的岗位`
}, },
time: 'createTime', time: 'createTime',
isRead: 'status', isRead: 'status',
listDesc: 'companyName', listDesc: 'companyName',
}, },
navigateTo(item, dispatch) { navigateTo(item, dispatch) {
dispatch('readNew', { dispatch('readNew', {
key: '1', key: '1',
id: item.id id: item.id
}) })
uni.navigateTo({ uni.navigateTo({
url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(item.missionNo)}&id=${encodeURIComponent(item.id)}` url: `/pages/projectInfo/projectInfo?type=1&missionNo=${encodeURIComponent(item.missionNo)}&id=${encodeURIComponent(item.id)}`
}) })
} }
} }
}, },
unread: { unread: {
"0": 0, "0": 0,
"1": 0 "1": 0
}, },
allUnread: 0, allUnread: 0,
dic: {} dic: {}
}, },
actions: { actions: {
newsInit({ newsInit({
dispatch dispatch
}) { }) {
const ps = [] const ps = []
ps.push(dispatch('getUnreadNum')) ps.push(dispatch('getUnreadNum'))
for (let key in handler) { for (let key in handler) {
ps.push(dispatch('newsReload', key)) ps.push(dispatch('newsReload', key))
} }
return Promise.all(ps) return Promise.all(ps)
}, },
newsReload({ newsReload({
dispatch, dispatch,
commit commit
}, id) { }, id) {
commit('CLEAR_NEWS_DATA', id) commit('CLEAR_NEWS_DATA', id)
return dispatch('newsGetNextPage', id) return dispatch('newsGetNextPage', id)
}, },
getUnreadNum({ getUnreadNum({
commit commit
}) { }) {
for (let key in handler) { for (let key in handler) {
handler[key].count().then((result) => { handler[key].count().then((result) => {
commit('SET_UNREADNUM', { commit('SET_UNREADNUM', {
id: key, id: key,
count: result count: result
}) })
}) })
} }
}, },
newsGetNextPage({ newsGetNextPage({
state, state,
commit commit
}, id) { }, id) {
const item = state.data[id] const item = state.data[id]
const page = item.page const page = item.page
const current = page.current + 1 const current = page.current + 1
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (parseInt(page.total / page.size) + 1 < current) { if (parseInt(page.total / page.size) + 1 < current) {
resolve() resolve()
return return
} }
handler[id].getList(current, page.size).then(res => { handler[id].getList(current, page.size).then(res => {
const data = res.data.data; const data = res.data.data;
commit('ADD_NEWS_DATA', { commit('ADD_NEWS_DATA', {
id, id,
data: data.records, data: data.records,
current, current,
total: data.total total: data.total
}) })
resolve(res) resolve(res)
}).catch(reject) }).catch(reject)
}) })
}, },
removeNew({ removeNew({
commit commit
}, { }, {
id, id,
key, key,
group, group,
index index
}) { }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
commit('REMOVE_NEWS', { commit('REMOVE_NEWS', {
id, id,
key, key,
group, group,
index index
}) })
handler[key].remove(id).then(resolve, reject) handler[key].remove(id).then(resolve, reject)
}) })
}, },
readNew({ readNew({
commit commit
}, { }, {
key, key,
id id
}) { }) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
commit('READ_NEWS', { commit('READ_NEWS', {
key, key,
id id
}) })
handler[key].read(id).then(resolve, reject) handler[key].read(id).then(resolve, reject)
}) })
}, },
endRefreshNewsTimer(){ endRefreshNewsTimer() {
stopRefreshToken() stopRefreshToken()
}, },
startRefreshNewsTimer({ startRefreshNewsTimer({
state, state,
commit, commit,
dispatch dispatch
}) { }) {
console.log('触发2') console.log('触发2')
dispatch('newsInit').then(() => { dispatch('newsInit').then(() => {
startRefreshToken(dispatch); startRefreshToken(dispatch);
}) })
} }
}, },
mutations: { mutations: {
SET_UNREADNUM: (state, { SET_UNREADNUM: (state, {
id, id,
count count
}) => { }) => {
state.unread[id] = count state.unread[id] = count
state.allUnread = getCount(state.unread) state.allUnread = getCount(state.unread)
}, },
CLEAR_NEWS_DATA: (state, id) => { CLEAR_NEWS_DATA: (state, id) => {
state.data[id].page = { state.data[id].page = {
current: 0, current: 0,
size size
} }
state.data[id].data = [] state.data[id].data = []
}, },
ADD_NEWS_DATA: (state, { ADD_NEWS_DATA: (state, {
id, id,
data, data,
current, current,
total total
}) => { }) => {
data.forEach(item => { data.forEach(item => {
state.dic[item.id] = item state.dic[item.id] = item
}) })
state.data[id].page.total = total state.data[id].page.total = total
state.data[id].page.current = current state.data[id].page.current = current
if (data.length > 0) { if (data.length > 0) {
state.data[id].data.push(data) state.data[id].data.push(data)
} }
}, },
REMOVE_NEWS: (state, { REMOVE_NEWS: (state, {
id, id,
key, key,
group, group,
index index
}) => { }) => {
const readProp = state.data[key].prop['isRead'] const readProp = state.data[key].prop['isRead']
if (state.dic[id][readProp] === 0) { if (state.dic[id][readProp] === 0) {
state.unread[key]-- state.unread[key]--
state.allUnread-- state.allUnread--
} }
state.dic[id] = undefined state.dic[id] = undefined
const data = state.data[key].data const data = state.data[key].data
data[group].splice(index, 1) data[group].splice(index, 1)
if (data[group].length === 0) { if (data[group].length === 0) {
data.splice(group, 1) data.splice(group, 1)
} }
}, },
READ_NEWS: (state, { READ_NEWS: (state, {
key, key,
id id
}) => { }) => {
const readProp = state.data[key].prop['isRead'] const readProp = state.data[key].prop['isRead']
if (state.dic[id][readProp] === 0) { if (state.dic[id][readProp] === 0) {
state.dic[id][readProp] = 1 state.dic[id][readProp] = 1
state.unread[key]-- state.unread[key]--
state.allUnread-- state.allUnread--
} }
} }
}, },
getters: { getters: {
} }
}; };
export default news; export default news;

View File

@@ -3,10 +3,10 @@ module.exports = {
port: 1887, port: 1887,
proxy: { proxy: {
'/api': { '/api': {
target: 'http://192.168.1.101:8200', target: 'http://10.165.0.173:8000',
ws: true, ws: true,
pathRewrite: { pathRewrite: {
'^/api/jobslink-api': '/' '^/api': '/'
} }
}, },
'/qq/map': { '/qq/map': {