This commit is contained in:
parent
8d34b5449f
commit
1147ff4168
|
@ -39,7 +39,7 @@ export function dictionaryDel (params) {
|
||||||
export function dictionaryPage (params) {
|
export function dictionaryPage (params) {
|
||||||
return request({
|
return request({
|
||||||
url: dictionaryApi.page,
|
url: dictionaryApi.page,
|
||||||
method: 'post',
|
method: 'get',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,7 @@ export function dictionaryItemDel (params) {
|
||||||
export function dictionaryItemPage (params) {
|
export function dictionaryItemPage (params) {
|
||||||
return request({
|
return request({
|
||||||
url: dictionaryItemApi.page,
|
url: dictionaryItemApi.page,
|
||||||
method: 'post',
|
method: 'get',
|
||||||
data: params
|
data: params
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,7 +136,7 @@ export default {
|
||||||
loadData (pagination, filters, sorter) {
|
loadData (pagination, filters, sorter) {
|
||||||
this.localLoading = true
|
this.localLoading = true
|
||||||
const parameter = Object.assign({
|
const parameter = Object.assign({
|
||||||
pageIndex: (pagination && pagination.current) ||
|
pageNum: (pagination && pagination.current) ||
|
||||||
this.showPagination && this.localPagination.current || this.pageNum,
|
this.showPagination && this.localPagination.current || this.pageNum,
|
||||||
pageSize: (pagination && pagination.pageSize) ||
|
pageSize: (pagination && pagination.pageSize) ||
|
||||||
this.showPagination && this.localPagination.pageSize || this.pageSize
|
this.showPagination && this.localPagination.pageSize || this.pageSize
|
||||||
|
|
|
@ -61,7 +61,7 @@ export const asyncRouterMap = [
|
||||||
path: '/sys/dictionary',
|
path: '/sys/dictionary',
|
||||||
name: 'DictionaryList',
|
name: 'DictionaryList',
|
||||||
component: () => import('@/views/sys/dictionary/DictionaryList'),
|
component: () => import('@/views/sys/dictionary/DictionaryList'),
|
||||||
meta: { title: '数据字段', keepAlive: true }
|
meta: { title: '数据词典', keepAlive: true }
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import storage from 'store'
|
import storage from 'store'
|
||||||
import { userLogin, getInfo } from '@/api/security/user'
|
import { userLogin, getInfo } from '@/api/security/user'
|
||||||
import { ACCESS_TOKEN, LOGIN_TOKEN } from '@/store/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
import { welcome } from '@/utils/util'
|
import { welcome } from '@/utils/util'
|
||||||
|
|
||||||
const user = {
|
const user = {
|
||||||
state: {
|
state: {
|
||||||
loginToken: '',
|
token: '',
|
||||||
name: '',
|
name: '',
|
||||||
welcome: '',
|
welcome: '',
|
||||||
avatar: '',
|
avatar: '',
|
||||||
|
@ -15,7 +15,7 @@ const user = {
|
||||||
|
|
||||||
mutations: {
|
mutations: {
|
||||||
SET_TOKEN: (state, token) => {
|
SET_TOKEN: (state, token) => {
|
||||||
state.loginToken = token
|
state.token = token
|
||||||
},
|
},
|
||||||
SET_NAME: (state, { name, welcome }) => {
|
SET_NAME: (state, { name, welcome }) => {
|
||||||
state.name = name
|
state.name = name
|
||||||
|
@ -37,10 +37,8 @@ const user = {
|
||||||
Login ({ commit }, userInfo) {
|
Login ({ commit }, userInfo) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
userLogin(userInfo).then(response => {
|
userLogin(userInfo).then(response => {
|
||||||
const result = response.data
|
storage.set(ACCESS_TOKEN, response.token, 24 * 60 * 60 * 1000)
|
||||||
storage.set(LOGIN_TOKEN, result.loginToken, 24 * 60 * 60 * 1000)
|
commit('SET_TOKEN', response.token)
|
||||||
commit('SET_TOKEN', result.loginToken)
|
|
||||||
commit('SET_INFO', result)
|
|
||||||
resolve()
|
resolve()
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
reject(error)
|
reject(error)
|
||||||
|
@ -82,7 +80,6 @@ const user = {
|
||||||
return new Promise((resolve) => {
|
return new Promise((resolve) => {
|
||||||
commit('SET_TOKEN', '')
|
commit('SET_TOKEN', '')
|
||||||
commit('SET_ROLES', [])
|
commit('SET_ROLES', [])
|
||||||
storage.remove(LOGIN_TOKEN)
|
|
||||||
storage.remove(ACCESS_TOKEN)
|
storage.remove(ACCESS_TOKEN)
|
||||||
resolve()
|
resolve()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
export const ACCESS_TOKEN = 'ACCESS-TOKEN'
|
export const ACCESS_TOKEN = 'Authorization'
|
||||||
export const LOGIN_TOKEN = 'LOGIN-TOKEN'
|
|
||||||
export const TOKEN_NAME = 'Authorization'
|
|
||||||
|
|
||||||
export const SIDEBAR_TYPE = 'sidebar_type'
|
export const SIDEBAR_TYPE = 'sidebar_type'
|
||||||
export const TOGGLE_MOBILE_TYPE = 'is_mobile'
|
export const TOGGLE_MOBILE_TYPE = 'is_mobile'
|
||||||
|
|
|
@ -3,10 +3,9 @@ import store from '@/store'
|
||||||
import storage from 'store'
|
import storage from 'store'
|
||||||
import notification from 'ant-design-vue/es/notification'
|
import notification from 'ant-design-vue/es/notification'
|
||||||
import { VueAxios } from './axios'
|
import { VueAxios } from './axios'
|
||||||
import { ACCESS_TOKEN, LOGIN_TOKEN, TOKEN_NAME } from '@/store/mutation-types'
|
import { ACCESS_TOKEN } from '@/store/mutation-types'
|
||||||
|
|
||||||
const DATA_OWNER = 1
|
const SUCCESS_CODE = 200
|
||||||
const SUCCESS_CODE = 'ok'
|
|
||||||
const INVALID_TOKEN_CODE = '0000'
|
const INVALID_TOKEN_CODE = '0000'
|
||||||
|
|
||||||
const toast = (msg, description) => {
|
const toast = (msg, description) => {
|
||||||
|
@ -48,20 +47,17 @@ const errorHandler = (error) => {
|
||||||
|
|
||||||
// request interceptor
|
// request interceptor
|
||||||
request.interceptors.request.use(config => {
|
request.interceptors.request.use(config => {
|
||||||
const token = storage.get(ACCESS_TOKEN)
|
// const token = storage.get(ACCESS_TOKEN)
|
||||||
const loginToken = storage.get(LOGIN_TOKEN)
|
// 由于登录接口待联调,token使用默认值
|
||||||
// 如果 token 存在
|
const token = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6ImU1MmNhNTQ4LThmYmMtNGUyNC1iZjZjLWEzZjgwNDAwMDNiMCJ9._j_AHCd4I_PTWk4mt9euUzlABBoiqsNAIjVGrFJPWv8ZyoqgH9JPs2QFHtoj1Vly8cgtOri8X0ylbttglCcUQQ'
|
||||||
// 让每个请求携带自定义 token 请根据实际情况自行修改
|
// 如果 token 存在,让每个请求携带自定义 token 请根据实际情况自行修改
|
||||||
if (token) {
|
if (token) {
|
||||||
config.headers[ACCESS_TOKEN] = token
|
config.headers[ACCESS_TOKEN] = token
|
||||||
config.headers[TOKEN_NAME] = 'eyJhbGciOiJIUzUxMiJ9.eyJsb2dpbl91c2VyX2tleSI6IjdhYTViMGZiLTkyOWQtNDhhZS04ODU1LWJkNzM5MjdlOTNiZCJ9.CZzowaB-w2krGpNttPZBNLfq1mw775Lh-sx1K8onfgSwNzA6bw-P7CqC4vgH29xjDv3ey4zEFDzV9pHnrAGrDA'
|
|
||||||
}
|
}
|
||||||
if (config.method === 'post') {
|
if (config.method === 'post') {
|
||||||
if (!config.data) {
|
if (!config.data) {
|
||||||
config.data = {}
|
config.data = {}
|
||||||
}
|
}
|
||||||
config.data.dataOwner = DATA_OWNER
|
|
||||||
config.data.loginToken = loginToken
|
|
||||||
}
|
}
|
||||||
return config
|
return config
|
||||||
}, errorHandler)
|
}, errorHandler)
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
<template>
|
<template>
|
||||||
<a-drawer :visible="visible" :title="modalTitle" :width="1020" @close="onCancel">
|
<a-modal centered :visible="visible" :title="modalTitle" :width="720" @close="onCancel">
|
||||||
<a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
|
<a-form-model
|
||||||
|
ref="ruleForm"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
:label-col="labelCol"
|
||||||
|
:wrapper-col="wrapperCol">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
<a-form-model-item ref="dictionaryName" label="词典名称" prop="dictionaryName">
|
<a-form-model-item ref="dictionaryName" label="词典名称" prop="dictionaryName">
|
||||||
|
@ -19,7 +24,7 @@
|
||||||
<a-button type="primary" @click="onSubmit">保存</a-button>
|
<a-button type="primary" @click="onSubmit">保存</a-button>
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-drawer>
|
||||||
</template>
|
</a-modal></template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { dictionaryAdd, dictionaryUpdate, dictionaryGet } from '@/api/sys/dictionary'
|
import { dictionaryAdd, dictionaryUpdate, dictionaryGet } from '@/api/sys/dictionary'
|
||||||
|
@ -39,7 +44,7 @@ export default {
|
||||||
wrapperCol: { span: 16 },
|
wrapperCol: { span: 16 },
|
||||||
form: {
|
form: {
|
||||||
dictionaryName: '',
|
dictionaryName: '',
|
||||||
dictionaryCode: '',
|
dictionaryCode: ''
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
dictionaryName: [
|
dictionaryName: [
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<a-drawer :visible="visible" :title="modalTitle" :width="720" @close="onCancel">
|
<a-modal :visible="visible" :title="modalTitle" :width="720" @close="onCancel">
|
||||||
<a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
|
<a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol">
|
||||||
<a-row>
|
<a-row>
|
||||||
<a-col :span="12">
|
<a-col :span="12">
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
<a-button @click="onCancel">取消</a-button>
|
<a-button @click="onCancel">取消</a-button>
|
||||||
<a-button type="primary" @click="onSubmit">保存</a-button>
|
<a-button type="primary" @click="onSubmit">保存</a-button>
|
||||||
</div>
|
</div>
|
||||||
</a-drawer>
|
</a-modal>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in New Issue