Commit 1b19427d by 陈超

A

parent 1cd67f3e
......@@ -15,3 +15,20 @@ export function configSystemSet(data) {
data
})
}
export function getNotice(params) {
return request({
noProgress: true,
url: '/admin/merchantNotice/getUnread',
method: 'get',
params
})
}
export function clearNotice(params) {
return request({
url: '/admin/merchantNotice/clearUnread',
method: 'get',
params
})
}
\ No newline at end of file
......@@ -11,61 +11,14 @@
</div>
</div>
<div class="top-bar__title">
<div
v-if="showMenu"
class="top-bar__item top-bar__item--show">
<top-menu/>
<div class="layout_h_r" style="height: 100%;margin-right: 140px;">
<el-badge v-for="(item, index) in alert" :key="index" v-if="!item.hide" :max="99" :hidden="item.number <= 0" :value="item.number" class="self_center" style="margin-left: 12px;">
<el-button @click="onNavigate(item)" size="small">{{item.title}}</el-button>
</el-badge>
</div>
</div>
<div class="top-bar__right">
<el-tooltip
v-if="showColor"
effect="dark"
content="主题色"
placement="bottom">
<div class="top-bar__item">
<top-color/>
</div>
</el-tooltip>
<el-tooltip
v-if="showDebug"
:content="logsFlag?'没有错误日志':`${logsLen}条错误日志`"
effect="dark"
placement="bottom">
<div class="top-bar__item">
<top-logs/>
</div>
</el-tooltip>
<el-tooltip
v-if="showLock"
effect="dark"
content="锁屏"
placement="bottom">
<div class="top-bar__item">
<top-lock/>
</div>
</el-tooltip>
<el-tooltip
v-if="showTheme"
effect="dark"
content="特色主题"
placement="bottom">
<div class="top-bar__item top-bar__item--show">
<top-theme/>
</div>
</el-tooltip>
<el-tooltip
v-if="showFullScreen"
:content="isFullScreen?'退出全屏':'全屏'"
effect="dark"
placement="bottom">
<div class="top-bar__item">
<i
:class="isFullScreen?'icon-zuixiaohua':'icon-quanpingzuidahua'"
@click="handleScreen"/>
</div>
</el-tooltip>
<el-tooltip
v-if="userInfo.avatar"
effect="dark"
content="用户头像"
......@@ -101,6 +54,7 @@
</div>
</template>
<script>
import { getNotice, clearNotice } from '@/api/systemSet/systemSet.js'
import { mapGetters, mapState } from 'vuex'
import { fullscreenToggel, handleImg, listenfullscreen } from '@/util'
import topLock from './top-lock'
......@@ -122,7 +76,30 @@ export default {
},
filters: {},
data() {
return {}
return {
alert: [{
title: "提现结果",
menuName: "钱包",
number: 0,
tag: 'notice_merchant_withdraw_result',
url: '',
hide: false
},{
title: "商品审核结果",
menuName: "商品管理",
number: 0,
tag: 'notice_goods_auth_result',
url: '',
hide: false
},{
title: "订单待发货",
menuName: "订单管理",
number: 0,
tag: 'notice_order_wait_send',
url: '',
hide: false
}]
}
},
computed: {
...mapState({
......@@ -142,16 +119,76 @@ export default {
'isCollapse',
'tag',
'logsLen',
'logsFlag'
'logsFlag',
'menu'
])
},
created() {
handleImg(this.userInfo.avatar, 'thumbnail')
this.$store.dispatch('GetUserInfo').then(r => {}).catch(e => {})
},
mounted() {
listenfullscreen(this.setScreen)
this.alert.forEach(item => {
let find = this.search(item.menuName, this.menu)
if(find) {
item.hide = false
item.url = find.path
} else {
item.hide = true
}
})
this.loadRead()
},
methods: {
search(name, menus) {
if(menus == undefined || menus.length == 0) {
return undefined
}
for(let i = 0; i < menus.length; i++) {
let m = menus[i]
if(m.name == name) {
return m
} else {
let f = this.search(name, m.children)
if(f) {
return f
}
}
}
},
loadRead() {
let showList = this.alert.filter(item => { return !item.hide })
let now = showList.map(r => { return r.tag }).join(",")
if(now.length > 0) {
getNotice({types: now})
.then(r => {
let z = r.data.data
if(z) {
z.forEach(d => {
showList.forEach(item => {
if(item.tag == d.type) {
item.number = d.value
}
})
})
}
setTimeout(this.loadRead, 10000)
})
.catch(e => {
})
}
},
onNavigate(item) {
clearNotice({types: item.tag})
.then(r => {
this.$router.push(item.url)
})
.catch(e => {
})
},
handleScreen() {
fullscreenToggel()
},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment