Commit 4c4884f0 by liimin

优化

1 parent c7a7bf55
......@@ -8,7 +8,7 @@ VUE_APP_TITLE=tFIMS
# 网络请求mock测试地址
# VUE_APP_API=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
# 网络请求公用地址
VUE_APP_API=http://tfims.test.glsx.com.cn/router
VUE_APP_API=http://tfims.test.glsx.com.cn/router
# 仓库地址
VUE_APP_REPO=http://192.168.3.171:7300/mock/5d638b3b6fbe9a0ac59d872e/tFIMS
......
......@@ -5,22 +5,22 @@
</template>
<script>
import util from '@/libs/util'
export default {
name: 'app',
watch: {
'$i18n.locale': 'i18nHandle'
},
created () {
this.i18nHandle(this.$i18n.locale)
},
methods: {
i18nHandle (val, oldVal) {
util.cookies.set('lang', val)
document.querySelector('html').setAttribute('lang', val)
}
}
}
// import util from '@/libs/util'
// export default {
// name: 'app',
// watch: {
// '$i18n.locale': 'i18nHandle'
// },
// created () {
// this.i18nHandle(this.$i18n.locale)
// },
// methods: {
// i18nHandle (val, oldVal) {
// util.cookies.set('lang', val)
// document.querySelector('html').setAttribute('lang', val)
// }
// }
// }
</script>
<style lang="scss">
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-26 18:02:41
* @Last Modified by: limin
* @Last Modified time: 2019-09-09 15:51:58
* @Last Modified time: 2019-09-10 17:29:30
*/
import axios from '@/plugin/axios'
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-26 18:02:49
* @Last Modified by: limin
* @Last Modified time: 2019-09-06 14:17:40
* @Last Modified time: 2019-09-10 18:09:16
*/
import MD5 from 'js-md5'
const secret = 'c24619ed7fef02a0ae16328146bca5f97cc6493957a2137b'
......
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-08-26 18:02:55
* @Last Modified by: limin
* @Last Modified time: 2019-09-06 13:50:36
* @Last Modified time: 2019-09-10 17:10:53
*/
import request from './request'
......@@ -107,6 +107,15 @@ export function AccountValidate (data = {}) {
}
/**
* 获取登录日志
* @param {} data
*/
export function getLoginlogs (data) {
data.method = `${user_path}search.loginlog`
return request(data)
}
/**
* 获取角色权限资源列表
* @param {*} data 参数
*/
......
import request from './request'
import RequestMethods from './request.methods'
const path = 'fims.user.'
export function ModifyPassword (data) {
data.method = `${path}password.modify`
return request(data, RequestMethods.GET)
}
export function getLoginlogs (data) {
data.method = `${path}search.loginlog`
return request(data)
}
......@@ -2,7 +2,7 @@
* @Author: limin
* @Date: 2019-09-01 19:06:01
* @Last Modified by: limin
* @Last Modified time: 2019-09-06 12:22:40
* @Last Modified time: 2019-09-10 10:32:06
*/
import { LOGIN_URL, REG_URL, Role_LIST_URL } from '@/api/sys.account'
......@@ -51,3 +51,8 @@ export const LOGIN_TYPE = 1 // 1pc,2小程序
* 超级管理员类型
*/
export const SUPPER_ADMIN = 1 //
/**
* 职务置灰选项
*/
export const POST_DISABLED = ['2001', '2002', '2003'] // 总经理 仓库 部门经理
<template>
<i :class="`el-icon-${name}`" aria-hidden="true"></i>
</template>
<script>
export default {
name: 'd2-el-icon',
props: {
name: {
type: String,
required: false,
default: ''
}
}
}
</script>
<template>
<div>
<i class="fa" v-if="isFa" :class="`fa-${name}`" aria-hidden="true"></i>
<i v-else :class="`el-icon-${name}`" aria-hidden="true"></i>
</div>
<i class="fa" :class="`fa-${name}`" aria-hidden="true"></i>
</template>
<script>
......@@ -14,11 +11,6 @@ export default {
type: String,
required: false,
default: 'font-awesome'
},
isFa: {
type: Boolean,
required: false,
default: true
}
}
}
......
......@@ -6,5 +6,6 @@ import authButton from './d2-auth/d2-auth-btn.js'
// 注意 有些组件使用异步加载会有影响
Vue.component('d2-container', d2Container)
Vue.component('d2-icon', () => import('./d2-icon'))
Vue.component('d2-el-icon', () => import('./d2-el-icon'))
Vue.component('d2-icon-svg', () => import('./d2-icon-svg/index.vue'))
Vue.component([authButton.name], authButton)
......@@ -28,6 +28,7 @@ export default {
</script>
<style lang="scss">
.header-datetime{
transform: translateX(-30px);
font-size: 12px;
transform: translateX(-10px);
}
</style>
......@@ -5,7 +5,7 @@
placement="bottom">
<el-button class="d2-mr btn-text can-hover" type="text" @click="toggle">
<d2-icon v-if="active" name="compress"/>
<d2-icon v-else name="arrows-alt" style="font-size: 16px"/>
<d2-el-icon v-else name="full-screen" style="font-size: 16px"/>
</el-button>
</el-tooltip>
</template>
......
<template>
<el-button class="d2-mr btn-text can-hover" type="text" @click="handleClick">
<d2-icon name="search" style="font-size: 18px;"/>
<d2-el-icon name="search" style="font-size: 18px;"/>
</el-button>
</template>
......
......@@ -8,9 +8,9 @@
class="d2-ml-0 d2-mr btn-text can-hover"
type="text"
@click="dialogVisible = true">
<d2-icon
name="diamond"
style="font-size: 16px"/>
<d2-el-icon
name="magic-stick"
style="font-size: 18px"/>
</el-button>
</el-tooltip>
<el-dialog
......
......@@ -2,9 +2,9 @@
<div class="d2-panel-search-item" :class="hoverMode ? 'can-hover' : ''" flex>
<div class="d2-panel-search-item__icon" flex-box="0">
<div class="d2-panel-search-item__icon-box" flex="main:center cross:center">
<d2-icon v-if="item.icon" :name="item.icon"/>
<d2-icon-svg v-else-if="item.iconSvg" :name="item.iconSvg"/>
<d2-icon v-else name="file-o"/>
<d2-el-icon v-if="item.icon" :name="item.icon"/>
<!-- <d2-icon-svg v-else-if="item.iconSvg" :name="item.iconSvg"/>
<d2-icon v-else name="file-o"/> -->
</div>
</div>
<div class="d2-panel-search-item__info" flex-box="1" flex="dir:top">
......
......@@ -9,7 +9,7 @@
></el-avatar>
</div>
<div class="name-role">
<span class="sender">{{ user.userName }} - {{ ['超级管理员','管理员'][+user.roleType] }}</span>
<span class="sender">{{ user.userName }} - {{ user.postName }}</span>
</div>
<div class="registe-info">
<span class="registe-info">
......@@ -25,7 +25,7 @@
</div>-->
<div class="main-operation">
<span class="main-operation-item">
<el-button size="small" icon="fa fa-male" @click="openPersonalDialog"> 查看个人信息</el-button>
<el-button size="small" icon="fa fa-male" @click="openPersonalDialog"> 个人信息</el-button>
</span>
<span class="main-operation-item">
<el-button size="small" icon="fa fa-key" @click="openPasswordDialog"> 修改密码</el-button>
......@@ -163,8 +163,8 @@ export default {
<style lang="scss" scoped>
.personal-panel {
font-size: 14px;
width: 248px;
font-size: 13px;
width: 220px;
text-align: center;
border-color: rgba(180, 190, 190, 0.2);
border-width: 1px;
......@@ -187,7 +187,7 @@ export default {
text-align: center;
}
.name-role {
font-size: 14px;
font-size: 12px;
padding: 5px;
}
.personal-relation {
......@@ -223,7 +223,7 @@ export default {
border-top-width: 1px;
border-top-style: solid;
&-item {
padding: 12px 16px;
padding: 8px 16px;
}
&:hover {
cursor: pointer;
......
......@@ -62,7 +62,7 @@ permision.packAsideMenus = function (resources, idsInPermision) {
if (!__oMenu) { // 不存在 可能是 按钮 直接继续循环
return true
}
if ((obj.parentId+'') === '0') { // 取出1级菜单
if ((obj.parentId + '') === '0') { // 取出1级菜单
__aMenusInPermision.push(__oMenu)
} else { // 取出子菜单
__aSub.push(__oMenu)
......
// Vue
import Vue from 'vue'
import i18n from './i18n'
// import i18n from './i18n'
import App from './App'
// 核心插件
import d2Admin from '@/plugin/d2admin'
......@@ -26,7 +26,7 @@ Vue.use(d2Admin)
new Vue({
router,
store,
i18n,
// i18n,
render: h => h(App),
// created () {
// 处理路由 得到每一级的路由设置
......
// 菜单 侧边栏
export default [
{ path: '/index', title: '系统监控', icon: 'desktop' },
{
title: '页面',
icon: 'folder-o',
children: [
{ path: '/page1', title: '页面 1' },
{ path: '/page2', title: '页面 2' },
{ path: '/page3', title: '页面 3' }
]
}, {
title: '车辆管理',
icon: 'folder-o',
path: '/trafficManagement'
}, {
title: '子系统管理',
icon: 'folder-o',
path: '/subSysManagement'
}, {
title: '上报日志',
icon: 'folder-o',
path: '/reportingLogs'
}
]
// 菜单 顶栏
export default [
{ path: '/index', title: '系统监控', icon: 'home' },
{
title: '页面',
icon: 'folder-o',
children: [
{ path: '/page1', title: '页面 1' },
{ path: '/page2', title: '页面 2' },
{ path: '/page3', title: '页面 3' }
]
}
]
......@@ -10,7 +10,7 @@ import {
} from '@/common/constants'
import qs from 'qs'
axios.defaults.withCredentials = true
const expiresMinute = 30
const expiresMinute = 60 // 过期时间(分钟)
// 创建一个错误
function errorCreate (msg) {
const error = new Error(msg)
......@@ -59,17 +59,18 @@ service.interceptors.request.use(
url,
params
} = config
if (!LogExternals.some(u => u === url || (params && u === params.method))) {
const token = util.cookies.get('token')
if (!token) { // 判断是否长时间未操作
await store.dispatch('d2admin/account/logout')
router.replace('/login')
}
const uuid = util.cookies.get('uuid')
// 如果请求链接不在排除列表 (排除列表: 登录 基础数据) 并且cookie 过期(判断是否长时间未操作)
if (!LogExternals.some(u => u === url || (params && u === params.method)) && !uuid) {
await store.dispatch('d2admin/account/logout')
router.replace('/login')
}
if (uuid) { // 判断 cookie 是否存在 存在则更新时间 避免登出时 记录空值
const inExpiresMinutes = new Date(new Date().getTime() + expiresMinute * 60 * 1000)
util.cookies.set('uuid', uuid, {
expires: inExpiresMinutes
})
}
const inExpiresMinutes = new Date(new Date().getTime() + expiresMinute * 60 * 1000)
util.cookies.set('token', 'token', {
expires: inExpiresMinutes
})
resolve(config)
})
},
......
......@@ -42,7 +42,7 @@ router.beforeEach(async (to, from, next) => {
await store.dispatch('d2admin/account/load')
next(to.path)
} else {
if (store.state.d2admin.user.info) {
if (store.state.d2admin.user.info) { // sessionstorage 用户存继续当前路由 不存在 跳转登录 防止页面关闭还可以打开页面
next()
} else {
if (to.path === '/login') { // 如果是登录页面路径,就直接next()
......
......@@ -169,7 +169,7 @@ export const resources = {
}]
},
'105': {
path: 'materialList',
path: '/materialList',
icon: 'tickets',
name: 'fimsMaterialList',
meta: {
......@@ -265,7 +265,7 @@ export const resources = {
title: '用户管理',
authId: '10701',
parentId: '107',
cache:true
cache: true
},
auth: [{ // 列表操作
authId: '1070101',
......@@ -342,7 +342,7 @@ export const resources = {
title: '登录日志',
authId: '10703',
parentId: '107',
cache:true
cache: true
},
component: _import('userManage/loginLogs')
},
......@@ -354,7 +354,7 @@ export const resources = {
title: '上报日志',
authId: '108',
parentId: '0',
cache:true
cache: true
},
component: _import('reportingLogs')
// auth: [{
......
......@@ -45,7 +45,7 @@ export default {
state.station = station.confes
state.subsys = subsys.confes
state.post = post.confes
await dispatch('save2db', { name:'', value: state })
await dispatch('save2db', { name: '', value: state })
resolve(state)
})
})
......@@ -68,10 +68,10 @@ export default {
resolve(__data)
})
},
set({ state, dispatch }, {name,value}) {
set ({ state, dispatch }, { name, value }) {
return new Promise(async resolve => {
state[name] = value
await dispatch('save2db', { name, value})
await dispatch('save2db', { name, value })
resolve(value)
})
},
......@@ -115,7 +115,7 @@ export default {
return new Promise(async resolve => {
await dispatch('d2admin/db/set', {
dbName: 'database',
path:name?`base.${name}`:'base',
path: name ? `base.${name}` : 'base',
value,
user: true
}, { root: true })
......
......@@ -48,7 +48,7 @@ export default {
// 当前用户的 uuid
uuid: util.cookies.get('uuid'),
// 当前的 token
token: util.cookies.get('token'),
// token: util.cookies.get('token'),
// 当前地址
url: _.get(window, 'location.href', ''),
// 用户设置
......
......@@ -21,7 +21,7 @@ export default {
// value: info,
// user: true
// }, { root: true })
sessionStorage.setItem('user', escape(JSON.stringify(info)))
sessionStorage.setItem('tfims-user', escape(JSON.stringify(info)))
// end
resolve()
})
......@@ -39,7 +39,7 @@ export default {
// defaultValue: {},
// user: true
// }, { root: true })
state.info = JSON.parse(unescape(sessionStorage.getItem('user')))
state.info = JSON.parse(unescape(sessionStorage.getItem('tfims-user')))
// end
resolve()
})
......@@ -54,7 +54,7 @@ export default {
// user: true
// }, { root: true })
state.info = null
sessionStorage.removeItem('user')
sessionStorage.removeItem('tfims-user')
resolve()
})
}
......
......@@ -84,7 +84,7 @@ export default {
])
},
methods: {
get:_.get,
get: _.get,
handleShowMore (log) {
// 打印一条日志的所有信息到控制台
this.$notify({
......
......@@ -50,6 +50,7 @@
:value="post.confCode"
v-for="(post,index) in baseData.posts"
:key="index"
:disabled="POST_DISABLED.includes(post.confCode)"
></el-option>
</el-select>
</el-form-item>
......@@ -79,7 +80,7 @@
import { Reg } from '@/api/sys.account'
import { mapActions } from 'vuex'
import notice from '@/common/notice'
import { RegistType } from '@/common/constants'
import { RegistType, POST_DISABLED } from '@/common/constants'
export default {
name: 'DialogReg',
props: {
......@@ -95,6 +96,7 @@ export default {
},
data () {
return {
POST_DISABLED,
company: [],
regForm: {
createType: RegistType.BY_SELF, // 1 自注册 2 管理员创建
......
......@@ -38,7 +38,7 @@
maxlength="10"
v-focus
>
<i slot="prepend" class="fa fa-user-circle-o"></i>
<d2-el-icon slot="prepend" name="user"></d2-el-icon>
</el-input>
</el-form-item>
<el-form-item prop="password">
......@@ -50,7 +50,7 @@
maxlength="12"
placeholder="请输入密码"
>
<i slot="prepend" class="fa fa-keyboard-o"></i>
<d2-el-icon slot="prepend" name="key"/>
</el-input>
</el-form-item>
<el-form-item class="form-action">
......@@ -104,10 +104,10 @@ export default {
// 表单校验
rules: Object.freeze({
loginName: [{
required: true,
message: '请输入用户名',
trigger: 'submit'
}
required: true,
message: '请输入用户名',
trigger: 'submit'
}
],
password: [{
required: true,
......@@ -154,7 +154,6 @@ export default {
</script>
<style lang="scss">
@import "~@/components/d2-icon/font-awesome-4.7.0/css/font-awesome.min.css";
.page-login {
@extend %unable-select;
$backgroundColor: #2a343d;
......
......@@ -70,7 +70,7 @@
</template>
<script>
import { getLoginlogs } from '@api/userManage'
import { getLoginlogs } from '@api/sys.account'
export default {
name: 'FimsLoginLogs',
data () {
......
......@@ -82,17 +82,17 @@ export default {
mounted () {
this.fetchData()
this.$event.$on('e-role-dialog-close', async isReload => {
if(isReload){
if (isReload) {
this.fetchData()
const { roles } = await RoleList()
this.set({name:BaseData.ROLE.KEY,value:roles})
this.set({ name: BaseData.ROLE.KEY, value: roles })
}
this.editVisible = false
})
},
methods: {
...mapActions('d2admin/base',['set']),
...mapActions('d2admin/base', ['set']),
fetchData () {
this.loadRoleList()
......
......@@ -48,6 +48,7 @@
:value="post.confCode"
v-for="(post,index) in baseData.posts"
:key="index"
:disabled="POST_DISABLED.includes(post.confCode)"
></el-option>
</el-select>
</el-form-item>
......@@ -90,7 +91,7 @@
<script>
import { mapActions } from 'vuex'
import notice from '@/common/notice'
import { RegistType } from '@/common/constants'
import { RegistType, POST_DISABLED } from '@/common/constants'
import util from '@/libs/util'
export default {
name: 'DialogReg',
......@@ -132,6 +133,7 @@ export default {
},
data () {
return {
POST_DISABLED,
regForm: {
createType: RegistType.BY_ADMIN, // 1 自注册 2 管理员创建
loginName: '',
......@@ -195,7 +197,7 @@ export default {
methods: {
...mapActions('d2admin/base', ['load']),
handleClose (done) {
this.$event.$emit('e-reg-dialog-close',false)
this.$event.$emit('e-reg-dialog-close', false)
},
// 提交注册或审核数据
submit () {
......@@ -208,7 +210,7 @@ export default {
if (operateStatus) {
notice.okTips(`${this.title}成功!`)
this.$refs.regForm.resetFields()
this.$event.$emit('e-reg-dialog-close',true)
this.$event.$emit('e-reg-dialog-close', true)
} else {
notice.errorTips(`${this.title}失败!`)
}
......
......@@ -55,9 +55,9 @@ module.exports = {
'js-cookie': 'Cookies',
'nprogress': 'NProgress',
'echarts': 'echarts',
'lodash':'_',
'lodash': '_',
// 'vue-i18n':'vue-i18n',
'ua-parser':'UaParser'
'ua-parser': 'UaParser'
}
// 非开发环境
if (process.env.NODE_ENV !== 'development') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!