Mod aaa-12 添加yarn编译文件,修改接口参数
RCA: SOL: 修改人:maxiaonan 检视人:maxiaonan
This commit is contained in:
parent
a08b3e8b2a
commit
8a017f2eaa
|
@ -11,10 +11,10 @@ module.exports = {
|
|||
assetsSubDirectory: 'static',
|
||||
assetsPublicPath: '/',
|
||||
proxyTable: {
|
||||
'api': {
|
||||
target: 'http://192.168.100.98:8181',
|
||||
changeorigin: true,
|
||||
pathrewrite: {
|
||||
'/api': {
|
||||
target: 'http://192.168.100.98:8181/',
|
||||
changeOrigin: true,
|
||||
pathRewrite: {
|
||||
'^/api': '/'
|
||||
}
|
||||
}
|
||||
|
@ -37,7 +37,8 @@ module.exports = {
|
|||
showEslintErrorsInOverlay: false,
|
||||
|
||||
/**
|
||||
* Source Maps
|
||||
* Source
|
||||
*
|
||||
*/
|
||||
|
||||
// https://webpack.js.org/configuration/devtool/#development
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "cmcc-front",
|
||||
"name": "sdn-web",
|
||||
"version": "1.0.0",
|
||||
"description": "CMCC Front By Vue",
|
||||
"description": "SDN Front By Vue",
|
||||
"author": "CMHI <http://hy.10086.cn/>",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
|
|
|
@ -10,7 +10,6 @@
|
|||
import enquireScreen from './utils/device'
|
||||
import chinese from 'ant-design-vue/lib/locale-provider/zh_CN'
|
||||
import 'moment/locale/zh-cn'
|
||||
|
||||
export default {
|
||||
name: 'cmcc',
|
||||
data () {
|
||||
|
|
|
@ -31,6 +31,7 @@ Vue.prototype.$delete = request.delete
|
|||
Vue.prototype.$export = request.export
|
||||
Vue.prototype.$download = request.download
|
||||
Vue.prototype.$upload = request.upload
|
||||
Vue.prototype.$bodyRequest = request.bodyRequest
|
||||
|
||||
/* eslint-disable no-new */
|
||||
new Vue({
|
||||
|
|
|
@ -6,7 +6,6 @@ import LoginView from '@/views/login/Common'
|
|||
import EmptyPageView from '@/views/common/EmptyPageView'
|
||||
import HomePageView from '@/views/HomePage'
|
||||
import db from 'utils/localstorage'
|
||||
import request from 'utils/request'
|
||||
|
||||
Vue.use(Router)
|
||||
|
||||
|
@ -37,16 +36,190 @@ router.beforeEach((to, from, next) => {
|
|||
next()
|
||||
}
|
||||
let token = db.get('USER_TOKEN')
|
||||
let user = db.get('USER')
|
||||
let userRouter = get('USER_ROUTER')
|
||||
if (token.length && user) {
|
||||
if (token.length) {
|
||||
if (!asyncRouter) {
|
||||
if (!userRouter) {
|
||||
request.get(`menu/${user.username}`).then((res) => {
|
||||
asyncRouter = res.data
|
||||
asyncRouter = [
|
||||
{
|
||||
children: [
|
||||
{
|
||||
component: 'HomePageView',
|
||||
hasChildren: false,
|
||||
hasParent: false,
|
||||
icon: 'home',
|
||||
meta: {
|
||||
closeable: false,
|
||||
isShow: true
|
||||
},
|
||||
name: '系统主页',
|
||||
path: '/home'
|
||||
},
|
||||
{
|
||||
children: [
|
||||
{
|
||||
component: 'system/domain/Domain',
|
||||
hasChildren: false,
|
||||
hasParent: true,
|
||||
id: 143,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '域管理',
|
||||
parentId: 1,
|
||||
path: '/system/domain'
|
||||
},
|
||||
{
|
||||
component: 'system/user/User',
|
||||
hasChildren: false,
|
||||
hasParent: true,
|
||||
icon: '',
|
||||
id: 3,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '用户管理',
|
||||
parentId: 1,
|
||||
path: '/system/user'
|
||||
},
|
||||
{
|
||||
component: 'system/role/Role',
|
||||
hasChildren: false,
|
||||
hasParent: true,
|
||||
icon: '',
|
||||
id: 4,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '角色管理',
|
||||
parentId: 1,
|
||||
path: '/system/role'
|
||||
},
|
||||
{
|
||||
component: 'system/resource/Resource',
|
||||
hasChildren: false,
|
||||
hasParent: true,
|
||||
icon: '',
|
||||
id: 139,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '资源管理',
|
||||
parentId: 1,
|
||||
path: '/system/resource'
|
||||
}
|
||||
],
|
||||
component: 'PageView',
|
||||
hasChildren: true,
|
||||
hasParent: true,
|
||||
icon: 'appstore-o',
|
||||
id: 1,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '系统管理',
|
||||
parentId: 0,
|
||||
path: '/system'
|
||||
},
|
||||
{
|
||||
children: [
|
||||
{
|
||||
component: 'monitor/Online',
|
||||
hasChildren: false,
|
||||
hasParent: true,
|
||||
icon: '',
|
||||
id: 8,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '在线用户',
|
||||
parentId: 2,
|
||||
path: '/monitor/online'
|
||||
},
|
||||
{
|
||||
component: 'monitor/SystemLog',
|
||||
hasChildren: false,
|
||||
hasParent: true,
|
||||
icon: '',
|
||||
id: 10,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '系统日志',
|
||||
parentId: 2,
|
||||
path: '/monitor/systemlog'
|
||||
}
|
||||
],
|
||||
component: 'PageView',
|
||||
hasChildren: true,
|
||||
hasParent: true,
|
||||
icon: 'dashboard',
|
||||
id: 2,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '系统监控',
|
||||
parentId: 0,
|
||||
path: '/monitor'
|
||||
},
|
||||
{
|
||||
children: [
|
||||
{
|
||||
component: 'others/Excel',
|
||||
hasChildren: false,
|
||||
hasParent: true,
|
||||
id: 129,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '导入导出',
|
||||
parentId: 128,
|
||||
path: '/others/excel'
|
||||
}
|
||||
],
|
||||
component: 'PageView',
|
||||
hasChildren: true,
|
||||
hasParent: true,
|
||||
icon: 'coffee',
|
||||
id: 128,
|
||||
meta: {
|
||||
closeable: true
|
||||
},
|
||||
name: '其他模块',
|
||||
parentId: 0,
|
||||
path: '/others'
|
||||
},
|
||||
{
|
||||
component: 'personal/Profile',
|
||||
hasChildren: false,
|
||||
hasParent: false,
|
||||
icon: 'none',
|
||||
meta: {
|
||||
closeable: true,
|
||||
isShow: false
|
||||
},
|
||||
name: '个人中心',
|
||||
path: '/profile'
|
||||
}
|
||||
],
|
||||
component: 'MenuView',
|
||||
hasChildren: false,
|
||||
hasParent: false,
|
||||
icon: 'none',
|
||||
name: '主页',
|
||||
path: '/',
|
||||
redirect: '/home'
|
||||
},
|
||||
{
|
||||
component: 'error/404',
|
||||
hasChildren: false,
|
||||
hasParent: false,
|
||||
name: 404,
|
||||
path: '*'
|
||||
}
|
||||
]
|
||||
save('USER_ROUTER', asyncRouter)
|
||||
go(to, next)
|
||||
})
|
||||
} else {
|
||||
asyncRouter = userRouter
|
||||
go(to, next)
|
||||
|
|
|
@ -8,21 +8,21 @@ moment.locale('zh-cn')
|
|||
// 统一配置
|
||||
let SDN_REQUEST = axios.create({
|
||||
// baseURL: 'http://127.0.0.1:9527/',
|
||||
baseURL: 'http://192.168.100.98:8181/',
|
||||
baseURL: '/api',
|
||||
responseType: 'json',
|
||||
withCredentials: true,
|
||||
validateStatus (status) {
|
||||
// 200 外的状态码都认定为失败
|
||||
return status === 200
|
||||
// 200、201、204外的状态码都认定为失败
|
||||
return status === 200 || status === 201 || status === 204
|
||||
}
|
||||
})
|
||||
|
||||
// 拦截请求
|
||||
SDN_REQUEST.interceptors.request.use((config) => {
|
||||
let expireTime = store.state.account.expireTime
|
||||
let now = moment().format('YYYYMMDDHHmmss')
|
||||
// let now = moment().format('YYYYMMDDHHmmss')
|
||||
// 让token早10秒种过期,提升“请重新登录”弹窗体验
|
||||
if (now - expireTime >= -10) {
|
||||
if (expireTime < -10) {
|
||||
Modal.error({
|
||||
title: '登录已过期',
|
||||
content: '很抱歉,登录已过期,请重新登录',
|
||||
|
@ -50,7 +50,7 @@ SDN_REQUEST.interceptors.response.use((config) => {
|
|||
return config
|
||||
}, (error) => {
|
||||
if (error.response) {
|
||||
let errorMessage = error.response.data === null ? '系统内部异常,请联系网站管理员' : error.response.data.message
|
||||
let errorMessage = error.response.data === null ? '系统内部异常,请联系网站管理员' : error.response.status + ':' + error.response.data.message
|
||||
switch (error.response.status) {
|
||||
case 404:
|
||||
notification.error({
|
||||
|
@ -96,6 +96,17 @@ const request = {
|
|||
}
|
||||
})
|
||||
},
|
||||
|
||||
bodyRequest (method, url, params) {
|
||||
return SDN_REQUEST.request({
|
||||
method: method,
|
||||
url: url,
|
||||
data: params,
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
}
|
||||
})
|
||||
},
|
||||
put (url, params) {
|
||||
return SDN_REQUEST.put(url, params, {
|
||||
transformRequest: [(params) => {
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
<a-col :span="4"></a-col>
|
||||
<a-col :span="4"></a-col>
|
||||
<a-col :span="4">
|
||||
<head-info title="今日IP" :content="todayIp" :center="false" :bordered="false"/>
|
||||
<head-info title="访问IP" :content="todayIp" :center="false" :bordered="false"/>
|
||||
</a-col>
|
||||
<a-col :span="4">
|
||||
<head-info title="今日访问" :content="todayVisitCount" :center="false" :bordered="false"/>
|
||||
|
@ -86,8 +86,8 @@ export default {
|
|||
}
|
||||
},
|
||||
todayIp: '',
|
||||
todayVisitCount: '',
|
||||
totalVisitCount: '',
|
||||
todayVisitCount: 0,
|
||||
totalVisitCount: 0,
|
||||
userRole: '',
|
||||
userDept: '',
|
||||
lastLoginTime: '',
|
||||
|
@ -125,64 +125,63 @@ export default {
|
|||
},
|
||||
mounted () {
|
||||
this.welcomeMessage = this.welcome()
|
||||
this.$get(`index/${this.user.username}`).then((r) => {
|
||||
let data = r.data.data
|
||||
this.todayIp = data.todayIp
|
||||
this.todayVisitCount = data.todayVisitCount
|
||||
this.totalVisitCount = data.totalVisitCount
|
||||
let sevenVisitCount = []
|
||||
let dateArr = []
|
||||
for (let i = 6; i >= 0; i--) {
|
||||
let time = moment().subtract(i, 'days').format('MM-DD')
|
||||
let contain = false
|
||||
for (let o of data.lastSevenVisitCount) {
|
||||
if (o.days === time) {
|
||||
contain = true
|
||||
sevenVisitCount.push(o.count)
|
||||
}
|
||||
}
|
||||
if (!contain) {
|
||||
sevenVisitCount.push(0)
|
||||
}
|
||||
dateArr.push(time)
|
||||
}
|
||||
let sevenUserVistCount = []
|
||||
for (let i = 6; i >= 0; i--) {
|
||||
let time = moment().subtract(i, 'days').format('MM-DD')
|
||||
let contain = false
|
||||
for (let o of data.lastSevenUserVisitCount) {
|
||||
if (o.days === time) {
|
||||
contain = true
|
||||
sevenUserVistCount.push(o.count)
|
||||
}
|
||||
}
|
||||
if (!contain) {
|
||||
sevenUserVistCount.push(0)
|
||||
}
|
||||
}
|
||||
// this.$get(`index/${this.user.username}`).then((r) => {
|
||||
this.todayIp = ''
|
||||
// this.todayVisitCount = this.$db.get('todayVisit') ? this.$db.get('todayVisit') : 0
|
||||
// this.totalVisitCount = this.$db.get('totalVisit') ? this.$db.get('totalVisit') : 0
|
||||
// let sevenVisitCount = this.$db.get('sevenVisit') ? this.$db.get('sevenVisit') : []
|
||||
// let sevenUserCount = this.$db.get('sevenUserVisit') ? this.$db.get('sevenUserVisit') : []
|
||||
// let dateArr = []
|
||||
// for (let i = 6; i >= 0; i--) {
|
||||
// let time = moment().subtract(i, 'days').format('MM-DD')
|
||||
// let contain = false
|
||||
// for (let o of sevenVisitCount) {
|
||||
// if (o.days === time) {
|
||||
// contain = true
|
||||
// sevenVisitCount.push(o.count)
|
||||
// }
|
||||
// }
|
||||
// if (!contain) {
|
||||
// sevenVisitCount.push(0)
|
||||
// }
|
||||
// dateArr.push(time)
|
||||
// }
|
||||
// for (let i = 6; i >= 0; i--) {
|
||||
// let time = moment().subtract(i, 'days').format('MM-DD')
|
||||
// let contain = false
|
||||
// for (let o of sevenUserCount) {
|
||||
// if (o.days === time) {
|
||||
// contain = true
|
||||
// sevenUserCount.push(o.count)
|
||||
// }
|
||||
// }
|
||||
// if (!contain) {
|
||||
// sevenUserCount.push(0)
|
||||
// }
|
||||
// }
|
||||
this.$refs.count.updateSeries([
|
||||
{
|
||||
name: '您',
|
||||
data: sevenUserVistCount
|
||||
data: 1
|
||||
},
|
||||
{
|
||||
name: '总数',
|
||||
data: sevenVisitCount
|
||||
data: 1
|
||||
}
|
||||
], true)
|
||||
this.$refs.count.updateOptions({
|
||||
xaxis: {
|
||||
categories: dateArr
|
||||
// categories: dateArr
|
||||
},
|
||||
title: {
|
||||
text: '近七日系统访问记录',
|
||||
align: 'left'
|
||||
}
|
||||
}, true, true)
|
||||
}).catch((r) => {
|
||||
console.error(r)
|
||||
this.$message.error('获取首页信息失败')
|
||||
})
|
||||
// }).catch((r) => {
|
||||
// console.error(r)
|
||||
// this.$message.error('获取首页信息失败')
|
||||
// })
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
@ -78,14 +78,16 @@ export default {
|
|||
}, 1500)
|
||||
},
|
||||
logout () {
|
||||
this.$get(`logout/${this.user.id}`).then(() => {
|
||||
return new Promise((resolve, reject) => {
|
||||
// this.$get(`logout/${this.user.username}`).then(() => {
|
||||
// return new Promise((resolve, reject) => {
|
||||
// this.$db.clear()
|
||||
// location.reload()
|
||||
// })
|
||||
// }).catch(() => {
|
||||
// this.$message.error('退出系统失败')
|
||||
// })
|
||||
this.$db.clear()
|
||||
location.reload()
|
||||
})
|
||||
}).catch(() => {
|
||||
this.$message.error('退出系统失败')
|
||||
})
|
||||
},
|
||||
...mapMutations({setSettingBar: 'setting/setSettingBar'})
|
||||
}
|
||||
|
|
|
@ -70,14 +70,17 @@ export default {
|
|||
scope: 'sdn',
|
||||
grant_type: 'password'
|
||||
}).then((r) => {
|
||||
let data = r.data.data
|
||||
data.user = name
|
||||
data.password = password
|
||||
console.log(r)
|
||||
let data = r.data
|
||||
data.user = {
|
||||
'username': name,
|
||||
'password': password
|
||||
}
|
||||
this.saveLoginData(data)
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
}, 500)
|
||||
this.$router.push('/')
|
||||
this.$router.push('/index')
|
||||
}).catch(() => {
|
||||
setTimeout(() => {
|
||||
this.loading = false
|
||||
|
@ -108,14 +111,8 @@ export default {
|
|||
this.setToken(data.access_token)
|
||||
this.setExpireTime(data.expires_in)
|
||||
this.setUser(data.user)
|
||||
this.setPermissions(data.permissions)
|
||||
this.setRoles(data.roles)
|
||||
this.setTheme(data.config.theme)
|
||||
this.setLayout(data.config.layout)
|
||||
this.setMultipage(data.config.multiPage === '1')
|
||||
this.fixSiderbar(data.config.fixSiderbar === '1')
|
||||
this.fixHeader(data.config.fixHeader === '1')
|
||||
this.setColor(data.config.color)
|
||||
this.setPermissions(['user:view', 'role:update', 'dept:add', 'resource:view', 'role:add', 'role:export', 'menu:update', 'menu:export', 'resource:export', 'dept:export', 'menu:view', 'role:view', 'dept:delete', 'user:export', 'role:delete', 'menu:delete', 'dept:view', 'user:add', 'user:delete', 'log:view', 'resource:delete', 'user:kickout', 'user:update', 'dept:update', 'menu:add', 'log:delete', 'domain:view', 'redis:view', 'log:export', 'user:reset', 'user:online', 'resource:add'])
|
||||
this.setRoles(['管理员'])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,16 +10,16 @@
|
|||
@cancel="cancelUpdatePassword"
|
||||
@ok="handleUpdatePassword">
|
||||
<a-form :autoFormCreate="(form)=>{this.form = form}">
|
||||
<a-form-item
|
||||
label='旧密码'
|
||||
v-bind="formItemLayout"
|
||||
fieldDecoratorId="oldPassword"
|
||||
:fieldDecoratorOptions="{rules: [{ required: true, message: '请输入旧密码'}, { validator: this.handleOldPassowrd }], validateTrigger: ['blur']}">
|
||||
<a-input type="password"
|
||||
autocomplete="false"
|
||||
v-model="oldPassword"
|
||||
placeholder="请输入旧密码"></a-input>
|
||||
</a-form-item>
|
||||
<!-- <a-form-item-->
|
||||
<!-- label='旧密码'-->
|
||||
<!-- v-bind="formItemLayout"-->
|
||||
<!-- fieldDecoratorId="oldPassword"-->
|
||||
<!-- :fieldDecoratorOptions="{rules: [{ required: true, message: '请输入旧密码'}, { validator: this.handleOldPassowrd }], validateTrigger: ['blur']}">-->
|
||||
<!-- <a-input type="password"-->
|
||||
<!-- autocomplete="false"-->
|
||||
<!-- v-model="oldPassword"-->
|
||||
<!-- placeholder="请输入旧密码"></a-input>-->
|
||||
<!-- </a-form-item>-->
|
||||
<a-popover placement="rightTop" trigger="click" :visible="state.passwordLevelChecked">
|
||||
<template slot="content">
|
||||
<div :style="{ width: '240px' }">
|
||||
|
@ -54,6 +54,8 @@
|
|||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import db from 'utils/localstorage'
|
||||
|
||||
const formItemLayout = {
|
||||
labelCol: { span: 4 },
|
||||
wrapperCol: { span: 18 }
|
||||
|
@ -130,11 +132,13 @@ export default {
|
|||
this.$emit('cancel')
|
||||
},
|
||||
handleUpdatePassword () {
|
||||
let userName = db.get('USER')
|
||||
this.form.validateFields((err, values) => {
|
||||
if (!err) {
|
||||
this.$put('user/password', {
|
||||
this.$bodyRequest('put', `/auth/v1/users/${userName}`, {
|
||||
name: this.user.username,
|
||||
password: this.newPassword,
|
||||
username: this.user.username
|
||||
domainid: 'sdn'
|
||||
}).then(() => {
|
||||
this.state.passwordLevelChecked = false
|
||||
this.$emit('success')
|
||||
|
@ -191,7 +195,7 @@ export default {
|
|||
handleOldPassowrd (rule, value, callback) {
|
||||
let password = this.oldPassword
|
||||
if (this.oldPassword.trim().length) {
|
||||
this.$get('user/password/check', {
|
||||
this.$bodyRequest('put', 'users/password/check', {
|
||||
password: password,
|
||||
username: this.user.username
|
||||
}).then((r) => {
|
||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue