初始化配置以及首页修改
This commit is contained in:
parent
667500bd63
commit
95504af9d2
|
|
@ -1,10 +1,10 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 博诺思管理系统
|
VUE_APP_TITLE = 华东实名制管理系统
|
||||||
|
|
||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
ENV = 'development'
|
ENV = 'development'
|
||||||
|
|
||||||
# 博诺思管理系统/开发环境
|
# 华东实名制管理系统/开发环境
|
||||||
VUE_APP_BASE_API = '/dev-api'
|
VUE_APP_BASE_API = '/dev-api'
|
||||||
|
|
||||||
# 路由懒加载
|
# 路由懒加载
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 博诺思管理系统
|
VUE_APP_TITLE = 华东实名制管理系统
|
||||||
|
|
||||||
# 生产环境配置
|
# 生产环境配置
|
||||||
ENV = 'production'
|
ENV = 'production'
|
||||||
|
|
||||||
# 博诺思管理系统/生产环境
|
# 华东实名制管理系统/生产环境
|
||||||
VUE_APP_BASE_API = '/prod-api'
|
VUE_APP_BASE_API = '/prod-api'
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
# 页面标题
|
# 页面标题
|
||||||
VUE_APP_TITLE = 博诺思管理系统
|
VUE_APP_TITLE = 华东实名制管理系统
|
||||||
|
|
||||||
NODE_ENV = production
|
NODE_ENV = production
|
||||||
|
|
||||||
# 测试环境配置
|
# 测试环境配置
|
||||||
ENV = 'staging'
|
ENV = 'staging'
|
||||||
|
|
||||||
# 博诺思管理系统/测试环境
|
# 华东实名制管理系统/测试环境
|
||||||
VUE_APP_BASE_API = '/stage-api'
|
VUE_APP_BASE_API = '/stage-api'
|
||||||
|
|
|
||||||
180
package.json
180
package.json
|
|
@ -1,93 +1,93 @@
|
||||||
{
|
{
|
||||||
"name": "bonus",
|
"name": "bonus",
|
||||||
"version": "3.6.4",
|
"version": "3.6.4",
|
||||||
"description": "博诺思管理系统",
|
"description": "华东实名制管理系统",
|
||||||
"author": "博诺思",
|
"author": "博诺思",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "vue-cli-service serve",
|
||||||
"build:prod": "vue-cli-service build",
|
"build:prod": "vue-cli-service build",
|
||||||
"build:stage": "vue-cli-service build --mode staging",
|
"build:stage": "vue-cli-service build --mode staging",
|
||||||
"preview": "node build/index.js --preview",
|
"preview": "node build/index.js --preview",
|
||||||
"lint": "eslint --ext .js,.vue src"
|
"lint": "eslint --ext .js,.vue src"
|
||||||
},
|
},
|
||||||
"husky": {
|
"husky": {
|
||||||
"hooks": {
|
"hooks": {
|
||||||
"pre-commit": "lint-staged"
|
"pre-commit": "lint-staged"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
"src/**/*.{js,vue}": [
|
"src/**/*.{js,vue}": [
|
||||||
"eslint --fix",
|
"eslint --fix",
|
||||||
"git add"
|
"git add"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"keywords": [
|
||||||
|
"vue",
|
||||||
|
"admin",
|
||||||
|
"dashboard",
|
||||||
|
"element-ui",
|
||||||
|
"boilerplate",
|
||||||
|
"admin-template",
|
||||||
|
"management-system"
|
||||||
|
],
|
||||||
|
"repository": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "http://192.168.0.56:3000/bonus/Bonus-Cloud.git"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@riophae/vue-treeselect": "0.4.0",
|
||||||
|
"axios": "0.24.0",
|
||||||
|
"clipboard": "2.0.8",
|
||||||
|
"core-js": "3.25.3",
|
||||||
|
"crypto-js": "^4.2.0",
|
||||||
|
"echarts": "5.4.0",
|
||||||
|
"element-ui": "2.15.14",
|
||||||
|
"file-saver": "2.0.5",
|
||||||
|
"fuse.js": "6.4.3",
|
||||||
|
"highlight.js": "9.18.5",
|
||||||
|
"js-beautify": "1.13.0",
|
||||||
|
"js-cookie": "3.0.1",
|
||||||
|
"jsencrypt": "3.0.0-rc.1",
|
||||||
|
"nprogress": "0.2.0",
|
||||||
|
"quill": "1.3.7",
|
||||||
|
"screenfull": "5.0.2",
|
||||||
|
"sm-crypto": "^0.3.13",
|
||||||
|
"sortablejs": "1.10.2",
|
||||||
|
"vue": "2.6.12",
|
||||||
|
"vue-count-to": "1.0.13",
|
||||||
|
"vue-cropper": "0.5.5",
|
||||||
|
"vue-meta": "2.4.0",
|
||||||
|
"vue-router": "3.4.9",
|
||||||
|
"vuedraggable": "2.24.3",
|
||||||
|
"vuex": "3.6.0",
|
||||||
|
"webstomp-client": "^1.2.6"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@vue/cli-plugin-babel": "4.4.6",
|
||||||
|
"@vue/cli-plugin-eslint": "4.4.6",
|
||||||
|
"@vue/cli-service": "4.4.6",
|
||||||
|
"babel-eslint": "10.1.0",
|
||||||
|
"babel-plugin-dynamic-import-node": "2.3.3",
|
||||||
|
"chalk": "4.1.0",
|
||||||
|
"compression-webpack-plugin": "6.1.2",
|
||||||
|
"connect": "3.6.6",
|
||||||
|
"eslint": "7.15.0",
|
||||||
|
"eslint-plugin-vue": "7.2.0",
|
||||||
|
"lint-staged": "10.5.3",
|
||||||
|
"runjs": "4.4.2",
|
||||||
|
"sass": "1.32.13",
|
||||||
|
"sass-loader": "10.1.1",
|
||||||
|
"script-ext-html-webpack-plugin": "2.1.5",
|
||||||
|
"svg-sprite-loader": "5.1.1",
|
||||||
|
"vue-template-compiler": "2.6.12"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=8.9",
|
||||||
|
"npm": ">= 3.0.0"
|
||||||
|
},
|
||||||
|
"browserslist": [
|
||||||
|
"> 1%",
|
||||||
|
"last 2 versions"
|
||||||
]
|
]
|
||||||
},
|
|
||||||
"keywords": [
|
|
||||||
"vue",
|
|
||||||
"admin",
|
|
||||||
"dashboard",
|
|
||||||
"element-ui",
|
|
||||||
"boilerplate",
|
|
||||||
"admin-template",
|
|
||||||
"management-system"
|
|
||||||
],
|
|
||||||
"repository": {
|
|
||||||
"type": "git",
|
|
||||||
"url": "http://192.168.0.56:3000/bonus/Bonus-Cloud.git"
|
|
||||||
},
|
|
||||||
"dependencies": {
|
|
||||||
"@riophae/vue-treeselect": "0.4.0",
|
|
||||||
"axios": "0.24.0",
|
|
||||||
"clipboard": "2.0.8",
|
|
||||||
"core-js": "3.25.3",
|
|
||||||
"crypto-js": "^4.2.0",
|
|
||||||
"echarts": "5.4.0",
|
|
||||||
"element-ui": "2.15.14",
|
|
||||||
"file-saver": "2.0.5",
|
|
||||||
"fuse.js": "6.4.3",
|
|
||||||
"highlight.js": "9.18.5",
|
|
||||||
"js-beautify": "1.13.0",
|
|
||||||
"js-cookie": "3.0.1",
|
|
||||||
"jsencrypt": "3.0.0-rc.1",
|
|
||||||
"nprogress": "0.2.0",
|
|
||||||
"quill": "1.3.7",
|
|
||||||
"screenfull": "5.0.2",
|
|
||||||
"sm-crypto": "^0.3.13",
|
|
||||||
"sortablejs": "1.10.2",
|
|
||||||
"vue": "2.6.12",
|
|
||||||
"vue-count-to": "1.0.13",
|
|
||||||
"vue-cropper": "0.5.5",
|
|
||||||
"vue-meta": "2.4.0",
|
|
||||||
"vue-router": "3.4.9",
|
|
||||||
"vuedraggable": "2.24.3",
|
|
||||||
"vuex": "3.6.0",
|
|
||||||
"webstomp-client": "^1.2.6"
|
|
||||||
},
|
|
||||||
"devDependencies": {
|
|
||||||
"@vue/cli-plugin-babel": "4.4.6",
|
|
||||||
"@vue/cli-plugin-eslint": "4.4.6",
|
|
||||||
"@vue/cli-service": "4.4.6",
|
|
||||||
"babel-eslint": "10.1.0",
|
|
||||||
"babel-plugin-dynamic-import-node": "2.3.3",
|
|
||||||
"chalk": "4.1.0",
|
|
||||||
"compression-webpack-plugin": "6.1.2",
|
|
||||||
"connect": "3.6.6",
|
|
||||||
"eslint": "7.15.0",
|
|
||||||
"eslint-plugin-vue": "7.2.0",
|
|
||||||
"lint-staged": "10.5.3",
|
|
||||||
"runjs": "4.4.2",
|
|
||||||
"sass": "1.32.13",
|
|
||||||
"sass-loader": "10.1.1",
|
|
||||||
"script-ext-html-webpack-plugin": "2.1.5",
|
|
||||||
"svg-sprite-loader": "5.1.1",
|
|
||||||
"vue-template-compiler": "2.6.12"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=8.9",
|
|
||||||
"npm": ">= 3.0.0"
|
|
||||||
},
|
|
||||||
"browserslist": [
|
|
||||||
"> 1%",
|
|
||||||
"last 2 versions"
|
|
||||||
]
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 4.7 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.4 KiB |
|
|
@ -1,8 +1,15 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="title-tip">
|
<div class="title-tip">
|
||||||
<div />
|
<div class="left">
|
||||||
<div>
|
<div />
|
||||||
{{ titleText }}
|
<div>
|
||||||
|
{{ titleText }}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="right">
|
||||||
|
<!-- 给个默认插槽 用于后续放置一些按钮等内容 -->
|
||||||
|
<slot />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
@ -20,13 +27,22 @@ export default {
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.title-tip {
|
.title-tip {
|
||||||
margin-bottom: 8px;
|
padding: 12px 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
border-bottom: 1px solid #e6e6e6;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
.title-tip .left {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
|
font-family: 'PingFang SC';
|
||||||
|
font-size: 16px;
|
||||||
|
|
||||||
& div:first-child {
|
& div:first-child {
|
||||||
width: 4px;
|
width: 6px;
|
||||||
height: 16px;
|
height: 18px;
|
||||||
margin-right: 8px;
|
margin-right: 8px;
|
||||||
background-color: #409eff;
|
background-color: #409eff;
|
||||||
border-radius: 2px;
|
border-radius: 2px;
|
||||||
|
|
|
||||||
|
|
@ -1,37 +1,67 @@
|
||||||
<template>
|
<template>
|
||||||
<div :class="classObj" class="app-wrapper" :style="{'--current-color': theme}">
|
<div
|
||||||
<div v-if="device==='mobile'&&sidebar.opened" class="drawer-bg" @click="handleClickOutside"/>
|
:class="classObj"
|
||||||
<sidebar v-if="!sidebar.hide" class="sidebar-container"/>
|
class="app-wrapper"
|
||||||
<div :class="{hasTagsView:needTagsView,sidebarHide:sidebar.hide}" class="main-container">
|
:style="{ '--current-color': theme }"
|
||||||
<div :class="{'fixed-header':fixedHeader}">
|
|
||||||
<navbar/>
|
|
||||||
<tags-view v-if="needTagsView"/>
|
|
||||||
</div>
|
|
||||||
<app-main/>
|
|
||||||
<right-panel>
|
|
||||||
<settings/>
|
|
||||||
</right-panel>
|
|
||||||
</div>
|
|
||||||
<el-dialog :title="title" :visible.sync="showChangePasswordDialog" width="30%" :close-on-click-modal="false"
|
|
||||||
:show-close="false"
|
|
||||||
>
|
>
|
||||||
<el-form ref="form" :model="user" :rules="rules" label-width="80px">
|
<div
|
||||||
<el-form-item label="旧密码" prop="oldPassword">
|
v-if="device === 'mobile' && sidebar.opened"
|
||||||
<el-input v-model="user.oldPassword" placeholder="请输入旧密码" type="password" show-password/>
|
class="drawer-bg"
|
||||||
</el-form-item>
|
@click="handleClickOutside"
|
||||||
<el-form-item label="新密码" prop="newPassword">
|
/>
|
||||||
<el-input v-model="user.newPassword" placeholder="请输入新密码" type="password" show-password/>
|
<sidebar v-if="!sidebar.hide" class="sidebar-container" />
|
||||||
</el-form-item>
|
<div
|
||||||
<el-form-item label="确认密码" prop="confirmPassword">
|
:class="{ hasTagsView: needTagsView, sidebarHide: sidebar.hide }"
|
||||||
<el-input v-model="user.confirmPassword" placeholder="请确认新密码" type="password" show-password/>
|
class="main-container"
|
||||||
</el-form-item>
|
>
|
||||||
</el-form>
|
<div :class="{ 'fixed-header': fixedHeader }">
|
||||||
<div slot="footer" class="dialog-footer">
|
<navbar />
|
||||||
<el-button type="primary" @click="submit">确 定</el-button>
|
<tags-view v-if="needTagsView" />
|
||||||
<el-button @click="close">取 消</el-button>
|
</div>
|
||||||
</div>
|
<app-main />
|
||||||
</el-dialog>
|
<right-panel>
|
||||||
</div>
|
<settings />
|
||||||
|
</right-panel>
|
||||||
|
</div>
|
||||||
|
<el-dialog
|
||||||
|
:title="title"
|
||||||
|
:visible.sync="showChangePasswordDialog"
|
||||||
|
width="30%"
|
||||||
|
:close-on-click-modal="false"
|
||||||
|
:show-close="false"
|
||||||
|
>
|
||||||
|
<el-form ref="form" :model="user" :rules="rules" label-width="80px">
|
||||||
|
<el-form-item label="旧密码" prop="oldPassword">
|
||||||
|
<el-input
|
||||||
|
v-model="user.oldPassword"
|
||||||
|
placeholder="请输入旧密码"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="新密码" prop="newPassword">
|
||||||
|
<el-input
|
||||||
|
v-model="user.newPassword"
|
||||||
|
placeholder="请输入新密码"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="确认密码" prop="confirmPassword">
|
||||||
|
<el-input
|
||||||
|
v-model="user.confirmPassword"
|
||||||
|
placeholder="请确认新密码"
|
||||||
|
type="password"
|
||||||
|
show-password
|
||||||
|
/>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submit">确 定</el-button>
|
||||||
|
<el-button @click="close">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
@ -43,272 +73,284 @@ import variables from '@/assets/styles/variables.scss'
|
||||||
import { validateNewPassword } from '@/utils/validate'
|
import { validateNewPassword } from '@/utils/validate'
|
||||||
import { updateUserPwd, checkPasswordStatus } from '@/api/system/user'
|
import { updateUserPwd, checkPasswordStatus } from '@/api/system/user'
|
||||||
import { handleNoWarningLog } from '@/api/system/log'
|
import { handleNoWarningLog } from '@/api/system/log'
|
||||||
import {MessageBox} from "element-ui";
|
import { MessageBox } from 'element-ui'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Layout',
|
name: 'Layout',
|
||||||
data() {
|
data() {
|
||||||
const equalToPassword = (rule, value, callback) => {
|
const equalToPassword = (rule, value, callback) => {
|
||||||
if (this.user.newPassword !== value) {
|
if (this.user.newPassword !== value) {
|
||||||
callback(new Error('两次输入的密码不一致'))
|
callback(new Error('两次输入的密码不一致'))
|
||||||
} else {
|
} else {
|
||||||
callback()
|
callback()
|
||||||
}
|
|
||||||
}
|
|
||||||
return {
|
|
||||||
showChangePasswordDialog: false, // 控制弹窗显示
|
|
||||||
title: '',
|
|
||||||
user: {
|
|
||||||
oldPassword: undefined,
|
|
||||||
newPassword: undefined,
|
|
||||||
confirmPassword: undefined
|
|
||||||
},
|
|
||||||
// 表单校验规则
|
|
||||||
rules: {
|
|
||||||
oldPassword: [
|
|
||||||
{ required: true, message: '旧密码不能为空', trigger: 'blur' }
|
|
||||||
],
|
|
||||||
newPassword: [
|
|
||||||
{ required: true, message: '新密码不能为空', trigger: 'blur' },
|
|
||||||
{ validator: validateNewPassword, trigger: 'blur' }
|
|
||||||
],
|
|
||||||
confirmPassword: [
|
|
||||||
{ required: true, message: '确认密码不能为空', trigger: 'blur' },
|
|
||||||
{ required: true, validator: equalToPassword, trigger: 'blur' }
|
|
||||||
]
|
|
||||||
},
|
|
||||||
socket: null,
|
|
||||||
wsUrl: JSON.parse(localStorage.getItem('systemConfig')).webSocketurl,//'ws://localhost:18082/ws', // WebSocket 端点
|
|
||||||
isConnected: false, // 连接状态
|
|
||||||
reconnectInterval: 5000 // 自动重连时间间隔(毫秒
|
|
||||||
|
|
||||||
}
|
|
||||||
},
|
|
||||||
components: {
|
|
||||||
AppMain,
|
|
||||||
Navbar,
|
|
||||||
RightPanel,
|
|
||||||
Settings,
|
|
||||||
Sidebar,
|
|
||||||
TagsView
|
|
||||||
},
|
|
||||||
mixins: [ResizeMixin],
|
|
||||||
computed: {
|
|
||||||
...mapState({
|
|
||||||
theme: state => state.settings.theme,
|
|
||||||
sideTheme: state => state.settings.sideTheme,
|
|
||||||
sidebar: state => state.app.sidebar,
|
|
||||||
device: state => state.app.device,
|
|
||||||
needTagsView: state => state.settings.tagsView,
|
|
||||||
fixedHeader: state => state.settings.fixedHeader,
|
|
||||||
roles: state => state.user.roles,
|
|
||||||
}),
|
|
||||||
classObj() {
|
|
||||||
return {
|
|
||||||
hideSidebar: !this.sidebar.opened,
|
|
||||||
openSidebar: this.sidebar.opened,
|
|
||||||
withoutAnimation: this.sidebar.withoutAnimation,
|
|
||||||
mobile: this.device === 'mobile'
|
|
||||||
}
|
|
||||||
},
|
|
||||||
variables() {
|
|
||||||
return variables
|
|
||||||
}
|
|
||||||
},
|
|
||||||
created() {
|
|
||||||
this.checkPasswordStatus()
|
|
||||||
if (this.roles.includes("audit") || this.roles.includes("systemAdmin")) {
|
|
||||||
this.connectWebSocket();
|
|
||||||
}
|
|
||||||
this.handleNoWarningLog()
|
|
||||||
},
|
|
||||||
methods: {
|
|
||||||
checkPasswordStatus() {
|
|
||||||
checkPasswordStatus().then(response => {
|
|
||||||
if (response.code === 200) {
|
|
||||||
this.showChangePasswordDialog = response.data
|
|
||||||
this.title = response.msg
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
handleNoWarningLog(){
|
|
||||||
handleNoWarningLog().then(response => {
|
|
||||||
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
handleClickOutside() {
|
|
||||||
this.$store.dispatch('app/closeSideBar', { withoutAnimation: false })
|
|
||||||
},
|
|
||||||
submit() {
|
|
||||||
this.$refs['form'].validate(valid => {
|
|
||||||
if (valid) {
|
|
||||||
updateUserPwd(this.user.oldPassword, this.user.newPassword).then(response => {
|
|
||||||
this.showChangePasswordDialog = false
|
|
||||||
this.$modal.msgSuccess('修改成功')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
},
|
|
||||||
close() {
|
|
||||||
this.$store.dispatch('LogOut').then(() => {
|
|
||||||
location.href = '/index';
|
|
||||||
})
|
|
||||||
},
|
|
||||||
|
|
||||||
// 连接 WebSocket
|
|
||||||
connectWebSocket() {
|
|
||||||
if (this.socket) {
|
|
||||||
console.log("WebSocket 已连接");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
console.log("WebSocket URL:{}",this.wsUrl)
|
|
||||||
this.socket = new WebSocket(this.wsUrl);
|
|
||||||
|
|
||||||
// 监听 WebSocket 连接成功事件
|
|
||||||
this.socket.onopen = () => {
|
|
||||||
console.log("WebSocket 连接成功");
|
|
||||||
this.isConnected = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
// 接收消息
|
|
||||||
this.socket.onmessage = (event) => {
|
|
||||||
console.log("收到消息:", event.data);
|
|
||||||
const warning = JSON.parse(event.data);
|
|
||||||
this.handleWarning(warning);
|
|
||||||
};
|
|
||||||
|
|
||||||
// 监听连接关闭事件
|
|
||||||
this.socket.onclose = () => {
|
|
||||||
console.log("WebSocket 连接已关闭");
|
|
||||||
this.isConnected = false;
|
|
||||||
this.socket = null;
|
|
||||||
// 自动重连
|
|
||||||
this.reconnectWebSocket();
|
|
||||||
};
|
|
||||||
|
|
||||||
// 监听连接错误事件
|
|
||||||
this.socket.onerror = (error) => {
|
|
||||||
console.error("WebSocket 错误:", error);
|
|
||||||
this.isConnected = false;
|
|
||||||
this.socket = null;
|
|
||||||
// 自动重连
|
|
||||||
this.reconnectWebSocket();
|
|
||||||
};
|
|
||||||
},
|
|
||||||
|
|
||||||
// 自动重连 WebSocket
|
|
||||||
reconnectWebSocket() {
|
|
||||||
console.log("尝试重新连接 WebSocket...");
|
|
||||||
setTimeout(() => {
|
|
||||||
this.connectWebSocket();
|
|
||||||
}, this.reconnectInterval);
|
|
||||||
},
|
|
||||||
|
|
||||||
// 处理告警信息并显示弹窗
|
|
||||||
handleWarning(warning) {
|
|
||||||
console.log(warning)
|
|
||||||
let warningContent = '';
|
|
||||||
|
|
||||||
if (warning.operaUserName) {
|
|
||||||
warningContent += `<p><strong>操作人:</strong>${warning.operaUserName}</p>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (warning.warningEvent) {
|
|
||||||
warningContent += `<p><strong>事件:</strong>${warning.warningEvent}</p>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (warning.warningIp) {
|
|
||||||
warningContent += `<p><strong>IP:</strong>${warning.warningIp}</p>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (warning.operaTime) {
|
|
||||||
warningContent += `<p><strong>时间:</strong>${warning.operaTime}</p>`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (warningContent) {
|
|
||||||
MessageBox.alert(
|
|
||||||
warningContent,
|
|
||||||
'告警通知',
|
|
||||||
{
|
|
||||||
dangerouslyUseHTMLString: true,
|
|
||||||
confirmButtonText: '确认',
|
|
||||||
customClass: 'custom-message-box',
|
|
||||||
callback: () => {
|
|
||||||
this.notifyBackend(warning.warningId);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
);
|
}
|
||||||
}
|
return {
|
||||||
|
showChangePasswordDialog: false, // 控制弹窗显示
|
||||||
|
title: '',
|
||||||
|
user: {
|
||||||
|
oldPassword: undefined,
|
||||||
|
newPassword: undefined,
|
||||||
|
confirmPassword: undefined,
|
||||||
|
},
|
||||||
|
// 表单校验规则
|
||||||
|
rules: {
|
||||||
|
oldPassword: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '旧密码不能为空',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
newPassword: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '新密码不能为空',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
{ validator: validateNewPassword, trigger: 'blur' },
|
||||||
|
],
|
||||||
|
confirmPassword: [
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: '确认密码不能为空',
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
validator: equalToPassword,
|
||||||
|
trigger: 'blur',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
socket: null,
|
||||||
|
wsUrl: '', //'ws://localhost:18082/ws', // WebSocket 端点
|
||||||
|
isConnected: false, // 连接状态
|
||||||
|
reconnectInterval: 5000, // 自动重连时间间隔(毫秒
|
||||||
|
}
|
||||||
},
|
},
|
||||||
|
components: {
|
||||||
|
AppMain,
|
||||||
|
Navbar,
|
||||||
|
RightPanel,
|
||||||
|
Settings,
|
||||||
|
Sidebar,
|
||||||
|
TagsView,
|
||||||
|
},
|
||||||
|
mixins: [ResizeMixin],
|
||||||
|
computed: {
|
||||||
|
...mapState({
|
||||||
|
theme: (state) => state.settings.theme,
|
||||||
|
sideTheme: (state) => state.settings.sideTheme,
|
||||||
|
sidebar: (state) => state.app.sidebar,
|
||||||
|
device: (state) => state.app.device,
|
||||||
|
needTagsView: (state) => state.settings.tagsView,
|
||||||
|
fixedHeader: (state) => state.settings.fixedHeader,
|
||||||
|
roles: (state) => state.user.roles,
|
||||||
|
}),
|
||||||
|
classObj() {
|
||||||
|
return {
|
||||||
|
hideSidebar: !this.sidebar.opened,
|
||||||
|
openSidebar: this.sidebar.opened,
|
||||||
|
withoutAnimation: this.sidebar.withoutAnimation,
|
||||||
|
mobile: this.device === 'mobile',
|
||||||
|
}
|
||||||
|
},
|
||||||
|
variables() {
|
||||||
|
return variables
|
||||||
|
},
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.checkPasswordStatus()
|
||||||
|
// if (this.roles.includes("audit") || this.roles.includes("systemAdmin")) {
|
||||||
|
// this.connectWebSocket();
|
||||||
|
// }
|
||||||
|
this.handleNoWarningLog()
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
checkPasswordStatus() {
|
||||||
|
checkPasswordStatus().then((response) => {
|
||||||
|
if (response.code === 200) {
|
||||||
|
this.showChangePasswordDialog = response.data
|
||||||
|
this.title = response.msg
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
// 通知后端告警已处理
|
handleNoWarningLog() {
|
||||||
notifyBackend(warningId) {
|
handleNoWarningLog().then((response) => {})
|
||||||
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
|
},
|
||||||
const message = {
|
|
||||||
warningId,
|
|
||||||
};
|
|
||||||
this.socket.send(warningId);
|
|
||||||
console.log(`已通知后端处理告警: ${warningId}`);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
beforeDestroy() {
|
|
||||||
// 页面销毁时关闭 WebSocket 连接
|
|
||||||
if (this.socket) {
|
|
||||||
this.socket.close();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
handleClickOutside() {
|
||||||
|
this.$store.dispatch('app/closeSideBar', {
|
||||||
|
withoutAnimation: false,
|
||||||
|
})
|
||||||
|
},
|
||||||
|
submit() {
|
||||||
|
this.$refs['form'].validate((valid) => {
|
||||||
|
if (valid) {
|
||||||
|
updateUserPwd(
|
||||||
|
this.user.oldPassword,
|
||||||
|
this.user.newPassword,
|
||||||
|
).then((response) => {
|
||||||
|
this.showChangePasswordDialog = false
|
||||||
|
this.$modal.msgSuccess('修改成功')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
close() {
|
||||||
|
this.$store.dispatch('LogOut').then(() => {
|
||||||
|
location.href = '/index'
|
||||||
|
})
|
||||||
|
},
|
||||||
|
|
||||||
|
// 连接 WebSocket
|
||||||
|
connectWebSocket() {
|
||||||
|
if (this.socket) {
|
||||||
|
console.log('WebSocket 已连接')
|
||||||
|
return
|
||||||
|
}
|
||||||
|
console.log('WebSocket URL:{}', this.wsUrl)
|
||||||
|
this.socket = new WebSocket(this.wsUrl)
|
||||||
|
|
||||||
|
// 监听 WebSocket 连接成功事件
|
||||||
|
this.socket.onopen = () => {
|
||||||
|
console.log('WebSocket 连接成功')
|
||||||
|
this.isConnected = true
|
||||||
|
}
|
||||||
|
|
||||||
|
// 接收消息
|
||||||
|
this.socket.onmessage = (event) => {
|
||||||
|
console.log('收到消息:', event.data)
|
||||||
|
const warning = JSON.parse(event.data)
|
||||||
|
this.handleWarning(warning)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听连接关闭事件
|
||||||
|
this.socket.onclose = () => {
|
||||||
|
console.log('WebSocket 连接已关闭')
|
||||||
|
this.isConnected = false
|
||||||
|
this.socket = null
|
||||||
|
// 自动重连
|
||||||
|
this.reconnectWebSocket()
|
||||||
|
}
|
||||||
|
|
||||||
|
// 监听连接错误事件
|
||||||
|
this.socket.onerror = (error) => {
|
||||||
|
console.error('WebSocket 错误:', error)
|
||||||
|
this.isConnected = false
|
||||||
|
this.socket = null
|
||||||
|
// 自动重连
|
||||||
|
this.reconnectWebSocket()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 自动重连 WebSocket
|
||||||
|
reconnectWebSocket() {
|
||||||
|
console.log('尝试重新连接 WebSocket...')
|
||||||
|
setTimeout(() => {
|
||||||
|
this.connectWebSocket()
|
||||||
|
}, this.reconnectInterval)
|
||||||
|
},
|
||||||
|
|
||||||
|
// 处理告警信息并显示弹窗
|
||||||
|
handleWarning(warning) {
|
||||||
|
console.log(warning)
|
||||||
|
let warningContent = ''
|
||||||
|
|
||||||
|
if (warning.operaUserName) {
|
||||||
|
warningContent += `<p><strong>操作人:</strong>${warning.operaUserName}</p>`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warning.warningEvent) {
|
||||||
|
warningContent += `<p><strong>事件:</strong>${warning.warningEvent}</p>`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warning.warningIp) {
|
||||||
|
warningContent += `<p><strong>IP:</strong>${warning.warningIp}</p>`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warning.operaTime) {
|
||||||
|
warningContent += `<p><strong>时间:</strong>${warning.operaTime}</p>`
|
||||||
|
}
|
||||||
|
|
||||||
|
if (warningContent) {
|
||||||
|
MessageBox.alert(warningContent, '告警通知', {
|
||||||
|
dangerouslyUseHTMLString: true,
|
||||||
|
confirmButtonText: '确认',
|
||||||
|
customClass: 'custom-message-box',
|
||||||
|
callback: () => {
|
||||||
|
this.notifyBackend(warning.warningId)
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
|
// 通知后端告警已处理
|
||||||
|
notifyBackend(warningId) {
|
||||||
|
if (this.socket && this.socket.readyState === WebSocket.OPEN) {
|
||||||
|
const message = {
|
||||||
|
warningId,
|
||||||
|
}
|
||||||
|
this.socket.send(warningId)
|
||||||
|
console.log(`已通知后端处理告警: ${warningId}`)
|
||||||
|
}
|
||||||
|
},
|
||||||
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 页面销毁时关闭 WebSocket 连接
|
||||||
|
if (this.socket) {
|
||||||
|
this.socket.close()
|
||||||
|
}
|
||||||
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
@import "~@/assets/styles/mixin.scss";
|
@import '~@/assets/styles/mixin.scss';
|
||||||
@import "~@/assets/styles/variables.scss";
|
@import '~@/assets/styles/variables.scss';
|
||||||
|
|
||||||
.app-wrapper {
|
.app-wrapper {
|
||||||
@include clearfix;
|
@include clearfix;
|
||||||
position: relative;
|
position: relative;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
|
||||||
&.mobile.openSidebar {
|
&.mobile.openSidebar {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.drawer-bg {
|
.drawer-bg {
|
||||||
background: #000;
|
background: #000;
|
||||||
opacity: 0.3;
|
opacity: 0.3;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
top: 0;
|
top: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 999;
|
z-index: 999;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fixed-header {
|
.fixed-header {
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 9;
|
z-index: 9;
|
||||||
width: calc(100% - #{$base-sidebar-width});
|
width: calc(100% - #{$base-sidebar-width});
|
||||||
transition: width 0.28s;
|
transition: width 0.28s;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hideSidebar .fixed-header {
|
.hideSidebar .fixed-header {
|
||||||
width: calc(100% - 54px);
|
width: calc(100% - 54px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.sidebarHide .fixed-header {
|
.sidebarHide .fixed-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mobile .fixed-header {
|
.mobile .fixed-header {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
|
|
@ -30,153 +30,153 @@ import Layout from '@/layout'
|
||||||
|
|
||||||
// 公共路由
|
// 公共路由
|
||||||
export const constantRoutes = [
|
export const constantRoutes = [
|
||||||
{
|
{
|
||||||
path: '/redirect',
|
path: '/redirect',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/redirect/:path(.*)',
|
path: '/redirect/:path(.*)',
|
||||||
component: () => import('@/views/redirect')
|
component: () => import('@/views/redirect'),
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/login',
|
path: '/login',
|
||||||
component: () => import('@/views/login1'),
|
component: () => import('@/views/login1'),
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/register',
|
path: '/register',
|
||||||
component: () => import('@/views/register1'),
|
component: () => import('@/views/register1'),
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/404',
|
path: '/404',
|
||||||
component: () => import('@/views/error/404'),
|
component: () => import('@/views/error/404'),
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/401',
|
path: '/401',
|
||||||
component: () => import('@/views/error/401'),
|
component: () => import('@/views/error/401'),
|
||||||
hidden: true
|
hidden: true,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
redirect: 'index',
|
redirect: 'index',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index',
|
path: 'index',
|
||||||
component: () => import('@/views/index'),
|
component: () => import('@/views/home-index/index'),
|
||||||
name: 'Index',
|
name: 'Index',
|
||||||
meta: { title: '首页', icon: 'dashboard', affix: true }
|
meta: { title: '首页', icon: 'dashboard', affix: true },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/user',
|
path: '/user',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
redirect: 'noredirect',
|
redirect: 'noredirect',
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'profile',
|
path: 'profile',
|
||||||
component: () => import('@/views/system/user/profile/index'),
|
component: () => import('@/views/system/user/profile/index'),
|
||||||
name: 'Profile',
|
name: 'Profile',
|
||||||
meta: { title: '个人中心', icon: 'user' }
|
meta: { title: '个人中心', icon: 'user' },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// 动态路由,基于用户权限动态去加载
|
// 动态路由,基于用户权限动态去加载
|
||||||
export const dynamicRoutes = [
|
export const dynamicRoutes = [
|
||||||
{
|
{
|
||||||
path: '/system/user-auth',
|
path: '/system/user-auth',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:user:edit'],
|
permissions: ['system:user:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'role/:userId(\\d+)',
|
path: 'role/:userId(\\d+)',
|
||||||
component: () => import('@/views/system/user/authRole'),
|
component: () => import('@/views/system/user/authRole'),
|
||||||
name: 'AuthRole',
|
name: 'AuthRole',
|
||||||
meta: { title: '分配角色', activeMenu: '/system/user' }
|
meta: { title: '分配角色', activeMenu: '/system/user' },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/system/role-auth',
|
path: '/system/role-auth',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:role:edit'],
|
permissions: ['system:role:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'user/:roleId(\\d+)',
|
path: 'user/:roleId(\\d+)',
|
||||||
component: () => import('@/views/system/role/authUser'),
|
component: () => import('@/views/system/role/authUser'),
|
||||||
name: 'AuthUser',
|
name: 'AuthUser',
|
||||||
meta: { title: '分配用户', activeMenu: '/system/role' }
|
meta: { title: '分配用户', activeMenu: '/system/role' },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/system/dict-data',
|
path: '/system/dict-data',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['system:dict:list'],
|
permissions: ['system:dict:list'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:dictId(\\d+)',
|
path: 'index/:dictId(\\d+)',
|
||||||
component: () => import('@/views/system/dict/data'),
|
component: () => import('@/views/system/dict/data'),
|
||||||
name: 'Data',
|
name: 'Data',
|
||||||
meta: { title: '字典数据', activeMenu: '/system/dict' }
|
meta: { title: '字典数据', activeMenu: '/system/dict' },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/face/face-data',
|
path: '/face/face-data',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: false, // 或者删除此属性以确保显示
|
hidden: false, // 或者删除此属性以确保显示
|
||||||
permissions: ['face:data:list'],
|
permissions: ['face:data:list'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
// 只需要 ':groupCode' 来匹配字符串
|
// 只需要 ':groupCode' 来匹配字符串
|
||||||
path: 'index/:groupCode',
|
path: 'index/:groupCode',
|
||||||
component: () => import('@/views/face/faceData/index'),
|
component: () => import('@/views/face/faceData/index'),
|
||||||
name: 'Data',
|
name: 'Data',
|
||||||
meta: { title: '人脸库', activeMenu: '/face/face-data' }
|
meta: { title: '人脸库', activeMenu: '/face/face-data' },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/monitor/job-log',
|
path: '/monitor/job-log',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['monitor:job:list'],
|
permissions: ['monitor:job:list'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:jobId(\\d+)',
|
path: 'index/:jobId(\\d+)',
|
||||||
component: () => import('@/views/monitor/job/log'),
|
component: () => import('@/views/monitor/job/log'),
|
||||||
name: 'JobLog',
|
name: 'JobLog',
|
||||||
meta: { title: '调度日志', activeMenu: '/monitor/job' }
|
meta: { title: '调度日志', activeMenu: '/monitor/job' },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/tool/gen-edit',
|
path: '/tool/gen-edit',
|
||||||
component: Layout,
|
component: Layout,
|
||||||
hidden: true,
|
hidden: true,
|
||||||
permissions: ['tool:gen:edit'],
|
permissions: ['tool:gen:edit'],
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: 'index/:tableId(\\d+)',
|
path: 'index/:tableId(\\d+)',
|
||||||
component: () => import('@/views/tool/gen/editTable'),
|
component: () => import('@/views/tool/gen/editTable'),
|
||||||
name: 'GenEdit',
|
name: 'GenEdit',
|
||||||
meta: { title: '修改生成配置', activeMenu: '/tool/gen' }
|
meta: { title: '修改生成配置', activeMenu: '/tool/gen' },
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
}
|
},
|
||||||
]
|
]
|
||||||
|
|
||||||
// 防止连续点击多次路由报错
|
// 防止连续点击多次路由报错
|
||||||
|
|
@ -184,15 +184,15 @@ let routerPush = Router.prototype.push
|
||||||
let routerReplace = Router.prototype.replace
|
let routerReplace = Router.prototype.replace
|
||||||
// push
|
// push
|
||||||
Router.prototype.push = function push(location) {
|
Router.prototype.push = function push(location) {
|
||||||
return routerPush.call(this, location).catch(err => err)
|
return routerPush.call(this, location).catch((err) => err)
|
||||||
}
|
}
|
||||||
// replace
|
// replace
|
||||||
Router.prototype.replace = function push(location) {
|
Router.prototype.replace = function push(location) {
|
||||||
return routerReplace.call(this, location).catch(err => err)
|
return routerReplace.call(this, location).catch((err) => err)
|
||||||
}
|
}
|
||||||
|
|
||||||
export default new Router({
|
export default new Router({
|
||||||
mode: 'history', // 去掉url中的#
|
mode: 'history', // 去掉url中的#
|
||||||
scrollBehavior: () => ({ y: 0 }),
|
scrollBehavior: () => ({ y: 0 }),
|
||||||
routes: constantRoutes
|
routes: constantRoutes,
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,85 @@
|
||||||
|
<template>
|
||||||
|
<!-- 首页 数据概览 -->
|
||||||
|
<div class="data-overview">
|
||||||
|
<el-card>
|
||||||
|
<h3>数据概览</h3>
|
||||||
|
<div class="data-overview-content">
|
||||||
|
<!-- 公司选择 -->
|
||||||
|
<el-radio-group v-model="selectCompany" size="medium">
|
||||||
|
<el-radio-button
|
||||||
|
:key="item"
|
||||||
|
:label="item"
|
||||||
|
v-for="item in companyList"
|
||||||
|
/>
|
||||||
|
</el-radio-group>
|
||||||
|
|
||||||
|
<div class="data-overview-time">
|
||||||
|
<div>
|
||||||
|
数据更新时间:12:15:00
|
||||||
|
<i
|
||||||
|
class="el-icon-refresh"
|
||||||
|
style="cursor: pointer; font-size: 18px"
|
||||||
|
>
|
||||||
|
</i>
|
||||||
|
</div>
|
||||||
|
<div class="user-help" @click="onHandleCheckOften">
|
||||||
|
<i class="el-icon-s-help"> </i>
|
||||||
|
<span> 常用功能 </span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'DataOverview',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
selectCompany: '全部',
|
||||||
|
companyList: ['全部', '输一', '输二', '输三', '输四'],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
onHandleCheckOften() {
|
||||||
|
this.$emit('handleCheckOften')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
h3 {
|
||||||
|
font-weight: bold;
|
||||||
|
letter-spacing: 1px;
|
||||||
|
font-family: 'PingFang SC';
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
.data-overview-content {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.data-overview-time,
|
||||||
|
.user-help {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.user-help {
|
||||||
|
margin-left: 40px;
|
||||||
|
flex-direction: column;
|
||||||
|
|
||||||
|
justify-content: center;
|
||||||
|
cursor: pointer;
|
||||||
|
transform: translateY(-15px);
|
||||||
|
color: #409eff;
|
||||||
|
|
||||||
|
.el-icon-s-help {
|
||||||
|
margin-bottom: 5px;
|
||||||
|
font-size: 30px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,91 @@
|
||||||
|
<template>
|
||||||
|
<!-- 常用功能 -->
|
||||||
|
<div class="often-use">
|
||||||
|
<el-card>
|
||||||
|
<div>
|
||||||
|
<TitleTip :titleText="'常用功能'">
|
||||||
|
<i class="el-icon-setting" @click="onHandleSetting" />
|
||||||
|
</TitleTip>
|
||||||
|
</div>
|
||||||
|
<div class="often-user-content">
|
||||||
|
<div
|
||||||
|
:key="item.name"
|
||||||
|
class="often-user-item"
|
||||||
|
v-for="item in oftenUseList"
|
||||||
|
>
|
||||||
|
<i :class="item.icon"> </i>
|
||||||
|
<span> {{ item.name }} </span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</el-card>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
export default {
|
||||||
|
name: 'OftenUse',
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
oftenUseList: [
|
||||||
|
{
|
||||||
|
name: '考勤统计',
|
||||||
|
icon: 'el-icon-s-help',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '人员库',
|
||||||
|
icon: 'el-icon-s-help',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '用户管理',
|
||||||
|
icon: 'el-icon-s-help',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '工资册审核',
|
||||||
|
icon: 'el-icon-s-help',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '分包合同管理',
|
||||||
|
icon: 'el-icon-s-help',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
// 打开配置页面
|
||||||
|
onHandleSetting() {},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style lang="scss" scoped>
|
||||||
|
.often-use {
|
||||||
|
margin-top: 12px;
|
||||||
|
}
|
||||||
|
.often-user-content {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(10, 1fr);
|
||||||
|
gap: 10px;
|
||||||
|
|
||||||
|
.often-user-item {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
cursor: pointer;
|
||||||
|
|
||||||
|
& i {
|
||||||
|
margin-bottom: 10px;
|
||||||
|
text-align: center;
|
||||||
|
font-size: 28px;
|
||||||
|
}
|
||||||
|
& span {
|
||||||
|
text-align: center;
|
||||||
|
font-size: 14px;
|
||||||
|
font-family: 'PingFang SC';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.el-icon-setting {
|
||||||
|
font-size: 26px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
<template>
|
||||||
|
<!-- 首页 -->
|
||||||
|
<div class="app-container">
|
||||||
|
<!-- 数据概览 -->
|
||||||
|
<DataOverview @handleCheckOften="handleCheckOften" />
|
||||||
|
<!-- 常用功能 -->
|
||||||
|
|
||||||
|
<el-collapse-transition>
|
||||||
|
<OftenUse v-show="showOftenUse" />
|
||||||
|
</el-collapse-transition>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import DataOverview from './components/dataOverview.vue'
|
||||||
|
import OftenUse from './components/oftenUse.vue'
|
||||||
|
export default {
|
||||||
|
components: {
|
||||||
|
DataOverview,
|
||||||
|
OftenUse,
|
||||||
|
},
|
||||||
|
|
||||||
|
methods: {
|
||||||
|
// 常用功能按钮切换
|
||||||
|
handleCheckOften() {
|
||||||
|
console.log('常用功能')
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
@ -1,219 +1,279 @@
|
||||||
<template>
|
<template>
|
||||||
<div class="login">
|
<div class="login">
|
||||||
<el-form ref="loginForm" :model="loginForm" :rules="loginRules" class="login-form">
|
<el-form
|
||||||
<h3 class="title">博诺思后台管理系统</h3>
|
ref="loginForm"
|
||||||
<el-form-item prop="username">
|
:model="loginForm"
|
||||||
<el-input
|
:rules="loginRules"
|
||||||
v-model="loginForm.username"
|
class="login-form"
|
||||||
type="text"
|
|
||||||
auto-complete="off"
|
|
||||||
placeholder="账号"
|
|
||||||
>
|
>
|
||||||
<svg-icon slot="prefix" icon-class="user" class="el-input__icon input-icon" />
|
<h3 class="title">华东实名制管理系统</h3>
|
||||||
</el-input>
|
<el-form-item prop="username">
|
||||||
</el-form-item>
|
<el-input
|
||||||
<el-form-item prop="password">
|
v-model="loginForm.username"
|
||||||
<el-input
|
type="text"
|
||||||
v-model="loginForm.password"
|
auto-complete="off"
|
||||||
type="password"
|
placeholder="账号"
|
||||||
auto-complete="off"
|
>
|
||||||
placeholder="密码"
|
<svg-icon
|
||||||
@keyup.enter.native="handleLogin"
|
slot="prefix"
|
||||||
>
|
icon-class="user"
|
||||||
<svg-icon slot="prefix" icon-class="password" class="el-input__icon input-icon" />
|
class="el-input__icon input-icon"
|
||||||
</el-input>
|
/>
|
||||||
</el-form-item>
|
</el-input>
|
||||||
<el-form-item prop="code" v-if="captchaEnabled">
|
</el-form-item>
|
||||||
<el-input
|
<el-form-item prop="password">
|
||||||
v-model="loginForm.code"
|
<el-input
|
||||||
auto-complete="off"
|
v-model="loginForm.password"
|
||||||
placeholder="验证码"
|
type="password"
|
||||||
style="width: 63%"
|
auto-complete="off"
|
||||||
@keyup.enter.native="handleLogin"
|
placeholder="密码"
|
||||||
>
|
@keyup.enter.native="handleLogin"
|
||||||
<svg-icon slot="prefix" icon-class="validCode" class="el-input__icon input-icon" />
|
>
|
||||||
</el-input>
|
<svg-icon
|
||||||
<div class="login-code">
|
slot="prefix"
|
||||||
<img :src="codeUrl" @click="getCode" class="login-code-img"/>
|
icon-class="password"
|
||||||
</div>
|
class="el-input__icon input-icon"
|
||||||
</el-form-item>
|
/>
|
||||||
<el-checkbox v-model="loginForm.rememberMe" style="margin:0px 0px 25px 0px;">记住密码</el-checkbox>
|
</el-input>
|
||||||
<el-form-item style="width:100%;">
|
</el-form-item>
|
||||||
<el-button
|
<el-form-item prop="code" v-if="captchaEnabled">
|
||||||
:loading="loading"
|
<el-input
|
||||||
size="medium"
|
v-model="loginForm.code"
|
||||||
type="primary"
|
auto-complete="off"
|
||||||
style="width:100%;"
|
placeholder="验证码"
|
||||||
@click.native.prevent="handleLogin"
|
style="width: 63%"
|
||||||
>
|
@keyup.enter.native="handleLogin"
|
||||||
<span v-if="!loading">登 录</span>
|
>
|
||||||
<span v-else>登 录 中...</span>
|
<svg-icon
|
||||||
</el-button>
|
slot="prefix"
|
||||||
<div style="float: right;" v-if="register">
|
icon-class="validCode"
|
||||||
<router-link class="link-type" :to="'/register'">立即注册</router-link>
|
class="el-input__icon input-icon"
|
||||||
</div>
|
/>
|
||||||
</el-form-item>
|
</el-input>
|
||||||
</el-form>
|
<div class="login-code">
|
||||||
<!-- 底部 -->
|
<img
|
||||||
<div class="el-login-footer">
|
:src="codeUrl"
|
||||||
<span>Copyright © 2018-2024 bonus.vip All Rights Reserved.</span>
|
@click="getCode"
|
||||||
|
class="login-code-img"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
<el-checkbox
|
||||||
|
v-model="loginForm.rememberMe"
|
||||||
|
style="margin: 0px 0px 25px 0px"
|
||||||
|
>记住密码</el-checkbox
|
||||||
|
>
|
||||||
|
<el-form-item style="width: 100%">
|
||||||
|
<el-button
|
||||||
|
:loading="loading"
|
||||||
|
size="medium"
|
||||||
|
type="primary"
|
||||||
|
style="width: 100%"
|
||||||
|
@click.native.prevent="handleLogin"
|
||||||
|
>
|
||||||
|
<span v-if="!loading">登 录</span>
|
||||||
|
<span v-else>登 录 中...</span>
|
||||||
|
</el-button>
|
||||||
|
<div style="float: right" v-if="register">
|
||||||
|
<router-link class="link-type" :to="'/register'"
|
||||||
|
>立即注册</router-link
|
||||||
|
>
|
||||||
|
</div>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<!-- 底部 -->
|
||||||
|
<!-- <div class="el-login-footer">
|
||||||
|
<span>Copyright © 2018-2024 bonus.vip All Rights Reserved.</span>
|
||||||
|
</div> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getCodeImg } from "@/api/login";
|
import { getCodeImg } from '@/api/login'
|
||||||
import Cookies from "js-cookie";
|
import Cookies from 'js-cookie'
|
||||||
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
import { encrypt, decrypt } from '@/utils/jsencrypt'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "Login",
|
name: 'Login',
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
codeUrl: "",
|
codeUrl: '',
|
||||||
loginForm: {
|
loginForm: {
|
||||||
username: "",
|
username: '',
|
||||||
password: "",
|
password: '',
|
||||||
rememberMe: false,
|
rememberMe: false,
|
||||||
code: "",
|
code: '',
|
||||||
uuid: ""
|
uuid: '',
|
||||||
},
|
},
|
||||||
loginRules: {
|
loginRules: {
|
||||||
username: [
|
username: [
|
||||||
{ required: true, trigger: "blur", message: "请输入您的账号" }
|
{
|
||||||
],
|
required: true,
|
||||||
password: [
|
trigger: 'blur',
|
||||||
{ required: true, trigger: "blur", message: "请输入您的密码" }
|
message: '请输入您的账号',
|
||||||
],
|
},
|
||||||
code: [{ required: true, trigger: "change", message: "请输入验证码" }]
|
],
|
||||||
},
|
password: [
|
||||||
loading: false,
|
{
|
||||||
// 验证码开关
|
required: true,
|
||||||
captchaEnabled: true,
|
trigger: 'blur',
|
||||||
// 注册开关
|
message: '请输入您的密码',
|
||||||
register: false,
|
},
|
||||||
redirect: undefined
|
],
|
||||||
};
|
code: [
|
||||||
},
|
{
|
||||||
watch: {
|
required: true,
|
||||||
$route: {
|
trigger: 'change',
|
||||||
handler: function(route) {
|
message: '请输入验证码',
|
||||||
this.redirect = route.query && route.query.redirect;
|
},
|
||||||
},
|
],
|
||||||
immediate: true
|
},
|
||||||
}
|
loading: false,
|
||||||
},
|
// 验证码开关
|
||||||
created() {
|
captchaEnabled: true,
|
||||||
this.getCode();
|
// 注册开关
|
||||||
this.getCookie();
|
register: false,
|
||||||
},
|
redirect: undefined,
|
||||||
methods: {
|
|
||||||
getCode() {
|
|
||||||
getCodeImg().then(res => {
|
|
||||||
this.captchaEnabled = res.captchaEnabled === undefined ? true : res.captchaEnabled;
|
|
||||||
if (this.captchaEnabled) {
|
|
||||||
this.codeUrl = "data:image/gif;base64," + res.img;
|
|
||||||
this.loginForm.uuid = res.uuid;
|
|
||||||
}
|
}
|
||||||
});
|
|
||||||
},
|
},
|
||||||
getCookie() {
|
watch: {
|
||||||
const username = Cookies.get("username");
|
$route: {
|
||||||
const password = Cookies.get("password");
|
handler: function (route) {
|
||||||
const rememberMe = Cookies.get('rememberMe')
|
this.redirect = route.query && route.query.redirect
|
||||||
this.loginForm = {
|
},
|
||||||
username: username === undefined ? this.loginForm.username : username,
|
immediate: true,
|
||||||
password: password === undefined ? this.loginForm.password : decrypt(password),
|
},
|
||||||
rememberMe: rememberMe === undefined ? false : Boolean(rememberMe)
|
|
||||||
};
|
|
||||||
},
|
},
|
||||||
handleLogin() {
|
created() {
|
||||||
this.$refs.loginForm.validate(valid => {
|
this.getCode()
|
||||||
if (valid) {
|
this.getCookie()
|
||||||
this.loading = true;
|
},
|
||||||
if (this.loginForm.rememberMe) {
|
methods: {
|
||||||
Cookies.set("username", this.loginForm.username, { expires: 30 });
|
getCode() {
|
||||||
Cookies.set("password", encrypt(this.loginForm.password), { expires: 30 });
|
getCodeImg().then((res) => {
|
||||||
Cookies.set('rememberMe', this.loginForm.rememberMe, { expires: 30 });
|
this.captchaEnabled =
|
||||||
} else {
|
res.captchaEnabled === undefined ? true : res.captchaEnabled
|
||||||
Cookies.remove("username");
|
if (this.captchaEnabled) {
|
||||||
Cookies.remove("password");
|
this.codeUrl = 'data:image/gif;base64,' + res.img
|
||||||
Cookies.remove('rememberMe');
|
this.loginForm.uuid = res.uuid
|
||||||
}
|
}
|
||||||
this.$store.dispatch("Login", this.loginForm).then(() => {
|
})
|
||||||
this.$router.push({ path: this.redirect || "/" }).catch(()=>{});
|
},
|
||||||
}).catch(() => {
|
getCookie() {
|
||||||
this.loading = false;
|
const username = Cookies.get('username')
|
||||||
if (this.captchaEnabled) {
|
const password = Cookies.get('password')
|
||||||
this.getCode();
|
const rememberMe = Cookies.get('rememberMe')
|
||||||
|
this.loginForm = {
|
||||||
|
username:
|
||||||
|
username === undefined ? this.loginForm.username : username,
|
||||||
|
password:
|
||||||
|
password === undefined
|
||||||
|
? this.loginForm.password
|
||||||
|
: decrypt(password),
|
||||||
|
rememberMe:
|
||||||
|
rememberMe === undefined ? false : Boolean(rememberMe),
|
||||||
}
|
}
|
||||||
});
|
},
|
||||||
}
|
handleLogin() {
|
||||||
});
|
this.$refs.loginForm.validate((valid) => {
|
||||||
}
|
if (valid) {
|
||||||
}
|
this.loading = true
|
||||||
};
|
if (this.loginForm.rememberMe) {
|
||||||
|
Cookies.set('username', this.loginForm.username, {
|
||||||
|
expires: 30,
|
||||||
|
})
|
||||||
|
Cookies.set(
|
||||||
|
'password',
|
||||||
|
encrypt(this.loginForm.password),
|
||||||
|
{ expires: 30 },
|
||||||
|
)
|
||||||
|
Cookies.set('rememberMe', this.loginForm.rememberMe, {
|
||||||
|
expires: 30,
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
Cookies.remove('username')
|
||||||
|
Cookies.remove('password')
|
||||||
|
Cookies.remove('rememberMe')
|
||||||
|
}
|
||||||
|
this.$store
|
||||||
|
.dispatch('Login', this.loginForm)
|
||||||
|
.then(() => {
|
||||||
|
this.$router
|
||||||
|
.push({ path: this.redirect || '/' })
|
||||||
|
.catch(() => {})
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
this.loading = false
|
||||||
|
if (this.captchaEnabled) {
|
||||||
|
this.getCode()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style rel="stylesheet/scss" lang="scss">
|
<style rel="stylesheet/scss" lang="scss">
|
||||||
.login {
|
.login {
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
background-image: url("../assets/images/login-background.jpg");
|
background-image: url('../assets/images/login-background.jpg');
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
}
|
}
|
||||||
.title {
|
.title {
|
||||||
margin: 0px auto 30px auto;
|
margin: 0px auto 30px auto;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #707070;
|
color: #707070;
|
||||||
}
|
}
|
||||||
|
|
||||||
.login-form {
|
.login-form {
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
background: #ffffff;
|
background: #ffffff;
|
||||||
width: 400px;
|
width: 400px;
|
||||||
padding: 25px 25px 5px 25px;
|
padding: 25px 25px 5px 25px;
|
||||||
.el-input {
|
.el-input {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
input {
|
input {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.input-icon {
|
||||||
|
height: 39px;
|
||||||
|
width: 14px;
|
||||||
|
margin-left: 2px;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
.input-icon {
|
|
||||||
height: 39px;
|
|
||||||
width: 14px;
|
|
||||||
margin-left: 2px;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
.login-tip {
|
.login-tip {
|
||||||
font-size: 13px;
|
font-size: 13px;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #bfbfbf;
|
color: #bfbfbf;
|
||||||
}
|
}
|
||||||
.login-code {
|
.login-code {
|
||||||
width: 33%;
|
width: 33%;
|
||||||
height: 38px;
|
height: 38px;
|
||||||
float: right;
|
float: right;
|
||||||
img {
|
img {
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.el-login-footer {
|
.el-login-footer {
|
||||||
height: 40px;
|
height: 40px;
|
||||||
line-height: 40px;
|
line-height: 40px;
|
||||||
position: fixed;
|
position: fixed;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
letter-spacing: 1px;
|
letter-spacing: 1px;
|
||||||
}
|
}
|
||||||
.login-code-img {
|
.login-code-img {
|
||||||
height: 38px;
|
height: 38px;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
1068
src/views/login1.vue
1068
src/views/login1.vue
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue