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
1da5945d
Commit
1da5945d
authored
Apr 26, 2020
by
冯超鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新模块
parent
0bd713ac
Pipeline
#29
failed with stages
Changes
10
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
192 additions
and
297 deletions
+192
-297
WxuserController.php
app/Http/Controllers/WxuserController.php
+38
-2
dump.rdb
dump.rdb
+0
-0
wxuser.js
resources/js/api/wxuser.js
+30
-0
device.svg
resources/js/icons/svg/device.svg
+1
-0
devicelist.svg
resources/js/icons/svg/devicelist.svg
+1
-0
index.js
resources/js/router/index.js
+3
-1
device.js
resources/js/router/modules/device.js
+23
-0
index.vue
resources/js/views/device/index.vue
+9
-0
index.vue
resources/js/views/wx_user/index.vue
+86
-294
api.php
routes/api.php
+1
-0
No files found.
app/Http/Controllers/WxuserController.php
View file @
1da5945d
...
...
@@ -9,7 +9,7 @@
namespace
App\Http\Controllers
;
use
App\Laravue\Models\wxUser
;
use
App\Laravue\Models\wxUser
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Http\Resources\Json\ResourceCollection
;
...
...
@@ -26,18 +26,54 @@ class WxuserController extends Controller
* */
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$limit
=
$request
->
input
(
'limit'
);
if
(
$pagenNum
===
''
||
$limit
==
''
){
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
}
$cont
=
Wxuser
::
count
();
$Wxuser
=
Wxuser
::
select
(
'nickname'
,
'id'
,
'openid'
,
'sex'
,
'province'
,
'city'
,
'mobile'
,
'country'
,
'headimgurl'
,
'created_at'
,
'state'
)
->
offset
(
$pagenNum
)
->
orderBy
(
'id'
,
'desc'
)
->
limit
(
$limit
)
->
get
();
$data
=
[
'Wxuser'
=>
$Wxuser
,
'cont'
=>
$cont
];
if
(
$Wxuser
){
return
$this
->
jsonSuccessData
(
$
Wxuser
);
return
$this
->
jsonSuccessData
(
$
data
);
}
else
{
return
$this
->
jsonErrorData
(
'105'
,
'获取数据失败'
);
}
}
//用户搜索
public
function
seek
(
Request
$request
){
$keys
=
$request
->
all
();
$handle
=
DB
::
table
(
'wx_User'
);
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
;
}
}
else
if
(
$k
==
'state'
){
if
(
$v
==
'正常'
){
$v
=
2
;
}
else
if
(
'禁用'
){
$v
=
1
;
}
}
$keys
[
$key
]
&&
$handle
->
where
(
$k
,
'like'
,
'%'
.
$v
.
'%'
);
}
$datas
=
$handle
->
get
();
$cont
=
$handle
->
count
();
$data
=
[
'Wxuser'
=>
$datas
,
'cont'
=>
$cont
];
return
$this
->
jsonSuccessData
(
$data
);
}
}
\ No newline at end of file
dump.rdb
View file @
1da5945d
No preview for this file type
resources/js/api/wxuser.js
0 → 100644
View file @
1da5945d
import
request
from
'@/utils/request'
;
import
Resource
from
'@/api/resource'
;
class
UserResource
extends
Resource
{
constructor
()
{
super
(
'wxuser/wxlist'
);
}
permissions
(
id
)
{
return
request
({
url
:
'/'
+
this
.
uri
+
'/'
+
id
+
'/permissions'
,
method
:
'get'
,
});
}
fetchArticle
(
data
)
{
return
request
({
url
:
'/wxuser/seek'
,
method
:
'post'
,
data
,
});
}
updatePermission
(
id
,
permissions
)
{
return
request
({
url
:
'/'
+
this
.
uri
+
'/'
+
id
+
'/permissions'
,
method
:
'put'
,
data
:
permissions
,
});
}
}
export
{
UserResource
as
default
};
resources/js/icons/svg/device.svg
0 → 100644
View file @
1da5945d
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
t=
"1587887688558"
class=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"1201"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
width=
"200"
height=
"200"
><defs><style
type=
"text/css"
></style></defs><path
d=
"M860.16 184.32H163.84a122.88 122.88 0 0 0-122.88 122.88v40.96a122.88 122.88 0 0 0 122.88 122.88h696.32a122.88 122.88 0 0 0 122.88-122.88v-40.96a122.88 122.88 0 0 0-122.88-122.88z m81.92 163.84a81.92 81.92 0 0 1-81.92 81.92H163.84a81.92 81.92 0 0 1-81.92-81.92v-40.96a81.92 81.92 0 0 1 81.92-81.92h696.32a81.92 81.92 0 0 1 81.92 81.92zM860.16 552.96H163.84a122.88 122.88 0 0 0-122.88 122.88v40.96a122.88 122.88 0 0 0 122.88 122.88h696.32a122.88 122.88 0 0 0 122.88-122.88v-40.96a122.88 122.88 0 0 0-122.88-122.88z m81.92 163.84a81.92 81.92 0 0 1-81.92 81.92H163.84a81.92 81.92 0 0 1-81.92-81.92v-40.96a81.92 81.92 0 0 1 81.92-81.92h696.32a81.92 81.92 0 0 1 81.92 81.92z"
p-id=
"1202"
></path><path
d=
"M184.32 266.24a61.44 61.44 0 1 0 61.44 61.44 61.44 61.44 0 0 0-61.44-61.44z m0 81.92a20.48 20.48 0 1 1 20.48-20.48 20.48 20.48 0 0 1-20.48 20.48zM839.68 634.88a61.44 61.44 0 1 0 61.44 61.44 61.44 61.44 0 0 0-61.44-61.44z m0 81.92a20.48 20.48 0 1 1 20.48-20.48 20.48 20.48 0 0 1-20.48 20.48zM204.8 614.4a81.92 81.92 0 0 0-79.0528 102.4h43.8272A40.96 40.96 0 0 1 163.84 696.32a40.96 40.96 0 0 1 40.96-40.96h81.92v-40.96zM860.16 327.68a40.96 40.96 0 0 1-5.7344 20.48h43.8272A81.92 81.92 0 0 0 819.2 245.76v40.96a40.96 40.96 0 0 1 40.96 40.96zM737.28 245.76h40.96v40.96h-40.96z"
p-id=
"1203"
></path></svg>
\ No newline at end of file
resources/js/icons/svg/devicelist.svg
0 → 100644
View file @
1da5945d
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
t=
"1587888568774"
class=
"icon"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
p-id=
"1355"
xmlns:xlink=
"http://www.w3.org/1999/xlink"
width=
"200"
height=
"200"
><defs><style
type=
"text/css"
></style></defs><path
d=
"M448 416h-64a32 32 0 1 1 0-64h64a32 32 0 1 1 0 64z m320 256H256a32 32 0 0 1 0-64h512a32 32 0 0 1 0 64z m0 128H256a32 32 0 0 1 0-64h512a32 32 0 0 1 0 64z m-32-256H288a64 64 0 0 1-64-64V288a64 64 0 0 1 64-64h448a64 64 0 0 1 64 64v192a64 64 0 0 1-64 64zM288 288v192h448V288H288z"
p-id=
"1356"
></path></svg>
\ No newline at end of file
resources/js/router/index.js
View file @
1da5945d
...
...
@@ -18,6 +18,7 @@ import componentRoutes from './modules/components';
import
chartsRoutes
from
'./modules/charts'
;
import
tableRoutes
from
'./modules/table'
;
import
adminRoutes
from
'./modules/admin'
;
import
deviceRoutes
from
'./modules/device'
;
import
nestedRoutes
from
'./modules/nested'
;
import
errorRoutes
from
'./modules/error'
;
import
excelRoutes
from
'./modules/excel'
;
...
...
@@ -128,6 +129,7 @@ export const asyncRoutes = [
nestedRoutes
,
tableRoutes
,
adminRoutes
,
deviceRoutes
,
{
path
:
'/theme'
,
component
:
Layout
,
...
...
@@ -210,7 +212,7 @@ export const asyncRoutes = [
meta
:
{
permissions
:
[
'view menu wx_user'
]
},
children
:
[
{
path
:
'
index
'
,
path
:
'
wxuser/wxlist
'
,
component
:
()
=>
import
(
'@/views/wx_user'
),
name
:
'wx_user'
,
meta
:
{
title
:
'wx_user'
,
icon
:
'wechat'
},
...
...
resources/js/router/modules/device.js
0 → 100644
View file @
1da5945d
import
Layout
from
'@/layout'
;
const
deviceRoutes
=
{
path
:
'/device'
,
component
:
Layout
,
redirect
:
'/device/index'
,
name
:
'Device'
,
alwaysShow
:
true
,
meta
:
{
title
:
'device'
,
icon
:
'device'
,
permissions
:
[
'view menu administrator'
],
},
children
:
[
{
path
:
'device'
,
component
:
()
=>
import
(
'@/views/device/index'
),
name
:
'Device'
,
meta
:
{
title
:
'设备管理'
,
icon
:
'devicelist'
,
permissions
:
[
'manage user'
]
},
},
],
};
export
default
deviceRoutes
;
resources/js/views/device/index.vue
0 → 100644
View file @
1da5945d
<
template
>
<div></div>
</
template
>
<
script
>
</
script
>
<
style
>
</
style
>
resources/js/views/wx_user/index.vue
View file @
1da5945d
<
template
>
<div
class=
"app-container"
>
<div
class=
"filter-container"
>
<el-input
v-model=
"listQuery.title"
placeholder=
"用户名称或关键字"
style=
"width: 200px;"
class=
"filter-item"
@
keyup
.
enter
.
native=
"handleFilter"
/>
<el-button
v-waves
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleFilter"
>
{{
$t
(
'table.search'
)
}}
</el-button>
<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-select
v-model=
"query.sex"
placeholder=
"性别"
clearable
style=
"width: 90px"
class=
"filter-item"
>
<el-option
v-for=
"item in importanceOptions"
:key=
"item"
:label=
"item"
:value=
"item"
/>
</el-select>
<el-select
v-model=
"query.state"
placeholder=
"状态"
clearable
class=
"filter-item"
style=
"width: 130px"
>
<el-option
v-for=
"item in calendarTypeOptions"
:key=
"item"
:label=
"item"
:value=
"item"
/>
</el-select>
<el-button
v-waves
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleSubmit"
>
{{
$t
(
'table.search'
)
}}
</el-button>
</el-form>
<el-button
v-waves
:loading=
"downloadLoading"
class=
"filter-item"
type=
"primary"
icon=
"el-icon-download"
@
click=
"handleDownload"
>
{{
$t
(
'table.export'
)
}}
</el-button>
<el-checkbox
v-model=
"showReviewer"
class=
"filter-item"
style=
"margin-left:15px;"
@
change=
"tableKey=tableKey+1"
>
{{
$t
(
'table.openid'
)
}}
</el-checkbox>
<el-checkbox
v-model=
"showReviewer"
class=
"filter-item"
style=
"margin-left:15px;"
@
change=
"tableKey=tableKey+1"
>
OpenId
</el-checkbox>
</div>
<el-table
:key=
"tableKey"
v-loading=
"listLoading"
:data=
"list"
border
fit
highlight-current-row
style=
"width: 98%;"
@
sort-change=
"sortChange"
>
<el-table-column
label=
"ID"
prop=
"id"
sortable=
"custom"
align=
"center"
width=
"80"
>
<el-table
:key=
"tableKey"
v-loading=
"loading"
:data=
"list"
border
fit
highlight-current-row
>
<el-table-column
align=
"center"
label=
"id"
width=
"80"
>
<template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
id
}}
</span>
</
template
>
</el-table-column>
<el-table-column
v-if=
"showReviewer"
label=
"openid"
width=
"150px"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
openid
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"用户头像"
align=
"center"
width=
"120"
>
<
template
slot-scope=
"scope"
>
<el-image
:src=
"scope.row.headimgurl"
:fit=
"fit"
></el-image>
</
template
>
</el-table-column>
<el-table-column
label=
"用户名称"
width=
"130px"
align=
"center"
>
<el-table-column
align=
"center"
label=
"用户名称"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
nickname
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"性别"
width=
"120px"
align=
"center"
>
<el-table-column
align=
"center"
label=
"用户头像"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<
span>
{{
scope
.
row
.
author
}}
</span
>
<
el-image
:src=
"scope.row.headimgurl"
:preview-src-list=
"srcList"
></el-image
>
</
template
>
</el-table-column>
<el-table-column
label=
"省份"
width=
"140px"
align=
"center"
>
<el-table-column
v-if=
"showReviewer"
align=
"center"
label=
"openid"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<span
>
{{
scope
.
row
.
province
}}
</span>
<span
@
click=
"handleCopy(scope.row.openid,$event)"
>
{{
scope
.
row
.
openid
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"country"
align=
"center"
width=
"140"
>
<el-table-column
align=
"center"
label=
"性别"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
country
}}
</span>
<span>
{{
scope
.
row
.
sex
==
1
?
'男'
:
'女'
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"城市"
width=
"140px"
align=
"center
"
>
<el-table-column
align=
"center"
label=
"手机号"
width=
"170
"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
city
}}
</span>
<span>
{{
scope
.
row
.
mobile
}}
</span>
</
template
>
</el-table-column>
<el-table-column
label=
"手机号"
align=
"center"
width=
"15
0"
>
<el-table-column
align=
"center"
label=
"地区"
width=
"17
0"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
mobile
}}
</span>
<span>
{{
scope
.
row
.
country
}}{{
scope
.
row
.
province
}}{{
scope
.
row
.
city
}}
</span>
</
template
>
</el-table-column>
<!-- | parseTime('{y}-{m}-{d} {h}:{i}') -->
<el-table-column
label=
"创建时间"
align=
"center"
width=
"150"
>
<el-table-column
align=
"center"
label=
"创建时间"
width=
"170"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
created_at
|
parseTime
(
'{y
}
-{m
}
-{d
}
{h
}
:{i
}
'
)
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<!--
状态
后续需要加
-->
<!--
<
el
-
table
-
column
:
label
=
"$t('table.status')"
class
-
name
=
"status-col"
width
=
"100"
>
<
template
slot
-
scope
=
"{row
}
"
>
<
el
-
tag
:
type
=
"row.status | statusFilter"
>
{{
row
.
status
}}
<
/el-tag
>
<
el
-
table
-
column
align
=
"center"
label
=
"状态"
width
=
"170"
>
<
template
slot
-
scope
=
"scope"
>
<
span
>
{{
scope
.
row
.
state
==
1
?
'禁用'
:
'正常'
}}
<
/span
>
<
/template
>
<
/el-table-column
>
<
el
-
table
-
column
:
label
=
"$t('table.actions')"
align
=
"center"
width
=
"230"
class
-
name
=
"small-padding fixed-width"
>
<
template
slot
-
scope
=
"{row
}
"
>
<
el
-
button
type
=
"primary"
size
=
"mini"
@
click
=
"handleUpdate(row)"
>
{{
$t
(
'table.edit'
)
}}
<
/el-button
>
<
el
-
button
v
-
if
=
"row.status!='published'"
size
=
"mini"
type
=
"success"
@
click
=
"handleModifyStatus(row,'published')"
>
{{
$t
(
'table.publish'
)
}}
<
/el-button
>
<
el
-
button
v
-
if
=
"row.status!='draft'"
size
=
"mini"
@
click
=
"handleModifyStatus(row,'draft')"
>
{{
$t
(
'table.draft'
)
}}
<
/el-button
>
<
el
-
button
v
-
if
=
"row.status!='deleted'"
size
=
"mini"
type
=
"danger"
@
click
=
"handleModifyStatus(row,'deleted')"
>
{{
$t
(
'table.delete'
)
}}
<
/el-button
>
<
/template
>
<
/el-table-column> --
>
<
/el-table
>
<!--
分页
-->
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"listQuery.page"
:
limit
.
sync
=
"listQuery.limit"
@
pagination
=
"getList"
/>
<
el
-
dialog
:
title
=
"textMap[dialogStatus]"
:
visible
.
sync
=
"dialogFormVisible"
>
<
el
-
form
ref
=
"dataForm"
:
rules
=
"rules"
:
model
=
"temp"
label
-
position
=
"left"
label
-
width
=
"70px"
style
=
"width: 400px; margin-left:50px;"
>
<
el
-
form
-
item
:
label
=
"$t('table.type')"
prop
=
"type"
>
<
el
-
select
v
-
model
=
"temp.type"
class
=
"filter-item"
placeholder
=
"Please select"
>
<
el
-
option
v
-
for
=
"item in calendarTypeOptions"
:
key
=
"item.key"
:
label
=
"item.display_name"
:
value
=
"item.key"
/>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"$t('table.date')"
prop
=
"timestamp"
>
<
el
-
date
-
picker
v
-
model
=
"temp.timestamp"
type
=
"datetime"
placeholder
=
"Please pick a date"
/>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"$t('table.title')"
prop
=
"title"
>
<
el
-
input
v
-
model
=
"temp.title"
/>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"$t('table.status')"
>
<
el
-
select
v
-
model
=
"temp.status"
class
=
"filter-item"
placeholder
=
"Please select"
>
<
el
-
option
v
-
for
=
"item in statusOptions"
:
key
=
"item"
:
label
=
"item"
:
value
=
"item"
/>
<
/el-select
>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"$t('table.importance')"
>
<
el
-
rate
v
-
model
=
"temp.importance"
:
colors
=
"['#99A9BF', '#F7BA2A', '#FF9900']"
:
max
=
"3"
style
=
"margin-top:8px;"
/>
<
/el-form-item
>
<
el
-
form
-
item
:
label
=
"$t('table.remark')"
>
<
el
-
input
v
-
model
=
"temp.remark"
:
autosize
=
"{ minRows: 2, maxRows: 4
}
"
type
=
"textarea"
placeholder
=
"Please input"
/>
<
/el-form-item
>
<
/el-form
>
<
div
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
@
click
=
"dialogFormVisible = false"
>
{{
$t
(
'table.cancel'
)
}}
<
/el-button
>
<
el
-
button
type
=
"primary"
@
click
=
"dialogStatus==='create'?createData():updateData()"
>
{{
$t
(
'table.confirm'
)
}}
<
/el-button
>
<
/div
>
<
/el-dialog
>
<
el
-
dialog
:
visible
.
sync
=
"dialogPvVisible"
title
=
"Reading statistics"
>
<
el
-
table
:
data
=
"pvData"
border
fit
highlight
-
current
-
row
style
=
"width: 100%"
>
<
el
-
table
-
column
prop
=
"key"
label
=
"Channel"
/>
<
el
-
table
-
column
prop
=
"pv"
label
=
"Pv"
/>
<
/el-table
>
<
span
slot
=
"footer"
class
=
"dialog-footer"
>
<
el
-
button
type
=
"primary"
@
click
=
"dialogPvVisible = false"
>
{{
$t
(
'table.confirm'
)
}}
<
/el-button
>
<
/span
>
<
/el-dialog
>
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"query.page"
:
limit
.
sync
=
"query.limit"
@
pagination
=
"getList"
/>
<
/div
>
<
/template
>
<
script
>
import
{
fetchPv
,
createArticle
,
updateArticle
}
from
'@/api/article'
;
import
waves
from
'@/directive/waves'
;
// Waves directive
import
UserResource
from
'@/api/wxuser'
;
import
clip
from
'@/utils/clipboard'
;
import
Pagination
from
'@/components/Pagination'
;
// 分页
import
{
parseTime
}
from
'@/utils'
;
import
Resource
from
'@/api/resource'
;
const
WxuserResource
=
new
Resource
(
'wxuser/wxlist?page=1&limit=1'
);
import
Pagination
from
'@/components/Pagination'
;
// Secondary package based on el-pagination
const
calendarTypeOptions
=
[
{
key
:
'CN'
,
display_name
:
'China'
}
,
{
key
:
'US'
,
display_name
:
'USA'
}
,
{
key
:
'JA'
,
display_name
:
'Japan'
}
,
{
key
:
'VI'
,
display_name
:
'Vietnam'
}
,
];
// arr to obj ,such as
{
CN
:
"China"
,
US
:
"USA"
}
const
calendarTypeKeyValue
=
calendarTypeOptions
.
reduce
((
acc
,
cur
)
=>
{
acc
[
cur
.
key
]
=
cur
.
display_name
;
return
acc
;
}
,
{
}
);
import
waves
from
'@/directive/waves'
;
// 水波纹效果
const
userResource
=
new
UserResource
();
export
default
{
name
:
'W
XU
ser'
,
name
:
'W
xu
ser'
,
components
:
{
Pagination
}
,
directives
:
{
waves
}
,
filters
:
{
statusFilter
(
status
)
{
const
statusMap
=
{
published
:
'success'
,
draft
:
'info'
,
deleted
:
'danger'
,
}
;
return
statusMap
[
status
];
}
,
typeFilter
(
type
)
{
return
calendarTypeKeyValue
[
type
];
}
,
}
,
data
()
{
return
{
total
:
0
,
tableKey
:
0
,
list
:
[],
total
:
0
,
listLoading
:
true
,
listQuery
:
{
page
:
1
,
limit
:
20
,
importance
:
undefined
,
title
:
undefined
,
type
:
undefined
,
sort
:
'+id'
,
fits
:
[
'fill'
,
'contain'
,
'cover'
,
'none'
,
'scale-down'
],
}
,
calendarTypeOptions
,
sortOptions
:
[{
label
:
'ID Ascending'
,
key
:
'+id'
}
,
{
label
:
'ID Descending'
,
key
:
'-id'
}
],
statusOptions
:
[
'published'
,
'draft'
,
'deleted'
],
loading
:
true
,
showReviewer
:
false
,
temp
:
{
id
:
undefined
,
importance
:
1
,
remark
:
''
,
timestamp
:
new
Date
(),
title
:
''
,
type
:
''
,
status
:
'published'
,
}
,
dialogFormVisible
:
false
,
dialogStatus
:
''
,
textMap
:
{
update
:
'Edit'
,
create
:
'Create'
,
}
,
dialogPvVisible
:
false
,
pvData
:
[],
rules
:
{
type
:
[{
required
:
true
,
message
:
'type is required'
,
trigger
:
'change'
}
],
timestamp
:
[{
type
:
'date'
,
required
:
true
,
message
:
'timestamp is required'
,
trigger
:
'change'
}
],
title
:
[{
required
:
true
,
message
:
'title is required'
,
trigger
:
'blur'
}
],
query
:
{
page
:
1
,
limit
:
10
,
nickname
:
undefined
,
sex
:
undefined
,
state
:
undefined
,
}
,
importanceOptions
:
[
'男'
,
'女'
],
calendarTypeOptions
:
[
'正常'
,
'禁用'
],
srcList
:
[],
downloadLoading
:
false
,
}
;
}
,
...
...
@@ -235,145 +109,63 @@ export default {
}
,
methods
:
{
async
getList
()
{
this
.
listLoading
=
true
;
const
{
data
}
=
await
WxuserResource
.
list
({
}
);
this
.
list
=
data
;
this
.
listLoading
=
false
;
}
,
handleFilter
()
{
this
.
listQuery
.
page
=
1
;
this
.
getList
();
}
,
handleModifyStatus
(
row
,
status
)
{
this
.
$message
({
message
:
'Successful operation'
,
type
:
'success'
,
const
{
limit
,
page
}
=
this
.
query
;
this
.
loading
=
true
;
const
{
data
}
=
await
userResource
.
list
(
this
.
query
);
var
Wxuser
=
data
.
Wxuser
;
this
.
list
=
Wxuser
;
this
.
list
.
forEach
((
element
,
index
)
=>
{
element
[
'index'
]
=
(
page
-
1
)
*
limit
+
index
+
1
;
}
);
row
.
status
=
status
;
}
,
sortChange
(
data
)
{
const
{
prop
,
order
}
=
data
;
if
(
prop
===
'id'
)
{
this
.
sortByID
(
order
);
}
}
,
sortByID
(
order
)
{
if
(
order
===
'ascending'
)
{
this
.
listQuery
.
sort
=
'+id'
;
}
else
{
this
.
listQuery
.
sort
=
'-id'
;
for
(
var
item
of
Wxuser
)
{
this
.
srcList
.
push
(
item
[
'headimgurl'
]);
}
this
.
handleFilter
();
}
,
resetTemp
()
{
this
.
temp
=
{
id
:
undefined
,
importance
:
1
,
remark
:
''
,
timestamp
:
new
Date
(),
title
:
''
,
status
:
'published'
,
type
:
''
,
}
;
}
,
handleCreate
()
{
this
.
resetTemp
();
this
.
dialogStatus
=
'create'
;
this
.
dialogFormVisible
=
true
;
this
.
$nextTick
(()
=>
{
this
.
$refs
[
'dataForm'
].
clearValidate
();
}
);
this
.
total
=
data
.
cont
;
this
.
loading
=
false
;
}
,
createData
()
{
this
.
$refs
[
'dataForm'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
this
.
temp
.
id
=
parseInt
(
Math
.
random
()
*
100
)
+
1024
;
// mock a id
this
.
temp
.
author
=
'laravue'
;
createArticle
(
this
.
temp
).
then
(()
=>
{
this
.
list
.
unshift
(
this
.
temp
);
this
.
dialogFormVisible
=
false
;
this
.
$notify
({
title
:
'Success'
,
message
:
'Created successfully'
,
type
:
'success'
,
duration
:
2000
,
}
);
}
);
}
}
);
}
,
handleUpdate
(
row
)
{
this
.
temp
=
Object
.
assign
({
}
,
row
);
// copy obj
this
.
temp
.
timestamp
=
new
Date
(
this
.
temp
.
timestamp
);
this
.
dialogStatus
=
'update'
;
this
.
dialogFormVisible
=
true
;
this
.
$nextTick
(()
=>
{
this
.
$refs
[
'dataForm'
].
clearValidate
();
}
);
}
,
updateData
()
{
this
.
$refs
[
'dataForm'
].
validate
((
valid
)
=>
{
if
(
valid
)
{
const
tempData
=
Object
.
assign
({
}
,
this
.
temp
);
tempData
.
timestamp
=
+
new
Date
(
tempData
.
timestamp
);
// change Thu Nov 30 2017 16:41:05 GMT+0800 (CST) to 1512031311464
updateArticle
(
tempData
).
then
(()
=>
{
for
(
const
v
of
this
.
list
)
{
if
(
v
.
id
===
this
.
temp
.
id
)
{
const
index
=
this
.
list
.
indexOf
(
v
);
this
.
list
.
splice
(
index
,
1
,
this
.
temp
);
break
;
}
}
this
.
dialogFormVisible
=
false
;
this
.
$notify
({
title
:
'Success'
,
message
:
'Updated successfully'
,
type
:
'success'
,
duration
:
2000
,
}
);
}
);
}
}
);
}
,
handleDelete
(
row
)
{
this
.
$notify
({
title
:
'Success'
,
message
:
'Deleted successfully'
,
type
:
'success'
,
duration
:
2000
,
}
);
const
index
=
this
.
list
.
indexOf
(
row
);
this
.
list
.
splice
(
index
,
1
);
}
,
handleFetchPv
(
pv
)
{
fetchPv
(
pv
).
then
(
response
=>
{
this
.
pvData
=
response
.
data
.
pvData
;
this
.
dialogPvVisible
=
true
;
}
);
handleCopy
(
text
,
event
)
{
clip
(
text
,
event
);
}
,
handleDownload
()
{
this
.
downloadLoading
=
true
;
import
(
'@/vendor/Export2Excel'
).
then
(
excel
=>
{
const
tHeader
=
[
'
timestamp'
,
'title'
,
'type'
,
'importance'
,
'status
'
];
const
filterVal
=
[
'
timestamp'
,
'title'
,
'type'
,
'importance'
,
'status
'
];
const
tHeader
=
[
'
id'
,
'openid'
,
'nickname'
,
'sex'
,
'mobile'
,
'created_at
'
];
const
filterVal
=
[
'
id'
,
'openid'
,
'nickname'
,
'sex'
,
'mobile'
,
'created_at
'
];
const
data
=
this
.
formatJson
(
filterVal
,
this
.
list
);
excel
.
export_json_to_excel
({
header
:
tHeader
,
data
,
filename
:
'
table-list
'
,
filename
:
'
微信用户
'
,
}
);
this
.
downloadLoading
=
false
;
}
);
}
,
formatJson
(
filterVal
,
jsonData
)
{
return
jsonData
.
map
(
v
=>
filterVal
.
map
(
j
=>
{
if
(
j
===
'
timestamp
'
)
{
if
(
j
===
'
created_at
'
)
{
return
parseTime
(
v
[
j
]);
}
else
if
(
j
===
'sex'
)
{
return
v
[
j
]
===
1
?
'男'
:
'女'
;
}
else
{
return
v
[
j
];
}
}
));
}
,
async
handleSubmit
()
{
const
{
limit
,
page
}
=
this
.
query
;
this
.
loading
=
true
;
const
{
data
}
=
await
userResource
.
fetchArticle
(
this
.
query
);
var
Wxuser
=
data
.
Wxuser
;
this
.
list
=
Wxuser
;
this
.
list
.
forEach
((
element
,
index
)
=>
{
element
[
'index'
]
=
(
page
-
1
)
*
limit
+
index
+
1
;
}
);
for
(
var
item
of
Wxuser
)
{
this
.
srcList
.
push
(
item
[
'headimgurl'
]);
}
this
.
total
=
data
.
cont
;
this
.
loading
=
false
;
}
,
}
,
}
;
<
/script
>
routes/api.php
View file @
1da5945d
...
...
@@ -28,6 +28,7 @@ Route::group(['middleware' => 'auth:api'], function () {
Route
::
apiResource
(
'permissions'
,
'PermissionController'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
Route
::
get
(
'wxuser/wxlist'
,
'WxuserController@wxlist'
);
//微信用户列表
Route
::
post
(
'wxuser/seek'
,
'WxuserController@seek'
);
//微信搜索
Route
::
get
(
'user/HUserList'
,
'UserController@HUserList'
);
//用户列表
Route
::
post
(
'user/addUser'
,
'UserController@addUser'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
//新增用户
Route
::
post
(
'user/deleteuser'
,
'UserController@deleteuser'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
//删除用户
...
...
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