新增:添加用户类型
parent
a2f109efcf
commit
b3e4e858be
|
@ -30,3 +30,5 @@ export const BUTTON_STATUS_NUMBER = getButtonSettings([{ label: '启用', value:
|
||||||
export const BUTTON_WHETHER_NUMBER = getButtonSettings([{ label: '是', value: 1 }, { label: '否', value: 0 }])
|
export const BUTTON_WHETHER_NUMBER = getButtonSettings([{ label: '是', value: 1 }, { label: '否', value: 0 }])
|
||||||
// 是 true/ 否 false
|
// 是 true/ 否 false
|
||||||
export const BUTTON_WHETHER_BOOL = getButtonSettings([{ label: '是', value: true }, { label: '否', value: false }])
|
export const BUTTON_WHETHER_BOOL = getButtonSettings([{ label: '是', value: true }, { label: '否', value: false }])
|
||||||
|
// 用户类型
|
||||||
|
export const USER_TYPE = getButtonSettings([{ label: '后台用户', value: 0 }, { label: '前台用户', value: 1 }])
|
||||||
|
|
|
@ -18,20 +18,22 @@ export default {
|
||||||
/**
|
/**
|
||||||
* @description 登录
|
* @description 登录
|
||||||
* @param {Object} context
|
* @param {Object} context
|
||||||
* @param {Object} data
|
* @param {Object} payload username {String} 用户账号
|
||||||
* @param {Object} data username {String} 用户账号
|
* @param {Object} payload password {String} 密码
|
||||||
* @param {Object} data password {String} 密码
|
* @param {Object} payload route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式
|
||||||
* @param {Object} data route {Object} 登录成功后定向的路由对象 任何 vue-router 支持的格式
|
|
||||||
* @param {Object} data request function 请求方法
|
|
||||||
*/
|
*/
|
||||||
async login ({ dispatch }, data) {
|
async login ({ dispatch }, {
|
||||||
let request = data.request
|
username = '',
|
||||||
if (request) {
|
password = '',
|
||||||
delete data.request
|
captcha = '',
|
||||||
} else {
|
captchaKey = ''
|
||||||
request = SYS_USER_LOGIN
|
} = {}) {
|
||||||
}
|
let res = await SYS_USER_LOGIN({
|
||||||
let res = await request(data)
|
username,
|
||||||
|
password,
|
||||||
|
captcha,
|
||||||
|
captchaKey
|
||||||
|
})
|
||||||
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
|
// 设置 cookie 一定要存 uuid 和 token 两个 cookie
|
||||||
// 整个系统依赖这两个数据进行校验和存储
|
// 整个系统依赖这两个数据进行校验和存储
|
||||||
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
|
// uuid 是用户身份唯一标识 用户注册的时候确定 并且不可改变 不可重复
|
||||||
|
|
|
@ -14,7 +14,7 @@ export function GetList (query) {
|
||||||
return request({
|
return request({
|
||||||
url: urlPrefix,
|
url: urlPrefix,
|
||||||
method: 'get',
|
method: 'get',
|
||||||
data: query
|
params: query
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
export function createObj (obj) {
|
export function createObj (obj) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { request } from '@/api/service'
|
import { request } from '@/api/service'
|
||||||
import { BUTTON_STATUS_BOOL } from '@/config/button'
|
import { BUTTON_STATUS_BOOL, USER_TYPE } from '@/config/button'
|
||||||
import { urlPrefix as deptPrefix } from '../dept/api'
|
import { urlPrefix as deptPrefix } from '../dept/api'
|
||||||
|
|
||||||
export const crudOptions = (vm) => {
|
export const crudOptions = (vm) => {
|
||||||
|
@ -234,8 +234,26 @@ export const crudOptions = (vm) => {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
component: { props: { color: 'auto' } } // 自动染色
|
component: { props: { color: 'auto' } } // 自动染色
|
||||||
|
}, {
|
||||||
|
title: '用户类型',
|
||||||
|
key: 'user_type',
|
||||||
|
search: {
|
||||||
|
value: 0,
|
||||||
|
disabled: false
|
||||||
},
|
},
|
||||||
{
|
width: 140,
|
||||||
|
type: 'select',
|
||||||
|
dict: {
|
||||||
|
data: USER_TYPE
|
||||||
|
},
|
||||||
|
form: {
|
||||||
|
show: false,
|
||||||
|
value: 0,
|
||||||
|
component: {
|
||||||
|
span: 12
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, {
|
||||||
title: '状态',
|
title: '状态',
|
||||||
key: 'is_active',
|
key: 'is_active',
|
||||||
search: {
|
search: {
|
||||||
|
|
|
@ -94,6 +94,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getCrudOptions () {
|
getCrudOptions () {
|
||||||
|
this.crud.searchOptions.form.user_type = 0
|
||||||
return crudOptions(this)
|
return crudOptions(this)
|
||||||
},
|
},
|
||||||
pageRequest (query) {
|
pageRequest (query) {
|
||||||
|
|
Loading…
Reference in New Issue