|
@@ -9,7 +9,41 @@
|
|
|
<div class ="center-logo">
|
|
|
</div>
|
|
|
|
|
|
+ <el-dropdown id="news" trigger="click" style =" position:absolute;top:20px;right:170px">
|
|
|
+ <span style="margin-right:25px; position:relative;">
|
|
|
+ <i class="el-icon-message" style="color:#fff;font-size:24px;"></i>
|
|
|
+ <i v-if="messageNum !==0" style="display:block; width:20px; height:20px; float:left; border-radius: 10px;
|
|
|
+ background:red; font-style:normal; position:absolute; right:-12px; bottom:14px; font-weight: 300; font-size:12px ; line-height: 20px; text-align:center; color:#fff;">{{ messageNum }}</i>
|
|
|
+ </span>
|
|
|
+ <el-dropdown-menu slot="dropdown" class="user-dropdown">
|
|
|
+ <div style="padding-left: 10px;color:#409eff">
|
|
|
+ 通知
|
|
|
+ </div>
|
|
|
+ <div v-if="messageList.length !==0" style="min-width:300px" >
|
|
|
+
|
|
|
+ <el-dropdown-item v-for="(item,index) in messageList" :key="index" divided>
|
|
|
+ <div style="display:flex;flex-direction:row; flex-wrap:wrap; justify-content:space-between;" @click="click_message(item)">
|
|
|
+ <div style="margin-right:30px;width:50%;display:inline-block;">
|
|
|
+ <div style=" ">{{ item.name }}</div>
|
|
|
+ <div style=" width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; ">{{ item.content }}</div>
|
|
|
+ </div>
|
|
|
+ <div style="width:30%;display:inline-block; ">{{ item.created_at }}</div>
|
|
|
+ </div>
|
|
|
+ </el-dropdown-item>
|
|
|
+ </div>
|
|
|
+ <div v-else style="min-width:300px;font-size:14px;color:#999;text-align:center;margin:0 auto " >
|
|
|
+ 暂无消息
|
|
|
+ </div>
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ <div style="text-align:right;margin-top:10px;margin-right:10px;font-size:14px;color:#333; cursor: pointer;" @click="click_message_all" >
|
|
|
+ 历史消息
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </el-dropdown-menu>
|
|
|
+ </el-dropdown>
|
|
|
+
|
|
|
<span style="position:absolute;top:20px;right:120px;font-size:14px;">
|
|
|
{{user_name}}
|
|
|
</span>
|
|
@@ -17,6 +51,34 @@
|
|
|
<el-button type="primary" plain size="mini" @click="logout">退出</el-button>
|
|
|
|
|
|
</el-header>
|
|
|
+
|
|
|
+ <!-- 弹窗 新增or修改 -->
|
|
|
+ <el-dialog title="消息提示" :visible.sync="addFormShow" @close="add_dialog_close" width="50%">
|
|
|
+ <div class="">
|
|
|
+ <el-form ref="addFormRef" :model="addForm" label-position="right" label-width="100px" style="width:50%;margin:0 auto 50px">
|
|
|
+
|
|
|
+ <el-form-item label="类型名称:" prop="name">
|
|
|
+ <el-input v-model="addForm.name" disabled ></el-input>
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ <el-form-item label="消息内容:" prop="content">
|
|
|
+ <el-input ref="content" v-model="addForm.content" type="textarea" maxlength="200" style="width: 100%;" :rows="3" disabled />
|
|
|
+ </el-form-item>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ </el-form>
|
|
|
+ <div slot="footer" class="dialog-footer">
|
|
|
+
|
|
|
+ <el-button @click="add_dialog_close" >关闭</el-button>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+ </el-dialog>
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
<el-container style = "position:relative">
|
|
|
<!-- 侧边栏 -->
|
|
|
<el-aside :width="isCollapse ? '64px' : '200px'" >
|
|
@@ -86,6 +148,16 @@ import { parseTime, json2excel } from '@/utils/index.js'
|
|
|
export default {
|
|
|
data() {
|
|
|
return {
|
|
|
+
|
|
|
+
|
|
|
+ addFormShow:false,
|
|
|
+ addForm:{
|
|
|
+ name:'',id:'' ,content:'' ,is_show: 1
|
|
|
+ },
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
messageNum: 0,
|
|
|
messageList:[
|
|
|
// {id:1},{id:2},
|
|
@@ -95,15 +167,13 @@ export default {
|
|
|
|
|
|
|
|
|
editableTabsValue: '2',
|
|
|
- editableTabs: [
|
|
|
+ editableTabs: [
|
|
|
{ title: '首页', name: '/home' },
|
|
|
// { title: '角色列表', name: '/roles' },
|
|
|
- ],
|
|
|
- tabIndex: 2,
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
+ ],
|
|
|
+ tabIndex: 2,
|
|
|
|
|
|
+
|
|
|
|
|
|
isCollapse:false, //侧边栏是否展开
|
|
|
activePath:"",//侧边栏高亮路径
|
|
@@ -172,7 +242,7 @@ export default {
|
|
|
},
|
|
|
created(){
|
|
|
|
|
|
-
|
|
|
+ var me = this
|
|
|
//处理Store刷新后消失的问题
|
|
|
// 在页面加载时读取sessionStorage
|
|
|
if (sessionStorage.getItem('store')) {
|
|
@@ -187,12 +257,42 @@ export default {
|
|
|
this.getMenuList()
|
|
|
this.activePath = window.sessionStorage.getItem('activePath')
|
|
|
|
|
|
- console.log(" this.activePath==========",this.activePath)
|
|
|
+ console.log(" this.activePath==========600000",this.activePath)
|
|
|
|
|
|
this.getUserInfo()
|
|
|
+ this.getMessInfo()
|
|
|
+
|
|
|
+ window.setInterval(() => {
|
|
|
+ setTimeout(() => {
|
|
|
+ me.getMessInfo()
|
|
|
+ }, 0)
|
|
|
+ }, 600000)
|
|
|
+
|
|
|
},
|
|
|
methods:{
|
|
|
+ //获取右上角信息内容
|
|
|
+ getMessInfo(){
|
|
|
+ var me = this
|
|
|
+
|
|
|
+ ajaxDataPost('/api/v1/ops/message_template/user/list?page=1&page_size=5', {is_show:1}).then(e => {
|
|
|
+ console.log("获取用户信息",e)
|
|
|
+ //打印请求成功结果
|
|
|
+
|
|
|
+ if(e.code == 200 ){
|
|
|
+ me.messageList = e.data.list
|
|
|
+ me.messageNum = e.data.total; // 总数
|
|
|
+
|
|
|
+ } else {
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
+
|
|
|
+
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
|
|
|
//获取用户信息
|
|
|
getUserInfo(){
|
|
@@ -218,15 +318,44 @@ export default {
|
|
|
|
|
|
click_message_all(){
|
|
|
var me = this
|
|
|
-
|
|
|
- window.sessionStorage.setItem('activePath','/MessagesReceive')
|
|
|
- me.activePath = '/MessagesReceive'
|
|
|
+
|
|
|
me.$router.push('/MessagesReceive')
|
|
|
|
|
|
-
|
|
|
- console.log(me.activePath)
|
|
|
+ window.sessionStorage.setItem('activePath','/MessagesReceive')
|
|
|
+ me.activePath = '/MessagesReceive'
|
|
|
+ console.log(" this.activePath==========",me.activePath)
|
|
|
+ console.log(111111111)
|
|
|
},
|
|
|
|
|
|
+ click_message(row){
|
|
|
+ var me = this
|
|
|
+ console.log('行内容row=========', row)
|
|
|
+ //编辑行内容赋值
|
|
|
+ me.addForm = Object.assign({}, row)
|
|
|
+
|
|
|
+ ajaxDataPut("/api/v1/ops/message_template/user/show/"+ row.id , {}).then(e => {
|
|
|
+ console.log("消息已读:",e)
|
|
|
+ //打印请求成功结果
|
|
|
+ if(e.code == 200 ){
|
|
|
+ me.getMessInfo()
|
|
|
+ } else {
|
|
|
+ // me.$message({ type: 'error', message: '失败!' + e.msg, duration: 2000 })
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
+
|
|
|
+ me.addFormShow = true
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ //新增关闭
|
|
|
+ add_dialog_close(){
|
|
|
+ var me = this
|
|
|
+ //内容重置
|
|
|
+ me.addFormShow = false
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
handleClick(val) {
|
|
|
// console.log(tab, event);
|
|
|
console.log(val.name);
|