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 @@
...
@@ -9,7 +9,7 @@
namespace
App\Http\Controllers
;
namespace
App\Http\Controllers
;
use
App\Laravue\Models\wxUser
;
use
App\Laravue\Models\wxUser
;
use
Illuminate\Http\Request
;
use
Illuminate\Http\Request
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Support\Facades\DB
;
use
Illuminate\Http\Resources\Json\ResourceCollection
;
use
Illuminate\Http\Resources\Json\ResourceCollection
;
...
@@ -26,18 +26,54 @@ class WxuserController extends Controller
...
@@ -26,18 +26,54 @@ class WxuserController extends Controller
* */
* */
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$pagenNum
=
$request
->
input
(
'page'
)
-
1
;
//页数
$limit
=
$request
->
input
(
'limit'
);
$limit
=
$request
->
input
(
'limit'
);
if
(
$pagenNum
===
''
||
$limit
==
''
){
if
(
$pagenNum
===
''
||
$limit
==
''
){
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
return
$this
->
jsonErrorData
(
105
,
'页数或limit不能为空'
);
}
}
$cont
=
Wxuser
::
count
();
$Wxuser
=
Wxuser
::
select
(
'nickname'
,
'id'
,
'openid'
,
'sex'
,
'province'
,
'city'
,
'mobile'
,
'country'
,
'headimgurl'
,
'created_at'
,
'state'
)
$Wxuser
=
Wxuser
::
select
(
'nickname'
,
'id'
,
'openid'
,
'sex'
,
'province'
,
'city'
,
'mobile'
,
'country'
,
'headimgurl'
,
'created_at'
,
'state'
)
->
offset
(
$pagenNum
)
->
offset
(
$pagenNum
)
->
orderBy
(
'id'
,
'desc'
)
->
orderBy
(
'id'
,
'desc'
)
->
limit
(
$limit
)
->
limit
(
$limit
)
->
get
();
->
get
();
$data
=
[
'Wxuser'
=>
$Wxuser
,
'cont'
=>
$cont
];
if
(
$Wxuser
){
if
(
$Wxuser
){
return
$this
->
jsonSuccessData
(
$
Wxuser
);
return
$this
->
jsonSuccessData
(
$
data
);
}
else
{
}
else
{
return
$this
->
jsonErrorData
(
'105'
,
'获取数据失败'
);
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';
...
@@ -18,6 +18,7 @@ import componentRoutes from './modules/components';
import
chartsRoutes
from
'./modules/charts'
;
import
chartsRoutes
from
'./modules/charts'
;
import
tableRoutes
from
'./modules/table'
;
import
tableRoutes
from
'./modules/table'
;
import
adminRoutes
from
'./modules/admin'
;
import
adminRoutes
from
'./modules/admin'
;
import
deviceRoutes
from
'./modules/device'
;
import
nestedRoutes
from
'./modules/nested'
;
import
nestedRoutes
from
'./modules/nested'
;
import
errorRoutes
from
'./modules/error'
;
import
errorRoutes
from
'./modules/error'
;
import
excelRoutes
from
'./modules/excel'
;
import
excelRoutes
from
'./modules/excel'
;
...
@@ -128,6 +129,7 @@ export const asyncRoutes = [
...
@@ -128,6 +129,7 @@ export const asyncRoutes = [
nestedRoutes
,
nestedRoutes
,
tableRoutes
,
tableRoutes
,
adminRoutes
,
adminRoutes
,
deviceRoutes
,
{
{
path
:
'/theme'
,
path
:
'/theme'
,
component
:
Layout
,
component
:
Layout
,
...
@@ -210,7 +212,7 @@ export const asyncRoutes = [
...
@@ -210,7 +212,7 @@ export const asyncRoutes = [
meta
:
{
permissions
:
[
'view menu wx_user'
]
},
meta
:
{
permissions
:
[
'view menu wx_user'
]
},
children
:
[
children
:
[
{
{
path
:
'
index
'
,
path
:
'
wxuser/wxlist
'
,
component
:
()
=>
import
(
'@/views/wx_user'
),
component
:
()
=>
import
(
'@/views/wx_user'
),
name
:
'wx_user'
,
name
:
'wx_user'
,
meta
:
{
title
:
'wx_user'
,
icon
:
'wechat'
},
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
>
<
template
>
<div
class=
"app-container"
>
<div
class=
"app-container"
>
<div
class=
"filter-container"
>
<div
class=
"filter-container"
>
<el-input
v-model=
"listQuery.title"
placeholder=
"用户名称或关键字"
style=
"width: 200px;"
class=
"filter-item"
@
keyup
.
enter
.
native=
"handleFilter"
/>
<el-form
ref=
"query"
:model=
"query"
style=
"display: inline-block;"
>
<el-button
v-waves
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleFilter"
>
<el-input
v-model=
"query.nickname"
placeholder=
"用户名称"
style=
"width: 200px;"
class=
"filter-item"
name=
"userskk"
/>
{{
$t
(
'table.search'
)
}}
<el-select
v-model=
"query.sex"
placeholder=
"性别"
clearable
style=
"width: 90px"
class=
"filter-item"
>
</el-button>
<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"
>
<el-button
v-waves
:loading=
"downloadLoading"
class=
"filter-item"
type=
"primary"
icon=
"el-icon-download"
@
click=
"handleDownload"
>
{{
$t
(
'table.export'
)
}}
{{
$t
(
'table.export'
)
}}
</el-button>
</el-button>
<el-checkbox
v-model=
"showReviewer"
class=
"filter-item"
style=
"margin-left:15px;"
@
change=
"tableKey=tableKey+1"
>
<el-checkbox
v-model=
"showReviewer"
class=
"filter-item"
style=
"margin-left:15px;"
@
change=
"tableKey=tableKey+1"
>
OpenId
</el-checkbox>
{{
$t
(
'table.openid'
)
}}
</el-checkbox>
</div>
</div>
<el-table
:key=
"tableKey"
v-loading=
"loading"
:data=
"list"
border
fit
highlight-current-row
>
<el-table
<el-table-column
align=
"center"
label=
"id"
width=
"80"
>
: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"
>
<template
slot-scope=
"scope"
>
<template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
id
}}
</span>
<span>
{{
scope
.
row
.
id
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
v-if=
"showReviewer"
label=
"openid"
width=
"150px"
align=
"center"
>
<
template
slot-scope=
"scope"
>
<el-table-column
align=
"center"
label=
"用户名称"
width=
"150"
>
<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"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
nickname
}}
</span>
<span>
{{
scope
.
row
.
nickname
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"性别"
width=
"120px"
align=
"center"
>
<el-table-column
align=
"center"
label=
"用户头像"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<
span>
{{
scope
.
row
.
author
}}
</span
>
<
el-image
:src=
"scope.row.headimgurl"
:preview-src-list=
"srcList"
></el-image
>
</
template
>
</
template
>
</el-table-column>
</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"
>
<
template
slot-scope=
"scope"
>
<span
>
{{
scope
.
row
.
province
}}
</span>
<span
@
click=
"handleCopy(scope.row.openid,$event)"
>
{{
scope
.
row
.
openid
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"country"
align=
"center"
width=
"140"
>
<el-table-column
align=
"center"
label=
"性别"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
country
}}
</span>
<span>
{{
scope
.
row
.
sex
==
1
?
'男'
:
'女'
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
label=
"城市"
width=
"140px"
align=
"center
"
>
<el-table-column
align=
"center"
label=
"手机号"
width=
"170
"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
city
}}
</span>
<span>
{{
scope
.
row
.
mobile
}}
</span>
</
template
>
</
template
>
</el-table-column>
</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"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
mobile
}}
</span>
<span>
{{
scope
.
row
.
country
}}{{
scope
.
row
.
province
}}{{
scope
.
row
.
city
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<!-- | parseTime('{y}-{m}-{d} {h}:{i}') -->
<el-table-column
align=
"center"
label=
"创建时间"
width=
"170"
>
<el-table-column
label=
"创建时间"
align=
"center"
width=
"150"
>
<
template
slot-scope=
"scope"
>
<
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
}
'
)
}}
<
/span
>
<
/template
>
<
/template
>
<
/el-table-column
>
<
/el-table-column
>
<!--
状态
后续需要加
-->
<
el
-
table
-
column
align
=
"center"
label
=
"状态"
width
=
"170"
>
<!--
<
el
-
table
-
column
:
label
=
"$t('table.status')"
class
-
name
=
"status-col"
width
=
"100"
>
<
template
slot
-
scope
=
"scope"
>
<
template
slot
-
scope
=
"{row
}
"
>
<
span
>
{{
scope
.
row
.
state
==
1
?
'禁用'
:
'正常'
}}
<
/span
>
<
el
-
tag
:
type
=
"row.status | statusFilter"
>
{{
row
.
status
}}
<
/el-tag
>
<
/template
>
<
/template
>
<
/el-table-column
>
<
/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
>
<
/el-table
>
<!--
分页
-->
<
pagination
v
-
show
=
"total>0"
:
total
=
"total"
:
page
.
sync
=
"query.page"
:
limit
.
sync
=
"query.limit"
@
pagination
=
"getList"
/>
<
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
>
<
/div
>
<
/div
>
<
/template
>
<
/template
>
<
script
>
<
script
>
import
{
fetchPv
,
createArticle
,
updateArticle
}
from
'@/api/article'
;
import
UserResource
from
'@/api/wxuser'
;
import
waves
from
'@/directive/waves'
;
// Waves directive
import
clip
from
'@/utils/clipboard'
;
import
Pagination
from
'@/components/Pagination'
;
// 分页
import
{
parseTime
}
from
'@/utils'
;
import
{
parseTime
}
from
'@/utils'
;
import
Resource
from
'@/api/resource'
;
import
waves
from
'@/directive/waves'
;
// 水波纹效果
const
WxuserResource
=
new
Resource
(
'wxuser/wxlist?page=1&limit=1'
);
const
userResource
=
new
UserResource
();
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
;
}
,
{
}
);
export
default
{
export
default
{
name
:
'W
XU
ser'
,
name
:
'W
xu
ser'
,
components
:
{
Pagination
}
,
components
:
{
Pagination
}
,
directives
:
{
waves
}
,
directives
:
{
waves
}
,
filters
:
{
statusFilter
(
status
)
{
const
statusMap
=
{
published
:
'success'
,
draft
:
'info'
,
deleted
:
'danger'
,
}
;
return
statusMap
[
status
];
}
,
typeFilter
(
type
)
{
return
calendarTypeKeyValue
[
type
];
}
,
}
,
data
()
{
data
()
{
return
{
return
{
total
:
0
,
tableKey
:
0
,
tableKey
:
0
,
list
:
[],
list
:
[],
total
:
0
,
loading
:
true
,
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'
],
showReviewer
:
false
,
showReviewer
:
false
,
temp
:
{
query
:
{
id
:
undefined
,
page
:
1
,
importance
:
1
,
limit
:
10
,
remark
:
''
,
nickname
:
undefined
,
timestamp
:
new
Date
(),
sex
:
undefined
,
title
:
''
,
state
:
undefined
,
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'
}
],
}
,
}
,
importanceOptions
:
[
'男'
,
'女'
],
calendarTypeOptions
:
[
'正常'
,
'禁用'
],
srcList
:
[],
downloadLoading
:
false
,
downloadLoading
:
false
,
}
;
}
;
}
,
}
,
...
@@ -235,145 +109,63 @@ export default {
...
@@ -235,145 +109,63 @@ export default {
}
,
}
,
methods
:
{
methods
:
{
async
getList
()
{
async
getList
()
{
this
.
listLoading
=
true
;
const
{
limit
,
page
}
=
this
.
query
;
const
{
data
}
=
await
WxuserResource
.
list
({
}
);
this
.
loading
=
true
;
this
.
list
=
data
;
const
{
data
}
=
await
userResource
.
list
(
this
.
query
);
this
.
listLoading
=
false
;
var
Wxuser
=
data
.
Wxuser
;
}
,
this
.
list
=
Wxuser
;
handleFilter
()
{
this
.
list
.
forEach
((
element
,
index
)
=>
{
this
.
listQuery
.
page
=
1
;
element
[
'index'
]
=
(
page
-
1
)
*
limit
+
index
+
1
;
this
.
getList
();
}
,
handleModifyStatus
(
row
,
status
)
{
this
.
$message
({
message
:
'Successful operation'
,
type
:
'success'
,
}
);
}
);
row
.
status
=
status
;
for
(
var
item
of
Wxuser
)
{
}
,
this
.
srcList
.
push
(
item
[
'headimgurl'
]);
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'
;
}
}
this
.
handleFilter
();
this
.
total
=
data
.
cont
;
}
,
this
.
loading
=
false
;
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
();
}
);
}
,
}
,
createData
()
{
handleCopy
(
text
,
event
)
{
this
.
$refs
[
'dataForm'
].
validate
((
valid
)
=>
{
clip
(
text
,
event
);
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
;
}
);
}
,
}
,
handleDownload
()
{
handleDownload
()
{
this
.
downloadLoading
=
true
;
this
.
downloadLoading
=
true
;
import
(
'@/vendor/Export2Excel'
).
then
(
excel
=>
{
import
(
'@/vendor/Export2Excel'
).
then
(
excel
=>
{
const
tHeader
=
[
'
timestamp'
,
'title'
,
'type'
,
'importance'
,
'status
'
];
const
tHeader
=
[
'
id'
,
'openid'
,
'nickname'
,
'sex'
,
'mobile'
,
'created_at
'
];
const
filterVal
=
[
'
timestamp'
,
'title'
,
'type'
,
'importance'
,
'status
'
];
const
filterVal
=
[
'
id'
,
'openid'
,
'nickname'
,
'sex'
,
'mobile'
,
'created_at
'
];
const
data
=
this
.
formatJson
(
filterVal
,
this
.
list
);
const
data
=
this
.
formatJson
(
filterVal
,
this
.
list
);
excel
.
export_json_to_excel
({
excel
.
export_json_to_excel
({
header
:
tHeader
,
header
:
tHeader
,
data
,
data
,
filename
:
'
table-list
'
,
filename
:
'
微信用户
'
,
}
);
}
);
this
.
downloadLoading
=
false
;
this
.
downloadLoading
=
false
;
}
);
}
);
}
,
}
,
formatJson
(
filterVal
,
jsonData
)
{
formatJson
(
filterVal
,
jsonData
)
{
return
jsonData
.
map
(
v
=>
filterVal
.
map
(
j
=>
{
return
jsonData
.
map
(
v
=>
filterVal
.
map
(
j
=>
{
if
(
j
===
'
timestamp
'
)
{
if
(
j
===
'
created_at
'
)
{
return
parseTime
(
v
[
j
]);
return
parseTime
(
v
[
j
]);
}
else
if
(
j
===
'sex'
)
{
return
v
[
j
]
===
1
?
'男'
:
'女'
;
}
else
{
}
else
{
return
v
[
j
];
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
>
<
/script
>
routes/api.php
View file @
1da5945d
...
@@ -28,6 +28,7 @@ Route::group(['middleware' => 'auth:api'], function () {
...
@@ -28,6 +28,7 @@ Route::group(['middleware' => 'auth:api'], function () {
Route
::
apiResource
(
'permissions'
,
'PermissionController'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
Route
::
apiResource
(
'permissions'
,
'PermissionController'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
Route
::
get
(
'wxuser/wxlist'
,
'WxuserController@wxlist'
);
//微信用户列表
Route
::
get
(
'wxuser/wxlist'
,
'WxuserController@wxlist'
);
//微信用户列表
Route
::
post
(
'wxuser/seek'
,
'WxuserController@seek'
);
//微信搜索
Route
::
get
(
'user/HUserList'
,
'UserController@HUserList'
);
//用户列表
Route
::
get
(
'user/HUserList'
,
'UserController@HUserList'
);
//用户列表
Route
::
post
(
'user/addUser'
,
'UserController@addUser'
)
->
middleware
(
'permission:'
.
\App\Laravue\Acl
::
PERMISSION_PERMISSION_MANAGE
);
//新增用户
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
);
//删除用户
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