消息推送,详情页header

This commit is contained in:
熊丽君
2021-08-20 17:36:05 +08:00
parent eb782ddaf4
commit 19f379a826
7 changed files with 168 additions and 44 deletions

16
src/api/home/news.js Normal file
View File

@ -0,0 +1,16 @@
import request from '@/utils/request';
// 消息通知列表
export function getUserMsgPush(params) {
return request({
url: '/mobile/getUserMsgPush',
params
});
}
// 一条消息已读
export function readPush(params) {
return request({
url: '/mobile/readPush',
params
});
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -5,7 +5,7 @@
ref="form" ref="form"
:model="form" :model="form"
:rules="rules" :rules="rules"
label-width="80px" label-width="100px"
style="width:514px" style="width:514px"
> >
<el-form-item label="企业全称"> <el-form-item label="企业全称">
@ -131,11 +131,11 @@ export default {
}, },
optionList1: [ optionList1: [
{ {
value: 1, value: 2,
label: '地级市' label: '地级市'
}, },
{ {
value: 2, value: 3,
label: '合肥区县' label: '合肥区县'
} }
], ],
@ -161,7 +161,7 @@ export default {
userInfo().then(({ data }) => { userInfo().then(({ data }) => {
if (data) { if (data) {
data.addressType = data.addressType - 0; data.addressType = data.addressType - 0;
if (data.addressType == 1) { if (data.addressType == 2) {
this.getType(true, data); this.getType(true, data);
} else { } else {
this.getCity(true, data); this.getCity(true, data);
@ -199,7 +199,7 @@ export default {
handleCity(e) { handleCity(e) {
this.form.cityId = ''; this.form.cityId = '';
// 地级市 // 地级市
if (e === 1) { if (e === 2) {
this.getType(false); this.getType(false);
} else { } else {
this.getCity(false); this.getCity(false);
@ -213,7 +213,7 @@ export default {
if (edit) this.form = info; if (edit) this.form = info;
}); });
}, },
// 获取地级市 // 获取区县
getCity(edit, info) { getCity(edit, info) {
getDictListByStatus({ type: 6 }).then(({ data }) => { getDictListByStatus({ type: 6 }).then(({ data }) => {
this.optionList2 = data; this.optionList2 = data;
@ -266,5 +266,8 @@ export default {
} }
} }
} }
/deep/.el-form-item__label {
font-size: 16px;
}
} }
</style> </style>

View File

@ -38,6 +38,13 @@ export default {
] ]
}; };
}, },
watch: {
$route(newVal, oldVal) {
if (newVal.path === '/mine/info') {
this.index = 0;
}
}
},
methods: { methods: {
async logout() { async logout() {
this.$confirm('确定退出账号吗?', '提示', { this.$confirm('确定退出账号吗?', '提示', {

View File

@ -1,15 +1,17 @@
<template> <template>
<div class="news_page"> <div class="news_page">
<div class="list"> <div class="list">
<div class="item"> <div class="item" v-for="item in newsList" :key="item.id">
<div class="item_icon"> <div class="item_icon">
<div class="red"></div> <div class="red" v-if="!item.status"></div>
</div> </div>
<div class="item_r"> <div class="item_r">
<div class="item_r_t"> <div class="item_r_t">
<div class="flex"> <div class="flex">
<div class="col_333">新政策匹配通知</div> <div class="col_333">新政策匹配通知</div>
<div class="col_999">5-29</div> <div class="col_999">
{{ parseTime(item.createTime, '{m}-{d}') }}
</div>
</div> </div>
</div> </div>
<div class="item_r_b"> <div class="item_r_b">
@ -18,8 +20,14 @@
现有一项新的符合贵公司条件的政策可申报快查看详情吧 现有一项新的符合贵公司条件的政策可申报快查看详情吧
</div> </div>
<!-- 跳转详情 --> <!-- 跳转详情 -->
<router-link to=""> <router-link
<div class="col_333"> target="_blank"
:to="{
path: '/result',
query: { key: 'policy', id: item.policyId }
}"
>
<div class="col_333" @click="handleStatus(item)">
查看详情<i class="el-icon-arrow-right"></i> 查看详情<i class="el-icon-arrow-right"></i>
</div> </div>
</router-link> </router-link>
@ -27,9 +35,48 @@
</div> </div>
</div> </div>
</div> </div>
<pagination
style="background-color:unset"
v-show="total > 0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getNewsList"
/>
</div> </div>
</div> </div>
</template> </template>
<script>
import { getUserMsgPush, readPush } from '@/api/home/news';
export default {
data() {
return {
queryParams: {
pageNum: 1,
pageSize: 10
},
total: 0,
newsList: []
};
},
methods: {
getNewsList() {
getUserMsgPush(this.queryParams).then(({ data }) => {
this.newsList = data.list;
this.total = data.total;
});
},
handleStatus(item) {
readPush({ id: item.id }).then(res => {
item.status = 1;
});
}
},
created() {
this.getNewsList();
}
};
</script>
<style lang="scss" scoped> <style lang="scss" scoped>
.news_page { .news_page {
.list { .list {
@ -39,6 +86,7 @@
padding: 10px; padding: 10px;
border-radius: 10px; border-radius: 10px;
background-color: #fff; background-color: #fff;
margin-bottom: 15px;
.item_icon { .item_icon {
position: relative; position: relative;
margin-right: 15px; margin-right: 15px;

View File

@ -3,8 +3,19 @@
<div class="list" v-for="item in policyList" :key="item.id"> <div class="list" v-for="item in policyList" :key="item.id">
<div class="item"> <div class="item">
<div style="max-width:520px"> <div style="max-width:520px">
<h4 class="pointer text_hidden_one" @click="handleItem(item.id)"> <!-- <h4 class="pointer text_hidden_one" @click="handleItem(item.id)">
{{ item.title }} {{ item.title }}
</h4> -->
<h4 class="pointer text_hidden_one">
<router-link
target="_blank"
:to="{
path: '/result',
query: { key: 'policy', id: item.id }
}"
>
{{ item.title }}
</router-link>
</h4> </h4>
<div class="info"> <div class="info">
<div>来源{{ item.source }}</div> <div>来源{{ item.source }}</div>

View File

@ -5,20 +5,35 @@
<div class="my_header"> <div class="my_header">
<div class="title content p0-100"> <div class="title content p0-100">
<el-row :gutter="20"> <el-row :gutter="20">
<el-col :span="8"><span>嘉策科技创新服务平台</span></el-col> <el-col :span="8">
<el-col :span="8" <!-- <span>嘉策科技创新服务平台</span> -->
><el-input <img
src="@/assets/logo/logo2.png"
alt=""
style="vertical-align: middle;"
/>
</el-col>
<el-col :span="16">
<el-row
style="justify-content: flex-end;height: 100%;align-items: center;padding-right: 30px;"
>
<el-col :span="8">
<div class="search">
<el-input
v-model.trim="input" v-model.trim="input"
placeholder="请输入搜索关键字" placeholder="请输入搜索关键字"
prefix-icon="el-icon-search"
@keyup.enter.native="toSearch" @keyup.enter.native="toSearch"
></el-input ></el-input>
></el-col> <el-button type="warning" @click="toSearch">一站搜</el-button>
<el-col :span="8" style="text-align: right"> </div>
</el-col>
</el-row>
</el-col>
<!-- <el-col :span="8" style="text-align: right">
<span <span
>服务热线<span style="color: #ffa32c">400-0507-580</span></span >服务热线<span style="color: #ffa32c">400-0507-580</span></span
> >
</el-col> </el-col> -->
</el-row> </el-row>
</div> </div>
</div> </div>
@ -98,7 +113,7 @@
target="_blank" target="_blank"
:to="{ :to="{
path: '/result', path: '/result',
query: { key: 'policy', id: item.id }, query: { key: 'policy', id: item.id }
}" }"
> >
<span></span>{{ item.title }} <span></span>{{ item.title }}
@ -174,7 +189,7 @@ import {
getPolicyReadInfo, getPolicyReadInfo,
getInfo, getInfo,
getInfo2, getInfo2,
getInfo3, getInfo3
} from '@/api/search'; } from '@/api/search';
import { getPolicyList, getRead } from '@/api/home/notice'; import { getPolicyList, getRead } from '@/api/home/notice';
import { mapGetters } from 'vuex'; import { mapGetters } from 'vuex';
@ -182,7 +197,7 @@ import { add, cancel } from '@/api/search';
import Editor from '@/components/Editor'; import Editor from '@/components/Editor';
export default { export default {
components: { components: {
Editor, Editor
}, },
data() { data() {
return { return {
@ -190,7 +205,7 @@ export default {
type: '', type: '',
formData: {}, formData: {},
noticeList: [], noticeList: [],
total: {}, total: {}
}; };
}, },
watch: { watch: {
@ -199,34 +214,34 @@ export default {
this.$nextTick(() => { this.$nextTick(() => {
this.formatRichText(this.formData.downloadUrl, this.formData.id); this.formatRichText(this.formData.downloadUrl, this.formData.id);
}); });
}
}, },
}, deep: true
deep: true,
}, },
computed: { computed: {
...mapGetters(['token']), ...mapGetters(['token'])
}, },
methods: { methods: {
toSearch() { toSearch() {
if (!this.input.length) return this.msgError('请输入搜索关键字'); if (!this.input.length) return this.msgError('请输入搜索关键字');
let routerJump = this.$router.resolve({ let routerJump = this.$router.resolve({
path: '/search', path: '/search',
query: { val: this.input }, query: { val: this.input }
}); });
window.open(routerJump.href, '_blank'); window.open(routerJump.href, '_blank');
}, },
addItem() { addItem() {
add({ policyId: this.formData.id }).then((res) => { add({ policyId: this.formData.id }).then(res => {
this.formData.collected = 1; this.formData.collected = 1;
this.msgSuccess('操作成功'); this.msgSuccess('操作成功');
}); });
}, },
cancelItem() { cancelItem() {
cancel({ policyId: this.formData.id }).then((res) => { cancel({ policyId: this.formData.id }).then(res => {
this.formData.collected = 0; this.formData.collected = 0;
this.msgSuccess('操作成功'); this.msgSuccess('操作成功');
}); });
}, }
}, },
created() { created() {
let { key, id } = this.$route.query; let { key, id } = this.$route.query;
@ -263,7 +278,7 @@ export default {
getPolicyList({ pageNum: 1, pageSize: 5 }).then(({ data }) => { getPolicyList({ pageNum: 1, pageSize: 5 }).then(({ data }) => {
this.noticeList = data.list; this.noticeList = data.list;
}); });
}, }
}; };
</script> </script>
@ -292,11 +307,35 @@ export default {
position: fixed; position: fixed;
z-index: 1; z-index: 1;
width: 100%; width: 100%;
height: 46px; height: 48px;
line-height: 46px; line-height: 48px;
background: #3d3e3e; background: #3d3e3e;
.title { .title {
color: #fff; color: #fff;
.el-row {
display: flex;
.search {
align-items: center;
display: flex;
height: 30px;
overflow: hidden;
/deep/input {
color: #fff;
border-left: 0;
border-right: 0;
border-radius: 6px 0 0 6px;
background-color: rgba(255, 255, 255, 0.2);
}
.el-button {
height: 30px;
border-top-left-radius: 0;
border-bottom-left-radius: 0;
background-color: #ffa32c;
font-size: 16px;
padding: 0 16px;
}
}
}
} }
} }
.my_main { .my_main {