提示语、样式bug修改
This commit is contained in:
@@ -30,299 +30,305 @@
|
||||
</a-spin>
|
||||
</template>
|
||||
<span @click="fetchNotice" class="header-notice">
|
||||
<a-badge :count="msgTotal">
|
||||
<a-icon style="margin-right: 8px" type="bell" />通知消息
|
||||
<a-badge :count="msgTotal" :numberStyle="{}">
|
||||
<a-icon style="margin-right: 8px" type="bell"/>通知消息
|
||||
</a-badge>
|
||||
</span>
|
||||
<!-- <show-announcement ref="ShowAnnouncement" @ok="modalFormOk"></show-announcement>-->
|
||||
<!-- <show-announcement ref="ShowAnnouncement" @ok="modalFormOk"></show-announcement>-->
|
||||
<dynamic-notice ref="showDynamNotice" :path="openPath" :formData="formData"/>
|
||||
</a-popover>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getAction,putAction } from '@/api/manage'
|
||||
// import ShowAnnouncement from './ShowAnnouncement'
|
||||
import store from '@/store/'
|
||||
import DynamicNotice from './DynamicNotice'
|
||||
import {Bus} from '@comp/tools/Bus'
|
||||
import { getAction, putAction } from '@/api/manage'
|
||||
// import ShowAnnouncement from './ShowAnnouncement'
|
||||
import store from '@/store/'
|
||||
import DynamicNotice from './DynamicNotice'
|
||||
import { Bus } from '@comp/tools/Bus'
|
||||
|
||||
|
||||
export default {
|
||||
name: 'HeaderNotice',
|
||||
components: {
|
||||
DynamicNotice,
|
||||
// ShowAnnouncement,
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
loadding: false,
|
||||
url:{
|
||||
listCementByUser:'/sys/annountCement/listByUser',
|
||||
editCementSend:'/sys/sysAnnouncementSend/editCompanyByAnntIdAndUserId',
|
||||
queryById:'/sys/annountCement/queryById',
|
||||
},
|
||||
hovered: false,
|
||||
announcement1:[],
|
||||
announcement2:[],
|
||||
msg1Count:'0',
|
||||
msg2Count:'0',
|
||||
msg1Title:'通知(0)',
|
||||
msg2Title:'',
|
||||
stopTimer:false,
|
||||
websock: null,
|
||||
lockReconnect:false,
|
||||
heartCheck:null,
|
||||
formData:{},
|
||||
openPath:''
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
msgTotal () {
|
||||
return parseInt(this.msg1Count)+parseInt(this.msg2Count)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
Bus.$on('notice-change', () => {
|
||||
// console.log('notice-change')
|
||||
this.loadData()
|
||||
})
|
||||
},
|
||||
destroyed: function () { // 离开页面生命周期函数
|
||||
this.websocketOnclose()
|
||||
Bus.$off('notice-change')
|
||||
},
|
||||
mounted() {
|
||||
export default {
|
||||
name: 'HeaderNotice',
|
||||
components: {
|
||||
DynamicNotice
|
||||
// ShowAnnouncement,
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
loadding: false,
|
||||
url: {
|
||||
listCementByUser: '/sys/annountCement/listByUser',
|
||||
editCementSend: '/sys/sysAnnouncementSend/editCompanyByAnntIdAndUserId',
|
||||
queryById: '/sys/annountCement/queryById'
|
||||
},
|
||||
hovered: false,
|
||||
announcement1: [],
|
||||
announcement2: [],
|
||||
msg1Count: '0',
|
||||
msg2Count: '0',
|
||||
msg1Title: '通知(0)',
|
||||
msg2Title: '',
|
||||
stopTimer: false,
|
||||
websock: null,
|
||||
lockReconnect: false,
|
||||
heartCheck: null,
|
||||
formData: {},
|
||||
openPath: ''
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
msgTotal() {
|
||||
return parseInt(this.msg1Count) + parseInt(this.msg2Count)
|
||||
}
|
||||
},
|
||||
created() {
|
||||
Bus.$on('notice-change', () => {
|
||||
// console.log('notice-change')
|
||||
this.loadData()
|
||||
//this.timerFun();
|
||||
this.initWebSocket()
|
||||
// this.heartCheckFun();
|
||||
},
|
||||
methods: {
|
||||
timerFun() {
|
||||
this.stopTimer = false
|
||||
let myTimer = setInterval(()=>{
|
||||
// 停止定时器
|
||||
if (this.stopTimer == true) {
|
||||
clearInterval(myTimer)
|
||||
return
|
||||
}
|
||||
this.loadData()
|
||||
},6000)
|
||||
},
|
||||
loadData (){
|
||||
try {
|
||||
// 获取系统消息
|
||||
getAction(this.url.listCementByUser).then((res) => {
|
||||
if (res.success) {
|
||||
this.announcement1 = res.result.anntMsgList
|
||||
this.msg1Count = res.result.anntMsgTotal
|
||||
this.msg1Title = '通知(' + res.result.anntMsgTotal + ')'
|
||||
this.announcement2 = res.result.sysMsgList
|
||||
this.msg2Count = res.result.sysMsgTotal
|
||||
this.msg2Title = '系统消息(' + res.result.sysMsgTotal + ')'
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log('系统消息通知异常',error)//这行打印permissionName is undefined
|
||||
this.stopTimer = true
|
||||
console.log('清理timer')
|
||||
})
|
||||
} catch (err) {
|
||||
this.stopTimer = true
|
||||
console.log('通知异常',err)
|
||||
}
|
||||
},
|
||||
fetchNotice () {
|
||||
if (this.loadding) {
|
||||
this.loadding = false
|
||||
})
|
||||
},
|
||||
destroyed: function () { // 离开页面生命周期函数
|
||||
this.websocketOnclose()
|
||||
Bus.$off('notice-change')
|
||||
},
|
||||
mounted() {
|
||||
this.loadData()
|
||||
//this.timerFun();
|
||||
this.initWebSocket()
|
||||
// this.heartCheckFun();
|
||||
},
|
||||
methods: {
|
||||
timerFun() {
|
||||
this.stopTimer = false
|
||||
let myTimer = setInterval(() => {
|
||||
// 停止定时器
|
||||
if (this.stopTimer == true) {
|
||||
clearInterval(myTimer)
|
||||
return
|
||||
}
|
||||
this.loadding = true
|
||||
setTimeout(() => {
|
||||
this.loadding = false
|
||||
}, 200)
|
||||
},
|
||||
showAnnouncement(record){
|
||||
putAction(this.url.editCementSend,{anntId:record.id}).then((res)=>{
|
||||
if(res.success){
|
||||
this.loadData()
|
||||
Bus.$emit('header-notice-change')
|
||||
}
|
||||
})
|
||||
this.hovered = false
|
||||
const param = JSON.parse(record.busId)
|
||||
if(record.openType==='component'){
|
||||
this.openPath = record.openPage
|
||||
this.formData = param
|
||||
this.$refs.showDynamNotice.detail(record.openPage)
|
||||
}else if(record.openType === 'url') {
|
||||
console.log(record.openPage,'url')
|
||||
const param = JSON.parse(record.busId)
|
||||
// 如果是url 跳转页面
|
||||
this.$router.push({
|
||||
path:record.openPage,
|
||||
query:param
|
||||
})
|
||||
}else {
|
||||
this.$refs.ShowAnnouncement.detail(record)
|
||||
}
|
||||
},
|
||||
toMyAnnouncement(){
|
||||
this.$router.push({
|
||||
path: '/system/userAnnouncementList'
|
||||
})
|
||||
this.handleHoverChange(false)
|
||||
},
|
||||
modalFormOk(){
|
||||
},
|
||||
handleHoverChange (visible) {
|
||||
this.hovered = visible
|
||||
},
|
||||
|
||||
initWebSocket: function () {
|
||||
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
|
||||
var userId = store.getters.userInfo.id
|
||||
console.log('store.getters.userInfo',store.getters.userInfo)
|
||||
var url = window._CONFIG['domianWebSocketURL'].replace('https://','wss://').replace('http://','ws://')+'/websocket/'+userId
|
||||
//console.log(url);
|
||||
this.websock = new WebSocket(url)
|
||||
this.websock.onopen = this.websocketOnopen
|
||||
this.websock.onerror = this.websocketOnerror
|
||||
this.websock.onmessage = this.websocketOnmessage
|
||||
this.websock.onclose = this.websocketOnclose
|
||||
},
|
||||
websocketOnopen: function () {
|
||||
console.log('WebSocket连接成功')
|
||||
//心跳检测重置
|
||||
//this.heartCheck.reset().start();
|
||||
},
|
||||
websocketOnerror: function () {
|
||||
console.log('WebSocket连接发生错误')
|
||||
this.reconnect()
|
||||
},
|
||||
websocketOnmessage: function (e) {
|
||||
console.log('-----接收消息-------',e.data)
|
||||
var data = eval('(' + e.data + ')') //解析对象
|
||||
if(data.cmd == 'topic'){
|
||||
//系统通知
|
||||
this.loadData()
|
||||
}else if(data.cmd == 'user'){
|
||||
//用户消息
|
||||
this.loadData()
|
||||
}
|
||||
//心跳检测重置
|
||||
//this.heartCheck.reset().start();
|
||||
},
|
||||
websocketOnclose: function (e) {
|
||||
console.log('connection closed (' + e + ')')
|
||||
if(e){
|
||||
console.log('connection closed (' + e.code + ')')
|
||||
}
|
||||
this.reconnect()
|
||||
},
|
||||
websocketSend(text) { // 数据发送
|
||||
try {
|
||||
this.websock.send(text)
|
||||
} catch (err) {
|
||||
console.log('send failed (' + err.code + ')')
|
||||
}
|
||||
},
|
||||
|
||||
openNotification (data) {
|
||||
var text = data.msgTxt
|
||||
const key = `open${Date.now()}`
|
||||
this.$notification.open({
|
||||
message: '消息提醒',
|
||||
placement:'bottomRight',
|
||||
description: text,
|
||||
key,
|
||||
btn: (h)=>{
|
||||
return h('a-button', {
|
||||
props: {
|
||||
type: 'primary',
|
||||
size: 'small',
|
||||
},
|
||||
on: {
|
||||
click: () => this.showDetail(key,data)
|
||||
}
|
||||
}, '查看详情')
|
||||
},
|
||||
})
|
||||
},
|
||||
|
||||
reconnect() {
|
||||
var that = this
|
||||
if(that.lockReconnect) return
|
||||
that.lockReconnect = true
|
||||
//没连接上会一直重连,设置延迟避免请求过多
|
||||
setTimeout(function () {
|
||||
console.info('尝试重连...')
|
||||
that.initWebSocket()
|
||||
that.lockReconnect = false
|
||||
}, 5000)
|
||||
},
|
||||
heartCheckFun(){
|
||||
var that = this
|
||||
//心跳检测,每20s心跳一次
|
||||
that.heartCheck = {
|
||||
timeout: 20000,
|
||||
timeoutObj: null,
|
||||
serverTimeoutObj: null,
|
||||
reset: function(){
|
||||
clearTimeout(this.timeoutObj)
|
||||
//clearTimeout(this.serverTimeoutObj);
|
||||
return this
|
||||
},
|
||||
start: function(){
|
||||
// var self = this
|
||||
this.timeoutObj = setTimeout(function(){
|
||||
//这里发送一个心跳,后端收到后,返回一个心跳消息,
|
||||
//onmessage拿到返回的心跳就说明连接正常
|
||||
that.websocketSend('HeartBeat')
|
||||
console.info('客户端发送心跳')
|
||||
//self.serverTimeoutObj = setTimeout(function(){//如果超过一定时间还没重置,说明后端主动断开了
|
||||
// that.websock.close();//如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
|
||||
//}, self.timeout)
|
||||
}, this.timeout)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
showDetail(key,data){
|
||||
this.$notification.close(key)
|
||||
var id = data.msgId
|
||||
getAction(this.url.queryById,{id:id}).then((res) => {
|
||||
this.loadData()
|
||||
}, 6000)
|
||||
},
|
||||
loadData() {
|
||||
try {
|
||||
// 获取系统消息
|
||||
getAction(this.url.listCementByUser).then((res) => {
|
||||
if (res.success) {
|
||||
var record = res.result
|
||||
this.showAnnouncement(record)
|
||||
this.announcement1 = res.result.anntMsgList
|
||||
this.msg1Count = res.result.anntMsgTotal
|
||||
this.msg1Title = '通知(' + res.result.anntMsgTotal + ')'
|
||||
this.announcement2 = res.result.sysMsgList
|
||||
this.msg2Count = res.result.sysMsgTotal
|
||||
this.msg2Title = '系统消息(' + res.result.sysMsgTotal + ')'
|
||||
}
|
||||
}).catch(error => {
|
||||
console.log('系统消息通知异常', error)//这行打印permissionName is undefined
|
||||
this.stopTimer = true
|
||||
console.log('清理timer')
|
||||
})
|
||||
} catch (err) {
|
||||
this.stopTimer = true
|
||||
console.log('通知异常', err)
|
||||
}
|
||||
},
|
||||
fetchNotice() {
|
||||
if (this.loadding) {
|
||||
this.loadding = false
|
||||
return
|
||||
}
|
||||
this.loadding = true
|
||||
setTimeout(() => {
|
||||
this.loadding = false
|
||||
}, 200)
|
||||
},
|
||||
showAnnouncement(record) {
|
||||
putAction(this.url.editCementSend, { anntId: record.id }).then((res) => {
|
||||
if (res.success) {
|
||||
this.loadData()
|
||||
Bus.$emit('header-notice-change')
|
||||
}
|
||||
})
|
||||
this.hovered = false
|
||||
const param = JSON.parse(record.busId)
|
||||
if (record.openType === 'component') {
|
||||
this.openPath = record.openPage
|
||||
this.formData = param
|
||||
this.$refs.showDynamNotice.detail(record.openPage)
|
||||
} else if (record.openType === 'url') {
|
||||
console.log(record.openPage, 'url')
|
||||
const param = JSON.parse(record.busId)
|
||||
// 如果是url 跳转页面
|
||||
this.$router.push({
|
||||
path: record.openPage,
|
||||
query: param
|
||||
})
|
||||
} else {
|
||||
this.$refs.ShowAnnouncement.detail(record)
|
||||
}
|
||||
},
|
||||
toMyAnnouncement() {
|
||||
this.$router.push({
|
||||
path: '/system/userAnnouncementList'
|
||||
})
|
||||
this.handleHoverChange(false)
|
||||
},
|
||||
modalFormOk() {
|
||||
},
|
||||
handleHoverChange(visible) {
|
||||
this.hovered = visible
|
||||
},
|
||||
|
||||
initWebSocket: function () {
|
||||
// WebSocket与普通的请求所用协议有所不同,ws等同于http,wss等同于https
|
||||
var userId = store.getters.userInfo.id
|
||||
console.log('store.getters.userInfo', store.getters.userInfo)
|
||||
var url = window._CONFIG['domianWebSocketURL'].replace('https://', 'wss://').replace('http://', 'ws://') + '/websocket/' + userId
|
||||
//console.log(url);
|
||||
this.websock = new WebSocket(url)
|
||||
this.websock.onopen = this.websocketOnopen
|
||||
this.websock.onerror = this.websocketOnerror
|
||||
this.websock.onmessage = this.websocketOnmessage
|
||||
this.websock.onclose = this.websocketOnclose
|
||||
},
|
||||
websocketOnopen: function () {
|
||||
console.log('WebSocket连接成功')
|
||||
//心跳检测重置
|
||||
//this.heartCheck.reset().start();
|
||||
},
|
||||
websocketOnerror: function () {
|
||||
console.log('WebSocket连接发生错误')
|
||||
this.reconnect()
|
||||
},
|
||||
websocketOnmessage: function (e) {
|
||||
console.log('-----接收消息-------', e.data)
|
||||
var data = eval('(' + e.data + ')') //解析对象
|
||||
if (data.cmd == 'topic') {
|
||||
//系统通知
|
||||
this.loadData()
|
||||
} else if (data.cmd == 'user') {
|
||||
//用户消息
|
||||
this.loadData()
|
||||
}
|
||||
//心跳检测重置
|
||||
//this.heartCheck.reset().start();
|
||||
},
|
||||
websocketOnclose: function (e) {
|
||||
console.log('connection closed (' + e + ')')
|
||||
if (e) {
|
||||
console.log('connection closed (' + e.code + ')')
|
||||
}
|
||||
this.reconnect()
|
||||
},
|
||||
websocketSend(text) { // 数据发送
|
||||
try {
|
||||
this.websock.send(text)
|
||||
} catch (err) {
|
||||
console.log('send failed (' + err.code + ')')
|
||||
}
|
||||
},
|
||||
|
||||
openNotification(data) {
|
||||
var text = data.msgTxt
|
||||
const key = `open${ Date.now() }`
|
||||
this.$notification.open({
|
||||
message: '消息提醒',
|
||||
placement: 'bottomRight',
|
||||
description: text,
|
||||
key,
|
||||
btn: (h) => {
|
||||
return h('a-button', {
|
||||
props: {
|
||||
type: 'primary',
|
||||
size: 'small'
|
||||
},
|
||||
on: {
|
||||
click: () => this.showDetail(key, data)
|
||||
}
|
||||
}, '查看详情')
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
reconnect() {
|
||||
var that = this
|
||||
if (that.lockReconnect) return
|
||||
that.lockReconnect = true
|
||||
//没连接上会一直重连,设置延迟避免请求过多
|
||||
setTimeout(function () {
|
||||
console.info('尝试重连...')
|
||||
that.initWebSocket()
|
||||
that.lockReconnect = false
|
||||
}, 5000)
|
||||
},
|
||||
heartCheckFun() {
|
||||
var that = this
|
||||
//心跳检测,每20s心跳一次
|
||||
that.heartCheck = {
|
||||
timeout: 20000,
|
||||
timeoutObj: null,
|
||||
serverTimeoutObj: null,
|
||||
reset: function () {
|
||||
clearTimeout(this.timeoutObj)
|
||||
//clearTimeout(this.serverTimeoutObj);
|
||||
return this
|
||||
},
|
||||
start: function () {
|
||||
// var self = this
|
||||
this.timeoutObj = setTimeout(function () {
|
||||
//这里发送一个心跳,后端收到后,返回一个心跳消息,
|
||||
//onmessage拿到返回的心跳就说明连接正常
|
||||
that.websocketSend('HeartBeat')
|
||||
console.info('客户端发送心跳')
|
||||
//self.serverTimeoutObj = setTimeout(function(){//如果超过一定时间还没重置,说明后端主动断开了
|
||||
// that.websock.close();//如果onclose会执行reconnect,我们执行ws.close()就行了.如果直接执行reconnect 会触发onclose导致重连两次
|
||||
//}, self.timeout)
|
||||
}, this.timeout)
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
showDetail(key, data) {
|
||||
this.$notification.close(key)
|
||||
var id = data.msgId
|
||||
getAction(this.url.queryById, { id: id }).then((res) => {
|
||||
if (res.success) {
|
||||
var record = res.result
|
||||
this.showAnnouncement(record)
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="css">
|
||||
.header-notice-wrapper {
|
||||
top: 50px !important;
|
||||
}
|
||||
.header-notice-wrapper {
|
||||
top: 50px !important;
|
||||
}
|
||||
</style>
|
||||
<style lang="less" scoped>
|
||||
.header-notice{
|
||||
display: inline-block;
|
||||
transition: all 0.3s;
|
||||
.header-notice {
|
||||
display: inline-block;
|
||||
transition: all 0.3s;
|
||||
|
||||
span {
|
||||
vertical-align: initial;
|
||||
}
|
||||
}
|
||||
.notice-title {
|
||||
text-align: center;
|
||||
padding: 3px 0;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
letter-spacing: 1px;
|
||||
span {
|
||||
vertical-align: initial;
|
||||
}
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
text-align: center;
|
||||
padding: 3px 0;
|
||||
border-bottom: 1px solid #e8e8e8;
|
||||
letter-spacing: 1px;
|
||||
}
|
||||
|
||||
//消息数量红点的位置,解决挡字的bug
|
||||
/deep/ .ant-badge-count, .ant-badge-dot, .ant-badge .ant-scroll-number-custom-component {
|
||||
right: -1.1rem;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
+174
-169
@@ -3,7 +3,7 @@
|
||||
<a-dropdown>
|
||||
<span class="action action-full ant-dropdown-link user-dropdown-menu" style='color: #fff'>
|
||||
<a-avatar class="avatar" size="small" :src="getAvatar()"/>
|
||||
<span v-if="isDesktop()">欢迎您,{{ nickname() }}</span>
|
||||
<span v-if="isDesktop()">欢迎您,{{ username }}</span>
|
||||
</span>
|
||||
<a-menu slot="overlay" class="user-dropdown-menu-wrapper">
|
||||
<a-menu-item key="0">
|
||||
@@ -34,196 +34,201 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import HeaderNotice from './HeaderNotice'
|
||||
import UserPassword from './UserPassword'
|
||||
import SettingDrawer from '@/components/setting/SettingDrawer'
|
||||
import DepartSelect from './DepartSelect'
|
||||
import { mapActions, mapGetters,mapState } from 'vuex'
|
||||
import { mixinDevice } from '@/utils/mixin.js'
|
||||
import { getFileAccessHttpUrl,getAction } from '@/api/manage'
|
||||
import Vue from 'vue'
|
||||
import { UI_CACHE_DB_DICT_DATA } from '@/store/mutation-types'
|
||||
import HeaderNotice from './HeaderNotice'
|
||||
import UserPassword from './UserPassword'
|
||||
import SettingDrawer from '@/components/setting/SettingDrawer'
|
||||
import DepartSelect from './DepartSelect'
|
||||
import { mapActions, mapGetters, mapState } from 'vuex'
|
||||
import { mixinDevice } from '@/utils/mixin.js'
|
||||
import { getFileAccessHttpUrl, getAction } from '@/api/manage'
|
||||
import Vue from 'vue'
|
||||
import { UI_CACHE_DB_DICT_DATA, USER_INFO } from '@/store/mutation-types'
|
||||
|
||||
export default {
|
||||
name: 'UserMenu',
|
||||
mixins: [mixinDevice],
|
||||
data(){
|
||||
return{
|
||||
// update-begin author:sunjianlei date:20200219 for: 头部菜单搜索规范命名 --------------
|
||||
searchMenuOptions:[],
|
||||
searchMenuComp: 'span',
|
||||
searchMenuVisible: false,
|
||||
// update-begin author:sunjianlei date:20200219 for: 头部菜单搜索规范命名 --------------
|
||||
export default {
|
||||
name: 'UserMenu',
|
||||
mixins: [mixinDevice],
|
||||
data() {
|
||||
return {
|
||||
// update-begin author:sunjianlei date:20200219 for: 头部菜单搜索规范命名 --------------
|
||||
searchMenuOptions: [],
|
||||
searchMenuComp: 'span',
|
||||
searchMenuVisible: false,
|
||||
// update-begin author:sunjianlei date:20200219 for: 头部菜单搜索规范命名 --------------
|
||||
username: '',
|
||||
visible: true
|
||||
}
|
||||
},
|
||||
components: {
|
||||
HeaderNotice,
|
||||
UserPassword,
|
||||
DepartSelect,
|
||||
SettingDrawer
|
||||
},
|
||||
props: {
|
||||
theme: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'dark'
|
||||
}
|
||||
},
|
||||
/* update_begin author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
created() {
|
||||
let lists = []
|
||||
this.searchMenus(lists, this.permissionMenuList)
|
||||
this.searchMenuOptions = [...lists]
|
||||
this.username = Vue.ls.get(USER_INFO).name
|
||||
},
|
||||
mounted() {
|
||||
//如果是单点登录模式
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
if (process.env.VUE_APP_SSO == 'true') {
|
||||
let depart = this.userInfo().orgCode
|
||||
if (!depart) {
|
||||
this.updateCurrentDepart()
|
||||
}
|
||||
},
|
||||
components: {
|
||||
HeaderNotice,
|
||||
UserPassword,
|
||||
DepartSelect,
|
||||
SettingDrawer
|
||||
},
|
||||
props: {
|
||||
theme: {
|
||||
type: String,
|
||||
required: false,
|
||||
default: 'dark'
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
// 后台菜单
|
||||
permissionMenuList: state => state.user.permissionList
|
||||
|
||||
})
|
||||
},
|
||||
/* update_end author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
watch: {
|
||||
// update-begin author:sunjianlei date:20200219 for: 菜单搜索改为动态组件,在手机端呈现出弹出框
|
||||
device: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.searchMenuVisible = false
|
||||
this.searchMenuComp = this.isMobile() ? 'a-modal' : 'span'
|
||||
}
|
||||
},
|
||||
}
|
||||
// update-end author:sunjianlei date:20200219 for: 菜单搜索改为动态组件,在手机端呈现出弹出框
|
||||
},
|
||||
methods: {
|
||||
/* update_begin author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
created() {
|
||||
let lists = []
|
||||
this.searchMenus(lists,this.permissionMenuList)
|
||||
this.searchMenuOptions=[...lists]
|
||||
showClick() {
|
||||
this.searchMenuVisible = true
|
||||
},
|
||||
mounted() {
|
||||
//如果是单点登录模式
|
||||
|
||||
// eslint-disable-next-line no-undef
|
||||
if (process.env.VUE_APP_SSO == 'true') {
|
||||
let depart = this.userInfo().orgCode
|
||||
if (!depart) {
|
||||
this.updateCurrentDepart()
|
||||
}
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
...mapState({
|
||||
// 后台菜单
|
||||
permissionMenuList: state => state.user.permissionList
|
||||
|
||||
})
|
||||
hiddenClick() {
|
||||
this.shows = false
|
||||
},
|
||||
/* update_end author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
watch: {
|
||||
// update-begin author:sunjianlei date:20200219 for: 菜单搜索改为动态组件,在手机端呈现出弹出框
|
||||
device: {
|
||||
immediate: true,
|
||||
handler() {
|
||||
this.searchMenuVisible = false
|
||||
this.searchMenuComp = this.isMobile() ? 'a-modal' : 'span'
|
||||
},
|
||||
},
|
||||
// update-end author:sunjianlei date:20200219 for: 菜单搜索改为动态组件,在手机端呈现出弹出框
|
||||
...mapActions(['Logout']),
|
||||
...mapGetters(['nickname', 'avatar', 'userInfo']),
|
||||
getAvatar() {
|
||||
return getFileAccessHttpUrl(this.avatar())
|
||||
},
|
||||
methods: {
|
||||
/* update_begin author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
showClick() {
|
||||
this.searchMenuVisible = true
|
||||
},
|
||||
hiddenClick(){
|
||||
this.shows = false
|
||||
},
|
||||
/* update_end author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
...mapActions(['Logout']),
|
||||
...mapGetters(['nickname', 'avatar','userInfo']),
|
||||
getAvatar(){
|
||||
return getFileAccessHttpUrl(this.avatar())
|
||||
},
|
||||
handleLogout() {
|
||||
const that = this
|
||||
handleLogout() {
|
||||
const that = this
|
||||
|
||||
this.$confirm({
|
||||
title: '提示',
|
||||
content: '真的要注销登录吗 ?',
|
||||
onOk() {
|
||||
return that.Logout({}).then(() => {
|
||||
// update-begin author:wangshuai date:20200601 for: 退出登录跳转登录页面
|
||||
that.$router.push({ path: '/user/login' })
|
||||
// update-end author:wangshuai date:20200601 for: 退出登录跳转登录页面
|
||||
//window.location.reload()
|
||||
}).catch(err => {
|
||||
that.$message.error({
|
||||
title: '错误',
|
||||
description: err.message
|
||||
})
|
||||
this.$confirm({
|
||||
title: '提示',
|
||||
content: '真的要注销登录吗 ?',
|
||||
onOk() {
|
||||
return that.Logout({}).then(() => {
|
||||
// update-begin author:wangshuai date:20200601 for: 退出登录跳转登录页面
|
||||
that.$router.push({ path: '/user/login' })
|
||||
// update-end author:wangshuai date:20200601 for: 退出登录跳转登录页面
|
||||
//window.location.reload()
|
||||
}).catch(err => {
|
||||
that.$message.error({
|
||||
title: '错误',
|
||||
description: err.message
|
||||
})
|
||||
},
|
||||
onCancel() {
|
||||
},
|
||||
})
|
||||
},
|
||||
updatePassword(){
|
||||
let username = this.userInfo().phone
|
||||
this.$refs.userPassword.show(username)
|
||||
},
|
||||
updateCurrentDepart(){
|
||||
this.$refs.departSelect.show()
|
||||
},
|
||||
systemSetting(){
|
||||
this.$refs.settingDrawer.showDrawer()
|
||||
},
|
||||
/* update_begin author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
searchMenus(arr,menus){
|
||||
for(let i of menus){
|
||||
if(!i.hidden && 'layouts/RouteView'!==i.component){
|
||||
arr.push(i)
|
||||
}
|
||||
if(i.children&& i.children.length>0){
|
||||
this.searchMenus(arr,i.children)
|
||||
}
|
||||
})
|
||||
},
|
||||
onCancel() {
|
||||
}
|
||||
},
|
||||
filterOption(input, option) {
|
||||
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
},
|
||||
// update_begin author:sunjianlei date:20191230 for: 解决外部链接打开失败的问题
|
||||
searchMethods(value) {
|
||||
let route = this.searchMenuOptions.filter(item => item.id === value)[0]
|
||||
if (route.meta.internalOrExternal === true || route.component.includes('layouts/IframePageView')) {
|
||||
window.open(route.meta.url, '_blank')
|
||||
} else {
|
||||
this.$router.push({ path: route.path })
|
||||
})
|
||||
},
|
||||
updatePassword() {
|
||||
let username = this.userInfo().phone
|
||||
this.$refs.userPassword.show(username)
|
||||
},
|
||||
updateCurrentDepart() {
|
||||
this.$refs.departSelect.show()
|
||||
},
|
||||
systemSetting() {
|
||||
this.$refs.settingDrawer.showDrawer()
|
||||
},
|
||||
/* update_begin author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
searchMenus(arr, menus) {
|
||||
for (let i of menus) {
|
||||
if (!i.hidden && 'layouts/RouteView' !== i.component) {
|
||||
arr.push(i)
|
||||
}
|
||||
if (i.children && i.children.length > 0) {
|
||||
this.searchMenus(arr, i.children)
|
||||
}
|
||||
this.searchMenuVisible = false
|
||||
},
|
||||
// update_end author:sunjianlei date:20191230 for: 解决外部链接打开失败的问题
|
||||
/*update_end author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
/*update_begin author:liushaoqian date:20200507 for: 刷新缓存*/
|
||||
clearCache(){
|
||||
getAction('sys/dict/refleshCache').then((res) => {
|
||||
if (res.success) {
|
||||
//重新加载缓存
|
||||
getAction('sys/dict/queryAllDictItems').then((res) => {
|
||||
if (res.success) {
|
||||
Vue.ls.remove(UI_CACHE_DB_DICT_DATA)
|
||||
Vue.ls.set(UI_CACHE_DB_DICT_DATA, res.result, 7 * 24 * 60 * 60 * 1000)
|
||||
}
|
||||
})
|
||||
this.$message.success('刷新缓存完成!')
|
||||
}
|
||||
}).catch(e=>{
|
||||
this.$message.warn('刷新缓存失败!')
|
||||
console.log('刷新失败',e)
|
||||
})
|
||||
}
|
||||
/*update_end author:liushaoqian date:20200507 for: 刷新缓存*/
|
||||
},
|
||||
filterOption(input, option) {
|
||||
return option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
|
||||
},
|
||||
// update_begin author:sunjianlei date:20191230 for: 解决外部链接打开失败的问题
|
||||
searchMethods(value) {
|
||||
let route = this.searchMenuOptions.filter(item => item.id === value)[0]
|
||||
if (route.meta.internalOrExternal === true || route.component.includes('layouts/IframePageView')) {
|
||||
window.open(route.meta.url, '_blank')
|
||||
} else {
|
||||
this.$router.push({ path: route.path })
|
||||
}
|
||||
this.searchMenuVisible = false
|
||||
},
|
||||
// update_end author:sunjianlei date:20191230 for: 解决外部链接打开失败的问题
|
||||
/*update_end author:zhaoxin date:20191129 for: 做头部菜单栏导航*/
|
||||
/*update_begin author:liushaoqian date:20200507 for: 刷新缓存*/
|
||||
clearCache() {
|
||||
getAction('sys/dict/refleshCache').then((res) => {
|
||||
if (res.success) {
|
||||
//重新加载缓存
|
||||
getAction('sys/dict/queryAllDictItems').then((res) => {
|
||||
if (res.success) {
|
||||
Vue.ls.remove(UI_CACHE_DB_DICT_DATA)
|
||||
Vue.ls.set(UI_CACHE_DB_DICT_DATA, res.result, 7 * 24 * 60 * 60 * 1000)
|
||||
}
|
||||
})
|
||||
this.$message.success('刷新缓存完成!')
|
||||
}
|
||||
}).catch(e => {
|
||||
this.$message.warn('刷新缓存失败!')
|
||||
console.log('刷新失败', e)
|
||||
})
|
||||
}
|
||||
/*update_end author:liushaoqian date:20200507 for: 刷新缓存*/
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="less" scoped>
|
||||
/* update_begin author:zhaoxin date:20191129 for: 让搜索框颜色能随主题颜色变换*/
|
||||
/* update-begin author:sunjianlei date:20191220 for: 解决全局样式冲突问题 */
|
||||
.user-wrapper .search-input {
|
||||
width: 180px;
|
||||
color: inherit;
|
||||
/* update_begin author:zhaoxin date:20191129 for: 让搜索框颜色能随主题颜色变换*/
|
||||
/* update-begin author:sunjianlei date:20191220 for: 解决全局样式冲突问题 */
|
||||
.user-wrapper .search-input {
|
||||
width: 180px;
|
||||
color: inherit;
|
||||
|
||||
/deep/ .ant-select-selection {
|
||||
background-color: inherit;
|
||||
border: 0;
|
||||
border-bottom: 1px solid white;
|
||||
&__placeholder, &__field__placeholder {
|
||||
color: inherit;
|
||||
}
|
||||
/deep/ .ant-select-selection {
|
||||
background-color: inherit;
|
||||
border: 0;
|
||||
border-bottom: 1px solid white;
|
||||
|
||||
&__placeholder, &__field__placeholder {
|
||||
color: inherit;
|
||||
}
|
||||
}
|
||||
/* update-end author:sunjianlei date:20191220 for: 解决全局样式冲突问题 */
|
||||
/* update_end author:zhaoxin date:20191129 for: 让搜索框颜色能随主题颜色变换*/
|
||||
}
|
||||
|
||||
/* update-end author:sunjianlei date:20191220 for: 解决全局样式冲突问题 */
|
||||
/* update_end author:zhaoxin date:20191129 for: 让搜索框颜色能随主题颜色变换*/
|
||||
</style>
|
||||
|
||||
<style scoped>
|
||||
.logout_title {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
.logout_title {
|
||||
color: #fff;
|
||||
text-decoration: none;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
class="j-table-force-nowrap"
|
||||
>
|
||||
<span slot="action" slot-scope="record" class="action-span-cell">
|
||||
<a @click="lookLogistics()" v-if="record.postStatus === 1">查看物流</a>
|
||||
<a @click="lookLogistics(record)" v-if="record.postStatus === 1">查看物流</a>
|
||||
</span>
|
||||
<!-- <p slot="expandedRowRender" slot-scope="record" style="margin: 0">-->
|
||||
<!-- {{ record.sendDate }}-->
|
||||
@@ -291,8 +291,9 @@ export default {
|
||||
/*
|
||||
* 查看物流
|
||||
* */
|
||||
lookLogistics() {
|
||||
window.open('https://www.ems.com.cn/', '_blank')
|
||||
lookLogistics(record) {
|
||||
const com = Number(record.sendMethod) === 1 && 'ems' || 'shunfeng'
|
||||
window.open(`https://www.kuaidi100.com/chaxun?com=${ com }&nu=${ record.postNo }`)
|
||||
},
|
||||
/*
|
||||
* 去合同详情 传入合同id
|
||||
|
||||
@@ -255,6 +255,9 @@ export default {
|
||||
text-align: center;
|
||||
}
|
||||
.operate {
|
||||
a {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
//width: 150px;
|
||||
}
|
||||
</style>
|
||||
|
||||
@@ -87,7 +87,7 @@
|
||||
<a-form-item class='captcha'>
|
||||
<a-input
|
||||
size="large"
|
||||
v-decorator="['captcha', { rules: validatorRules.captcha.rules,validateTrigger: 'blur'}]"
|
||||
v-decorator="['captcha', validatorRules.captcha]"
|
||||
type="text"
|
||||
autocomplete="new-password"
|
||||
placeholder="请输入验证码">
|
||||
@@ -173,7 +173,7 @@ export default {
|
||||
username: { rules: [{ required: true, message: '请输入手机号!' }, { validator: this.checkPhone }] },
|
||||
password: { rules: [{ required: true, message: '请输入密码!' }] },
|
||||
mobile: { rules: [{ validator: this.validateMobile }] },
|
||||
captcha: { rule: [{ required: true, message: '请输入验证码!' }] },
|
||||
captcha: { rules: [{ required: true, message: '请输入验证码!' }] },
|
||||
inputCode: { rules: [{ required: true, message: '请输入验证码!' }] },
|
||||
phone: { rules: [{ required: true, message: '请输入手机号!' }, { validator: this.checkPhone }] }
|
||||
},
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<a-row v-if="$route.query.isFirstLogin !== 'true'">
|
||||
<a-col :span='22'>
|
||||
<a-form-item
|
||||
label="手机"
|
||||
label="手机号"
|
||||
:labelCol="{span: 5}"
|
||||
:wrapperCol="{span: 19}"
|
||||
>
|
||||
@@ -37,7 +37,7 @@
|
||||
v-decorator="['captcha', validatorRules.captcha]"
|
||||
type="text"
|
||||
autocomplete="new-password"
|
||||
placeholder="验证码">
|
||||
placeholder="请输入验证码">
|
||||
</a-input>
|
||||
<a-button
|
||||
tabindex="-1"
|
||||
@@ -56,7 +56,7 @@
|
||||
:labelCol="{span: 5}"
|
||||
:wrapperCol="{span: 19}">
|
||||
<a-input-password
|
||||
placeholder="新密码"
|
||||
placeholder="请输入新密码"
|
||||
v-decorator="['password', validatorRules.password]"
|
||||
autocomplete="new-password"
|
||||
@paste.native.capture.prevent="handleOperate"
|
||||
@@ -73,7 +73,7 @@
|
||||
:labelCol="{span: 5}"
|
||||
:wrapperCol="{span: 19}">
|
||||
<a-input-password
|
||||
placeholder="确认密码"
|
||||
placeholder="请输入确认密码"
|
||||
v-decorator="['confirmPassword', validatorRules.confirmPassword]"
|
||||
type="password"
|
||||
@paste.native.capture.prevent="handleOperate"
|
||||
@@ -118,26 +118,29 @@ export default {
|
||||
validatorRules: {
|
||||
phone: {
|
||||
rules: [
|
||||
{ required: true, message: '请输入手机号码!' }, { validator: this.validatePhone }],
|
||||
{ required: true, message: '请输入手机号!' }, { validator: this.validatePhone }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
captcha: {
|
||||
rules: [{ required: true, message: '请输入短信验证码!' }],
|
||||
rules: [{ required: true, message: '请输入验证码!' }],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
password: {
|
||||
rules: [
|
||||
{required: true, message: '请输入新密码!'},
|
||||
{
|
||||
required: true,
|
||||
pattern: /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,.\/]).{8,}$/,
|
||||
message: '密码由8位数字、大小写字母和特殊符号组成!!'
|
||||
message: '密码由8位及以上数字、大小写字母和特殊符号组成!'
|
||||
}
|
||||
],
|
||||
validateTrigger: 'blur'
|
||||
},
|
||||
confirmPassword: {
|
||||
rules: [
|
||||
{ required: true, message: '密码不能为空!' },
|
||||
{ required: true, message: '请输入确认密码!' },
|
||||
{ pattern: /^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[~!@#$%^&*()_+`\-={}:";'<>?,./]).{8,30}$/,
|
||||
message: '密码由8位及以上数字、大小写字母和特殊符号组成!'
|
||||
},
|
||||
{ validator: this.handlePasswordCheck }
|
||||
],
|
||||
validateTrigger: 'blur'
|
||||
|
||||
Reference in New Issue
Block a user