Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas3-fe
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas3-fe
Commits
cbb7678a
Commit
cbb7678a
authored
Dec 28, 2021
by
guxukai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: query-wrapper完善
parent
de4d639c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
25 deletions
+43
-25
index.vue
src/pages/entry/views/fixed/proxy/index.vue
+26
-24
index.vue
src/shared/components/global/query-wrapper/index.vue
+17
-1
No files found.
src/pages/entry/views/fixed/proxy/index.vue
View file @
cbb7678a
<
template
>
<
template
>
<
div></div
>
<
g-query-wrapper
:error=
"userError"
:data=
"userData"
:run=
"userRun"
:loading=
"userLoading"
/
>
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
useAuth
}
from
'@shared/store/modules/auth'
import
{
useAuth
}
from
'@shared/store/modules/auth'
...
@@ -18,29 +18,31 @@ const {
...
@@ -18,29 +18,31 @@ const {
loading
:
userLoading
,
loading
:
userLoading
,
error
:
userError
,
error
:
userError
,
run
:
userRun
,
run
:
userRun
,
}
=
useRequest
(()
=>
}
=
useRequest
(
UserToken
.
get
({
()
=>
token
:
authStore
.
loginInfo
.
token
,
UserToken
.
get
({
}).
then
(
res
=>
{
token
:
authStore
.
loginInfo
.
token
,
if
(
res
.
code
===
GATEWAY_CODE
.
success
)
{
}).
then
(
res
=>
{
userStore
.
$patch
({
userInfo
:
res
.
data
})
if
(
res
.
code
===
GATEWAY_CODE
.
success
)
{
//超管跳转
userStore
.
$patch
({
userInfo
:
res
.
data
})
if
(
authStore
.
loginInfo
.
id
===
10000000
)
{
//超管跳转
authStore
.
$patch
({
if
(
authStore
.
loginInfo
.
id
===
10000000
)
{
consoleInfo
:
{
authStore
.
$patch
({
consoleName
:
'超管'
,
consoleInfo
:
{
consoleObjectId
:
'1'
,
consoleName
:
'超管'
,
consoleTypeId
:
'1'
,
consoleObjectId
:
'1'
,
},
consoleTypeId
:
'1'
,
})
},
window
.
location
.
replace
(
`
${
origin
}
/super/proxy`
)
})
return
window
.
location
.
replace
(
`
${
origin
}
/super/proxy`
)
return
}
//其余跳转
authStore
.
$reset
()
window
.
location
.
replace
(
`
${
origin
}
/account/proxy`
)
}
}
//其余跳转
return
res
authStore
.
$reset
()
}),
window
.
location
.
replace
(
`
${
origin
}
/account/proxy`
)
{
manual
:
true
},
}
return
res
}),
)
)
</
script
>
</
script
>
src/shared/components/global/query-wrapper/index.vue
View file @
cbb7678a
<
template
>
<
template
>
<div>
<div>
<slot
v-if=
"!loading"
/>
<slot
v-if=
"!loading && !error && !hasError"
/>
<div
v-if=
"loading"
>
数据获取中...
</div>
<div
v-if=
"error"
>
{{
error
}}
</div>
<div
v-if=
"hasError"
>
{{
data
.
message
}}
</div>
<div
v-if=
"error || hasError"
>
<el-button
@
click=
"run"
>
重新请求
</el-button>
</div>
</div>
</div>
</
template
>
</
template
>
<
script
lang=
"ts"
setup
>
<
script
lang=
"ts"
setup
>
import
{
GATEWAY_CODE
}
from
'@shared/http/constants'
import
{
HttpResponse
}
from
'@shared/http/HttpResponse'
import
{
PropType
}
from
'vue'
const
props
=
defineProps
({
const
props
=
defineProps
({
loading
:
{
loading
:
{
type
:
Boolean
,
type
:
Boolean
,
...
@@ -13,6 +27,7 @@ const props = defineProps({
...
@@ -13,6 +27,7 @@ const props = defineProps({
required
:
false
,
required
:
false
,
},
},
data
:
{
data
:
{
type
:
Object
as
PropType
<
HttpResponse
>
,
required
:
false
,
required
:
false
,
},
},
run
:
{
run
:
{
...
@@ -20,4 +35,5 @@ const props = defineProps({
...
@@ -20,4 +35,5 @@ const props = defineProps({
required
:
true
,
required
:
true
,
},
},
})
})
const
hasError
=
props
.
data
&&
props
.
data
?.
code
!==
GATEWAY_CODE
.
success
</
script
>
</
script
>
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