Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
standalone-anyremote
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
qlintonger xeno
standalone-anyremote
Commits
dfb7b8f5
Commit
dfb7b8f5
authored
Apr 30, 2024
by
pangchong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 提交
parent
af14cecb
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
src/api/alova-instance.ts
+13
-0
src/views/layout/gHeader.vue
+17
-0
No files found.
src/api/alova-instance.ts
View file @
dfb7b8f5
...
...
@@ -28,6 +28,7 @@ export const alova = createAlova({
// 请求拦截器
beforeRequest
(
method
)
{
console
.
log
(
method
)
//开启加载动画
const
appStore
=
useAppStore
()
const
loading
=
method
.
meta
?.
loading
...
...
@@ -38,11 +39,23 @@ export const alova = createAlova({
appStore
.
count
++
}
// 设置请求头application/json;charset=UTF-8
const
isDownload
=
method
.
meta
?.
isDownload
if
(
isDownload
&&
method
.
data
)
{
method
.
data
=
Object
.
entries
(
method
.
data
).
reduce
(
function
(
q
,
w
)
{
if
(
!
(
w
[
1
]
instanceof
File
))
{
q
.
set
(
w
[
0
],
w
[
1
])
}
else
{
q
.
set
(
w
[
0
],
w
[
1
],
w
[
1
].
name
)
}
return
q
},
new
FormData
())
}
else
{
method
.
config
.
headers
=
{
'Content-Type'
:
'application/x-www-form-urlencoded'
}
//转换成表单数据
method
.
data
=
qs
.
stringify
(
method
.
data
)
}
//加入token
const
userStore
=
useUserStore
()
if
(
userStore
.
token
)
{
...
...
src/views/layout/gHeader.vue
View file @
dfb7b8f5
...
...
@@ -2,6 +2,11 @@
<a-layout-header
class=
"h-[60px] flex items-center px-4 justify-between bg-theme-bg2"
>
<a-image
:src=
"logo"
:preview=
"false"
fit=
"fill"
/>
<a-space
size=
"large"
>
<a-upload
:show-file-list=
"false"
:custom-request=
"uploadMuFile"
>
<template
#
upload-button
>
<a-button
type=
"outline"
shape=
"circle"
><global-icon
icon=
"question-circle"
:size=
"14"
></global-icon></a-button>
</
template
>
</a-upload>
<a-button
type=
"outline"
shape=
"circle"
><global-icon
icon=
"question-circle"
:size=
"14"
></global-icon></a-button>
<a-button
type=
"outline"
shape=
"circle"
><global-icon
icon=
"safe"
:size=
"14"
></global-icon></a-button>
<!-- <a-dropdown @select="handleLanguage">
...
...
@@ -35,6 +40,7 @@ import logo from '@/assets/images/header/logo.png'
import
useLocale
from
'@/hooks/locale'
import
{
activedTheme
}
from
'../../../project.ui.config'
import
useUserStore
from
'@/store/user'
import
{
alova
}
from
'@/api/alova-instance'
const
{
changeLocale
}
=
useLocale
()
//切换语言
...
...
@@ -50,6 +56,17 @@ const userStore = useUserStore()
const
logOut
=
()
=>
{
userStore
.
handleLogOut
()
}
const
uploadMuFile
=
(
option
:
any
)
=>
{
const
{
onProgress
,
onError
,
onSuccess
,
fileItem
,
name
}
=
option
var
params
=
{
apiPwd
:
'Ifar$2_0160_525_Mocp'
,
file
:
fileItem
.
file
,
requestFrom
:
6
,
uid
:
4
}
alova
.
Post
(
'/admin/uploadMuFile'
,
params
,
{
meta
:
{
isDownload
:
true
}
}).
then
(()
=>
{})
}
</
script
>
<
style
lang=
"less"
scoped
>
.arco-btn
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment