Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
L
laravelzh
Project
Project
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
冯超鹏
laravelzh
Commits
0f854804
Commit
0f854804
authored
Jul 31, 2020
by
Administrator
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
微信用户
parent
1f10e656
Pipeline
#108
canceled with stages
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
46 deletions
+90
-46
WxuserController.php
app/Http/Controllers/WxuserController.php
+42
-25
index.vue
resources/js/views/wx_user/index.vue
+48
-21
No files found.
app/Http/Controllers/WxuserController.php
View file @
0f854804
...
...
@@ -30,8 +30,27 @@ class WxuserController extends Controller
if
(
$pagenNum
===
''
||
$limit
==
''
){
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
}
$cont
=
WxUser
::
count
();
$where
=
[];
$keys
=
$request
->
all
();
if
(
isset
(
$keys
[
'sex'
]))
{
$keys
[
'sex'
]
=
$keys
[
'sex'
]
==
3
?
0
:
$keys
[
'sex'
];
$where
[]
=
[
'sex'
,
'='
,
$keys
[
'sex'
]];
}
if
(
isset
(
$keys
[
'state'
]))
{
$where
[]
=
[
'state'
,
'='
,
$keys
[
'state'
]];
}
if
(
isset
(
$keys
[
'mobile'
]))
{
$where
[]
=
[
'mobile'
,
'like'
,
"%
$keys[mobile]%"]
;
}
$city
= '';
if(isset(
$keys['city']
)) {
$city
=
$keys['city']
;
}
$cont
= WxUser::where(
$where
)
->whereRaw("
concat
(
country
,
province
,
city
)
like
'%{$city}%'
")->count();
$Wxuser
= WxUser::select('nickname','id','openid','sex','province','city','mobile','country','headimgurl','created_at','state')
->where(
$where
)
->whereRaw("
concat
(
country
,
province
,
city
)
like
'%{$city}%'
")
->offset(
$pagenNum
)
->orderBy('id', 'desc')
->limit(
$limit
)
...
...
@@ -46,32 +65,30 @@ class WxuserController extends Controller
//用户搜索
public function seek (Request
$request
){
$keys
=
$request->all
();
foreach
(
$keys
as
$key
=>
$val
)
{
if
(
$key
==
'page'
)
{
unset
(
$keys
[
$key
]);
}
elseif
(
$key
==
'limit'
){
unset
(
$keys
[
$key
]);
}
}
foreach
(
$keys
as
$k
=>
$v
)
{
if
(
$k
==
'sex'
){
if
(
$v
==
'男'
){
$v
=
1
;
}
else
if
(
$v
==
'女'
){
$v
=
2
;
$where
= [];
if(isset(
$keys['sex']
)) {
$keys['sex']
=
$keys['sex']
== 3 ? 0 :
$keys['sex']
;
$where
[] = ['sex', '=',
$keys['sex']]
;
}
}
else
if
(
$k
==
'state'
){
if
(
$v
==
'正常'
){
$v
=
2
;
}
else
if
(
$v
==
'禁用'
){
$v
=
1
;
if(isset(
$keys['state']
)) {
$where
[] = ['state', '=',
$keys['state']]
;
}
if(isset(
$keys['mobile']
)) {
$where
[] = ['mobile', 'like', "
%
$keys
[
mobile
]
%
"];
}
$keys
[
$key
]
&&
DB
::
table
(
'wx_user'
)
->
where
(
$k
,
'like'
,
'%'
.
$v
.
'%'
);
$city
= '';
if(isset(
$keys['city']
)) {
$city
=
$keys['city']
;
}
$datas
=
DB
::
table
(
'wx_user'
)
->
get
();
$cont
=
DB
::
table
(
'wx_user'
)
->
count
();
$datas
= DB::table('wx_user')
->where(
$where
)
->whereRaw("
concat
(
country
,
province
,
city
)
like
'%{$city}%'
")
->limit(
$keys['limit']
)
->offset(
$keys['limit']
* (
$keys['page']
- 1))
->orderBy('id', 'DESC')
->get();
$cont
= DB::table('wx_user')->where(
$where
)->whereRaw("
concat
(
country
,
province
,
city
)
like
'%{$city}%'
")->count();
$data
= ['Wxuser'=>
$datas
,'cont'=>
$cont
];
return
$this->jsonSuccessData
(
$data
);
}
...
...
resources/js/views/wx_user/index.vue
View file @
0f854804
...
...
@@ -2,12 +2,13 @@
<div
class=
"app-container"
>
<div
class=
"filter-container"
>
<el-form
ref=
"query"
:model=
"query"
style=
"display: inline-block;"
>
<el-input
v-model=
"query.nickname"
placeholder=
"用户名称"
style=
"width: 200px;"
class=
"filter-item"
name=
"userskk"
/>
<el-input
v-model=
"query.mobile"
placeholder=
"手机号"
style=
"width: 200px;"
class=
"filter-item"
name=
"userskk"
/>
<el-input
v-model=
"query.city"
placeholder=
"地区"
style=
"width: 200px;"
class=
"filter-item"
name=
"city"
/>
<el-select
v-model=
"query.sex"
placeholder=
"性别"
clearable
style=
"width: 90px"
class=
"filter-item"
@
change=
"selectOneSex"
>
<el-option
v-for=
"item in importanceOptions"
:key=
"item
"
:label=
"item"
:value=
"item
"
/>
<el-option
v-for=
"item in importanceOptions"
:key=
"item
.key"
:label=
"item.val"
:value=
"item.key
"
/>
</el-select>
<el-select
v-model=
"query.state"
placeholder=
"状态"
clearable
class=
"filter-item"
style=
"width: 130px"
@
change=
"selectOneState"
>
<el-option
v-for=
"item in calendarTypeOptions"
:key=
"item
"
:label=
"item"
:value=
"item
"
/>
<el-option
v-for=
"item in calendarTypeOptions"
:key=
"item
.key"
:label=
"item.val"
:value=
"item.key
"
/>
</el-select>
<el-button
v-waves
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleSubmit"
>
{{
$t
(
'table.search'
)
}}
...
...
@@ -25,19 +26,13 @@
</
template
>
</el-table-column>
<el-table-column
align=
"
center
"
label=
"用户名称"
>
<el-table-column
align=
"
left
"
label=
"用户名称"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
nickname
|
handeNickname
}}
</span>
<el-image
:src=
"scope.row.headimgurl"
:preview-src-list=
"srcList"
style=
"width:50px"
></el-image>
<a
class=
"zl-nickname"
>
{{
scope
.
row
.
nickname
|
handeNickname
}}
</a>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"用户头像"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<el-image
:src=
"scope.row.headimgurl"
:preview-src-list=
"srcList"
></el-image>
</
template
>
</el-table-column>
<el-table-column
v-if=
"showReviewer"
align=
"center"
label=
"openid"
width=
"150"
>
<el-table-column
v-if=
"showReviewer"
align=
"center"
label=
"openid"
width=
"320"
>
<
template
slot-scope=
"scope"
>
<span
style=
"color: #909399;"
@
click=
"handleCopy(scope.row.openid,$event)"
>
{{
scope
.
row
.
openid
}}
</span>
</
template
>
...
...
@@ -45,7 +40,7 @@
<el-table-column
align=
"center"
label=
"性别"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
sex
==
1
?
'男'
:
'女'
}}
</span>
<span>
{{
scope
.
row
.
sex
|
handeSex
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"手机号"
width=
"200"
>
...
...
@@ -53,14 +48,14 @@
<span>
{{
scope
.
row
.
mobile
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"地区"
width=
"
17
0"
>
<el-table-column
align=
"center"
label=
"地区"
width=
"
22
0"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
country
}}{{
scope
.
row
.
province
}}{{
scope
.
row
.
city
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"创建时间"
width=
"
17
0"
>
<el-table-column
align=
"center"
label=
"创建时间"
width=
"
20
0"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
created_at
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
'
)
}}
<
/span
>
<span>
{{
scope
.
row
.
created_at
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
:{s
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
align
=
"center"
label
=
"状态"
width
=
"170"
>
...
...
@@ -89,6 +84,12 @@ export default {
handeNickname
:
function
(
value
)
{
return
Base64
.
decode
(
value
);
}
,
handeSex
:
function
(
value
)
{
const
sexes
=
[
'未知'
,
'男'
,
'女'
,
];
return
sexes
[
value
];
}
,
}
,
data
()
{
return
{
...
...
@@ -100,12 +101,28 @@ export default {
query
:
{
page
:
1
,
limit
:
10
,
nicknam
e
:
undefined
,
mobil
e
:
undefined
,
sex
:
undefined
,
state
:
undefined
,
city
:
undefined
,
}
,
importanceOptions
:
[
'男'
,
'女'
],
calendarTypeOptions
:
[
'正常'
,
'禁用'
],
importanceOptions
:
[{
'key'
:
0
,
'val'
:
'未知'
,
}
,
{
'key'
:
1
,
'val'
:
'男'
,
}
,
{
'key'
:
2
,
'val'
:
'女'
,
}
],
calendarTypeOptions
:
[{
'key'
:
1
,
'val'
:
'禁用'
,
}
,
{
'key'
:
2
,
'val'
:
'启用'
,
}
],
srcList
:
[],
downloadLoading
:
false
,
}
;
...
...
@@ -151,7 +168,10 @@ export default {
if
(
j
===
'created_at'
)
{
return
parseTime
(
v
[
j
]);
}
else
if
(
j
===
'sex'
)
{
return
v
[
j
]
===
1
?
'男'
:
'女'
;
const
sexes
=
[
'未知'
,
'男'
,
'女'
,
];
return
sexes
[
v
[
j
]];
}
else
{
return
v
[
j
];
}
...
...
@@ -185,3 +205,10 @@ export default {
}
,
}
;
<
/script
>
<
style
>
.
zl
-
nickname
{
position
:
absolute
;
line
-
height
:
50
px
;
margin
-
left
:
10
px
;
}
<
/style
>
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