Mod aaa-12 添加yarn编译文件,修改接口参数

RCA:
SOL:
修改人:maxiaonan
检视人:maxiaonan
This commit is contained in:
maxiaonan 2019-07-04 17:00:29 +08:00
parent a08b3e8b2a
commit 8a017f2eaa
13 changed files with 17298 additions and 520 deletions

View File

@ -11,10 +11,10 @@ module.exports = {
assetsSubDirectory: 'static', assetsSubDirectory: 'static',
assetsPublicPath: '/', assetsPublicPath: '/',
proxyTable: { proxyTable: {
'api': { '/api': {
target: 'http://192.168.100.98:8181', target: 'http://192.168.100.98:8181/',
changeorigin: true, changeOrigin: true,
pathrewrite: { pathRewrite: {
'^/api': '/' '^/api': '/'
} }
} }
@ -37,7 +37,8 @@ module.exports = {
showEslintErrorsInOverlay: false, showEslintErrorsInOverlay: false,
/** /**
* Source Maps * Source
*
*/ */
// https://webpack.js.org/configuration/devtool/#development // https://webpack.js.org/configuration/devtool/#development

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
{ {
"name": "cmcc-front", "name": "sdn-web",
"version": "1.0.0", "version": "1.0.0",
"description": "CMCC Front By Vue", "description": "SDN Front By Vue",
"author": "CMHI <http://hy.10086.cn/>", "author": "CMHI <http://hy.10086.cn/>",
"private": true, "private": true,
"scripts": { "scripts": {

View File

@ -10,7 +10,6 @@
import enquireScreen from './utils/device' import enquireScreen from './utils/device'
import chinese from 'ant-design-vue/lib/locale-provider/zh_CN' import chinese from 'ant-design-vue/lib/locale-provider/zh_CN'
import 'moment/locale/zh-cn' import 'moment/locale/zh-cn'
export default { export default {
name: 'cmcc', name: 'cmcc',
data () { data () {

View File

@ -31,6 +31,7 @@ Vue.prototype.$delete = request.delete
Vue.prototype.$export = request.export Vue.prototype.$export = request.export
Vue.prototype.$download = request.download Vue.prototype.$download = request.download
Vue.prototype.$upload = request.upload Vue.prototype.$upload = request.upload
Vue.prototype.$bodyRequest = request.bodyRequest
/* eslint-disable no-new */ /* eslint-disable no-new */
new Vue({ new Vue({

View File

@ -6,7 +6,6 @@ import LoginView from '@/views/login/Common'
import EmptyPageView from '@/views/common/EmptyPageView' import EmptyPageView from '@/views/common/EmptyPageView'
import HomePageView from '@/views/HomePage' import HomePageView from '@/views/HomePage'
import db from 'utils/localstorage' import db from 'utils/localstorage'
import request from 'utils/request'
Vue.use(Router) Vue.use(Router)
@ -37,16 +36,190 @@ router.beforeEach((to, from, next) => {
next() next()
} }
let token = db.get('USER_TOKEN') let token = db.get('USER_TOKEN')
let user = db.get('USER')
let userRouter = get('USER_ROUTER') let userRouter = get('USER_ROUTER')
if (token.length && user) { if (token.length) {
if (!asyncRouter) { if (!asyncRouter) {
if (!userRouter) { if (!userRouter) {
request.get(`menu/${user.username}`).then((res) => { asyncRouter = [
asyncRouter = res.data {
save('USER_ROUTER', asyncRouter) children: [
go(to, next) {
}) 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 { } else {
asyncRouter = userRouter asyncRouter = userRouter
go(to, next) go(to, next)

View File

@ -8,21 +8,21 @@ moment.locale('zh-cn')
// //
let SDN_REQUEST = axios.create({ let SDN_REQUEST = axios.create({
// baseURL: 'http://127.0.0.1:9527/', // baseURL: 'http://127.0.0.1:9527/',
baseURL: 'http://192.168.100.98:8181/', baseURL: '/api',
responseType: 'json', responseType: 'json',
withCredentials: true, withCredentials: true,
validateStatus (status) { validateStatus (status) {
// 200 // 200201204
return status === 200 return status === 200 || status === 201 || status === 204
} }
}) })
// //
SDN_REQUEST.interceptors.request.use((config) => { SDN_REQUEST.interceptors.request.use((config) => {
let expireTime = store.state.account.expireTime let expireTime = store.state.account.expireTime
let now = moment().format('YYYYMMDDHHmmss') // let now = moment().format('YYYYMMDDHHmmss')
// token10 // token10
if (now - expireTime >= -10) { if (expireTime < -10) {
Modal.error({ Modal.error({
title: '登录已过期', title: '登录已过期',
content: '很抱歉,登录已过期,请重新登录', content: '很抱歉,登录已过期,请重新登录',
@ -50,7 +50,7 @@ SDN_REQUEST.interceptors.response.use((config) => {
return config return config
}, (error) => { }, (error) => {
if (error.response) { 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) { switch (error.response.status) {
case 404: case 404:
notification.error({ 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) { put (url, params) {
return SDN_REQUEST.put(url, params, { return SDN_REQUEST.put(url, params, {
transformRequest: [(params) => { transformRequest: [(params) => {

View File

@ -23,7 +23,7 @@
<a-col :span="4"></a-col> <a-col :span="4"></a-col>
<a-col :span="4"></a-col> <a-col :span="4"></a-col>
<a-col :span="4"> <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>
<a-col :span="4"> <a-col :span="4">
<head-info title="今日访问" :content="todayVisitCount" :center="false" :bordered="false"/> <head-info title="今日访问" :content="todayVisitCount" :center="false" :bordered="false"/>
@ -86,8 +86,8 @@ export default {
} }
}, },
todayIp: '', todayIp: '',
todayVisitCount: '', todayVisitCount: 0,
totalVisitCount: '', totalVisitCount: 0,
userRole: '', userRole: '',
userDept: '', userDept: '',
lastLoginTime: '', lastLoginTime: '',
@ -125,64 +125,63 @@ export default {
}, },
mounted () { mounted () {
this.welcomeMessage = this.welcome() this.welcomeMessage = this.welcome()
this.$get(`index/${this.user.username}`).then((r) => { // this.$get(`index/${this.user.username}`).then((r) => {
let data = r.data.data this.todayIp = ''
this.todayIp = data.todayIp // this.todayVisitCount = this.$db.get('todayVisit') ? this.$db.get('todayVisit') : 0
this.todayVisitCount = data.todayVisitCount // this.totalVisitCount = this.$db.get('totalVisit') ? this.$db.get('totalVisit') : 0
this.totalVisitCount = data.totalVisitCount // let sevenVisitCount = this.$db.get('sevenVisit') ? this.$db.get('sevenVisit') : []
let sevenVisitCount = [] // let sevenUserCount = this.$db.get('sevenUserVisit') ? this.$db.get('sevenUserVisit') : []
let dateArr = [] // let dateArr = []
for (let i = 6; i >= 0; i--) { // for (let i = 6; i >= 0; i--) {
let time = moment().subtract(i, 'days').format('MM-DD') // let time = moment().subtract(i, 'days').format('MM-DD')
let contain = false // let contain = false
for (let o of data.lastSevenVisitCount) { // for (let o of sevenVisitCount) {
if (o.days === time) { // if (o.days === time) {
contain = true // contain = true
sevenVisitCount.push(o.count) // sevenVisitCount.push(o.count)
} // }
} // }
if (!contain) { // if (!contain) {
sevenVisitCount.push(0) // sevenVisitCount.push(0)
} // }
dateArr.push(time) // 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: 1
},
{
name: '总数',
data: 1
} }
let sevenUserVistCount = [] ], true)
for (let i = 6; i >= 0; i--) { this.$refs.count.updateOptions({
let time = moment().subtract(i, 'days').format('MM-DD') xaxis: {
let contain = false // categories: dateArr
for (let o of data.lastSevenUserVisitCount) { },
if (o.days === time) { title: {
contain = true text: '近七日系统访问记录',
sevenUserVistCount.push(o.count) align: 'left'
}
}
if (!contain) {
sevenUserVistCount.push(0)
}
} }
this.$refs.count.updateSeries([ }, true, true)
{ // }).catch((r) => {
name: '您', // console.error(r)
data: sevenUserVistCount // this.$message.error('')
}, // })
{
name: '总数',
data: sevenVisitCount
}
], true)
this.$refs.count.updateOptions({
xaxis: {
categories: dateArr
},
title: {
text: '近七日系统访问记录',
align: 'left'
}
}, true, true)
}).catch((r) => {
console.error(r)
this.$message.error('获取首页信息失败')
})
} }
} }
</script> </script>

View File

@ -78,14 +78,16 @@ export default {
}, 1500) }, 1500)
}, },
logout () { logout () {
this.$get(`logout/${this.user.id}`).then(() => { // this.$get(`logout/${this.user.username}`).then(() => {
return new Promise((resolve, reject) => { // return new Promise((resolve, reject) => {
this.$db.clear() // this.$db.clear()
location.reload() // location.reload()
}) // })
}).catch(() => { // }).catch(() => {
this.$message.error('退出系统失败') // this.$message.error('退')
}) // })
this.$db.clear()
location.reload()
}, },
...mapMutations({setSettingBar: 'setting/setSettingBar'}) ...mapMutations({setSettingBar: 'setting/setSettingBar'})
} }

View File

@ -70,14 +70,17 @@ export default {
scope: 'sdn', scope: 'sdn',
grant_type: 'password' grant_type: 'password'
}).then((r) => { }).then((r) => {
let data = r.data.data console.log(r)
data.user = name let data = r.data
data.password = password data.user = {
'username': name,
'password': password
}
this.saveLoginData(data) this.saveLoginData(data)
setTimeout(() => { setTimeout(() => {
this.loading = false this.loading = false
}, 500) }, 500)
this.$router.push('/') this.$router.push('/index')
}).catch(() => { }).catch(() => {
setTimeout(() => { setTimeout(() => {
this.loading = false this.loading = false
@ -108,14 +111,8 @@ export default {
this.setToken(data.access_token) this.setToken(data.access_token)
this.setExpireTime(data.expires_in) this.setExpireTime(data.expires_in)
this.setUser(data.user) this.setUser(data.user)
this.setPermissions(data.permissions) 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(data.roles) this.setRoles(['管理员'])
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)
} }
} }
} }

View File

@ -10,16 +10,16 @@
@cancel="cancelUpdatePassword" @cancel="cancelUpdatePassword"
@ok="handleUpdatePassword"> @ok="handleUpdatePassword">
<a-form :autoFormCreate="(form)=>{this.form = form}"> <a-form :autoFormCreate="(form)=>{this.form = form}">
<a-form-item <!-- <a-form-item-->
label='旧密码' <!-- label='旧密码'-->
v-bind="formItemLayout" <!-- v-bind="formItemLayout"-->
fieldDecoratorId="oldPassword" <!-- fieldDecoratorId="oldPassword"-->
:fieldDecoratorOptions="{rules: [{ required: true, message: '请输入旧密码'}, { validator: this.handleOldPassowrd }], validateTrigger: ['blur']}"> <!-- :fieldDecoratorOptions="{rules: [{ required: true, message: '请输入旧密码'}, { validator: this.handleOldPassowrd }], validateTrigger: ['blur']}">-->
<a-input type="password" <!-- <a-input type="password"-->
autocomplete="false" <!-- autocomplete="false"-->
v-model="oldPassword" <!-- v-model="oldPassword"-->
placeholder="请输入旧密码"></a-input> <!-- placeholder="请输入旧密码"></a-input>-->
</a-form-item> <!-- </a-form-item>-->
<a-popover placement="rightTop" trigger="click" :visible="state.passwordLevelChecked"> <a-popover placement="rightTop" trigger="click" :visible="state.passwordLevelChecked">
<template slot="content"> <template slot="content">
<div :style="{ width: '240px' }"> <div :style="{ width: '240px' }">
@ -54,6 +54,8 @@
</div> </div>
</template> </template>
<script> <script>
import db from 'utils/localstorage'
const formItemLayout = { const formItemLayout = {
labelCol: { span: 4 }, labelCol: { span: 4 },
wrapperCol: { span: 18 } wrapperCol: { span: 18 }
@ -130,11 +132,13 @@ export default {
this.$emit('cancel') this.$emit('cancel')
}, },
handleUpdatePassword () { handleUpdatePassword () {
let userName = db.get('USER')
this.form.validateFields((err, values) => { this.form.validateFields((err, values) => {
if (!err) { if (!err) {
this.$put('user/password', { this.$bodyRequest('put', `/auth/v1/users/${userName}`, {
name: this.user.username,
password: this.newPassword, password: this.newPassword,
username: this.user.username domainid: 'sdn'
}).then(() => { }).then(() => {
this.state.passwordLevelChecked = false this.state.passwordLevelChecked = false
this.$emit('success') this.$emit('success')
@ -191,7 +195,7 @@ export default {
handleOldPassowrd (rule, value, callback) { handleOldPassowrd (rule, value, callback) {
let password = this.oldPassword let password = this.oldPassword
if (this.oldPassword.trim().length) { if (this.oldPassword.trim().length) {
this.$get('user/password/check', { this.$bodyRequest('put', 'users/password/check', {
password: password, password: password,
username: this.user.username username: this.user.username
}).then((r) => { }).then((r) => {

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff