Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
R
risk-monitor
项目
项目
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
图表
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
蔡建
risk-monitor
Commits
b67feed8
提交
b67feed8
authored
3月 03, 2026
作者:
coderBryanFu
浏览文件
操作
浏览文件
下载
差异文件
styles:组件命名更新
上级
c46c21a0
67255f2a
全部展开
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
108 行增加
和
12 行删除
+108
-12
SearchContainer.vue
src/components/SearchContainer.vue
+108
-12
index.vue
src/views/bill/billHome/index.vue
+0
-0
没有找到文件。
src/components/SearchContainer.vue
浏览文件 @
b67feed8
<
template
>
<
template
>
<div
class=
"search-container"
v-show=
"!isShow"
>
<div
class=
"search-container"
v-show=
"!isShow"
>
<div
class=
"search-main"
>
<div
class=
"search-type-tabs"
v-if=
"enableBillTypeSwitch"
>
<input
v-model=
"store.searchBillText"
:placeholder=
"placeholder"
@
keyup
.
enter=
"handleSearch"
class=
"search-input"
/>
<div
class=
"search-type-tab"
:class=
"
{ active: billSearchType === 'federal' }"
@click="handleChangeBillSearchType('federal')">
联邦议会
</div>
<div
class=
"search-type-tab"
:class=
"
{ active: billSearchType === 'state' }"
@click="handleChangeBillSearchType('state')">
州议会
</div>
</div>
<div
class=
"search-main"
:class=
"
{ 'search-main-with-tabs': enableBillTypeSwitch }">
<input
v-model=
"store.searchBillText"
:placeholder=
"placeholder"
@
keyup
.
enter=
"handleSearch"
class=
"search-input"
/>
<div
class=
"search-btn"
@
click=
"handleSearch"
>
<div
class=
"search-btn"
@
click=
"handleSearch"
>
<img
src=
"@/assets/icons/search-icon.png"
alt
/>
<img
src=
"@/assets/icons/search-icon.png"
alt
/>
搜索
搜索
...
@@ -43,19 +54,26 @@
...
@@ -43,19 +54,26 @@
</
template
>
</
template
>
<
script
setup
>
<
script
setup
>
import
{
ref
,
nextTick
,
watchEffect
,
onMounted
}
from
"vue"
;
import
{
ref
,
nextTick
,
watchEffect
}
from
"vue"
;
import
{
useContainerScroll
}
from
"@/hooks/useScrollShow"
;
import
{
useContainerScroll
}
from
"@/hooks/useScrollShow"
;
import
{
useRouter
}
from
"vue-router"
;
import
{
useRouter
}
from
"vue-router"
;
import
{
useWrittingAsstaintStore
}
from
"@/stores/writtingAsstaintStore"
;
import
{
useWrittingAsstaintStore
}
from
"@/stores/writtingAsstaintStore"
;
const
store
=
useWrittingAsstaintStore
();
const
store
=
useWrittingAsstaintStore
();
const
router
=
useRouter
();
const
router
=
useRouter
();
let
{
countInfo
,
containerRef
,
placeholder
,
areaName
}
=
defineProps
({
const
{
countInfo
,
containerRef
,
placeholder
,
areaName
,
enableBillTypeSwitch
,
defaultBillSearchType
}
=
defineProps
({
countInfo
:
{
countInfo
:
{
type
:
Array
,
type
:
Array
,
default
:
()
=>
[]
default
:
()
=>
[]
},
},
containerRef
:
{
containerRef
:
{
type
:
Object
,
type
:
Object
,
default
:
{}
default
:
{}
...
@@ -67,18 +85,48 @@ let { countInfo, containerRef, placeholder, areaName } = defineProps({
...
@@ -67,18 +85,48 @@ let { countInfo, containerRef, placeholder, areaName } = defineProps({
areaName
:
{
areaName
:
{
type
:
String
,
type
:
String
,
default
:
"法案"
default
:
"法案"
},
// 法案页专用:是否展示“联邦议会/州议会”搜索类型切换
// 其他页面默认 false,不受影响
enableBillTypeSwitch
:
{
type
:
Boolean
,
default
:
false
},
// 法案页专用:默认搜索类型
// 可选值:'federal'(联邦议会)| 'state'(州议会)
defaultBillSearchType
:
{
type
:
String
,
default
:
"federal"
}
}
});
});
// 法案搜索类型状态(仅在 enableBillTypeSwitch=true 时生效)
// 维护说明:
// - federal: 联邦议会
// - state: 州议会
const
billSearchType
=
ref
(
defaultBillSearchType
===
"state"
?
"state"
:
"federal"
);
const
handleChangeBillSearchType
=
type
=>
{
billSearchType
.
value
=
type
;
};
const
handleSearch
=
()
=>
{
const
handleSearch
=
()
=>
{
window
.
sessionStorage
.
setItem
(
"curTabName"
,
`搜索-
${
store
.
searchBillText
}
`
);
window
.
sessionStorage
.
setItem
(
"curTabName"
,
`搜索-
${
store
.
searchBillText
}
`
);
if
(
!
areaName
)
return
;
if
(
!
areaName
)
return
;
const
query
=
{
searchText
:
store
.
searchBillText
,
areaName
:
areaName
};
// 法案页附带搜索类型参数,便于搜索结果页后续按类型处理
if
(
enableBillTypeSwitch
)
{
query
.
billSearchType
=
billSearchType
.
value
;
}
const
curRoute
=
router
.
resolve
({
const
curRoute
=
router
.
resolve
({
path
:
"/searchResults"
,
path
:
"/searchResults"
,
query
:
{
query
searchText
:
store
.
searchBillText
,
areaName
:
areaName
}
});
});
window
.
open
(
curRoute
.
href
,
"_blank"
);
window
.
open
(
curRoute
.
href
,
"_blank"
);
};
};
...
@@ -90,17 +138,17 @@ watchEffect(() => {
...
@@ -90,17 +138,17 @@ watchEffect(() => {
if
(
isShow
.
value
)
{
if
(
isShow
.
value
)
{
homeMainRef
.
value
.
classList
.
add
(
"scroll-main"
);
homeMainRef
.
value
.
classList
.
add
(
"scroll-main"
);
homeMainRef
.
value
.
classList
.
add
(
"scrollHomeMain"
);
homeMainRef
.
value
.
classList
.
add
(
"scrollHomeMain"
);
}
else
{
}
else
{
homeMainRef
.
value
.
classList
.
remove
(
"scroll-main"
);
homeMainRef
.
value
.
classList
.
remove
(
"scroll-main"
);
homeMainRef
.
value
.
classList
.
remove
(
"scrollHomeMain"
);
homeMainRef
.
value
.
classList
.
remove
(
"scrollHomeMain"
);
}
}
store
.
changeIsShowSearchBar
(
isShow
.
value
);
store
.
changeIsShowSearchBar
(
isShow
.
value
);
});
});
store
.
setSearchData
({
placeholder
,
areaName
,
containerRef
:
homeMainRef
});
store
.
setSearchData
({
placeholder
,
areaName
,
containerRef
:
homeMainRef
});
// 锚点跳转
// 锚点跳转
const
handleToPosi
=
id
=>
{
const
handleToPosi
=
id
=>
{
const
element
=
document
.
getElementById
(
id
);
const
element
=
document
.
getElementById
(
id
);
...
@@ -131,6 +179,43 @@ const handleToPosi = id => {
...
@@ -131,6 +179,43 @@ const handleToPosi = id => {
width
:
960px
;
width
:
960px
;
height
:
168px
;
height
:
168px
;
margin
:
0
auto
68px
auto
;
margin
:
0
auto
68px
auto
;
.search-type-tabs
{
display
:
flex
;
align-items
:
flex-end
;
height
:
41px
;
gap
:
2px
;
.search-type-tab
{
width
:
176px
;
height
:
41px
;
line-height
:
48px
;
text-align
:
center
;
border-radius
:
10px
10px
0
0
;
border
:
1px
solid
rgb
(
255
,
255
,
255
);
border-bottom
:
none
;
background
:
rgba
(
255
,
255
,
255
,
0
.65
);
color
:
rgb
(
95
,
101
,
108
);
font-family
:
Microsoft
YaHei
;
font-size
:
18px
;
font-weight
:
700
;
line-height
:
41px
;
cursor
:
pointer
;
padding
:
0
16px
;
box-sizing
:
border-box
;
}
.search-type-tab.active
{
background
:
rgba
(
231
,
243
,
255
,
1
);
color
:
rgb
(
5
,
95
,
194
);
border-color
:
rgb
(
255
,
255
,
255
);
}
}
.search-main-with-tabs
{
border-top-left-radius
:
0
!
important
;
}
.search-center
{
.search-center
{
width
:
688px
;
width
:
688px
;
height
:
48px
;
height
:
48px
;
...
@@ -170,6 +255,7 @@ const handleToPosi = id => {
...
@@ -170,6 +255,7 @@ const handleToPosi = id => {
}
}
}
}
}
}
.search-main
{
.search-main
{
display
:
flex
;
display
:
flex
;
padding-right
:
3px
;
padding-right
:
3px
;
...
@@ -181,9 +267,11 @@ const handleToPosi = id => {
...
@@ -181,9 +267,11 @@ const handleToPosi = id => {
background-color
:
rgba
(
255
,
255
,
255
,
0
.65
);
background-color
:
rgba
(
255
,
255
,
255
,
0
.65
);
border-radius
:
10px
;
border-radius
:
10px
;
border
:
1px
solid
#fff
;
border
:
1px
solid
#fff
;
&
:hover
{
&
:hover
{
border
:
1px
solid
var
(
--
color-main-active
);
border
:
1px
solid
var
(
--
color-main-active
);
}
}
.search-input
{
.search-input
{
border
:
none
;
border
:
none
;
outline
:
none
;
outline
:
none
;
...
@@ -201,6 +289,7 @@ const handleToPosi = id => {
...
@@ -201,6 +289,7 @@ const handleToPosi = id => {
color
:
#a8abb2
;
color
:
#a8abb2
;
}
}
}
}
.search-btn
{
.search-btn
{
cursor
:
pointer
;
cursor
:
pointer
;
display
:
flex
;
display
:
flex
;
...
@@ -216,6 +305,7 @@ const handleToPosi = id => {
...
@@ -216,6 +305,7 @@ const handleToPosi = id => {
font-family
:
"Microsoft YaHei"
;
font-family
:
"Microsoft YaHei"
;
line-height
:
22px
;
line-height
:
22px
;
color
:
#fff
;
color
:
#fff
;
img
{
img
{
width
:
18px
;
width
:
18px
;
height
:
18px
;
height
:
18px
;
...
@@ -223,6 +313,7 @@ const handleToPosi = id => {
...
@@ -223,6 +313,7 @@ const handleToPosi = id => {
}
}
}
}
}
}
.search-bottom
{
.search-bottom
{
width
:
688px
;
width
:
688px
;
height
:
48px
;
height
:
48px
;
...
@@ -230,6 +321,7 @@ const handleToPosi = id => {
...
@@ -230,6 +321,7 @@ const handleToPosi = id => {
margin-top
:
36px
;
margin-top
:
36px
;
display
:
flex
;
display
:
flex
;
justify-content
:
space-between
;
justify-content
:
space-between
;
// gap: 16px;
// gap: 16px;
.btn
{
.btn
{
display
:
flex
;
display
:
flex
;
...
@@ -243,9 +335,11 @@ const handleToPosi = id => {
...
@@ -243,9 +335,11 @@ const handleToPosi = id => {
background
:
#e7f3ff
;
background
:
#e7f3ff
;
cursor
:
pointer
;
cursor
:
pointer
;
position
:
relative
;
position
:
relative
;
&
:hover
{
&
:hover
{
background
:
#cae3fc
;
background
:
#cae3fc
;
}
}
.btn-text
{
.btn-text
{
width
:
80px
;
width
:
80px
;
color
:
var
(
--
color-main-active
);
color
:
var
(
--
color-main-active
);
...
@@ -256,12 +350,14 @@ const handleToPosi = id => {
...
@@ -256,12 +350,14 @@ const handleToPosi = id => {
margin-left
:
36px
;
margin-left
:
36px
;
text-align
:
center
;
text-align
:
center
;
}
}
.btn-icon
{
.btn-icon
{
position
:
absolute
;
position
:
absolute
;
top
:
16px
;
top
:
16px
;
right
:
19px
;
right
:
19px
;
width
:
6px
;
width
:
6px
;
height
:
12px
;
height
:
12px
;
img
{
img
{
width
:
100%
;
width
:
100%
;
height
:
100%
;
height
:
100%
;
...
...
src/views/bill/billHome/index.vue
浏览文件 @
b67feed8
差异被折叠。
点击展开。
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论