Browse Source

Merge branch 'master' of ssh://101.201.226.163:50022/binbin0314/datang-admin

master
lucky 3 years ago
parent
commit
0c88e301b7
  1. 22
      src/api/jurisdiction.js
  2. 1
      src/router/menus/others.js
  3. 6
      src/router/modules/privilegeManagement.js
  4. 42
      src/utils/request.js
  5. 15
      src/views/layout/components/Sidebar/index.vue
  6. 74
      src/views/layout/components/rightMenu/rightMenu.vue
  7. 24
      src/views/otherPage/index.vue

22
src/api/jurisdiction.js

@ -15,6 +15,17 @@ export function GET_LIST(params) {
}).then(res => res.data) }).then(res => res.data)
} }
/**
* 管理员修改密码
*/
export function MODIFY_PASSWORD(params) {
return request({
url: `${admin}/modifyPassword`,
method: 'post',
data: params
}).then(res => res.data)
}
/** /**
* 重置管理员密码 * 重置管理员密码
*/ */
@ -135,3 +146,14 @@ export function ROLE_ADD(params) {
data: params data: params
}).then(res => res.data) }).then(res => res.data)
} }
/**
* 获取当前角色所有的权限
*/
export function GET_ALL_HAVE(params) {
return request({
url: `${permission}/have`,
method: 'post',
data: params
}).then(res => res.data)
}

1
src/router/menus/others.js

@ -4,6 +4,7 @@ const others = {
path: '/others', path: '/others',
component: Layout, component: Layout,
meta: {title: '其他', icon: 'dingdan', noCache: true, affix: false}, meta: {title: '其他', icon: 'dingdan', noCache: true, affix: false},
code: '9900',
children: [ children: [
{ {
path: '/configuration', path: '/configuration',

6
src/router/modules/privilegeManagement.js

@ -4,19 +4,21 @@ const commodityManagement = {
path: '/privilegeManagement', path: '/privilegeManagement',
component: Layout, component: Layout,
meta: {title: '权限管理', icon: 'shouquanguanli', noCache: true, affix: false}, meta: {title: '权限管理', icon: 'shouquanguanli', noCache: true, affix: false},
code: '6600',
children: [ children: [
{ {
path: '/privilegeManagement/account', path: '/privilegeManagement/account',
component: () => import('@/views/privilegeManagement/account/index'), component: () => import('@/views/privilegeManagement/account/index'),
name: '账户管理', name: '账户管理',
code: '6601',
meta: {title: '账户管理', noCache: false, affix: false} meta: {title: '账户管理', noCache: false, affix: false}
}, },
{ {
path: '/privilegeManagement/role', path: '/privilegeManagement/role',
component: () => import('@/views/privilegeManagement/role/index'), component: () => import('@/views/privilegeManagement/role/index'),
name: '角色管理', name: '角色管理',
code: '6602',
meta: {title: '角色管理', noCache: false, affix: false}, meta: {title: '角色管理', noCache: false, affix: false},
}, },
{ {
path: '/privilegeManagement/role/permissions', path: '/privilegeManagement/role/permissions',
@ -24,7 +26,6 @@ const commodityManagement = {
hidden:true, hidden:true,
name: '新增角色', name: '新增角色',
meta: {title: '新增角色', noCache: false, affix: false}, meta: {title: '新增角色', noCache: false, affix: false},
}, },
{ {
path: '/privilegeManagement/account/opiModel', path: '/privilegeManagement/account/opiModel',
@ -32,7 +33,6 @@ const commodityManagement = {
hidden:true, hidden:true,
name: '用户增加/查看', name: '用户增加/查看',
meta: {title: '用户增加/查看', noCache: false, affix: false}, meta: {title: '用户增加/查看', noCache: false, affix: false},
} }
] ]
}; };

42
src/utils/request.js

@ -46,27 +46,43 @@ service.interceptors.request.use(
// response interceptor // response interceptor
service.interceptors.response.use( service.interceptors.response.use(
response => response, // response => response,
/** /**
* 下面的注释为通过在response里自定义code来标示请求状态 * 下面的注释为通过在response里自定义code来标示请求状态
* 当code返回如下情况则说明权限有问题登出并返回到登录页 * 当code返回如下情况则说明权限有问题登出并返回到登录页
* 如想通过 xmlhttprequest 来状态码标识 逻辑可写在下面error中 * 如想通过 xmlhttprequest 来状态码标识 逻辑可写在下面error中
* 以下代码均为样例请结合自生需求加以修改若不需要则可删除 * 以下代码均为样例请结合自生需求加以修改若不需要则可删除
*/ */
// response => { response => {
// const res = response.data const res = response.data
if (res.code == 49) {
// if (res.code == 401) { let time = 15
// debugger // var timer = setInterval(() => {
// window.location.href = "#/login" // time -= 1
// return Promise.reject('error') // },1000)
// } else { var t = setTimeout(()=> {
// return response.data window.location.href = "#/login"
// } // timer && clearInterval(timer)
// }, },15000)
window._vm.$notify({
type: 'warning',
title: '登录失效提示',
dangerouslyUseHTMLString: true,
message: `<div>登录失效, 将在${time}秒后退回到登录页, 点击关闭按钮取消回退!!</div>`,
duration: 16000,
onClose: ()=> {
t && clearTimeout(t)
// timer && clearInterval(timer)
return response
},
});
} else {
return response
}
},
error => { error => {
console.log('err' + error) // for debug console.log('err' + error) // for debug
if (error.response.status == 401) { if (error.response.status == 49) {
myalert.fail("登录失效,请重新登录!!") myalert.fail("登录失效,请重新登录!!")
setTimeout(() => { setTimeout(() => {
window.location.href = "#/login" window.location.href = "#/login"

15
src/views/layout/components/Sidebar/index.vue

@ -18,14 +18,12 @@
/> />
</el-menu> </el-menu>
</el-scrollbar> </el-scrollbar>
<div class="slider_bottom"> <div class="slider_bottom" @click="click_collapse">
<svg-icon <svg-icon
@click.native="click_collapse"
icon-class="right" icon-class="right"
v-if="isCollapse" v-if="isCollapse"
/> />
<svg-icon <svg-icon
@click.native="click_collapse"
icon-class="left" icon-class="left"
v-if="!isCollapse" v-if="!isCollapse"
/> />
@ -53,6 +51,7 @@
display: flex; display: flex;
justify-content: center; justify-content: center;
align-items: center; align-items: center;
cursor: pointer;
} }
</style> </style>
@ -60,6 +59,8 @@
import { mapGetters, mapActions } from "vuex"; import { mapGetters, mapActions } from "vuex";
import SidebarItem from "./SidebarItem"; import SidebarItem from "./SidebarItem";
import variables from "@/styles/variables.scss"; import variables from "@/styles/variables.scss";
import { GET_ALL_HAVE } from '@/api/jurisdiction'
export default { export default {
components: { SidebarItem }, components: { SidebarItem },
mounted() {}, mounted() {},
@ -72,12 +73,20 @@ export default {
return !this.sidebar.opened; return !this.sidebar.opened;
} }
}, },
created() {
this.getAllPermission()
},
methods: { methods: {
...mapActions({ ...mapActions({
toggleSideBar: "toggleSideBar" toggleSideBar: "toggleSideBar"
}), }),
click_collapse() { click_collapse() {
this.toggleSideBar(); this.toggleSideBar();
},
getAllPermission() {
GET_ALL_HAVE({}).then(res => {
console.log(res)
})
} }
} }
}; };

74
src/views/layout/components/rightMenu/rightMenu.vue

@ -10,7 +10,7 @@
<div class="popucontent"> <div class="popucontent">
<div class="list"> <div class="list">
<!--<div class="listitem">个人资料</div>--> <!--<div class="listitem">个人资料</div>-->
<!--<div class="listitem last2">设置</div>--> <div class="listitem last2" @click="dialogVisible = true">修改密码</div>
<div @click="logout" class="listitem last">退出</div> <div @click="logout" class="listitem last">退出</div>
</div> </div>
</div> </div>
@ -27,18 +27,58 @@
</div> </div>
</div> </div>
</el-popover> </el-popover>
<el-dialog
title="修改密码"
:visible.sync="dialogVisible"
width="30%">
<el-form :model="cipher" ref="cipher" label-width="120px" class="demo-cipher">
<el-form-item label="原密码" prop="oldPassword" :rules="[{required: true, message: '不能为空', trigger: 'blur'}]">
<el-input :type="status.oldPassword" v-model="cipher.oldPassword">
<i slot="suffix" class="el-input__icon el-icon-view" @click="changeStatus('oldPassword')" style="cursor: pointer;"></i>
</el-input>
</el-form-item>
<el-form-item label="新密码" prop="newPassword" :rules="[{required: true, message: '不能为空', trigger: 'blur'}]">
<el-input :type="status.newPassword" v-model="cipher.newPassword">
<i slot="suffix" class="el-input__icon el-icon-view" @click="changeStatus('newPassword')" style="cursor: pointer;"></i>
</el-input>
</el-form-item>
<el-form-item label="再次确认新密码" prop="newPasswordTwo" :rules="[{required: true, message: '不能为空', trigger: 'blur'}]">
<el-input :type="status.newPasswordTwo" v-model="cipher.newPasswordTwo">
<i slot="suffix" class="el-input__icon el-icon-view" @click="changeStatus('newPasswordTwo')" style="cursor: pointer;"></i>
</el-input>
</el-form-item>
<el-form-item style="text-align: right;">
<el-button type="primary" @click="submit"> </el-button>
<el-button @click="dialogVisible = false"> </el-button>
</el-form-item>
</el-form>
</el-dialog>
</div> </div>
</template> </template>
<script> <script>
import Alert from "@/utils/alert";
import logoSrc from '@/assets/quxia.png' import logoSrc from '@/assets/quxia.png'
import { getCookie } from "../../../../utils/cookie"; import { getCookie } from "../../../../utils/cookie";
import { mapState, mapActions } from "vuex"; import { mapState, mapActions } from "vuex";
import { MODIFY_PASSWORD } from '@/api/jurisdiction'
export default { export default {
data(){ data(){
return{ return{
logoSrc:logoSrc, logoSrc:logoSrc,
user:'' user:'',
dialogVisible: false,
cipher: {
oldPassword: '',
newPassword: '',
newPasswordTwo: ''
},
status: {
newPassword: 'password',
newPasswordTwo: 'password',
oldPassword: 'password',
}
} }
}, },
mounted(){ mounted(){
@ -69,7 +109,35 @@
setTimeout(() => { setTimeout(() => {
this.$router.push('/login') this.$router.push('/login')
}, 100) }, 100)
} },
submit() {
const params = {...this.cipher}
this.$refs.cipher.validate(res => {
if(!this.cipher.newPasswordTwo || !this.cipher.newPassword || !this.cipher.oldPassword) {
return false
} else if(this.cipher.newPasswordTwo !== this.cipher.newPassword) {
Alert.fail('两次新密码输入不一样!');
return false
} else {
MODIFY_PASSWORD(params).then(res => {
if(res.code === 200) {
Alert.success('添加成功,请重新登录')
this.logout()
} else {
Alert.fail(res.msg)
}
})
this.dialogVisible = false;
}
})
},
changeStatus(code) {
if(this.status[code] === 'password') {
this.status[code] = 'text'
} else {
this.status[code] = 'password'
}
},
} }
}; };
</script> </script>

24
src/views/otherPage/index.vue

@ -58,11 +58,20 @@
<el-table-column prop="value" label="常量值"> <el-table-column prop="value" label="常量值">
<template slot-scope="lists"> <template slot-scope="lists">
<div v-for="(item,index) in getValue(lists.row.value)" :key="index" @click="changeStatus(lists.$index,'value')"> <div v-for="(item,index) in getValue(lists.row.value)" :key="index" @click="changeStatus(lists.$index,'value')">
<div>{{ item.title }}</div> <div>
<template v-if="lists.row.code !== 'otherLink'">
{{ item.title }}
</template>
<template v-else>
<el-input v-if="statusCode === 'value' && statusIndex === lists.$index" :value="item.title" @blur="changeTitle($event,index,lists.row)" />
<span v-else>{{ item.title }}</span>
</template>
</div>
<template v-if="Array.isArray(item.value)"> <template v-if="Array.isArray(item.value)">
<div v-for="(itemA,indexA) in item.value" :key="indexA"> <div v-for="(itemA,indexA) in item.value" :key="indexA">
<el-input v-if="statusCode === 'value' && statusIndex === lists.$index" :value="itemA" @blur="changeValue($event,item.title,lists.row,indexA)" /> <el-input v-if="statusCode === 'value' && statusIndex === lists.$index" :value="itemA" @blur="changeValue($event,item.title,lists.row,indexA)" />
<span v-else>{{ itemA }}</span> <span v-else>{{ itemA }}</span>
{{ item.title }}
</div> </div>
</template> </template>
<template v-else> <template v-else>
@ -119,7 +128,6 @@
const FormContainer = () => import('./form.vue'); const FormContainer = () => import('./form.vue');
import { GET_LIST,UPDATE_DATA } from '@/api/otherPage'; import { GET_LIST,UPDATE_DATA } from '@/api/otherPage';
import Alert from "@/utils/alert"; import Alert from "@/utils/alert";
import {pageSize} from '../../config';
export default { export default {
name: "index", name: "index",
@ -146,6 +154,18 @@
}, },
components: { FormContainer }, components: { FormContainer },
methods: { methods: {
// content
changeTitle(e,index,item) {
let strList = JSON.parse(item.value)
strList[index].content = e.target.value
const params = {
code: item.code,
constantId: item.constantId,
value: JSON.stringify(strList)
}
this.updateData(params)
},
// //
changeStatus(index,code) { changeStatus(index,code) {
this.statusIndex= index; this.statusIndex= index;

Loading…
Cancel
Save