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
2c0a03bd
Commit
2c0a03bd
authored
Mar 14, 2023
by
HouTiZhuo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
全网搜优化
parent
954ca8fa
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
9 deletions
+28
-9
static/nativeComponents/GoodsSearch/index.js
+15
-6
static/nativeComponents/GoodsSearch/index.wxml
+7
-2
static/nativeComponents/GoodsSearch/index.wxss
+6
-1
No files found.
static/nativeComponents/GoodsSearch/index.js
View file @
2c0a03bd
...
...
@@ -14,6 +14,7 @@ Component({
* 组件的初始数据
*/
data
:
{
searchValue
:
''
,
backgroundColor
:
''
,
borderColor
:
''
,
placeholderValue
:
''
,
...
...
@@ -47,27 +48,35 @@ Component({
*/
methods
:
{
toSearchPage
(
e
){
if
(
this
.
data
.
datas
.
componentData
[
'searchModel'
]
==
1
)
return
;
app
.
trackCpn
(
e
,
this
.
data
.
datas
.
componentName
)
const
placeHolderText
=
this
.
data
.
datas
.
componentData
[
"placeHolderVal"
]
||
""
;
let
query
=
`?placeHolderText=
${
placeHolderText
}
`
;
if
(
this
.
data
.
datas
.
componentData
[
'searchModel'
]
==
1
)
{
query
+=
`&searchScopeFlag=
${
this
.
data
.
searchScopeFlag
}
`
;
}
let
link
=
`/contentSearch/contentSearch
${
query
}
`
;
if
(
this
.
data
.
datas
.
componentData
[
'searchModel'
]
==
1
&&
this
.
data
.
searchScopeFlag
==
0
)
{
app
.
$themeToLink
({
type
:
1
,
link
});
},
// 全网搜和本店搜
toSearchAllOrLocal
()
{
const
placeHolderText
=
this
.
data
.
datas
.
componentData
[
"placeHolderVal"
]
||
""
;
const
query
=
`?placeHolderText=
${
placeHolderText
}
&searchScopeFlag=
${
this
.
data
.
searchScopeFlag
}
&searchValue=
${
this
.
data
.
searchValue
}
`
;
let
link
=
`/contentSearch/contentSearch
${
query
}
`
;
if
(
this
.
data
.
searchScopeFlag
==
0
)
{
link
=
`/goodsSearch/searchAllGoods
${
query
}
`
;
}
// 重置默认全网搜
this
.
setData
({
searchScopeFlag
:
0
});
app
.
$themeToLink
({
type
:
1
,
link
});
},
// 本店搜
handleSearchLocal
()
{
this
.
setData
({
searchScopeFlag
:
1
});
this
.
toSearchAllOrLocal
();
},
// 全网搜
handleSearchAll
()
{
this
.
setData
({
searchScopeFlag
:
0
});
this
.
toSearchAllOrLocal
();
},
onInput
(
e
)
{
this
.
setData
({
searchValue
:
e
.
detail
.
value
});
},
// 扫码搜功能
handleScan
()
{
...
...
static/nativeComponents/GoodsSearch/index.wxml
View file @
2c0a03bd
...
...
@@ -10,8 +10,13 @@
</view>
<view class="svg-divider"></view>
</block>
<input style="width:{{placeholderValue.length*40}}rpx" disabled type="text" placeholder="{{placeholderValue}}">
</input>
<block wx:if="{{datas.componentData['searchModel'] != 1}}">
<input style="width:{{placeholderValue.length*40}}rpx" disabled type="text" placeholder="{{placeholderValue}}">
</input>
</block>
<block wx:else>
<input class="search-input" type="text" placeholder="{{placeholderValue}}" bindinput="onInput" value="{{searchValue}}"></input>
</block>
<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>
...
...
static/nativeComponents/GoodsSearch/index.wxss
View file @
2c0a03bd
...
...
@@ -32,8 +32,13 @@
justify-content: center;
}
.search-input {
flex: 1;
color: #000 !important;
}
.search-btn {
position:
absolut
e;
position:
relativ
e;
right: 0;
justify-content: end;
margin-right: 2px;
...
...
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