Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wx-boss
Project
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
姜雷
wx-boss
Commits
536a08da
Commit
536a08da
authored
Nov 06, 2019
by
姜雷
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
区域筛选添加截流函数
parent
e872a6b4
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
46 additions
and
10 deletions
+46
-10
areaSelect.js
miniprogram/pages/areaSelect/areaSelect.js
+0
-0
areaSelect.ts
miniprogram/pages/areaSelect/areaSelect.ts
+14
-3
areaSelect.wxml
miniprogram/pages/areaSelect/areaSelect.wxml
+1
-1
AreaSelect.js
miniprogram/pages/components/AreaSelect/AreaSelect.js
+0
-0
AreaSelect.ts
miniprogram/pages/components/AreaSelect/AreaSelect.ts
+14
-3
AreaSelect.wxml
miniprogram/pages/components/AreaSelect/AreaSelect.wxml
+1
-1
util.js
miniprogram/utils/util.js
+9
-2
util.ts
miniprogram/utils/util.ts
+7
-0
No files found.
miniprogram/pages/areaSelect/areaSelect.js
View file @
536a08da
This diff is collapsed.
Click to expand it.
miniprogram/pages/areaSelect/areaSelect.ts
View file @
536a08da
import
{
baseFetch
}
from
'../../api/fetch'
;
import
{
delay
}
from
'../../utils/util'
;
// miniprogram/pages/areaSelect/areaSelect.js
Page
({
...
...
@@ -43,7 +44,7 @@ Page({
let
index
=
res
.
data
.
findIndex
(
item
=>
item
.
id
==
this
.
data
.
selected
,
);
console
.
log
(
this
.
data
.
selected
,
index
)
console
.
log
(
this
.
data
.
selected
,
index
);
if
(
index
>
-
1
)
{
this
.
setData
({
selectedIndex
:
index
,
...
...
@@ -64,10 +65,20 @@ Page({
inputHandle
(
e
)
{
const
{
value
}
=
e
.
detail
;
console
.
log
(
e
,
value
);
delay
(()
=>
{
this
.
getFilterListByName
(
value
);
},
500
);
},
confirmHandle
(
e
)
{
const
{
value
}
=
e
.
detail
;
console
.
log
(
e
,
value
);
this
.
getFilterListByName
(
value
);
},
getFilterListByName
(
name
:
string
)
{
let
filterList
=
[];
if
(
valu
e
)
{
if
(
nam
e
)
{
filterList
=
this
.
data
.
areaList
.
filter
(
item
=>
item
[
'areaName'
].
includes
(
valu
e
),
item
[
'areaName'
].
includes
(
nam
e
),
);
}
else
{
filterList
=
this
.
data
.
areaList
;
...
...
miniprogram/pages/areaSelect/areaSelect.wxml
View file @
536a08da
<!-- miniprogram/pages/areaSelect/areaSelect.wxml -->
<view class="areaselect-pickBox">
<view class="areaselect-pickFilter">
<input class="areaselect-pickInput" type="text" bind
confirm="input
Handle" />
<input class="areaselect-pickInput" type="text" bind
input="inputHandle" bindconfirm="confirm
Handle" />
<view class="areaselect-pickBtn" bindtap="bindPickerChange">确认</view>
</view>
<view class="areaselect-list">
...
...
miniprogram/pages/components/AreaSelect/AreaSelect.js
View file @
536a08da
This diff is collapsed.
Click to expand it.
miniprogram/pages/components/AreaSelect/AreaSelect.ts
View file @
536a08da
import
{
delay
}
from
"../../../utils/util"
;
// pages/components/AreaSelect/AreaSelect.js
Component
({
properties
:
{
...
...
@@ -70,15 +72,24 @@ Component({
inputHandle
(
e
)
{
const
{
value
}
=
e
.
detail
;
console
.
log
(
e
,
value
);
delay
(()
=>
{
this
.
getFilterListByName
(
value
);
},
500
);
},
confirmHandle
(
e
)
{
const
{
value
}
=
e
.
detail
;
console
.
log
(
e
,
value
);
this
.
getFilterListByName
(
value
);
},
getFilterListByName
(
name
:
string
)
{
let
filterList
=
[];
if
(
valu
e
)
{
if
(
nam
e
)
{
filterList
=
this
.
data
.
range
.
filter
(
item
=>
item
[
this
.
data
.
rangeKey
].
includes
(
valu
e
),
item
[
this
.
data
.
rangeKey
].
includes
(
nam
e
),
);
}
else
{
filterList
=
this
.
data
.
range
;
}
this
.
setData
({
filterList
,
});
...
...
miniprogram/pages/components/AreaSelect/AreaSelect.wxml
View file @
536a08da
...
...
@@ -12,7 +12,7 @@
<view class="areaselect-pickView {{showPickerView?'show':''}}" bindtap="maskClickHandle">
<view class="areaselect-pickBox {{showPickerView?'show':''}}" catchtap="innerClickHandle">
<view wx:if="{{showPickerView}}" class="areaselect-pickFilter">
<input class="areaselect-pickInput" type="text" bind
confirm="input
Handle" />
<input class="areaselect-pickInput" type="text" bind
input="inputHandle" bindconfirm="confirm
Handle" />
<view class="areaselect-pickBtn" bindtap="bindPickerChange">确认</view>
</view>
<view class="areaselect-list">
...
...
miniprogram/utils/util.js
View file @
536a08da
...
...
@@ -33,4 +33,11 @@ var joinComma = function (num) {
}
return
result
.
join
(
''
);
};
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxvQkFBMkIsSUFBVTtJQUNuQyxJQUFNLElBQUksR0FBRyxJQUFJLENBQUMsV0FBVyxFQUFFLENBQUM7SUFDaEMsSUFBTSxLQUFLLEdBQUcsSUFBSSxDQUFDLFFBQVEsRUFBRSxHQUFHLENBQUMsQ0FBQztJQUNsQyxJQUFNLEdBQUcsR0FBRyxJQUFJLENBQUMsT0FBTyxFQUFFLENBQUM7SUFDM0IsSUFBTSxJQUFJLEdBQUcsSUFBSSxDQUFDLFFBQVEsRUFBRSxDQUFDO0lBQzdCLElBQU0sTUFBTSxHQUFHLElBQUksQ0FBQyxVQUFVLEVBQUUsQ0FBQztJQUNqQyxJQUFNLE1BQU0sR0FBRyxJQUFJLENBQUMsVUFBVSxFQUFFLENBQUM7SUF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ikuam9pbignOicpXG4gICk7XG59XG5cbmNvbnN0IGZvcm1hdE51bWJlciA9IChuOiBudW1iZXIpID0+IHtcbiAgY29uc3Qgc3RyID0gbi50b1N0cmluZygpO1xuICByZXR1cm4gc3RyWzFdID8gc3RyIDogJzAnICsgc3RyO1xufTtcblxuZXhwb3J0IGNvbnN0IGZvcm1hdFByaWNlID0gKG46IG51bWJlcikgPT4ge1xuICBjb25zdCBzdHIgPSBuLnRvRml4ZWQoMik7XG4gIGxldCBzdHJBcnIgPSBzdHIuc3BsaXQoJy4nKTtcbiAgcmV0dXJuIGpvaW5Db21tYShzdHJBcnJbMF0pICsgJy4nICsgc3RyQXJyWzFdO1xufTtcblxuY29uc3Qgam9pbkNvbW1hID0gKG51bTogc3RyaW5nKSA9PiB7XG4gIHZhciByZXN1bHQgPSBbXSxcbiAgICBjb3VudGVyID0gMDtcbiAgZm9yIChsZXQgaW5kZXggPSBudW0ubGVuZ3RoIC0gMTsgaW5kZXggPj0gMDsgaW5kZXgtLSkge1xuICAgIGNvdW50ZXIrKztcbiAgICBjb25zdCBlbGVtZW50ID0gbnVtW2luZGV4XTtcbiAgICByZXN1bHQudW5zaGlmdChlbGVtZW50KTtcbiAgICBpZiAoIShjb3VudGVyICUgMykgJiYgaW5kZXggIT0gMCkge1xuICAgICAgcmVzdWx0LnVuc2hpZnQoJywnKTtcbiAgICB9XG4gIH1cbiAgcmV0dXJuIHJlc3VsdC5qb2luKCcnKTtcbn07XG4iXX0=
\ No newline at end of file
exports
.
delay
=
(
function
()
{
var
timer
=
0
;
return
function
(
callback
,
ms
)
{
clearTimeout
(
timer
);
timer
=
setTimeout
(
callback
,
ms
);
};
})();
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxvQkFBMkIsSUFBVTtJ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07XG59O1xuXG5jb25zdCBqb2luQ29tbWEgPSAobnVtOiBzdHJpbmcpID0+IHtcbiAgdmFyIHJlc3VsdCA9IFtdLFxuICAgIGNvdW50ZXIgPSAwO1xuICBmb3IgKGxldCBpbmRleCA9IG51bS5sZW5ndGggLSAxOyBpbmRleCA+PSAwOyBpbmRleC0tKSB7XG4gICAgY291bnRlcisrO1xuICAgIGNvbnN0IGVsZW1lbnQgPSBudW1baW5kZXhdO1xuICAgIHJlc3VsdC51bnNoaWZ0KGVsZW1lbnQpO1xuICAgIGlmICghKGNvdW50ZXIgJSAzKSAmJiBpbmRleCAhPSAwKSB7XG4gICAgICByZXN1bHQudW5zaGlmdCgnLCcpO1xuICAgIH1cbiAgfVxuICByZXR1cm4gcmVzdWx0LmpvaW4oJycpO1xufTtcbmV4cG9ydCBjb25zdCBkZWxheSA9IChmdW5jdGlvbigpIHtcbiAgbGV0IHRpbWVyID0gMDtcbiAgcmV0dXJuIGZ1bmN0aW9uKGNhbGxiYWNrOiAoKSA9PiB2b2lkLCBtczogbnVtYmVyKSB7XG4gICAgY2xlYXJUaW1lb3V0KHRpbWVyKTtcbiAgICB0aW1lciA9IHNldFRpbWVvdXQoY2FsbGJhY2ssIG1zKTtcbiAgfTtcbn0pKCk7XG4iXX0=
\ No newline at end of file
miniprogram/utils/util.ts
View file @
536a08da
...
...
@@ -37,3 +37,10 @@ const joinComma = (num: string) => {
}
return
result
.
join
(
''
);
};
export
const
delay
=
(
function
()
{
let
timer
=
0
;
return
function
(
callback
:
()
=>
void
,
ms
:
number
)
{
clearTimeout
(
timer
);
timer
=
setTimeout
(
callback
,
ms
);
};
})();
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