Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
江名洋
/
linkwe-scrm
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 70f10702
authored
Oct 29, 2021
by
xinla
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
移动端关键词列表排序修改
1 parent
fa5abf3d
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
38 additions
and
40 deletions
linkwe-mobile/src/views/communityOperating/keywords/index.vue
linkwe-mobile/src/views/communityOperating/keywords/index.vue
View file @
70f1070
<
template
>
<
template
>
<div>
<div>
<div>
<div>
<van-search
<van-search
v-model=
"keyword"
placeholder=
"搜索活码名或关键词"
shape=
"round"
@
search=
"onSearch"
@
clear=
"clear"
>
v-model=
"keyword"
placeholder=
"搜索活码名或关键词"
shape=
"round"
@
search=
"onSearch"
@
clear=
"clear"
>
</van-search>
</van-search>
</div>
</div>
...
@@ -43,7 +37,7 @@ import { getKeywordTasks } from '@/api/community'
...
@@ -43,7 +37,7 @@ import { getKeywordTasks } from '@/api/community'
export
default
{
export
default
{
components
:
{
KeywordPanel
},
components
:
{
KeywordPanel
},
data
()
{
data
()
{
return
{
return
{
keyword
:
''
,
keyword
:
''
,
storageKey
:
'keywords'
,
storageKey
:
'keywords'
,
...
@@ -55,19 +49,22 @@ export default {
...
@@ -55,19 +49,22 @@ export default {
},
},
methods
:
{
methods
:
{
getTasks
()
{
getTasks
()
{
this
.
loading
=
true
this
.
loading
=
true
getKeywordTasks
(
this
.
keyword
).
then
((
res
)
=>
{
getKeywordTasks
(
this
.
keyword
)
if
(
res
.
code
===
200
)
{
.
then
((
res
)
=>
{
this
.
tasks
=
res
.
rows
if
(
res
.
code
===
200
)
{
}
let
timeStamp
=
(
dateString
)
=>
(
dateString
?
+
new
Date
(
dateString
.
replace
(
/-/g
,
'/'
))
:
0
)
this
.
loading
=
false
this
.
tasks
=
res
.
rows
.
sort
((
a
,
b
)
=>
timeStamp
(
b
.
updateTime
)
-
timeStamp
(
a
.
updateTime
))
}).
catch
(()
=>
{
}
this
.
loading
=
false
this
.
loading
=
false
})
})
.
catch
(()
=>
{
this
.
loading
=
false
})
},
},
setHistory
(
keyword
)
{
setHistory
(
keyword
)
{
if
(
!
keyword
)
return
if
(
!
keyword
)
return
if
(
!
this
.
history
.
includes
(
keyword
))
{
if
(
!
this
.
history
.
includes
(
keyword
))
{
...
@@ -76,41 +73,42 @@ export default {
...
@@ -76,41 +73,42 @@ export default {
}
}
},
},
removeHistory
(
keyword
)
{
removeHistory
(
keyword
)
{
if
(
this
.
history
.
includes
(
keyword
))
{
if
(
this
.
history
.
includes
(
keyword
))
{
this
.
history
.
splice
(
this
.
history
.
indexOf
(
keyword
),
1
)
this
.
history
.
splice
(
this
.
history
.
indexOf
(
keyword
),
1
)
localStorage
.
setItem
(
this
.
storageKey
,
JSON
.
stringify
(
this
.
history
))
localStorage
.
setItem
(
this
.
storageKey
,
JSON
.
stringify
(
this
.
history
))
}
}
},
},
getHistory
()
{
getHistory
()
{
this
.
history
=
JSON
.
parse
(
localStorage
.
getItem
(
this
.
storageKey
))
||
[]
this
.
history
=
JSON
.
parse
(
localStorage
.
getItem
(
this
.
storageKey
))
||
[]
},
},
onSearch
()
{
onSearch
()
{
this
.
setHistory
(
this
.
keyword
)
this
.
setHistory
(
this
.
keyword
)
this
.
getTasks
()
this
.
getTasks
()
},
},
search
(
keyword
)
{
search
(
keyword
)
{
this
.
keyword
=
keyword
this
.
keyword
=
keyword
this
.
getTasks
()
this
.
getTasks
()
},
},
clear
()
{
clear
()
{
this
.
keyword
=
''
this
.
getTasks
()
this
.
getTasks
()
}
}
},
},
computed
:
{
computed
:
{
url
()
{
url
()
{
return
window
.
location
.
href
return
window
.
location
.
href
}
}
},
},
created
()
{
created
()
{
this
.
getHistory
()
this
.
getHistory
()
this
.
getTasks
()
this
.
getTasks
()
...
@@ -119,25 +117,25 @@ export default {
...
@@ -119,25 +117,25 @@ export default {
</
script
>
</
script
>
<
style
lang=
"less"
scoped
>
<
style
lang=
"less"
scoped
>
.history-wrapper
{
.history-wrapper
{
padding
:
0
20px
20px
;
padding
:
0
20px
20px
;
.van-tag
{
.van-tag
{
margin
:
10px
10px
0
0
;
margin
:
10px
10px
0
0
;
}
}
}
}
.bottom-line
{
.bottom-line
{
background-color
:
#f2f2f2
;
background-color
:
#f2f2f2
;
height
:
15px
;
height
:
15px
;
}
}
.overlay
{
.overlay
{
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
.van-loading
{
.van-loading
{
margin
:
auto
;
margin
:
auto
;
}
}
}
}
</
style
>
</
style
>
Write
Preview
Markdown
is supported
Attach a file
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 post a comment