Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
chifengweb2.0
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
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
lichunliang
chifengweb2.0
Commits
0a5188f2
Commit
0a5188f2
authored
Jul 04, 2025
by
sxl
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:全局搜索 接口处理
parent
937afddc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
94 deletions
+92
-94
index copy.vue
pages/Search/index copy.vue
+27
-32
index.vue
pages/Search/index.vue
+65
-62
No files found.
pages/Search/index copy.vue
View file @
0a5188f2
...
@@ -14,26 +14,17 @@
...
@@ -14,26 +14,17 @@
</div>
</div>
<div
class=
"inner"
>
<div
class=
"inner"
>
<div
class=
"search-input"
>
<div
class=
"search-input"
>
<el-input
<el-input
v-model=
"query.searchCon"
placeholder=
"请输入内容"
v-model=
"query.searchCon"
@
keyup.enter.native=
"tabList(query.searchCon)"
></el-input>
placeholder=
"请输入内容"
<span
class=
"search-btn"
@
click=
"tabList(query.searchCon)"
>
搜索
</span>
@
keyup.enter.native=
"tabList(query.searchCon)"
></el-input>
<span
class=
"search-btn"
@
click=
"tabList(query.searchCon)"
>
搜索
</span
>
</div>
</div>
</div>
</div>
<div
class=
"con-tab"
>
<div
class=
"con-tab"
>
<div
class=
"inner"
>
<div
class=
"inner"
>
<ul
v-if=
"conListData"
>
<ul
v-if=
"conListData"
>
<li
<li
v-for=
"(con, index) in conListData"
:key=
"index"
@
click=
"setActive(index, con.type)"
v-for=
"(con, index) in conListData"
:class=
"
{ 'con-active': index === activeIndex }">
:key=
"index"
@
click=
"setActive(index, con.type)"
:class=
"
{ 'con-active': index === activeIndex }"
>
{{
con
.
type
}}
{{
con
.
type
}}
</li>
</li>
</ul>
</ul>
...
@@ -41,18 +32,12 @@
...
@@ -41,18 +32,12 @@
</div>
</div>
<div
class=
"inner"
>
<div
class=
"inner"
>
<p
class=
"srarch-result"
>
<p
class=
"srarch-result"
>
为您找到相关结果约为
<span>
{{
total
}}
</span
为您找到相关结果约为
<span>
{{
total
}}
</span>
个
>
个
</p>
</p>
</div>
</div>
<div
class=
"inner list"
>
<div
class=
"inner list"
>
<div
class=
"con-list"
>
<div
class=
"con-list"
>
<div
<div
class=
"con-list-con"
v-for=
"con in listcon"
:key=
"con.id"
@
click=
"gotoDet(con)"
>
class=
"con-list-con"
v-for=
"con in listcon"
:key=
"con.id"
@
click=
"gotoDet(con)"
>
<h2>
{{
con
.
title
}}
</h2>
<h2>
{{
con
.
title
}}
</h2>
<p
v-html=
"con.details"
></p>
<p
v-html=
"con.details"
></p>
</div>
</div>
...
@@ -61,14 +46,8 @@
...
@@ -61,14 +46,8 @@
<div
class=
"mt20"
></div>
<div
class=
"mt20"
></div>
<div
class=
"inner"
>
<div
class=
"inner"
>
<div
class=
"block"
>
<div
class=
"block"
>
<el-pagination
<el-pagination
@
size-change=
"handleSizeChange"
@
current-change=
"handleCurrentChange"
:page-size=
"10"
@
size-change=
"handleSizeChange"
layout=
"prev, pager, next, jumper"
:total=
"total"
v-if=
"total > 10"
>
@
current-change=
"handleCurrentChange"
:page-size=
"10"
layout=
"prev, pager, next, jumper"
:total=
"total"
v-if=
"total > 10"
>
</el-pagination>
</el-pagination>
</div>
</div>
</div>
</div>
...
@@ -207,7 +186,7 @@ export default {
...
@@ -207,7 +186,7 @@ export default {
async
tabList
(
searchCon
)
{
async
tabList
(
searchCon
)
{
try
{
try
{
const
listMohu
=
await
sendRequest
(
const
listMohu
=
await
sendRequest
(
"
/business/
/
homePage/listMohu
"
,
"
/business/homePage/listMohu
"
,
"
get
"
,
"
get
"
,
{
infor
:
searchCon
}
{
infor
:
searchCon
}
);
);
...
@@ -227,9 +206,11 @@ export default {
...
@@ -227,9 +206,11 @@ export default {
width
:
100%
;
width
:
100%
;
height
:
60px
;
height
:
60px
;
background
:
#f7f7f7
;
background
:
#f7f7f7
;
ul
{
ul
{
display
:
flex
;
display
:
flex
;
justify-content
:
start
;
justify-content
:
start
;
li
{
li
{
line-height
:
60px
;
line-height
:
60px
;
font-size
:
22px
;
font-size
:
22px
;
...
@@ -238,8 +219,10 @@ export default {
...
@@ -238,8 +219,10 @@ export default {
cursor
:
pointer
;
cursor
:
pointer
;
position
:
relative
;
position
:
relative
;
transition
:
all
0
.5s
linear
;
transition
:
all
0
.5s
linear
;
&
:hover
{
&
:hover
{
color
:
#000
;
color
:
#000
;
&
:
:
after
{
&
:
:
after
{
content
:
""
;
content
:
""
;
width
:
100%
;
width
:
100%
;
...
@@ -251,8 +234,10 @@ export default {
...
@@ -251,8 +234,10 @@ export default {
}
}
}
}
}
}
li
.con-active
{
li
.con-active
{
color
:
#000
;
color
:
#000
;
&
:
:
after
{
&
:
:
after
{
content
:
""
;
content
:
""
;
width
:
100%
;
width
:
100%
;
...
@@ -265,29 +250,35 @@ export default {
...
@@ -265,29 +250,35 @@ export default {
}
}
}
}
}
}
.list
{
.list
{
min-height
:
40vh
;
min-height
:
40vh
;
}
}
.con-list
{
.con-list
{
width
:
100%
;
width
:
100%
;
border
:
1px
solid
#e1e1e1
;
border
:
1px
solid
#e1e1e1
;
box-shadow
:
0px
3px
4px
0px
rgba
(
0
,
0
,
0
,
0
.2
);
box-shadow
:
0px
3px
4px
0px
rgba
(
0
,
0
,
0
,
0
.2
);
.con-list-con
{
.con-list-con
{
width
:
90%
;
width
:
90%
;
margin
:
20px
auto
;
margin
:
20px
auto
;
border-bottom
:
3px
dashed
#999
;
border-bottom
:
3px
dashed
#999
;
cursor
:
pointer
;
cursor
:
pointer
;
&
:last-child
{
&
:last-child
{
border-bottom
:
none
;
border-bottom
:
none
;
}
}
h2
{
h2
{
font-size
:
23px
;
font-size
:
23px
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#333333
;
color
:
#333333
;
line-height
:
46px
;
line-height
:
46px
;
}
}
>
p
{
>
p
{
font-size
:
19px
;
font-size
:
19px
;
font-family
:
Source
Han
Sans
CN
;
font-family
:
Source
Han
Sans
CN
;
font-weight
:
400
;
font-weight
:
400
;
...
@@ -302,6 +293,7 @@ export default {
...
@@ -302,6 +293,7 @@ export default {
}
}
}
}
}
}
.search-input
{
.search-input
{
width
:
70%
;
width
:
70%
;
margin
:
0
auto
;
margin
:
0
auto
;
...
@@ -309,6 +301,7 @@ export default {
...
@@ -309,6 +301,7 @@ export default {
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
.search-btn
{
.search-btn
{
width
:
80px
;
width
:
80px
;
background
:
#2f6fb9
;
background
:
#2f6fb9
;
...
@@ -320,11 +313,13 @@ export default {
...
@@ -320,11 +313,13 @@ export default {
color
:
#fff
;
color
:
#fff
;
}
}
}
}
.srarch-result
{
.srarch-result
{
font-size
:
22px
;
font-size
:
22px
;
font-weight
:
400
;
font-weight
:
400
;
color
:
#666666
;
color
:
#666666
;
line-height
:
80px
;
line-height
:
80px
;
span
{
span
{
color
:
rgba
(
47
,
111
,
185
,
1
);
color
:
rgba
(
47
,
111
,
185
,
1
);
}
}
...
...
pages/Search/index.vue
View file @
0a5188f2
<
template
>
<
template
>
<div
class=
"news cfkqbg"
>
<div
class=
"news cfkqbg"
>
<BackToTopButton
/>
<BackToTopButton
/>
<Header
:show=
"false"
:activeIndex=
"12"
/>
<Header
:show=
"false"
:activeIndex=
"12"
/>
<div
class=
"m2zrCon m2pubCon background-attachment"
>
<div
class=
"m2zrCon m2pubCon background-attachment"
>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"inner"
>
<div
class=
"inner"
>
...
@@ -14,26 +14,17 @@
...
@@ -14,26 +14,17 @@
</div>
</div>
<div
class=
"inner"
>
<div
class=
"inner"
>
<div
class=
"search-input"
>
<div
class=
"search-input"
>
<el-input
<el-input
v-model=
"query.searchCon"
placeholder=
"请输入内容"
v-model=
"query.searchCon"
@
keyup.enter.native=
"handleSearch(query.searchCon)"
></el-input>
placeholder=
"请输入内容"
<span
class=
"search-btn"
@
click=
"handleSearch(query.searchCon)"
>
搜索
</span>
@
keyup.enter.native=
"handleSearch(query.searchCon)"
></el-input>
<span
class=
"search-btn"
@
click=
"handleSearch(query.searchCon)"
>
搜索
</span
>
</div>
</div>
</div>
</div>
<div
class=
"con-tab"
>
<div
class=
"con-tab"
>
<div
class=
"inner"
>
<div
class=
"inner"
>
<ul
v-if=
"conListData"
>
<ul
v-if=
"conListData"
>
<li
<li
v-for=
"(con, index) in conListData"
:key=
"index"
@
click=
"setActive(index, con.type)"
v-for=
"(con, index) in conListData"
:class=
"
{ 'con-active': index === activeIndex }">
:key=
"index"
@
click=
"setActive(index, con.type)"
:class=
"
{ 'con-active': index === activeIndex }"
>
{{
con
.
type
}}
{{
con
.
type
}}
</li>
</li>
</ul>
</ul>
...
@@ -41,18 +32,12 @@
...
@@ -41,18 +32,12 @@
</div>
</div>
<div
class=
"inner"
>
<div
class=
"inner"
>
<p
class=
"srarch-result"
>
<p
class=
"srarch-result"
>
为您找到相关结果约为
<span>
{{
total
}}
</span
为您找到相关结果约为
<span>
{{
total
}}
</span>
个
>
个
</p>
</p>
</div>
</div>
<div
class=
"inner list"
>
<div
class=
"inner list"
>
<div
class=
"con-list"
>
<div
class=
"con-list"
>
<div
<div
class=
"con-list-con"
v-for=
"con in listcon"
:key=
"con.id"
@
click=
"gotoDet(con)"
>
class=
"con-list-con"
v-for=
"con in listcon"
:key=
"con.id"
@
click=
"gotoDet(con)"
>
<h2>
{{
con
.
title
}}
</h2>
<h2>
{{
con
.
title
}}
</h2>
<p
v-show=
"con.details"
>
{{
removeTagsAndSpaces
(
con
.
details
)
}}
</p>
<p
v-show=
"con.details"
>
{{
removeTagsAndSpaces
(
con
.
details
)
}}
</p>
</div>
</div>
...
@@ -133,7 +118,7 @@ export default {
...
@@ -133,7 +118,7 @@ export default {
},
},
methods
:
{
methods
:
{
removeTagsAndSpaces
(
input
)
{
removeTagsAndSpaces
(
input
)
{
if
(
input
)
{
if
(
input
)
{
// 使用;正则表达式替换
// 使用;正则表达式替换
var
output
=
input
.
replace
(
/<
\/?[^
>
]
+
(
>|$
)
/g
,
''
);
// 去除所有的
<>
标签
var
output
=
input
.
replace
(
/<
\/?[^
>
]
+
(
>|$
)
/g
,
''
);
// 去除所有的
<>
标签
output
=
output
.
replace
(
/
[\t\n\r]
/g
,
''
);
// 去除制表符、换行符、回车符
output
=
output
.
replace
(
/
[\t\n\r]
/g
,
''
);
// 去除制表符、换行符、回车符
...
@@ -144,16 +129,16 @@ export default {
...
@@ -144,16 +129,16 @@ export default {
}
}
},
},
handleSearch
(){
handleSearch
()
{
this
.
activeIndex
=
0
;
this
.
activeIndex
=
0
;
this
.
listcon
=
[];
this
.
listcon
=
[];
this
.
total
=
0
;
this
.
total
=
0
;
if
(
this
.
query
.
searchCon
)
{
if
(
this
.
query
.
searchCon
)
{
this
.
$router
.
push
({
this
.
$router
.
push
({
path
:
`/Search?search=
${
this
.
query
.
searchCon
}
`
,
path
:
`/Search?search=
${
this
.
query
.
searchCon
}
`
,
});
});
this
.
tabList
(
this
.
query
.
searchCon
);
this
.
tabList
(
this
.
query
.
searchCon
);
}
else
{
}
else
{
this
.
$message
({
this
.
$message
({
message
:
"
请输入查询内容
"
,
message
:
"
请输入查询内容
"
,
type
:
"
error
"
,
type
:
"
error
"
,
...
@@ -166,13 +151,13 @@ export default {
...
@@ -166,13 +151,13 @@ export default {
console
.
log
(
row
,
this
.
nowType
);
console
.
log
(
row
,
this
.
nowType
);
if
(
this
.
nowType
===
"
新闻资讯
"
)
{
if
(
this
.
nowType
===
"
新闻资讯
"
)
{
this
.
$router
.
push
({
path
:
`/News/det?id=
${
row
.
id
}
`
});
this
.
$router
.
push
({
path
:
`/News/det?id=
${
row
.
id
}
`
});
}
else
if
(
this
.
nowType
===
"
金融服务
"
)
{
}
else
if
(
this
.
nowType
===
"
金融服务
"
)
{
this
.
$router
.
push
({
path
:
`/Company?id=
${
row
.
id
}
`
});
this
.
$router
.
push
({
path
:
`/Company?id=
${
row
.
id
}
`
});
// } else if (this.nowType === "矿业权管理") {
// } else if (this.nowType === "矿业权管理") {
// this.$router.push({
// this.$router.push({
// path: `/TechnicalDocking/mmqManagement?id=${row.id}`,
// path: `/TechnicalDocking/mmqManagement?id=${row.id}`,
// });
// });
}
else
if
(
this
.
nowType
===
"
矿权交易
"
)
{
}
else
if
(
this
.
nowType
===
"
矿权交易
"
)
{
this
.
$router
.
push
({
path
:
`/Transaction/minDet?id=
${
row
.
id
}
`
});
this
.
$router
.
push
({
path
:
`/Transaction/minDet?id=
${
row
.
id
}
`
});
}
}
},
},
...
@@ -192,12 +177,12 @@ export default {
...
@@ -192,12 +177,12 @@ export default {
// this.scrollToTop();
// this.scrollToTop();
},
},
setActive
(
index
,
type
)
{
setActive
(
index
,
type
)
{
this
.
listcon
=
[];
this
.
listcon
=
[];
this
.
total
=
0
;
this
.
total
=
0
;
this
.
activeIndex
=
index
;
this
.
activeIndex
=
index
;
if
(
this
.
query
.
searchCon
)
{
if
(
this
.
query
.
searchCon
)
{
this
.
dataList
(
type
);
this
.
dataList
(
type
);
}
else
{
}
else
{
this
.
$message
({
this
.
$message
({
message
:
"
请输入查询内容
"
,
message
:
"
请输入查询内容
"
,
type
:
"
error
"
,
type
:
"
error
"
,
...
@@ -251,7 +236,7 @@ export default {
...
@@ -251,7 +236,7 @@ export default {
// this.listcon = [];
// this.listcon = [];
// this.total = 0;
// this.total = 0;
// }
// }
}
else
if
(
type
===
"
矿权交易
"
)
{
}
else
if
(
type
===
"
矿权交易
"
)
{
const
list
=
await
sendRequest
(
const
list
=
await
sendRequest
(
"
/business/templateData/queryByStr
"
,
"
/business/templateData/queryByStr
"
,
"
get
"
,
"
get
"
,
...
@@ -270,7 +255,7 @@ export default {
...
@@ -270,7 +255,7 @@ export default {
try
{
try
{
const
listMohu
=
await
sendRequest
(
const
listMohu
=
await
sendRequest
(
"
/business/
/
homePage/listMohu
"
,
"
/business/homePage/listMohu
"
,
"
get
"
,
"
get
"
,
{
infor
:
searchCon
}
{
infor
:
searchCon
}
);
);
...
@@ -290,9 +275,11 @@ export default {
...
@@ -290,9 +275,11 @@ export default {
width
:
100%
;
width
:
100%
;
height
:
60px
;
height
:
60px
;
background
:
#f7f7f7
;
background
:
#f7f7f7
;
ul
{
ul
{
display
:
flex
;
display
:
flex
;
justify-content
:
start
;
justify-content
:
start
;
li
{
li
{
line-height
:
60px
;
line-height
:
60px
;
font-size
:
16px
;
font-size
:
16px
;
...
@@ -301,8 +288,10 @@ export default {
...
@@ -301,8 +288,10 @@ export default {
cursor
:
pointer
;
cursor
:
pointer
;
position
:
relative
;
position
:
relative
;
transition
:
all
0
.5s
linear
;
transition
:
all
0
.5s
linear
;
&
:hover
{
&
:hover
{
color
:
#000
;
color
:
#000
;
&
:
:
after
{
&
:
:
after
{
content
:
""
;
content
:
""
;
width
:
100%
;
width
:
100%
;
...
@@ -314,8 +303,10 @@ export default {
...
@@ -314,8 +303,10 @@ export default {
}
}
}
}
}
}
li
.con-active
{
li
.con-active
{
color
:
#000
;
color
:
#000
;
&
:
:
after
{
&
:
:
after
{
content
:
""
;
content
:
""
;
width
:
100%
;
width
:
100%
;
...
@@ -328,29 +319,35 @@ export default {
...
@@ -328,29 +319,35 @@ export default {
}
}
}
}
}
}
.list
{
.list
{
min-height
:
40vh
;
min-height
:
40vh
;
}
}
.con-list
{
.con-list
{
width
:
100%
;
width
:
100%
;
border
:
1px
solid
#e1e1e1
;
border
:
1px
solid
#e1e1e1
;
box-shadow
:
0px
3px
4px
0px
rgba
(
0
,
0
,
0
,
0
.2
);
box-shadow
:
0px
3px
4px
0px
rgba
(
0
,
0
,
0
,
0
.2
);
.con-list-con
{
.con-list-con
{
width
:
90%
;
width
:
90%
;
margin
:
20px
auto
;
margin
:
20px
auto
;
border-bottom
:
3px
dashed
#999
;
border-bottom
:
3px
dashed
#999
;
cursor
:
pointer
;
cursor
:
pointer
;
&
:last-child
{
&
:last-child
{
border-bottom
:
none
;
border-bottom
:
none
;
}
}
h2
{
h2
{
font-size
:
16px
;
font-size
:
16px
;
font-weight
:
500
;
font-weight
:
500
;
color
:
#333333
;
color
:
#333333
;
line-height
:
32px
;
line-height
:
32px
;
}
}
>
p
{
>
p
{
font-size
:
14px
;
font-size
:
14px
;
font-family
:
Source
Han
Sans
CN
;
font-family
:
Source
Han
Sans
CN
;
font-weight
:
400
;
font-weight
:
400
;
...
@@ -365,6 +362,7 @@ export default {
...
@@ -365,6 +362,7 @@ export default {
}
}
}
}
}
}
.search-input
{
.search-input
{
width
:
70%
;
width
:
70%
;
margin
:
0
auto
;
margin
:
0
auto
;
...
@@ -372,6 +370,7 @@ export default {
...
@@ -372,6 +370,7 @@ export default {
display
:
flex
;
display
:
flex
;
justify-content
:
center
;
justify-content
:
center
;
align-items
:
center
;
align-items
:
center
;
.search-btn
{
.search-btn
{
width
:
80px
;
width
:
80px
;
background
:
#2f6fb9
;
background
:
#2f6fb9
;
...
@@ -383,20 +382,24 @@ export default {
...
@@ -383,20 +382,24 @@ export default {
color
:
#fff
;
color
:
#fff
;
}
}
}
}
.srarch-result
{
.srarch-result
{
font-size
:
16px
;
font-size
:
16px
;
font-weight
:
400
;
font-weight
:
400
;
color
:
#666666
;
color
:
#666666
;
line-height
:
40px
;
line-height
:
40px
;
span
{
span
{
color
:
rgba
(
47
,
111
,
185
,
1
);
color
:
rgba
(
47
,
111
,
185
,
1
);
}
}
}
}
@media
(
min-width
:
1200px
)
{
@media
(
min-width
:
1200px
)
{
.inner
{
.inner
{
width
:
1170px
;
width
:
1170px
;
}
}
}
}
@media
(
min-width
:
1499px
)
{
@media
(
min-width
:
1499px
)
{
.inner
{
.inner
{
width
:
1250px
;
width
:
1250px
;
...
...
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