Commit db31f240 authored by liuyang's avatar liuyang

完成用户新增功能

parent 59186984
This diff is collapsed.
......@@ -32,9 +32,7 @@ const mainRoutes = {
// 2. iframeUrl: 是否通过iframe嵌套展示内容, '以http[s]://开头': 是, '': 否
// 提示: 如需要通过iframe嵌套展示内容, 但不通过tab打开, 请自行创建组件使用iframe处理!
{ path: '/home', component: ()=>import('@/views/common/home'), name: 'home', meta: { title: '首页' } },
{ path: '/theme', component: ()=>import('@/views/common/theme'), name: 'theme', meta: { title: '主题' } },
{ path: '/article-add-or-update', component: ()=>import('@/views/modules/wx/article-add-or-update'), name: 'article', meta: { title: '编辑文章', isTab: true } },
{ path: '/material-news-add-or-update', component: ()=>import('@/views/modules/wx/material-news-add-or-update'), name: 'material-news', meta: { title: '图文素材' ,isDynamic:true,isTab:true} },
{ path: '/theme', component: ()=>import('@/views/common/theme'), name: 'theme', meta: { title: '主题' } }
],
beforeEnter (to, from, next) {
let token = Vue.cookie.get('token')
......@@ -112,9 +110,9 @@ function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
} else if (menuList[i].url && /\S/.test(menuList[i].url)) {
menuList[i].url = menuList[i].url.replace(/^\//, '')
var route = {
path: menuList[i].url.replace('/', '-'),
path: menuList[i].url,
component: null,
name: menuList[i].url.replace('/', '-'),
name: menuList[i].url,
meta: {
menuId: menuList[i].menuId,
title: menuList[i].name,
......@@ -147,10 +145,10 @@ function fnAddDynamicMenuRoutes (menuList = [], routes = []) {
{ path: '*', redirect: { name: '404' } }
])
sessionStorage.setItem('dynamicMenuRoutes', JSON.stringify(mainRoutes.children || '[]'))
console.log('\n')
console.log('%c!<-------------------- 动态(菜单)路由 s -------------------->', 'color:blue')
console.log(mainRoutes.children)
console.log('%c!<-------------------- 动态(菜单)路由 e -------------------->', 'color:blue')
// console.log('\n')
// console.log('%c!<-------------------- 动态(菜单)路由 s -------------------->', 'color:blue')
// console.log(mainRoutes.children)
// console.log('%c!<-------------------- 动态(菜单)路由 e -------------------->', 'color:blue')
}
}
export default router
......@@ -14,15 +14,10 @@ export default {
};
},
mounted() {
this.getAccessToken()
},
methods: {
getAccessToken(){
this.$http({
url: this.$http.adornUrl('/manage/wxAccessToken/getAccessToken'),
method: 'get'
})
}
}
};
</script>
......
......@@ -5,7 +5,7 @@
:visible.sync="visible">
<el-form :model="dataForm" :rules="dataRule" ref="dataForm" @keyup.enter.native="dataFormSubmit()" label-width="80px">
<el-form-item label="用户名" prop="userName">
<el-input v-model="dataForm.userName" placeholder="登录帐号"></el-input>
<el-input v-model="dataForm.userName" placeholder="登录帐号" :disabled="dataForm.id"></el-input>
</el-form-item>
<el-form-item label="密码" prop="password" :class="{ 'is-required': !dataForm.id }">
<el-input v-model="dataForm.password" type="password" placeholder="密码"></el-input>
......@@ -80,7 +80,6 @@
userName: '',
password: '',
comfirmPassword: '',
salt: '',
email: '',
mobile: '',
roleIdList: [],
......@@ -111,11 +110,11 @@
init (id) {
this.dataForm.id = id || 0
this.$http({
url: this.$http.adornUrl('/sys/role/select'),
url: this.$http.adornUrl('/api/sys/role/select'),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
this.roleList = data && data.code === 200 ? data.list : []
this.roleList = data && !data.errorCode ? data : []
}).then(() => {
this.visible = true
this.$nextTick(() => {
......@@ -124,17 +123,16 @@
}).then(() => {
if (this.dataForm.id) {
this.$http({
url: this.$http.adornUrl(`/sys/user/info/${this.dataForm.id}`),
url: this.$http.adornUrl(`/api/sys/user/info/${this.dataForm.id}`),
method: 'get',
params: this.$http.adornParams()
}).then(({data}) => {
if (data && data.code === 200) {
this.dataForm.userName = data.user.username
this.dataForm.salt = data.user.salt
this.dataForm.email = data.user.email
this.dataForm.mobile = data.user.mobile
this.dataForm.roleIdList = data.user.roleIdList
this.dataForm.status = data.user.status
if (data && !data.errorCode) {
this.dataForm.userName = data.username
this.dataForm.email = data.email
this.dataForm.mobile = data.mobile
this.dataForm.roleIdList = data.roleIdList
this.dataForm.status = data.status
}
})
}
......@@ -145,20 +143,22 @@
this.$refs['dataForm'].validate((valid) => {
if (valid) {
this.$http({
url: this.$http.adornUrl(`/sys/user/${!this.dataForm.id ? 'save' : 'update'}`),
url: this.$http.adornUrl(`/api/sys/user/${!this.dataForm.id ? 'save' : 'update'}`),
method: 'post',
data: this.$http.adornData({
'userId': this.dataForm.id || undefined,
'username': this.dataForm.userName,
'password': this.dataForm.password,
'salt': this.dataForm.salt,
'email': this.dataForm.email,
'mobile': this.dataForm.mobile,
'status': this.dataForm.status,
'roleIdList': this.dataForm.roleIdList
})
}).then(({data}) => {
if (data && data.code === 200) {
if (data && data.errorCode) {
this.$message.error(data.message)
} else {
this.$message({
message: '操作成功',
type: 'success',
......@@ -168,8 +168,6 @@
this.$emit('refreshDataList')
}
})
} else {
this.$message.error(data.msg)
}
})
}
......
......@@ -23,7 +23,7 @@
width="50">
</el-table-column>
<el-table-column
prop="userId"
prop="id"
header-align="center"
align="center"
width="80"
......@@ -64,8 +64,8 @@
width="150"
label="操作">
<template slot-scope="scope">
<el-button v-if="isAuth('sys:user:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.userId)">修改</el-button>
<el-button v-if="isAuth('sys:user:delete')" type="text" size="small" @click="deleteHandle(scope.row.userId)">删除</el-button>
<el-button v-if="isAuth('sys:user:update')" type="text" size="small" @click="addOrUpdateHandle(scope.row.id)">修改</el-button>
<el-button v-if="isAuth('sys:user:delete')" type="text" size="small" @click="deleteHandle(scope.row.id)">删除</el-button>
</template>
</el-table-column>
</el-table>
......@@ -111,17 +111,17 @@
getDataList () {
this.dataListLoading = true
this.$http({
url: this.$http.adornUrl('/sys/user/list'),
url: this.$http.adornUrl('/api/sys/user/list'),
method: 'get',
params: this.$http.adornParams({
'page': this.pageIndex,
'limit': this.pageSize,
'pageIndex': this.pageIndex,
'pageSize': this.pageSize,
'username': this.dataForm.userName
})
}).then(({data}) => {
if (data && data.code === 200) {
this.dataList = data.page.list
this.totalCount= data.page.totalCount
if (data && !data.errorCode) {
this.dataList = data.result
this.totalCount= data.total
} else {
this.dataList = []
this.totalCount= 0
......@@ -162,7 +162,7 @@
type: 'warning'
}).then(() => {
this.$http({
url: this.$http.adornUrl('/sys/user/delete'),
url: this.$http.adornUrl('/api/sys/user/delete'),
method: 'post',
data: this.$http.adornData(userIds, false)
}).then(({data}) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment