diff --git a/ebts-ui/src/api/system/notice.js b/ebts-ui/src/api/system/notice.js index c274ea5..c11bc04 100644 --- a/ebts-ui/src/api/system/notice.js +++ b/ebts-ui/src/api/system/notice.js @@ -8,6 +8,35 @@ export function listNotice(query) { params: query }) } +// 查询公告列表 +export function getFiche() { + return request({ + url: '/system/notice/fiche', + method: 'get', + }) +} +// 查询公告列表 +export function getInform() { + return request({ + url: '/system/notice/inform', + method: 'get', + }) +} + +// 查询公告列表 +export function read(noticeId) { + return request({ + url: '/system/notice/read/'+noticeId, + method: 'post', + }) +} +// 查询公告列表 +export function userDel(noticeId) { + return request({ + url: '/system/notice/del/'+noticeId, + method: 'delete', + }) +} // 查询公告详细 export function getNotice(noticeId) { @@ -41,4 +70,4 @@ export function delNotice(noticeId) { url: '/system/notice/' + noticeId, method: 'delete' }) -} \ No newline at end of file +} diff --git a/ebts-ui/src/layout/components/Navbar.vue b/ebts-ui/src/layout/components/Navbar.vue index ce9b8c5..6a97821 100644 --- a/ebts-ui/src/layout/components/Navbar.vue +++ b/ebts-ui/src/layout/components/Navbar.vue @@ -1,49 +1,80 @@ @@ -55,6 +86,7 @@ import Hamburger from '@/components/Hamburger' import Screenfull from '@/components/Screenfull' import SizeSelect from '@/components/SizeSelect' import Search from '@/components/HeaderSearch' +import { getFiche, getInform, getNotice, read, userDel } from '@/api/system/notice' export default { components: { @@ -62,7 +94,7 @@ export default { Hamburger, Screenfull, SizeSelect, - Search, + Search }, computed: { ...mapGetters([ @@ -83,11 +115,91 @@ export default { }, topNav: { get() { - return this.$store.state.settings.topNav; - }, - }, + return this.$store.state.settings.topNav + } + } + }, + data() { + return { + // 弹出层标题 + title: '', + // 是否显示弹出层 + open: false, + noticeState: false, + fiche: {}, + notice: {}, + informList: [] + } + }, + mounted() { + + let notice_text = document.getElementById('notice_text') + notice_text.addEventListener('webkitAnimationEnd', function() { + this.style.marginLeft = 0 + }, false) + this.initFiche() + this.initInform() }, methods: { + userDelNotice(id,type) { + userDel(id) + setTimeout(()=>{ + if (type != '1'){ + this.initFiche() + }else { + this.initInform() + } + },300) + this.open = false + }, + initInform(){ + this.noticeState = false + this.informList = [] + getInform().then(res=>{ + let data = res.data + for (let datum of data) { + if (datum.status == "1"){ + this.noticeState = true; + } + } + this.informList = data + }) + }, + initFiche() { + getFiche().then(res => { + let data = res.data + if (data){ + this.fiche = data + }else { + this.fiche.noticeTitle = "" + } + }) + }, + noticeClick(noticeId,type) { + getNotice(noticeId).then(res => { + this.notice = res.data + }) + this.open = true + read(noticeId) + setTimeout(()=>{ + if (type != '1'){ + this.initFiche() + }else { + this.initInform() + } + },300) + }, + handleClickBellBlock() { + let bell_block = document.getElementById('bell_block') + bell_block.style.display = 'block' + }, + closeBellBlock() { + let bell_block = document.getElementById('bell_block') + bell_block.style.display = 'none' + // bell_block.onblur = function(){ + // bell_block.style.display='none'; + // } + }, toggleSideBar() { this.$store.dispatch('app/toggleSideBar') }, @@ -100,41 +212,153 @@ export default { // this.$store.dispatch('LogOut').then(() => { // location.href = '/index'; // } - this.$store.dispatch("LogOut").then(() => { + this.$store.dispatch('LogOut').then(() => { if (!settings.casEnable) { - location.href = this.$router.options.base + "/index"; + location.href = this.$router.options.base + '/index' } - }); + }) }) } } } -