| | |
| | | <el-tooltip class="item" effect="dark" content="全屏" placement="bottom"> |
| | | <screenfull id="screenfull" class="right-menu-item hover-effect" /> |
| | | </el-tooltip> |
| | | |
| | | <el-tooltip class="item" effect="dark" content="我的消息" placement="bottom"> |
| | | <el-badge :is-dot="$store.state.settings.isDot" class="item right-menu-item hover-effect"> |
| | | <i class="el-icon-bell" @click="$message('点击了我的消息!');$store.state.settings.isDot=false" /> |
| | | </el-badge> |
| | | </el-tooltip> |
| | | |
| | | <div style=" font-size: 18px;font-family: 'Microsoft YaHei';color:#AAAAAA;padding:0 8px;cursor: pointer"> |
| | | {{ stu_torgname }} |
| | | </div> |
| | |
| | | <el-dropdown-item @click.native="editPassword"> |
| | | <span style="display:block;">修改密码</span> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item divided @click.native="systemSetting"> |
| | | <span style="display:block;">系统配置</span> |
| | | </el-dropdown-item> |
| | | <el-dropdown-item divided @click.native="logout"> |
| | | <span style="display:block;font-weight: bolder">退出</span> |
| | | </el-dropdown-item> |
| | | </el-dropdown-menu> |
| | | </el-dropdown> |
| | | </div> |
| | | |
| | | <el-dialog |
| | | v-el-drag-dialog |
| | | title="修改密码" |
| | |
| | | </el-dialog> |
| | | |
| | | </div> |
| | | |
| | | <right-panel ref="rightPanel"> |
| | | <settings /> |
| | | </right-panel> |
| | | |
| | | </div> |
| | | |
| | | </template> |
| | |
| | | import Search from '@/components/HeaderSearch' |
| | | import Screenfull from '@/components/Screenfull' |
| | | import variables from '@/styles/variables.scss' |
| | | import RightPanel from '@/components/RightPanel' |
| | | import Settings from '../components/Settings/index' |
| | | import * as signalR from '@aspnet/signalr' |
| | | |
| | | export default { |
| | | components: { |
| | |
| | | Breadcrumb, |
| | | Hamburger, |
| | | Search, |
| | | Screenfull |
| | | Screenfull, |
| | | Settings, |
| | | RightPanel |
| | | }, |
| | | directives: { elDragDialog }, |
| | | |
| | | data() { |
| | | const validatePassword1 = (rule, value, callback) => { |
| | | if (!value) { |
| | |
| | | { required: true, validator: validatePassword2, trigger: ['blur', 'change'] } |
| | | ] |
| | | }, |
| | | stu_torgname: '' |
| | | stu_torgname: '', |
| | | show: false, |
| | | signalr: null |
| | | } |
| | | }, |
| | | inject: [ |
| | | 'reload' |
| | | ], |
| | | created() { |
| | | // this.$signalr.start() |
| | | this.usercode = getCookie('navTabId') |
| | | this.username = getCookie('username') |
| | | this.stu_torgname = getCookie('stu_torgname') === '' ? '系统管理员' : getCookie('stu_torgname') |
| | | }, |
| | | mounted() { |
| | | // this.getHubConnectionBuilder() |
| | | }, |
| | | computed: { |
| | | ...mapGetters([ |
| | |
| | | } |
| | | }, |
| | | methods: { |
| | | // 建立hub连接 |
| | | async getHubConnectionBuilder() { |
| | | const url = 'http://121.196.36.24:8019/chatHub' |
| | | this.signalr = new signalR.HubConnectionBuilder().withUrl(url, { |
| | | // skipNegotiation: true, |
| | | // transport: signalR.HttpTransportType.WebSockets |
| | | }).configureLogging(signalR.LogLevel.Information).build() |
| | | |
| | | await this.signalr.start().then(() => { |
| | | if (window.Notification) { |
| | | if (Notification.permission === 'granted') { |
| | | console.log('允许通知') |
| | | } else if (Notification.permission !== 'denied') { |
| | | console.log('需要通知权限') |
| | | Notification.requestPermission((permission) => { |
| | | console.log('权限通知', permission) |
| | | }) |
| | | } else if (Notification.permission === 'denied') { |
| | | // console.log('拒绝通知') |
| | | } |
| | | } else { |
| | | console.error('浏览器不支持Notification') |
| | | } |
| | | // console.log('连接成功') |
| | | }) |
| | | |
| | | this.signalr.off('SendCustomUserMessage') |
| | | this.signalr.on('SendCustomUserMessage', (res) => { |
| | | this.$notify({ offset: 80, type: 'warning', title: '消息提醒', message: res }) |
| | | this.$store.state.settings.isDot = true |
| | | }) |
| | | await this.signalr.invoke('AddUser', getCookie('admin')) |
| | | }, |
| | | |
| | | systemSetting() { |
| | | this.$refs.rightPanel.show = !this.$refs.rightPanel.show |
| | | this.$refs.rightPanel.addEventClick() |
| | | }, |
| | | pageRefreshClick() { |
| | | this.reload() |
| | | const tabViews = this.$store.state.tagsView.visitedViews.map(item => { |
| | |
| | | this.$store.dispatch('app/toggleSideBar') |
| | | }, |
| | | async logout() { |
| | | // await this.signalr.stop() |
| | | // this.signalr.off('SendCustomUserMessage') |
| | | await this.$store.dispatch('user/logout') |
| | | this.$message.success('退出成功!') |
| | | this.$router.push(`/login`) |
| | |
| | | } |
| | | </script> |
| | | <style lang="scss" scoped> |
| | | ::v-deep .el-badge__content { |
| | | position: absolute !important; |
| | | top: 12px !important; |
| | | right: 10px !important; |
| | | } |
| | | |
| | | .display_btw { |
| | | display: flex; |
| | | justify-content: space-between; |