Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
liyeyun
Project
Project
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
cfld-frontend
liyeyun
Commits
e6508226
Commit
e6508226
authored
Dec 14, 2023
by
王玉鑫
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 我的园区401跳首页
parent
dbc68277
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
6 deletions
+32
-6
useDetail.ts
src/composable/useDetail.ts
+4
-1
useListView.ts
src/composable/useListView.ts
+10
-3
tools.ts
src/utils/tools.ts
+10
-0
MyDevelopDetail.vue
src/views/user/MyDevelopDetail.vue
+4
-1
MyIndustrialDetail.vue
src/views/user/MyIndustrialDetail.vue
+4
-1
No files found.
src/composable/useDetail.ts
View file @
e6508226
...
...
@@ -21,14 +21,17 @@ export function useDetail<T>(url: RequestUrl) {
const
initDetail
=
async
()
=>
{
try
{
const
{
success
,
msg
,
data
}
=
await
requestDetail
();
const
result
=
await
requestDetail
();
const
{
success
,
msg
,
data
}
=
result
;
if
(
success
)
{
detail
.
value
=
data
;
}
else
{
message
.
error
(
msg
||
'请求失败'
);
}
return
result
;
}
catch
(
error
)
{
console
.
log
(
error
);
return
Promise
.
reject
(
error
);
}
};
...
...
src/composable/useListView.ts
View file @
e6508226
...
...
@@ -2,10 +2,11 @@ import { useQueryList } from '@/composable/useQueryList.ts';
import
{
ref
,
type
Ref
,
watchEffect
,
nextTick
,
type
ShallowRef
,
computed
}
from
'vue'
;
import
{
RequestUrl
}
from
'@/types/api.ts'
;
import
type
{
CommonListResp
,
CommonListParams
}
from
'@/types/common'
;
import
type
{
RouteName
}
from
'@/router/router.ts'
;
import
{
RouteName
}
from
'@/router/router.ts'
;
import
{
useRoute
,
onBeforeRouteLeave
}
from
'vue-router'
;
import
{
useSearchParamsStore
}
from
'@/stores/searchParams.ts'
;
import
{
cloneDeep
,
isEmpty
}
from
'lodash-es'
;
import
{
handleNoAuth
}
from
'@/utils/tools.ts'
;
import
{
useRequest
}
from
'./useRequest.ts'
;
import
{
useJump
}
from
'./useJump.ts'
;
...
...
@@ -74,10 +75,10 @@ export function useListView<
isRequesting
.
value
=
b
;
};
watchEffect
(
async
()
=>
{
const
callQuery
=
async
()
=>
{
try
{
changeIsRequesting
(
true
);
const
{
data
}
=
await
queryList
(
const
{
data
,
code
}
=
await
queryList
(
{
...
searchParams
.
value
,
...
otherParams
.
value
,
...
...
@@ -86,11 +87,16 @@ export function useListView<
);
handleUrlClear
();
datas
.
value
=
data
.
records
;
handleNoAuth
(
code
);
}
catch
(
error
)
{
console
.
log
(
error
);
}
finally
{
changeIsRequesting
(
false
);
}
};
watchEffect
(()
=>
{
callQuery
();
});
/**
...
...
@@ -142,6 +148,7 @@ export function useListView<
isRequesting
,
haveSearchParams
,
queryList
,
callQuery
,
handleDetail
,
initPagination
,
handleFilterChange
,
...
...
src/utils/tools.ts
View file @
e6508226
import
router
,
{
RouteName
}
from
'@/router/router.ts'
;
export
const
heightLight
=
(
str
:
string
,
key
:
string
)
=>
{
const
reg
=
new
RegExp
(
key
,
'ig'
);
return
str
.
replace
(
reg
,
(
val
)
=>
{
return
`<span style="color: #C0322B;line-height: 25px;background: rgba(192,50,43,0.06);display: inline-block;">
${
val
}
</span>`
;
});
};
export
const
handleNoAuth
=
(
code
:
number
)
=>
{
if
(
code
===
401
)
{
router
.
replace
({
name
:
RouteName
.
home
,
});
}
};
src/views/user/MyDevelopDetail.vue
View file @
e6508226
...
...
@@ -136,6 +136,7 @@ import { filterAddress, formatNumber } from '@/utils/filters.ts';
import
{
useJump
}
from
'@/composable/useJump.ts'
;
import
{
RouteName
}
from
'@/router/router.ts'
;
import
{
useIndustryBase
}
from
'@/composable/useIndustryBase.ts'
;
import
{
handleNoAuth
}
from
'@/utils/tools.ts'
;
const
{
detail
,
initDetail
}
=
useDetail
<
MyParkDevelopDetailResp
>
(
RequestUrl
.
myParkDevelopDetail
);
const
{
router
}
=
useJump
();
...
...
@@ -536,5 +537,7 @@ const handleBack = () => {
});
};
initDetail
();
initDetail
().
then
(({
code
})
=>
{
handleNoAuth
(
code
);
});
</
script
>
src/views/user/MyIndustrialDetail.vue
View file @
e6508226
...
...
@@ -138,6 +138,7 @@ import { filterAddress, formatNumber } from '@/utils/filters.ts';
import
{
useJump
}
from
'@/composable/useJump.ts'
;
import
{
RouteName
}
from
'@/router/router.ts'
;
import
{
useIndustryBase
}
from
'@/composable/useIndustryBase.ts'
;
import
{
handleNoAuth
}
from
'@/utils/tools.ts'
;
const
{
detail
,
initDetail
}
=
useDetail
<
MyParkIndustrialDetailResp
>
(
RequestUrl
.
myParkIndustrialDetail
,
...
...
@@ -504,5 +505,7 @@ const handleBack = () => {
});
};
initDetail
();
initDetail
().
then
(({
code
})
=>
{
handleNoAuth
(
code
);
});
</
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