Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
unidocs-zh
提交
3c9a73ac
unidocs-zh
项目概览
DCloud
/
unidocs-zh
通知
3592
Star
108
Fork
920
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
120
列表
看板
标记
里程碑
合并请求
108
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
unidocs-zh
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
120
Issue
120
列表
看板
标记
里程碑
合并请求
108
合并请求
108
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
3c9a73ac
编写于
3月 21, 2022
作者:
D
DCloud_LXH
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
wip: search page
上级
19c08bf4
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
41 addition
and
30 deletion
+41
-30
docs/.vuepress/theme/components/DcloudSearchPage/index.styl
docs/.vuepress/theme/components/DcloudSearchPage/index.styl
+3
-2
docs/.vuepress/theme/components/DcloudSearchPage/index.vue
docs/.vuepress/theme/components/DcloudSearchPage/index.vue
+13
-9
docs/.vuepress/theme/components/DcloudSearchPage/postDcloudServer.js
...ess/theme/components/DcloudSearchPage/postDcloudServer.js
+21
-13
docs/.vuepress/theme/components/Navbar.vue
docs/.vuepress/theme/components/Navbar.vue
+2
-5
docs/.vuepress/theme/styles/navbar.styl
docs/.vuepress/theme/styles/navbar.styl
+2
-1
未找到文件。
docs/.vuepress/theme/components/DcloudSearchPage/index.styl
浏览文件 @
3c9a73ac
...
@@ -5,8 +5,8 @@ $svg-hover-color = #9b9b9b
...
@@ -5,8 +5,8 @@ $svg-hover-color = #9b9b9b
position relative
position relative
overflow auto
overflow auto
position fixed
position fixed
width 100
vw
width 100
%
height 100
vh
height 100
%
left 0
left 0
top 0
top 0
z-index 200
z-index 200
...
@@ -195,6 +195,7 @@ $svg-hover-color = #9b9b9b
...
@@ -195,6 +195,7 @@ $svg-hover-color = #9b9b9b
display flex
display flex
p.aw-text
p.aw-text
font-weight normal
margin 0
margin 0
display inline-flex
display inline-flex
...
...
docs/.vuepress/theme/components/DcloudSearchPage/index.vue
浏览文件 @
3c9a73ac
...
@@ -173,14 +173,13 @@
...
@@ -173,14 +173,13 @@
]),
]),
categoryIndex
:
0
,
categoryIndex
:
0
,
resultList
:
[],
resultList
:
[],
serverHtml
:
''
,
searchPage
:
0
,
// 跳转页数
searchPage
:
0
,
// 跳转页数
curHits
:
0
,
// 当前搜索结果总条数
curHits
:
0
,
// 当前搜索结果总条数
totalPage
:
0
,
// 搜索结果总共页数
totalPage
:
0
,
// 搜索结果总共页数
curPage
:
1
,
// 当前页
curPage
:
1
,
// 当前页
pageSize
:
0
,
// 每页条数
pageSize
:
0
,
// 每页条数
serverHtml
:
''
,
};
};
},
},
...
@@ -235,9 +234,16 @@
...
@@ -235,9 +234,16 @@
const
searchNavbarHeight
=
document
.
querySelector
(
'
.search-navbar
'
).
clientHeight
;
const
searchNavbarHeight
=
document
.
querySelector
(
'
.search-navbar
'
).
clientHeight
;
const
resultNumberHeight
=
document
.
querySelector
(
'
.result-number
'
).
clientHeight
;
const
resultNumberHeight
=
document
.
querySelector
(
'
.result-number
'
).
clientHeight
;
const
algoliaLogoHeight
=
document
.
querySelector
(
'
.algolia-logo
'
).
clientHeight
;
const
algoliaLogoHeight
=
document
.
querySelector
(
'
.algolia-logo
'
).
clientHeight
;
const
searchPagination
=
36
;
document
.
querySelector
(
'
.result-wrap
'
).
style
.
minHeight
=
document
.
querySelector
(
'
.result-wrap
'
).
style
.
minHeight
=
pageHeight
-
searchNavbarHeight
-
resultNumberHeight
-
algoliaLogoHeight
-
20
+
'
px
'
;
pageHeight
-
searchNavbarHeight
-
resultNumberHeight
-
algoliaLogoHeight
-
searchPagination
-
20
+
'
px
'
;
},
},
resetSearchPage
()
{
resetSearchPage
()
{
...
@@ -250,8 +256,8 @@
...
@@ -250,8 +256,8 @@
},
},
search
()
{
search
()
{
if
(
!
this
.
searchValue
)
return
;
if
(
!
this
.
searchValue
||
!
this
.
searchValue
.
trim
().
length
)
return
;
const
{
t
ext
,
t
ype
}
=
this
.
currentCategory
;
const
{
type
}
=
this
.
currentCategory
;
switch
(
type
)
{
switch
(
type
)
{
case
'
algolia
'
:
case
'
algolia
'
:
this
.
searchByAlgolia
(
this
.
searchValue
,
this
.
searchPage
).
then
(
this
.
searchByAlgolia
(
this
.
searchValue
,
this
.
searchPage
).
then
(
...
@@ -307,15 +313,13 @@
...
@@ -307,15 +313,13 @@
switch
(
tag
)
{
switch
(
tag
)
{
case
'
ext
'
:
case
'
ext
'
:
postExt
(
query
).
then
(({
html
,
hits
})
=>
{
postExt
(
query
).
then
(({
html
,
hits
})
=>
{
this
.
serverHtml
=
''
;
this
.
serverHtml
=
html
;
this
.
serverHtml
+=
html
;
this
.
curHits
=
hits
;
this
.
curHits
=
hits
;
});
});
break
;
break
;
case
'
ask
'
:
case
'
ask
'
:
postAsk
(
query
).
then
(({
html
,
hits
})
=>
{
postAsk
(
query
).
then
(({
html
,
hits
})
=>
{
this
.
serverHtml
=
''
;
this
.
serverHtml
=
html
;
this
.
serverHtml
+=
html
;
this
.
curHits
=
hits
;
this
.
curHits
=
hits
;
});
});
break
;
break
;
...
...
docs/.vuepress/theme/components/DcloudSearchPage/postDcloudServer.js
浏览文件 @
3c9a73ac
const
isProduction
=
process
.
env
.
NODE_ENV
===
"
production
"
const
isProduction
=
process
.
env
.
NODE_ENV
===
"
production
"
const
isMock
=
fals
e
const
isMock
=
tru
e
import
mock
from
'
./mock
'
import
mock
from
'
./mock
'
function
ajax
(
url
=
''
,
method
=
'
get
'
,)
{
function
ajax
(
url
=
''
,
method
=
'
get
'
,)
{
...
@@ -71,10 +71,12 @@ function _renderExt(ext, keyword) {
...
@@ -71,10 +71,12 @@ function _renderExt(ext, keyword) {
return
`<div class="matching-post">
return
`<div class="matching-post">
<a href="
${
ext
.
url
}
" target="_blank">
<a href="
${
ext
.
url
}
" target="_blank">
<div class="post-wrapper">
<div class="post-wrapper">
<p class="aw-text">
<h2>
<span class="post-tag">插件</span>
<p class="aw-text">
</p>
<span class="post-tag">插件</span>
<h2>
${
_handleHTMLString
(
ext
.
name
,
keyword
)}
</h2>
</p>
${
_handleHTMLString
(
ext
.
name
,
keyword
)}
</h2>
</div>
</div>
<p>
${
ext
.
total_download
}
次下载</p>
<p>
${
ext
.
total_download
}
次下载</p>
<p>
${
_handleHTMLString
(
ext
.
description
,
keyword
)}
</p>
<p>
${
_handleHTMLString
(
ext
.
description
,
keyword
)}
</p>
...
@@ -103,17 +105,23 @@ function _renderPost(post, value) {
...
@@ -103,17 +105,23 @@ function _renderPost(post, value) {
}
}
html
+=
`<div class="matching-post">
html
+=
`<div class="matching-post">
<a href="
${
post
.
url
}
" target="_blank"><div class="post-wrapper">
<a href="
${
post
.
url
}
" target="_blank">
<p class="aw-text"><span class="post-tag">
${
tagName
}
</span></p>
<div class="post-wrapper">
<h2>
${
post
.
title
}
</h2></div>`
<h2>
/* html += '<div class="matching-post">\n';
<p class="aw-text">
html += `<a href="${post.url}" target="_blank"><div class="post-wrapper">`;
<span class="post-tag">
${
tagName
}
</span>
html += `<p class="aw-text"><span class="post-tag">${tagName}</span></p>`
</p>
html += `\n<h2>${post.title}</h2></div>`; */
${
post
.
title
}
</h2>
</div>`
if
(
!!
value
)
{
if
(
!!
value
)
{
commentText
=
post
.
type
===
'
questions
'
?
'
回复
'
:
'
评论
'
;
commentText
=
post
.
type
===
'
questions
'
?
'
回复
'
:
'
评论
'
;
html
+=
`<p>
${
post
.
comment_count
}
个
${
commentText
}
<span class="aw-text-space">-</span>
${
post
.
view_count
}
次浏览</p>`
;
html
+=
`<p>
${
post
.
comment_count
}
个
${
commentText
}
<span class="aw-text-space">-</span>
${
post
.
view_count
}
次浏览
</p>`
;
}
}
html
+=
`\n<p>
${
post
.
content
}
</p>\n</a>\n</div>`
;
html
+=
`\n<p>
${
post
.
content
}
</p>\n</a>\n</div>`
;
...
...
docs/.vuepress/theme/components/Navbar.vue
浏览文件 @
3c9a73ac
...
@@ -35,11 +35,8 @@
...
@@ -35,11 +35,8 @@
} : {}"
} : {}"
>
>
<a
class=
"switch-version"
href=
"javascript:void(0)"
@
click=
"switchVersion"
>
回到旧版
</a>
<a
class=
"switch-version"
href=
"javascript:void(0)"
@
click=
"switchVersion"
>
回到旧版
</a>
<DcloudSearchPage
ref=
"dcloudSearchPage"
v-if=
"isAlgoliaSearch"
:options=
"algolia"
/>
<DcloudSearchPage
v-if=
"isAlgoliaSearch"
ref=
"dcloudSearchPage"
:options=
"algolia"
/>
<AlgoliaSearchBox
<AlgoliaSearchBox
v-if=
"isAlgoliaSearch"
/>
v-if=
"isAlgoliaSearch"
:options=
"algolia"
/>
<SearchBox
v-else-if=
"$site.themeConfig.search !== false && $page.frontmatter.search !== false"
/>
<SearchBox
v-else-if=
"$site.themeConfig.search !== false && $page.frontmatter.search !== false"
/>
</div>
</div>
</div>
</div>
...
...
docs/.vuepress/theme/styles/navbar.styl
浏览文件 @
3c9a73ac
...
@@ -92,7 +92,8 @@ $navbar-logo-height = $navbar-main-navbar-height - 2rem
...
@@ -92,7 +92,8 @@ $navbar-logo-height = $navbar-main-navbar-height - 2rem
justify-content flex-end
justify-content flex-end
.mobile-main-navbar
.mobile-main-navbar
display inline-block
display inline-block
padding-right 75px
// padding-right 75px
padding-right 165px
a
a
color $navbar-a-color
color $navbar-a-color
.mobile-links__btn:after
.mobile-links__btn:after
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录