-
Notifications
You must be signed in to change notification settings - Fork 154
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
31 changed files
with
2,183 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { AxiosRequestConfig } from 'axios'; | ||
import { useGlobalStore } from '@/stores/modules/global.ts'; | ||
import { storeToRefs } from 'pinia'; | ||
|
||
/** | ||
* @description 主要在 post、put、delete、patch 请求中设置 csrfToken | ||
* @param {AxiosRequestConfig} config | ||
*/ | ||
export const setOptionsCSRFToken = (config?: AxiosRequestConfig): AxiosRequestConfig => { | ||
const globalStore = useGlobalStore(); | ||
|
||
const { csrfToken } = storeToRefs(globalStore); | ||
|
||
if (!config) { | ||
config = {}; | ||
} | ||
|
||
if (csrfToken) { | ||
if (!config.headers) { | ||
config.headers = {}; | ||
} | ||
config.headers['X-CSRFToken'] = csrfToken; | ||
} | ||
|
||
return config; | ||
}; | ||
|
||
/** | ||
* @description 主要在 get 请求中设置 Organization Id | ||
* @param {AxiosRequestConfig} config | ||
*/ | ||
export const setOrgIDToRequestHeader = (config: AxiosRequestConfig) => { | ||
const globalStore = useGlobalStore(); | ||
|
||
const { JMSOrg, JMSLunaOra } = storeToRefs(globalStore); | ||
|
||
if (!config) { | ||
config = {}; | ||
} | ||
|
||
if (JMSOrg || JMSLunaOra) { | ||
if (!config.headers) { | ||
config.headers = {}; | ||
} | ||
|
||
if (!('X-JMS-ORG' in config.headers)) { | ||
config.headers['X-JMS-ORG'] = JMSOrg || JMSLunaOra; | ||
} | ||
} | ||
|
||
return config; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<template> | ||
<svg :style="iconStyle" aria-hidden="true"> | ||
<use :xlink:href="symbolId" /> | ||
</svg> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
// https://github.com/vbenjs/vite-plugin-svg-icons/blob/main/README.zh_CN.md | ||
import { computed, CSSProperties } from 'vue'; | ||
interface SvgProps { | ||
// 图标的名称 ==> 必传 | ||
name: string; | ||
// 图标的前缀 ==> 非必传(默认为"icon") | ||
prefix?: string; | ||
// 图标的样式 ==> 非必传 | ||
iconStyle?: CSSProperties; | ||
} | ||
const props = withDefaults(defineProps<SvgProps>(), { | ||
prefix: 'icon', | ||
iconStyle: () => ({ width: '30px', height: '30px' }) | ||
}); | ||
const symbolId = computed(() => `#${props.prefix}-${props.name}`); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<template> | ||
<n-dropdown | ||
trigger="hover" | ||
:show-arrow="true" | ||
placement="right" | ||
:options="options" | ||
@select="handleSelect" | ||
> | ||
<svg-icon :name="name" :icon-style="iconStyle" /> | ||
</n-dropdown> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { CSSProperties } from 'vue'; | ||
import { optionsDetail } from '@/layouts/components/Header/types'; | ||
import SvgIcon from '@/components/SvgIcon/index.vue'; | ||
const props = defineProps<{ | ||
name: string; | ||
options: optionsDetail[]; | ||
iconStyle: CSSProperties; | ||
}>(); | ||
const handleSelect = (key: string) => { | ||
props.options.forEach(item => { | ||
// 类型收窄 | ||
if (item.key === key && typeof item.onClink === 'function') { | ||
item.onClink(); | ||
} | ||
}); | ||
}; | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
src/layouts/components/Header/components/Profile/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<svg-icon :name="name" :icon-style="iconStyle"></svg-icon> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { CSSProperties } from 'vue'; | ||
import SvgIcon from '@/components/SvgIcon/index.vue'; | ||
defineProps<{ | ||
name: string; | ||
iconStyle: CSSProperties; | ||
}>(); | ||
</script> |
13 changes: 13 additions & 0 deletions
13
src/layouts/components/Header/components/Setting/index.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<template> | ||
<svg-icon :name="name" :icon-style="iconStyle"></svg-icon> | ||
</template> | ||
|
||
<script setup lang="ts"> | ||
import { CSSProperties } from 'vue'; | ||
import SvgIcon from '@/components/SvgIcon/index.vue'; | ||
defineProps<{ | ||
name: string; | ||
iconStyle: CSSProperties; | ||
}>(); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.