fix: 请求地址,localStorage(key)优化
This commit is contained in:
@@ -133,7 +133,7 @@
|
||||
<script>
|
||||
import rightBoxMixin from '@/mixins/right-box'
|
||||
import { get, post, put } from '@/utils/http'
|
||||
import { panelTypeAndRouteMapping } from '@/utils/constants'
|
||||
import { panelTypeAndRouteMapping, storageKey } from '@/utils/constants'
|
||||
import { api } from '@/utils/api'
|
||||
import { VAceEditor } from 'vue3-ace-editor'
|
||||
import 'ace-builds/src-noconflict/mode-javascript'
|
||||
@@ -149,7 +149,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
url: api.chart,
|
||||
loginName: localStorage.getItem('cn-username'),
|
||||
loginName: localStorage.getItem(storageKey.username),
|
||||
panelTypeAndRouteMapping: panelTypeAndRouteMapping,
|
||||
rules: { // 表单校验规则
|
||||
name: [
|
||||
@@ -355,7 +355,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
isCurrentUser (username) {
|
||||
return localStorage.getItem('cn-username') === username
|
||||
return localStorage.getItem(storageKey.username) === username
|
||||
},
|
||||
/* 密码失去焦点 检验确认密码 */
|
||||
pinBlur () {
|
||||
@@ -397,7 +397,7 @@ export default {
|
||||
})
|
||||
},
|
||||
async getChartData (value) {
|
||||
await get('/visual/chart?panelId=' + value).then(response => {
|
||||
await get(api.chart, { panelId: value }).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.chartData = response.data.list
|
||||
}
|
||||
|
||||
@@ -57,13 +57,16 @@
|
||||
<script>
|
||||
import rightBoxMixin from '@/mixins/right-box'
|
||||
import { get, post, put } from '@/utils/http'
|
||||
import { storageKey } from '@/utils/constants'
|
||||
import { api } from '@/utils/api'
|
||||
|
||||
export default {
|
||||
name: 'I18nBox',
|
||||
mixins: [rightBoxMixin],
|
||||
data () {
|
||||
return {
|
||||
url: 'sys/i18n',
|
||||
loginName: localStorage.getItem('cn-username'),
|
||||
url: api.i18nBox,
|
||||
loginName: localStorage.getItem(storageKey.username),
|
||||
rules: { // 表单校验规则
|
||||
name: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
@@ -88,7 +91,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
isCurrentUser (username) {
|
||||
return localStorage.getItem('cn-username') === username
|
||||
return localStorage.getItem(storageKey.username) === username
|
||||
},
|
||||
/* 密码失去焦点 检验确认密码 */
|
||||
pinBlur () {
|
||||
@@ -130,7 +133,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getLangData () {
|
||||
get('sys/dict?type=lang&pageSize=-1').then(response => {
|
||||
get(api.dict, { type: 'lang', pageSize: -1 }).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.langData = response.data.list
|
||||
}
|
||||
|
||||
@@ -50,6 +50,8 @@
|
||||
<script>
|
||||
import rightBoxMixin from '@/mixins/right-box'
|
||||
import { get, post, put } from '@/utils/http'
|
||||
import { api } from '@/utils/api'
|
||||
|
||||
export default {
|
||||
name: 'userBox',
|
||||
mixins: [rightBoxMixin],
|
||||
@@ -64,7 +66,7 @@ export default {
|
||||
data () {
|
||||
return {
|
||||
editRole: {},
|
||||
url: 'sys/role',
|
||||
url: api.role,
|
||||
rightBox: { model: { show: false } },
|
||||
rules: { // 表单校验规则
|
||||
name: [
|
||||
@@ -110,7 +112,7 @@ export default {
|
||||
return new Promise(resolve => {
|
||||
self.menus = []
|
||||
if (self.editRole.id) {
|
||||
get('/sys/role/menu/' + self.editRole.id).then(response => {
|
||||
get(api.menu + self.editRole.id).then(response => {
|
||||
if (response.code == 200) {
|
||||
self.menus = response.data.menus
|
||||
self.selectedIds = response.data.selectedIds
|
||||
@@ -120,7 +122,7 @@ export default {
|
||||
resolve()
|
||||
})
|
||||
} else {
|
||||
get('/sys/menu').then(response => {
|
||||
get(api.sysMenu).then(response => {
|
||||
if (response.code == 200) {
|
||||
self.menus = response.data.list
|
||||
} else {
|
||||
|
||||
@@ -116,7 +116,9 @@
|
||||
<script>
|
||||
import rightBoxMixin from '@/mixins/right-box'
|
||||
import { get, post, put } from '@/utils/http'
|
||||
import { themeData, langData } from '@/utils/constants'
|
||||
import { themeData, langData, storageKey } from '@/utils/constants'
|
||||
import { api } from '@/utils/api'
|
||||
|
||||
export default {
|
||||
name: 'UserBox',
|
||||
mixins: [rightBoxMixin],
|
||||
@@ -131,8 +133,8 @@ export default {
|
||||
}
|
||||
}
|
||||
return {
|
||||
url: 'sys/user',
|
||||
loginName: localStorage.getItem('cn-username'),
|
||||
url: api.user,
|
||||
loginName: localStorage.getItem(storageKey.username),
|
||||
rules: { // 表单校验规则
|
||||
name: [
|
||||
{ required: true, message: this.$t('validate.required'), trigger: 'blur' }
|
||||
@@ -180,7 +182,7 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
isCurrentUser (username) {
|
||||
return localStorage.getItem('cn-username') === username
|
||||
return localStorage.getItem(storageKey.username) === username
|
||||
},
|
||||
/* 密码失去焦点 检验确认密码 */
|
||||
pinBlur () {
|
||||
@@ -222,7 +224,7 @@ export default {
|
||||
})
|
||||
},
|
||||
getRoleData () {
|
||||
get('sys/role?pageSize=-1').then(response => {
|
||||
get(api.role, { pageSize: -1 }).then(response => {
|
||||
if (response.code === 200) {
|
||||
this.roleData = response.data.list
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user