Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mayi-mp-shop
Overview
Overview
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
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
程默
mayi-mp-shop
Commits
6afdfa32
Commit
6afdfa32
authored
Mar 01, 2023
by
HouTiZhuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全网搜功能开发
parent
402a60ed
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
43 additions
and
5 deletions
+43
-5
static/nativeComponents/GoodsSearch/index.js
+22
-5
static/nativeComponents/GoodsSearch/index.wxml
+4
-0
static/nativeComponents/GoodsSearch/index.wxss
+17
-0
No files found.
static/nativeComponents/GoodsSearch/index.js
View file @
6afdfa32
...
...
@@ -16,7 +16,8 @@ Component({
data
:
{
backgroundColor
:
''
,
borderColor
:
''
,
placeholderValue
:
''
placeholderValue
:
''
,
searchScopeFlag
:
0
},
ready
(){
this
.
setData
({
...
...
@@ -47,10 +48,26 @@ Component({
methods
:
{
toSearchPage
(
e
){
app
.
trackCpn
(
e
,
this
.
data
.
datas
.
componentName
)
app
.
$themeToLink
({
type
:
1
,
link
:
'/contentSearch/contentSearch?placeHolderText='
+
(
this
.
data
.
datas
.
componentData
[
"placeHolderVal"
]
||
''
)
})
const
placeHolderText
=
this
.
data
.
datas
.
componentData
[
"placeHolderVal"
]
||
""
;
let
query
=
`?placeHolderText=
${
placeHolderText
}
`
;
if
(
this
.
data
.
datas
.
componentData
[
'searchModel'
]
==
1
)
{
query
+=
`&searchScopeFlag=
${
this
.
data
.
searchScopeFlag
}
`
;
// 重置默认全网搜
this
.
setData
({
searchScopeFlag
:
0
});
}
let
link
=
`/contentSearch/contentSearch
${
query
}
`
;
if
(
this
.
data
.
datas
.
componentData
[
'searchModel'
]
==
1
&&
this
.
data
.
searchScopeFlag
==
0
)
{
link
=
`/goodsSearch/searchAllGoods
${
query
}
`
;
}
app
.
$themeToLink
({
type
:
1
,
link
});
},
// 本店搜
handleSearchLocal
()
{
this
.
setData
({
searchScopeFlag
:
1
});
},
// 全网搜
handleSearchAll
()
{
this
.
setData
({
searchScopeFlag
:
0
});
}
}
})
static/nativeComponents/GoodsSearch/index.wxml
View file @
6afdfa32
...
...
@@ -5,5 +5,9 @@
<i class="iconfont-common common-iconsousuo"></i>
<input style="width:{{placeholderValue.length*40}}rpx" disabled type="text" placeholder="{{placeholderValue}}">
</input>
<view class="flex search-btn" wx:if="{{datas.componentData['searchModel'] == 1}}">
<view class="search-btn__local" style="color:{{datas.componentData.leftBtn.color}};background-color:{{datas.componentData['leftBtn'].backgroundColor}};font-size:{{datas.componentData['leftBtn'].fontSize*2}}rpx;padding:{{datas.componentData['leftBtn'].paddingTop*2}}rpx {{datas.componentData['leftBtn'].paddingRight*2}}rpx {{datas.componentData['leftBtn'].paddingBottom*2}}rpx {{datas.componentData['leftBtn'].paddingLeft*2}}rpx;margin:{{datas.componentData['leftBtn'].marginTop*2}}rpx {{datas.componentData['leftBtn'].marginRight*2}}rpx {{datas.componentData['leftBtn'].marginBottom*2}}rpx {{datas.componentData['leftBtn'].marginLeft*2}}rpx;" bindtap="handleSearchLocal">搜本店</view>
<view class="search-btn__all" style="color:{{datas.componentData['rightBtn'].color}};background-color:{{datas.componentData['rightBtn'].backgroundColor}};font-size:{{datas.componentData['rightBtn'].fontSize*2}}rpx;padding:{{datas.componentData['rightBtn'].paddingTop*2}}rpx {{datas.componentData['rightBtn'].paddingRight*2}}rpx {{datas.componentData['rightBtn'].paddingBottom}}rpx {{datas.componentData['rightBtn'].paddingLeft*2}}rpx;margin:{{datas.componentData['rightBtn'].marginTop*2}}rpx {{datas.componentData['rightBtn'].marginRight*2}}rpx {{datas.componentData['rightBtn'].marginBottom*2}}rpx {{datas.componentData['rightBtn'].marginLeft*2}}rpx;" bindtap="handleSearchAll">搜全网</view>
</view>
</view>
</view>
static/nativeComponents/GoodsSearch/index.wxss
View file @
6afdfa32
...
...
@@ -31,3 +31,20 @@
.goods-search .textCenter{
justify-content: center;
}
.search-btn {
position: absolute;
right: 0;
justify-content: end;
margin-right: 2px;
}
.search-btn .search-btn__local {
border: none;
border-radius: 2em 0 0 2em;
}
.search-btn .search-btn__all {
border: none;
border-radius: 0 2em 2em 0;
}
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