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