6 changed files with 563 additions and 502 deletions
-
15src/api/storeManage/taskManage/index.js
-
164src/api/system/user.js
-
683src/layout/components/Navbar.vue
-
68src/views/storeManage/taskManage/index.vue
-
40src/views/storeManage/taskManage/module/detail.vue
-
95src/views/system/user/messageCenter/index.vue
@ -1,73 +1,91 @@ |
|||||
import request from '@/utils/request' |
|
||||
import { encrypt } from '@/utils/rsaEncrypt' |
|
||||
import { getToken } from '@/utils/auth' |
|
||||
|
|
||||
export function add(data) { |
|
||||
return request({ |
|
||||
url: 'api/users', |
|
||||
method: 'post', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function del(ids) { |
|
||||
return request({ |
|
||||
url: 'api/users', |
|
||||
method: 'delete', |
|
||||
data: ids |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function edit(data) { |
|
||||
return request({ |
|
||||
url: 'api/users', |
|
||||
method: 'put', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function editUser(data) { |
|
||||
return request({ |
|
||||
url: 'api/users/center', |
|
||||
method: 'put', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function updatePass(user) { |
|
||||
const data = { |
|
||||
oldPass: encrypt(user.oldPass), |
|
||||
newPass: encrypt(user.newPass) |
|
||||
} |
|
||||
return request({ |
|
||||
url: 'api/users/updatePass/', |
|
||||
method: 'post', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function updateEmail(form) { |
|
||||
const data = { |
|
||||
password: encrypt(form.pass), |
|
||||
email: form.email |
|
||||
} |
|
||||
return request({ |
|
||||
url: 'api/users/updateEmail/' + form.code, |
|
||||
method: 'post', |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export function resetpassword(data) { |
|
||||
return request({ |
|
||||
url: 'api/users/resetpassword', |
|
||||
method: 'post', |
|
||||
headers: { |
|
||||
Authorization: getToken() |
|
||||
}, |
|
||||
data |
|
||||
}) |
|
||||
} |
|
||||
|
|
||||
export default { add, edit, del, resetpassword } |
|
||||
|
|
||||
|
import request from '@/utils/request' |
||||
|
import { encrypt } from '@/utils/rsaEncrypt' |
||||
|
import { getToken } from '@/utils/auth' |
||||
|
|
||||
|
export function add(data) { |
||||
|
return request({ |
||||
|
url: 'api/users', |
||||
|
method: 'post', |
||||
|
data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
export function del(ids) { |
||||
|
return request({ |
||||
|
url: 'api/users', |
||||
|
method: 'delete', |
||||
|
data: ids |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
export function edit(data) { |
||||
|
return request({ |
||||
|
url: 'api/users', |
||||
|
method: 'put', |
||||
|
data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
export function editUser(data) { |
||||
|
return request({ |
||||
|
url: 'api/users/center', |
||||
|
method: 'put', |
||||
|
data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
export function updatePass(user) { |
||||
|
const data = { |
||||
|
oldPass: encrypt(user.oldPass), |
||||
|
newPass: encrypt(user.newPass) |
||||
|
} |
||||
|
return request({ |
||||
|
url: 'api/users/updatePass/', |
||||
|
method: 'post', |
||||
|
data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
export function updateEmail(form) { |
||||
|
const data = { |
||||
|
password: encrypt(form.pass), |
||||
|
email: form.email |
||||
|
} |
||||
|
return request({ |
||||
|
url: 'api/users/updateEmail/' + form.code, |
||||
|
method: 'post', |
||||
|
data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
export function resetpassword(data) { |
||||
|
return request({ |
||||
|
url: 'api/users/resetpassword', |
||||
|
method: 'post', |
||||
|
headers: { |
||||
|
Authorization: getToken() |
||||
|
}, |
||||
|
data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 我得消息
|
||||
|
export function FetchMyNotice(params) { |
||||
|
return request({ |
||||
|
url: 'api/users/myNotice', |
||||
|
method: 'get', |
||||
|
params |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
// 我得消息全部标记已读
|
||||
|
export function FetchMyReadAll(data) { |
||||
|
return request({ |
||||
|
url: 'api/users/myReadAll', |
||||
|
method: 'put', |
||||
|
data |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
export default { add, edit, del, resetpassword, FetchMyNotice, FetchMyReadAll } |
||||
|
|
@ -1,341 +1,342 @@ |
|||||
<template> |
|
||||
<div class="navbar"> |
|
||||
<!-- <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> --> |
|
||||
|
|
||||
<!-- <breadcrumb id="breadcrumb-container" class="breadcrumb-container" /> --> |
|
||||
<logo v-if="showLogo" :collapse="isCollapse" /> |
|
||||
|
|
||||
<div class="right-menu"> |
|
||||
<!-- <template v-if="device!=='mobile'"> |
|
||||
<search id="header-search" class="right-menu-item" /> |
|
||||
|
|
||||
<el-tooltip content="项目文档" effect="dark" placement="bottom"> |
|
||||
<Doc class="right-menu-item hover-effect" /> |
|
||||
</el-tooltip> |
|
||||
|
|
||||
<el-tooltip content="全屏缩放" effect="dark" placement="bottom"> |
|
||||
<screenfull id="screenfull" class="right-menu-item hover-effect" /> |
|
||||
</el-tooltip> |
|
||||
|
|
||||
<el-tooltip content="布局设置" effect="dark" placement="bottom"> |
|
||||
<size-select id="size-select" class="right-menu-item hover-effect" /> |
|
||||
</el-tooltip> |
|
||||
</template> --> |
|
||||
<!-- <div class="message-center"> |
|
||||
<span class="iconfont icon-xiaoxi" /> |
|
||||
</div> --> |
|
||||
|
|
||||
<!-- 消息中心 --> |
|
||||
<el-dropdown ref="messageDrop" class="message-center right-menu-item hover-effect" trigger="click"> |
|
||||
<div class="message-icon"> |
|
||||
<span class="iconfont icon-xiaoxi" /> |
|
||||
<i v-if="msgList.length > 0" class="message-num">{{ msgList.length }}</i> |
|
||||
</div> |
|
||||
<el-dropdown-menu slot="dropdown" class="message-dropdown" style="width: 420px;"> |
|
||||
<div style="display: flex; justify-content: flex-end; padding: 0 20px; height: 40px; line-height: 40px; color: #339CFF; font-size: 14px; border-bottom: 1px solid #339CFF;"> |
|
||||
<span style="cursor: pointer;" @click="handleAllRead">全部标记为已读</span> |
|
||||
<!-- 消息中心router --> |
|
||||
<span style="color:#fff; margin-left: 10px; cursor: pointer;" @click="toAllMessage">去查看</span> |
|
||||
</div> |
|
||||
<div style="max-height: 450px; overflow: hidden; overflow-y: scroll;"> |
|
||||
<el-dropdown-item v-if="msgList.length===0" class="message-list-item"> |
|
||||
<div style="text-align:center">暂无最新消息</div> |
|
||||
</el-dropdown-item> |
|
||||
<el-dropdown-item v-for="(item,index) in msgList" :key="index" class="message-list-item"> |
|
||||
<router-link :to="{ path: '/user/center', query: { activeIndex: 1 }}"> |
|
||||
<p>{{ item.noticeContent }}</p> |
|
||||
<span>{{ item.create_time | parseTime }}</span> |
|
||||
<i class="el-icon-arrow-right" /> |
|
||||
</router-link> |
|
||||
</el-dropdown-item> |
|
||||
</div> |
|
||||
</el-dropdown-menu> |
|
||||
</el-dropdown> |
|
||||
|
|
||||
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> |
|
||||
<div class="avatar-wrapper"> |
|
||||
<div class="user-img-cover"> |
|
||||
<img :src="user.avatarName ? baseApi + '/avatar/' + user.avatarName : Avatar" class="user-avatar" :onerror="defaultImg"> |
|
||||
</div> |
|
||||
<i class="el-icon-caret-bottom" /> |
|
||||
</div> |
|
||||
<el-dropdown-menu slot="dropdown"> |
|
||||
<!-- <span style="display:block;" @click="show = true"> |
|
||||
<el-dropdown-item> |
|
||||
布局设置 |
|
||||
</el-dropdown-item> |
|
||||
</span> --> |
|
||||
<!-- <router-link to="/user/center"> --> |
|
||||
<router-link :to="{ path: '/user/center', query: { activeIndex: 0 }}"> |
|
||||
<el-dropdown-item> |
|
||||
个人中心 |
|
||||
</el-dropdown-item> |
|
||||
</router-link> |
|
||||
<router-link :to="{ path: '/user/center', query: { activeIndex: 1 }}"> |
|
||||
<el-dropdown-item divided> |
|
||||
我的消息 |
|
||||
</el-dropdown-item> |
|
||||
</router-link> |
|
||||
<span style="display:block;" @click="logoutVisible=true"> |
|
||||
<el-dropdown-item divided> |
|
||||
退出登录 |
|
||||
</el-dropdown-item> |
|
||||
</span> |
|
||||
</el-dropdown-menu> |
|
||||
</el-dropdown> |
|
||||
</div> |
|
||||
|
|
||||
<!-- 退出登录 --> |
|
||||
<el-dialog title="退出登录" :modal-append-to-body="false" :close-on-click-modal="false" :visible.sync="logoutVisible" :before-close="handleClose"> |
|
||||
<span class="dialog-right-top" /> |
|
||||
<span class="dialog-left-bottom" /> |
|
||||
<div class="setting-dialog"> |
|
||||
<div class="dialog-delt"> |
|
||||
<p><span>确定注销并退出系统吗?</span></p> |
|
||||
</div> |
|
||||
<div slot="footer" class="dialog-footer"> |
|
||||
<el-button @click="logoutVisible = false">取消</el-button> |
|
||||
<el-button type="primary" @click="logout">确定</el-button> |
|
||||
</div> |
|
||||
</div> |
|
||||
</el-dialog> |
|
||||
</div> |
|
||||
</template> |
|
||||
|
|
||||
<script> |
|
||||
import { mapGetters } from 'vuex' |
|
||||
import Logo from '@/layout/components/Sidebar/Logo' |
|
||||
// import Breadcrumb from '@/components/Breadcrumb' |
|
||||
// import Hamburger from '@/components/Hamburger' |
|
||||
// import Doc from '@/components/Doc' |
|
||||
// import Screenfull from '@/components/Screenfull' |
|
||||
// import SizeSelect from '@/components/SizeSelect' |
|
||||
// import Search from '@/components/HeaderSearch' |
|
||||
import Avatar from '@/assets/images/avatar.png' |
|
||||
import { getUserNotice, isread } from '@/api/system/logs' |
|
||||
|
|
||||
export default { |
|
||||
inject: ['reload'], |
|
||||
components: { |
|
||||
// Breadcrumb, |
|
||||
// Hamburger, |
|
||||
// Screenfull, |
|
||||
// SizeSelect, |
|
||||
// Search, |
|
||||
// Doc, |
|
||||
Logo |
|
||||
}, |
|
||||
data() { |
|
||||
return { |
|
||||
Avatar: Avatar, |
|
||||
defaultImg: 'this.src="' + require('@/assets/images/avatar.png') + '"', |
|
||||
logoutVisible: false, |
|
||||
msgList: [] |
|
||||
} |
|
||||
}, |
|
||||
|
|
||||
computed: { |
|
||||
...mapGetters([ |
|
||||
'sidebar', |
|
||||
'device', |
|
||||
'user', |
|
||||
'baseApi' |
|
||||
]), |
|
||||
show: { |
|
||||
get() { |
|
||||
return this.$store.state.settings.showSettings |
|
||||
}, |
|
||||
set(val) { |
|
||||
this.$store.dispatch('settings/changeSetting', { |
|
||||
key: 'showSettings', |
|
||||
value: val |
|
||||
}) |
|
||||
} |
|
||||
}, |
|
||||
showLogo() { |
|
||||
return this.$store.state.settings.sidebarLogo |
|
||||
}, |
|
||||
isCollapse() { |
|
||||
return !this.sidebar.opened |
|
||||
} |
|
||||
}, |
|
||||
created() { |
|
||||
this.getMsgList() |
|
||||
}, |
|
||||
methods: { |
|
||||
// 获取未读消息 |
|
||||
async getMsgList() { |
|
||||
const params = { |
|
||||
page: 0, |
|
||||
size: 10, |
|
||||
// createTime: [], |
|
||||
sort: 'createTime,desc' |
|
||||
} |
|
||||
const list = [] |
|
||||
const allList = await this.getAllNoRead(params, list) |
|
||||
allList.forEach(item => { |
|
||||
item.pushUserName = item.noticeUsers[0].pushUserName |
|
||||
item.isRead = item.noticeUsers[0].isRead |
|
||||
}) |
|
||||
const arr = allList.filter(item => { return !item.isRead }) |
|
||||
if (arr.length > 20) { |
|
||||
this.msgList = arr.slice(0, 20) |
|
||||
} else { |
|
||||
this.msgList = arr |
|
||||
} |
|
||||
}, |
|
||||
// 全部已读 |
|
||||
async handleAllRead() { |
|
||||
const params = { |
|
||||
page: 0, |
|
||||
size: 10, |
|
||||
// createTime: [], |
|
||||
sort: 'createTime,desc' |
|
||||
} |
|
||||
const list = [] |
|
||||
const ids = [] |
|
||||
const allList = await this.getAllNoRead(params, list) |
|
||||
allList.forEach(item => { |
|
||||
item.noticeUsers.forEach(i => { |
|
||||
ids.push(i.id) |
|
||||
}) |
|
||||
}) |
|
||||
isread(ids).then(res => { |
|
||||
if (res) { |
|
||||
this.msgList = [] |
|
||||
// this.$router.go(0) |
|
||||
if (this.$route.path.includes('user/center') || this.$route.path.includes('system/notifyManage')) { |
|
||||
this.reload() |
|
||||
} |
|
||||
} |
|
||||
}) |
|
||||
}, |
|
||||
// 递归获取所有消息列表 |
|
||||
async getAllNoRead(params, list) { |
|
||||
const allList = await getUserNotice(params).then(res => { |
|
||||
list = list.concat(res.content) |
|
||||
if ((list.length) < res.totalElements) { |
|
||||
params.page++ |
|
||||
return this.getAllNoRead(params, list) |
|
||||
} else { |
|
||||
return list |
|
||||
} |
|
||||
}) |
|
||||
return allList |
|
||||
}, |
|
||||
toggleSideBar() { |
|
||||
this.$store.dispatch('app/toggleSideBar') |
|
||||
}, |
|
||||
toAllMessage() { |
|
||||
// this.$router.push('/system/messageCenter') |
|
||||
this.$router.push({ path: '/user/center', query: { activeIndex: 1 }}) |
|
||||
this.$refs.messageDrop.hide() |
|
||||
}, |
|
||||
// open() { |
|
||||
// this.$confirm('确定注销并退出系统吗?', '提示', { |
|
||||
// confirmButtonText: '确定', |
|
||||
// cancelButtonText: '取消', |
|
||||
// type: 'warning' |
|
||||
// }).then(() => { |
|
||||
// this.logout() |
|
||||
// }) |
|
||||
// }, |
|
||||
logout() { |
|
||||
this.$store.dispatch('LogOut').then(() => { |
|
||||
location.reload() |
|
||||
}) |
|
||||
}, |
|
||||
handleClose(done) { |
|
||||
done() |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
</script> |
|
||||
<style lang="scss" scoped> |
|
||||
.navbar { |
|
||||
display: flex; |
|
||||
justify-content: space-between; |
|
||||
width: 100%; |
|
||||
height: 100px; |
|
||||
overflow: hidden; |
|
||||
position: relative; |
|
||||
// background: #fff; |
|
||||
// box-shadow: 0 1px 4px rgba(0,21,41,.08); |
|
||||
box-shadow: 5px 2px 10px 1px rgba(15,164,222,0.16); |
|
||||
|
|
||||
.hamburger-container { |
|
||||
line-height: 46px; |
|
||||
height: 100%; |
|
||||
float: left; |
|
||||
cursor: pointer; |
|
||||
transition: background .3s; |
|
||||
-webkit-tap-highlight-color:transparent; |
|
||||
|
|
||||
&:hover { |
|
||||
background: rgba(0, 0, 0, .025) |
|
||||
} |
|
||||
} |
|
||||
|
|
||||
.errLog-container { |
|
||||
display: inline-block; |
|
||||
vertical-align: top; |
|
||||
} |
|
||||
|
|
||||
.right-menu { |
|
||||
// height: 100%; |
|
||||
display: flex; |
|
||||
padding-top: 25px; |
|
||||
line-height: 50px; |
|
||||
|
|
||||
&:focus { |
|
||||
outline: none; |
|
||||
} |
|
||||
|
|
||||
.right-menu-item { |
|
||||
display: inline-block; |
|
||||
padding: 0 8px; |
|
||||
height: 100%; |
|
||||
font-size: 18px; |
|
||||
color: #5a5e66; |
|
||||
vertical-align: text-bottom; |
|
||||
|
|
||||
&.hover-effect { |
|
||||
cursor: pointer; |
|
||||
transition: background .3s; |
|
||||
|
|
||||
&:hover { |
|
||||
background: rgba(0, 0, 0, .025) |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
.message-center{ |
|
||||
margin-right: 26px; |
|
||||
margin-top: 4px; |
|
||||
} |
|
||||
.avatar-container { |
|
||||
margin-right: 60px; |
|
||||
.avatar-wrapper { |
|
||||
margin-top: 5px; |
|
||||
position: relative; |
|
||||
.user-img-cover{ |
|
||||
width: 40px; |
|
||||
height: 40px; |
|
||||
} |
|
||||
.user-avatar { |
|
||||
cursor: pointer; |
|
||||
width: 40px; |
|
||||
height: 40px; |
|
||||
border-radius: 10px; |
|
||||
} |
|
||||
.el-icon-caret-bottom { |
|
||||
cursor: pointer; |
|
||||
position: absolute; |
|
||||
right: -20px; |
|
||||
top: 25px; |
|
||||
font-size: 12px; |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
} |
|
||||
</style> |
|
||||
|
<template> |
||||
|
<div class="navbar"> |
||||
|
<!-- <hamburger id="hamburger-container" :is-active="sidebar.opened" class="hamburger-container" @toggleClick="toggleSideBar" /> --> |
||||
|
|
||||
|
<!-- <breadcrumb id="breadcrumb-container" class="breadcrumb-container" /> --> |
||||
|
<logo v-if="showLogo" :collapse="isCollapse" /> |
||||
|
|
||||
|
<div class="right-menu"> |
||||
|
<!-- <template v-if="device!=='mobile'"> |
||||
|
<search id="header-search" class="right-menu-item" /> |
||||
|
|
||||
|
<el-tooltip content="项目文档" effect="dark" placement="bottom"> |
||||
|
<Doc class="right-menu-item hover-effect" /> |
||||
|
</el-tooltip> |
||||
|
|
||||
|
<el-tooltip content="全屏缩放" effect="dark" placement="bottom"> |
||||
|
<screenfull id="screenfull" class="right-menu-item hover-effect" /> |
||||
|
</el-tooltip> |
||||
|
|
||||
|
<el-tooltip content="布局设置" effect="dark" placement="bottom"> |
||||
|
<size-select id="size-select" class="right-menu-item hover-effect" /> |
||||
|
</el-tooltip> |
||||
|
</template> --> |
||||
|
<!-- <div class="message-center"> |
||||
|
<span class="iconfont icon-xiaoxi" /> |
||||
|
</div> --> |
||||
|
|
||||
|
<!-- 消息中心 --> |
||||
|
<el-dropdown ref="messageDrop" class="message-center right-menu-item hover-effect" trigger="click"> |
||||
|
<div class="message-icon"> |
||||
|
<span class="iconfont icon-xiaoxi" /> |
||||
|
<i v-if="msgList.length > 0" class="message-num">{{ msgList.length }}</i> |
||||
|
</div> |
||||
|
<el-dropdown-menu slot="dropdown" class="message-dropdown" style="width: 420px;"> |
||||
|
<div style="display: flex; justify-content: flex-end; padding: 0 20px; height: 40px; line-height: 40px; color: #339CFF; font-size: 14px; border-bottom: 1px solid #339CFF;"> |
||||
|
<span style="cursor: pointer;" @click="handleAllRead">全部标记为已读</span> |
||||
|
<!-- 消息中心router --> |
||||
|
<span style="color:#fff; margin-left: 10px; cursor: pointer;" @click="toAllMessage">去查看</span> |
||||
|
</div> |
||||
|
<div style="max-height: 450px; overflow: hidden; overflow-y: scroll;"> |
||||
|
<el-dropdown-item v-if="msgList.length===0" class="message-list-item"> |
||||
|
<div style="text-align:center">暂无最新消息</div> |
||||
|
</el-dropdown-item> |
||||
|
<el-dropdown-item v-for="(item,index) in msgList" :key="index" class="message-list-item"> |
||||
|
<router-link :to="{ path: '/user/center', query: { activeIndex: 1 }}"> |
||||
|
<p>{{ item.noticeContent }}</p> |
||||
|
<span>{{ item.createTime | parseTime }}</span> |
||||
|
<i class="el-icon-arrow-right" /> |
||||
|
</router-link> |
||||
|
</el-dropdown-item> |
||||
|
</div> |
||||
|
</el-dropdown-menu> |
||||
|
</el-dropdown> |
||||
|
|
||||
|
<el-dropdown class="avatar-container right-menu-item hover-effect" trigger="click"> |
||||
|
<div class="avatar-wrapper"> |
||||
|
<div class="user-img-cover"> |
||||
|
<img :src="user.avatarName ? baseApi + '/avatar/' + user.avatarName : Avatar" class="user-avatar" :onerror="defaultImg"> |
||||
|
</div> |
||||
|
<i class="el-icon-caret-bottom" /> |
||||
|
</div> |
||||
|
<el-dropdown-menu slot="dropdown"> |
||||
|
<!-- <span style="display:block;" @click="show = true"> |
||||
|
<el-dropdown-item> |
||||
|
布局设置 |
||||
|
</el-dropdown-item> |
||||
|
</span> --> |
||||
|
<!-- <router-link to="/user/center"> --> |
||||
|
<router-link :to="{ path: '/user/center', query: { activeIndex: 0 }}"> |
||||
|
<el-dropdown-item> |
||||
|
个人中心 |
||||
|
</el-dropdown-item> |
||||
|
</router-link> |
||||
|
<router-link :to="{ path: '/user/center', query: { activeIndex: 1 }}"> |
||||
|
<el-dropdown-item divided> |
||||
|
我的消息 |
||||
|
</el-dropdown-item> |
||||
|
</router-link> |
||||
|
<span style="display:block;" @click="logoutVisible=true"> |
||||
|
<el-dropdown-item divided> |
||||
|
退出登录 |
||||
|
</el-dropdown-item> |
||||
|
</span> |
||||
|
</el-dropdown-menu> |
||||
|
</el-dropdown> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 退出登录 --> |
||||
|
<el-dialog title="退出登录" :modal-append-to-body="false" :close-on-click-modal="false" :visible.sync="logoutVisible" :before-close="handleClose"> |
||||
|
<span class="dialog-right-top" /> |
||||
|
<span class="dialog-left-bottom" /> |
||||
|
<div class="setting-dialog"> |
||||
|
<div class="dialog-delt"> |
||||
|
<p><span>确定注销并退出系统吗?</span></p> |
||||
|
</div> |
||||
|
<div slot="footer" class="dialog-footer"> |
||||
|
<el-button @click="logoutVisible = false">取消</el-button> |
||||
|
<el-button type="primary" @click="logout">确定</el-button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</el-dialog> |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { mapGetters } from 'vuex' |
||||
|
import Logo from '@/layout/components/Sidebar/Logo' |
||||
|
// import Breadcrumb from '@/components/Breadcrumb' |
||||
|
// import Hamburger from '@/components/Hamburger' |
||||
|
// import Doc from '@/components/Doc' |
||||
|
// import Screenfull from '@/components/Screenfull' |
||||
|
// import SizeSelect from '@/components/SizeSelect' |
||||
|
// import Search from '@/components/HeaderSearch' |
||||
|
import Avatar from '@/assets/images/avatar.png' |
||||
|
// import { isread } from '@/api/system/logs' |
||||
|
import { FetchMyNotice, FetchMyReadAll } from '@/api/system/user' |
||||
|
|
||||
|
export default { |
||||
|
inject: ['reload'], |
||||
|
components: { |
||||
|
// Breadcrumb, |
||||
|
// Hamburger, |
||||
|
// Screenfull, |
||||
|
// SizeSelect, |
||||
|
// Search, |
||||
|
// Doc, |
||||
|
Logo |
||||
|
}, |
||||
|
data() { |
||||
|
return { |
||||
|
Avatar: Avatar, |
||||
|
defaultImg: 'this.src="' + require('@/assets/images/avatar.png') + '"', |
||||
|
logoutVisible: false, |
||||
|
msgList: [] |
||||
|
} |
||||
|
}, |
||||
|
|
||||
|
computed: { |
||||
|
...mapGetters([ |
||||
|
'sidebar', |
||||
|
'device', |
||||
|
'user', |
||||
|
'baseApi' |
||||
|
]), |
||||
|
show: { |
||||
|
get() { |
||||
|
return this.$store.state.settings.showSettings |
||||
|
}, |
||||
|
set(val) { |
||||
|
this.$store.dispatch('settings/changeSetting', { |
||||
|
key: 'showSettings', |
||||
|
value: val |
||||
|
}) |
||||
|
} |
||||
|
}, |
||||
|
showLogo() { |
||||
|
return this.$store.state.settings.sidebarLogo |
||||
|
}, |
||||
|
isCollapse() { |
||||
|
return !this.sidebar.opened |
||||
|
} |
||||
|
}, |
||||
|
created() { |
||||
|
this.getMsgList() |
||||
|
}, |
||||
|
methods: { |
||||
|
// 获取未读消息 |
||||
|
async getMsgList() { |
||||
|
const params = { |
||||
|
page: 0, |
||||
|
size: 10 |
||||
|
// createTime: [], |
||||
|
// sort: 'createTime,desc' |
||||
|
} |
||||
|
const list = [] |
||||
|
const allList = await this.getAllNoRead(params, list) |
||||
|
// allList.forEach(item => { |
||||
|
// item.pushUserName = item.noticeUsers[0].pushUserName |
||||
|
// item.isRead = item.noticeUsers[0].isRead |
||||
|
// }) |
||||
|
const arr = allList.filter(item => { return !item.isRead }) |
||||
|
if (arr.length > 20) { |
||||
|
this.msgList = arr.slice(0, 20) |
||||
|
} else { |
||||
|
this.msgList = arr |
||||
|
} |
||||
|
}, |
||||
|
// 全部已读 |
||||
|
async handleAllRead() { |
||||
|
// const params = { |
||||
|
// page: 0, |
||||
|
// size: 10 |
||||
|
// // createTime: [], |
||||
|
// // sort: 'createTime,desc' |
||||
|
// } |
||||
|
// const list = [] |
||||
|
// const ids = [] |
||||
|
// const allList = await this.getAllNoRead(params, list) |
||||
|
// allList.forEach(item => { |
||||
|
// item.noticeUsers.forEach(i => { |
||||
|
// ids.push(i.id) |
||||
|
// }) |
||||
|
// }) |
||||
|
FetchMyReadAll().then(res => { |
||||
|
if (res) { |
||||
|
this.msgList = [] |
||||
|
// this.$router.go(0) |
||||
|
if (this.$route.path.includes('user/center') || this.$route.path.includes('system/notifyManage')) { |
||||
|
this.reload() |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, |
||||
|
// 递归获取所有消息列表 |
||||
|
async getAllNoRead(params, list) { |
||||
|
const allList = await FetchMyNotice(params).then(res => { |
||||
|
list = list.concat(res.content) |
||||
|
if ((list.length) < res.totalElements) { |
||||
|
params.page++ |
||||
|
return this.getAllNoRead(params, list) |
||||
|
} else { |
||||
|
return list |
||||
|
} |
||||
|
}) |
||||
|
return allList |
||||
|
}, |
||||
|
toggleSideBar() { |
||||
|
this.$store.dispatch('app/toggleSideBar') |
||||
|
}, |
||||
|
toAllMessage() { |
||||
|
// this.$router.push('/system/messageCenter') |
||||
|
this.$router.push({ path: '/user/center', query: { activeIndex: 1 }}) |
||||
|
this.$refs.messageDrop.hide() |
||||
|
}, |
||||
|
// open() { |
||||
|
// this.$confirm('确定注销并退出系统吗?', '提示', { |
||||
|
// confirmButtonText: '确定', |
||||
|
// cancelButtonText: '取消', |
||||
|
// type: 'warning' |
||||
|
// }).then(() => { |
||||
|
// this.logout() |
||||
|
// }) |
||||
|
// }, |
||||
|
logout() { |
||||
|
this.$store.dispatch('LogOut').then(() => { |
||||
|
location.reload() |
||||
|
}) |
||||
|
}, |
||||
|
handleClose(done) { |
||||
|
done() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
<style lang="scss" scoped> |
||||
|
.navbar { |
||||
|
display: flex; |
||||
|
justify-content: space-between; |
||||
|
width: 100%; |
||||
|
height: 100px; |
||||
|
overflow: hidden; |
||||
|
position: relative; |
||||
|
// background: #fff; |
||||
|
// box-shadow: 0 1px 4px rgba(0,21,41,.08); |
||||
|
box-shadow: 5px 2px 10px 1px rgba(15,164,222,0.16); |
||||
|
|
||||
|
.hamburger-container { |
||||
|
line-height: 46px; |
||||
|
height: 100%; |
||||
|
float: left; |
||||
|
cursor: pointer; |
||||
|
transition: background .3s; |
||||
|
-webkit-tap-highlight-color:transparent; |
||||
|
|
||||
|
&:hover { |
||||
|
background: rgba(0, 0, 0, .025) |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
.errLog-container { |
||||
|
display: inline-block; |
||||
|
vertical-align: top; |
||||
|
} |
||||
|
|
||||
|
.right-menu { |
||||
|
// height: 100%; |
||||
|
display: flex; |
||||
|
padding-top: 25px; |
||||
|
line-height: 50px; |
||||
|
|
||||
|
&:focus { |
||||
|
outline: none; |
||||
|
} |
||||
|
|
||||
|
.right-menu-item { |
||||
|
display: inline-block; |
||||
|
padding: 0 8px; |
||||
|
height: 100%; |
||||
|
font-size: 18px; |
||||
|
color: #5a5e66; |
||||
|
vertical-align: text-bottom; |
||||
|
|
||||
|
&.hover-effect { |
||||
|
cursor: pointer; |
||||
|
transition: background .3s; |
||||
|
|
||||
|
&:hover { |
||||
|
background: rgba(0, 0, 0, .025) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
.message-center{ |
||||
|
margin-right: 26px; |
||||
|
margin-top: 4px; |
||||
|
} |
||||
|
.avatar-container { |
||||
|
margin-right: 60px; |
||||
|
.avatar-wrapper { |
||||
|
margin-top: 5px; |
||||
|
position: relative; |
||||
|
.user-img-cover{ |
||||
|
width: 40px; |
||||
|
height: 40px; |
||||
|
} |
||||
|
.user-avatar { |
||||
|
cursor: pointer; |
||||
|
width: 40px; |
||||
|
height: 40px; |
||||
|
border-radius: 10px; |
||||
|
} |
||||
|
.el-icon-caret-bottom { |
||||
|
cursor: pointer; |
||||
|
position: absolute; |
||||
|
right: -20px; |
||||
|
top: 25px; |
||||
|
font-size: 12px; |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue