Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
sun
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
钟尚武
sun
Commits
39257d20
Commit
39257d20
authored
6 years ago
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改问题
parent
10763992
master
dev
like-pre/r01
quick-reply
refactor
test
No related merge requests found
Show whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
90 additions
and
46 deletions
+90
-46
account.py
api/account.py
+12
-4
group.py
api/group.py
+5
-2
push.py
api/push.py
+4
-1
topic.py
api/topic.py
+2
-2
user.py
api/user.py
+2
-2
time_utils.py
utils/time_utils.py
+1
-1
permission.js
vu/src/permission.js
+1
-1
account.js
vu/src/router/modules/account.js
+4
-2
group.js
vu/src/router/modules/group.js
+2
-1
pick.js
vu/src/router/modules/pick.js
+2
-1
push.js
vu/src/router/modules/push.js
+2
-1
star.js
vu/src/router/modules/star.js
+2
-1
tag.js
vu/src/router/modules/tag.js
+2
-1
topic.js
vu/src/router/modules/topic.js
+2
-1
user.js
vu/src/router/modules/user.js
+2
-1
permission.js
vu/src/store/modules/permission.js
+10
-8
user.js
vu/src/store/modules/user.js
+1
-1
index.vue
vu/src/views/dashboard/index.vue
+2
-2
list.vue
vu/src/views/group/list.vue
+11
-9
list.vue
vu/src/views/tag/list.vue
+4
-0
TopicDetail.vue
vu/src/views/topic/components/TopicDetail.vue
+3
-0
UserDetail.vue
vu/src/views/user/components/UserDetail.vue
+7
-4
list.vue
vu/src/views/user/list.vue
+7
-0
No files found.
api/account.py
View file @
39257d20
...
@@ -78,6 +78,10 @@ class LoginView(APIView):
...
@@ -78,6 +78,10 @@ class LoginView(APIView):
data
.
update
({
data
.
update
({
'avatar'
:
settings
.
AVATAR
'avatar'
:
settings
.
AVATAR
})
})
if
data
[
'is_staff'
]:
data
.
update
({
'roles'
:
[
'staff'
]})
else
:
data
.
update
({
'roles'
:
[
'anonymous'
]})
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'获取用户信息失败,
%
s'
%
(
id
,
e
))
error_logger
.
error
(
u'获取用户信息失败,
%
s'
%
(
id
,
e
))
raise
raise
...
@@ -94,7 +98,7 @@ class LoginView(APIView):
...
@@ -94,7 +98,7 @@ class LoginView(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/account/login'
](
username
=
username
,
password
=
password
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/account/login'
](
username
=
username
,
password
=
password
)
.
unwrap
()
if
data
[
'success'
]
or
all
([
username
==
settings
.
USERNAME
,
password
==
settings
.
PASSWORD
]):
if
data
[
'success'
]
or
all
([
username
==
settings
.
USERNAME
,
password
==
settings
.
PASSWORD
]):
data
=
{
ret
=
{
'id'
:
data
[
'id'
],
'id'
:
data
[
'id'
],
'avatar'
:
settings
.
AVATAR
,
'avatar'
:
settings
.
AVATAR
,
'name'
:
data
[
'username'
],
'name'
:
data
[
'username'
],
...
@@ -102,19 +106,23 @@ class LoginView(APIView):
...
@@ -102,19 +106,23 @@ class LoginView(APIView):
'success'
:
1
,
'success'
:
1
,
}
}
else
:
else
:
data
=
{
ret
=
{
'id'
:
data
[
'id'
],
'id'
:
data
[
'id'
],
'avatar'
:
settings
.
AVATAR
,
'avatar'
:
settings
.
AVATAR
,
'name'
:
''
,
'name'
:
''
,
'session_key'
:
data
[
'session'
],
'session_key'
:
data
[
'session'
],
'success'
:
0
,
'success'
:
0
,
'message'
:
data
[
'message'
]
'message'
:
data
[
'message'
]
,
}
}
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'登陆失败
%
s'
,
e
)
error_logger
.
error
(
u'登陆失败
%
s'
,
e
)
raise
raise
if
data
[
'is_staff'
]:
ret
.
update
({
'roles'
:
[
'staff'
]})
else
:
ret
.
update
({
'roles'
:
[
'anonymous'
]})
return
{
return
{
'data'
:
data
'data'
:
ret
}
}
...
...
This diff is collapsed.
Click to expand it.
api/group.py
View file @
39257d20
...
@@ -52,14 +52,17 @@ class GroupUpdateOrCreate(APIView):
...
@@ -52,14 +52,17 @@ class GroupUpdateOrCreate(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/group/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/group/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'获取
%
d
用户信息失败
%
s'
%
(
id
,
e
))
error_logger
.
error
(
u'获取
%
s
用户信息失败
%
s'
%
(
id
,
e
))
raise
raise
return
data
return
data
def
post
(
self
,
request
):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
)
id
=
request
.
POST
.
get
(
'id'
)
star_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'star'
,
'[]'
))))
star_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'star'
,
'[]'
))))
try
:
group_user_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'group_users'
,
'[]'
))))
group_user_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'group_users'
,
'[]'
))))
except
:
group_user_ids
=
json
.
loads
(
request
.
POST
.
get
(
'group_users'
,
'[]'
))
data
=
{
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
,
''
),
'name'
:
request
.
POST
.
get
(
'name'
,
''
),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
'description'
:
request
.
POST
.
get
(
'description'
,
''
),
...
@@ -73,7 +76,7 @@ class GroupUpdateOrCreate(APIView):
...
@@ -73,7 +76,7 @@ class GroupUpdateOrCreate(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/group/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/sun/group/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'编辑
%
d
用户信息失败
%
s'
%
(
id
,
e
))
error_logger
.
error
(
u'编辑
%
s
用户信息失败
%
s'
%
(
id
,
e
))
raise
raise
return
{
return
{
'message'
:
'更新成功'
'message'
:
'更新成功'
...
...
This diff is collapsed.
Click to expand it.
api/push.py
View file @
39257d20
...
@@ -37,11 +37,14 @@ class PushUpdateOrCreateView(APIView):
...
@@ -37,11 +37,14 @@ class PushUpdateOrCreateView(APIView):
push_time
=
analysis_time
(
request
.
POST
.
get
(
'push_time'
,
0
))
push_time
=
analysis_time
(
request
.
POST
.
get
(
'push_time'
,
0
))
group_topic_id
=
request
.
POST
.
get
(
'group_topic_id'
,
''
)
group_topic_id
=
request
.
POST
.
get
(
'group_topic_id'
,
''
)
full_url
=
request
.
POST
.
get
(
'url'
,
''
)
+
group_topic_id
full_url
=
request
.
POST
.
get
(
'url'
,
''
)
+
group_topic_id
icon
=
request
.
POST
.
get
(
'icon'
,
''
)
if
icon
.
endswith
(
'-w'
):
icon
=
request
.
POST
.
get
(
'icon'
,
''
)[:
-
2
]
data
=
{
data
=
{
'url'
:
full_url
,
'url'
:
full_url
,
'push_time'
:
push_time
,
'push_time'
:
push_time
,
'icon'
:
request
.
POST
.
get
(
'icon'
,
''
)[:
-
2
]
,
'icon'
:
icon
,
'content'
:
request
.
POST
.
get
(
'content'
,
''
),
'content'
:
request
.
POST
.
get
(
'content'
,
''
),
'title'
:
request
.
POST
.
get
(
'title'
,
''
),
'title'
:
request
.
POST
.
get
(
'title'
,
''
),
'creator_id'
:
creator_id
'creator_id'
:
creator_id
...
...
This diff is collapsed.
Click to expand it.
api/topic.py
View file @
39257d20
...
@@ -41,7 +41,6 @@ class TopicUpdateOrCreateView(APIView):
...
@@ -41,7 +41,6 @@ class TopicUpdateOrCreateView(APIView):
def
post
(
self
,
request
):
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
,
''
)
id
=
request
.
POST
.
get
(
'id'
,
''
)
posting_time
=
analysis_time
(
request
.
POST
.
get
(
'posting_time'
,
0
))
posting_time
=
analysis_time
(
request
.
POST
.
get
(
'posting_time'
,
0
))
topic_images
=
list
(
map
(
lambda
x
:
x
[:
-
2
],
json
.
loads
(
request
.
POST
.
get
(
'topic_images'
,
[]))))
topic_images
=
list
(
map
(
lambda
x
:
x
[:
-
2
],
json
.
loads
(
request
.
POST
.
get
(
'topic_images'
,
[]))))
tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'tags'
,
'[]'
))))
tag_ids
=
list
(
map
(
lambda
x
:
x
.
split
(
':'
)[
0
],
json
.
loads
(
request
.
POST
.
get
(
'tags'
,
'[]'
))))
...
@@ -73,7 +72,7 @@ class ReplyUpdateOrCreateView(APIView):
...
@@ -73,7 +72,7 @@ class ReplyUpdateOrCreateView(APIView):
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
offset
=
int
(
request
.
GET
.
get
(
'page'
,
0
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
filter
.
update
({
'topic_id'
:
id
,
'is_online'
:
1
})
filter
.
update
({
'topic_id'
:
id
})
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/topic/reply/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/topic/reply/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
...
@@ -95,6 +94,7 @@ class ReplyUpdateOrCreateView(APIView):
...
@@ -95,6 +94,7 @@ class ReplyUpdateOrCreateView(APIView):
class
ReplyCreate
(
APIView
):
class
ReplyCreate
(
APIView
):
def
post
(
self
,
request
):
def
post
(
self
,
request
):
request
.
POST
.
get
(
'be_replied_id'
,
None
)
data
=
{
data
=
{
'user_id'
:
request
.
POST
.
get
(
'user_id'
)
.
split
(
':'
)[
0
],
'user_id'
:
request
.
POST
.
get
(
'user_id'
)
.
split
(
':'
)[
0
],
'replied_id'
:
request
.
POST
.
get
(
"replied_id"
,
None
),
'replied_id'
:
request
.
POST
.
get
(
"replied_id"
,
None
),
...
...
This diff is collapsed.
Click to expand it.
api/user.py
View file @
39257d20
...
@@ -32,7 +32,7 @@ class UserUpdateOrCreate(APIView):
...
@@ -32,7 +32,7 @@ class UserUpdateOrCreate(APIView):
try
:
try
:
data
=
self
.
rpc
[
'venus/sun/user/get'
](
id
=
id
)
.
unwrap
()
data
=
self
.
rpc
[
'venus/sun/user/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'获取
%
d
用户详情失败
%
s'
%
(
id
,
e
))
error_logger
.
error
(
u'获取
%
s
用户详情失败
%
s'
%
(
id
,
e
))
raise
raise
return
data
return
data
...
@@ -59,7 +59,7 @@ class UserUpdateOrCreate(APIView):
...
@@ -59,7 +59,7 @@ class UserUpdateOrCreate(APIView):
try
:
try
:
self
.
rpc
[
'venus/sun/user/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
self
.
rpc
[
'venus/sun/user/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
except
Exception
as
e
:
error_logger
.
error
(
u'创建/编辑
%
d
用户详情失败
%
s'
%
(
id
,
e
))
error_logger
.
error
(
u'创建/编辑
%
s
用户详情失败
%
s'
%
(
id
,
e
))
raise
raise
return
{
return
{
'message'
:
'更新成功'
'message'
:
'更新成功'
...
...
This diff is collapsed.
Click to expand it.
utils/time_utils.py
View file @
39257d20
...
@@ -54,7 +54,7 @@ def analysis_time(time):
...
@@ -54,7 +54,7 @@ def analysis_time(time):
:return:
:return:
"""
"""
try
:
try
:
target_time
=
unix_time_to_datetime
(
int
(
time
)
/
1000
)
target_time
=
unix_time_to_datetime
(
int
(
float
(
time
)
)
/
1000
)
except
ValueError
:
except
ValueError
:
target_time
=
utc_to_datetime
(
time
[:
-
5
]
+
'Z'
)
target_time
=
utc_to_datetime
(
time
[:
-
5
]
+
'Z'
)
...
...
This diff is collapsed.
Click to expand it.
vu/src/permission.js
View file @
39257d20
...
@@ -26,7 +26,7 @@ router.beforeEach((to, from, next) => {
...
@@ -26,7 +26,7 @@ router.beforeEach((to, from, next) => {
}
else
{
}
else
{
if
(
store
.
getters
.
roles
.
length
===
0
)
{
// 判断当前用户是否已拉取完user_info信息
if
(
store
.
getters
.
roles
.
length
===
0
)
{
// 判断当前用户是否已拉取完user_info信息
store
.
dispatch
(
'GetUserInfo'
).
then
(
res
=>
{
// 拉取user_info
store
.
dispatch
(
'GetUserInfo'
).
then
(
res
=>
{
// 拉取user_info
const
roles
=
res
.
data
.
roles
// note: roles must be a array! such as: ['editor','develop']
const
roles
=
res
.
data
.
data
.
data
.
roles
// note: roles must be a array! such as: ['editor','develop']
store
.
dispatch
(
'GenerateRoutes'
,
{
roles
}).
then
(()
=>
{
// 根据roles权限生成可访问的路由表
store
.
dispatch
(
'GenerateRoutes'
,
{
roles
}).
then
(()
=>
{
// 根据roles权限生成可访问的路由表
router
.
addRoutes
(
store
.
getters
.
addRouters
)
// 动态添加可访问路由表
router
.
addRoutes
(
store
.
getters
.
addRouters
)
// 动态添加可访问路由表
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
next
({
...
to
,
replace
:
true
})
// hack方法 确保addRoutes已完成 ,set the replace: true so the navigation will not leave a history record
...
...
This diff is collapsed.
Click to expand it.
vu/src/router/modules/account.js
View file @
39257d20
...
@@ -9,14 +9,16 @@ const AccountRouter = {
...
@@ -9,14 +9,16 @@ const AccountRouter = {
name
:
'Account'
,
name
:
'Account'
,
meta
:
{
meta
:
{
title
:
'账号管理'
,
title
:
'账号管理'
,
icon
:
'component'
icon
:
'component'
,
roles
:
[
'staff'
]
},
},
children
:
[
children
:
[
{
{
path
:
'list'
,
path
:
'list'
,
component
:
()
=>
import
(
'@/views/account/list'
),
component
:
()
=>
import
(
'@/views/account/list'
),
name
:
'AccountList'
,
name
:
'AccountList'
,
meta
:
{
title
:
'账户列表'
,
icon
:
'list'
}
meta
:
{
title
:
'账户列表'
,
icon
:
'list'
}
},
},
{
{
path
:
'create'
,
path
:
'create'
,
...
...
This diff is collapsed.
Click to expand it.
vu/src/router/modules/group.js
View file @
39257d20
...
@@ -9,7 +9,8 @@ const GroupRouter = {
...
@@ -9,7 +9,8 @@ const GroupRouter = {
name
:
'Group'
,
name
:
'Group'
,
meta
:
{
meta
:
{
title
:
'小组管理'
,
title
:
'小组管理'
,
icon
:
'component'
icon
:
'component'
,
roles
:
[
'staff'
]
},
},
children
:
[
children
:
[
{
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/router/modules/pick.js
View file @
39257d20
...
@@ -9,7 +9,8 @@ const PickRouter = {
...
@@ -9,7 +9,8 @@ const PickRouter = {
name
:
'Pick'
,
name
:
'Pick'
,
meta
:
{
meta
:
{
title
:
'Pick管理'
,
title
:
'Pick管理'
,
icon
:
'component'
icon
:
'component'
,
roles
:
[
'staff'
]
},
},
children
:
[
children
:
[
{
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/router/modules/push.js
View file @
39257d20
...
@@ -9,7 +9,8 @@ const PushRouter = {
...
@@ -9,7 +9,8 @@ const PushRouter = {
name
:
'Push'
,
name
:
'Push'
,
meta
:
{
meta
:
{
title
:
'Push管理'
,
title
:
'Push管理'
,
icon
:
'component'
icon
:
'component'
,
roles
:
[
'staff'
]
},
},
children
:
[
children
:
[
{
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/router/modules/star.js
View file @
39257d20
...
@@ -9,7 +9,8 @@ const StarRouter = {
...
@@ -9,7 +9,8 @@ const StarRouter = {
name
:
'Star'
,
name
:
'Star'
,
meta
:
{
meta
:
{
title
:
'明星管理'
,
title
:
'明星管理'
,
icon
:
'component'
icon
:
'component'
,
roles
:
[
'staff'
]
},
},
children
:
[
children
:
[
{
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/router/modules/tag.js
View file @
39257d20
...
@@ -7,7 +7,8 @@ const TagRouter = {
...
@@ -7,7 +7,8 @@ const TagRouter = {
name
:
'Tag'
,
name
:
'Tag'
,
meta
:
{
meta
:
{
title
:
'标签管理'
,
title
:
'标签管理'
,
icon
:
'component'
icon
:
'component'
,
roles
:
[
'staff'
,
'anonymous'
]
},
},
children
:
[
children
:
[
{
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/router/modules/topic.js
View file @
39257d20
...
@@ -9,7 +9,8 @@ const TopicRouter = {
...
@@ -9,7 +9,8 @@ const TopicRouter = {
name
:
'Topic'
,
name
:
'Topic'
,
meta
:
{
meta
:
{
title
:
'帖子管理'
,
title
:
'帖子管理'
,
icon
:
'component'
icon
:
'component'
,
roles
:
[
'staff'
,
'anonymous'
]
},
},
children
:
[
children
:
[
{
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/router/modules/user.js
View file @
39257d20
...
@@ -9,7 +9,8 @@ const GroupRouter = {
...
@@ -9,7 +9,8 @@ const GroupRouter = {
name
:
'User'
,
name
:
'User'
,
meta
:
{
meta
:
{
title
:
'用户管理'
,
title
:
'用户管理'
,
icon
:
'component'
icon
:
'component'
,
roles
:
[
'staff'
,
'anonymous'
]
},
},
children
:
[
children
:
[
{
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/store/modules/permission.js
View file @
39257d20
...
@@ -48,14 +48,16 @@ const permission = {
...
@@ -48,14 +48,16 @@ const permission = {
actions
:
{
actions
:
{
GenerateRoutes
({
commit
},
data
)
{
GenerateRoutes
({
commit
},
data
)
{
return
new
Promise
(
resolve
=>
{
return
new
Promise
(
resolve
=>
{
// const { roles } = data
const
{
roles
}
=
data
// const accessedRouters = asyncRouterMap
let
accessedRouters
// if (roles.includes('admin')) {
if
(
roles
.
includes
(
'staff'
))
{
// accessedRouters = asyncRouterMap
accessedRouters
=
asyncRouterMap
// } else {
console
.
log
(
accessedRouters
,
'-----'
)
// accessedRouters = filterAsyncRouter(asyncRouterMap, roles)
}
else
{
// }
accessedRouters
=
filterAsyncRouter
(
asyncRouterMap
,
roles
)
commit
(
'SET_ROUTERS'
,
asyncRouterMap
)
console
.
log
(
accessedRouters
)
}
commit
(
'SET_ROUTERS'
,
accessedRouters
)
resolve
()
resolve
()
})
})
}
}
...
...
This diff is collapsed.
Click to expand it.
vu/src/store/modules/user.js
View file @
39257d20
...
@@ -83,7 +83,7 @@ const user = {
...
@@ -83,7 +83,7 @@ const user = {
reject
(
'error'
)
reject
(
'error'
)
}
}
const
data
=
response
.
data
.
data
.
data
const
data
=
response
.
data
.
data
.
data
data
.
roles
=
[
'admin'
]
//
data.roles = ['admin']
if
(
data
.
roles
&&
data
.
roles
.
length
>
0
)
{
// 验证返回的roles是否是一个非空数组
if
(
data
.
roles
&&
data
.
roles
.
length
>
0
)
{
// 验证返回的roles是否是一个非空数组
commit
(
'SET_ROLES'
,
data
.
roles
)
commit
(
'SET_ROLES'
,
data
.
roles
)
}
else
{
}
else
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/views/dashboard/index.vue
View file @
39257d20
...
@@ -23,8 +23,8 @@ export default {
...
@@ -23,8 +23,8 @@ export default {
])
])
},
},
created
()
{
created
()
{
if
(
!
this
.
roles
.
includes
(
'
admin
'
))
{
if
(
!
this
.
roles
.
includes
(
'
staff
'
))
{
this
.
currentRole
=
'
editor
Dashboard'
this
.
currentRole
=
'
admin
Dashboard'
}
}
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
vu/src/views/group/list.vue
View file @
39257d20
...
@@ -48,17 +48,21 @@
...
@@ -48,17 +48,21 @@
<el-table-column
align=
"center"
label=
"用户数"
>
<el-table-column
align=
"center"
label=
"用户数"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<router-link
:to=
"
{path: '/user/list/', query: {group_id: scope.row.id}}" class="link-type">
<router-link
:to=
"
{path: '/user/list/', query: {group_id: scope.row.id}}" class="link-type"
v-if="this.adminRole"
>
<span>
{{
scope
.
row
.
user_nums
}}
</span>
<span>
{{
scope
.
row
.
user_nums
}}
</span>
</router-link>
</router-link>
<span
v-else
>
{{
scope
.
row
.
user_nums
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
<el-table-column
align=
"center"
label=
"帖子数"
>
<el-table-column
align=
"center"
label=
"帖子数"
>
<
template
slot-scope=
"scope"
>
<
template
slot-scope=
"scope"
>
<router-link
:to=
"
{path: '/topic/list/', query: {group_id: scope.row.id}}" class="link-type">
<router-link
:to=
"
{path: '/topic/list/', query: {group_id: scope.row.id}}" class="link-type"
v-if="this.adminRole"
>
<span>
{{
scope
.
row
.
topic_nums
}}
</span>
<span>
{{
scope
.
row
.
topic_nums
}}
</span>
</router-link>
</router-link>
<span
v-else
>
{{
scope
.
row
.
topic_nums
}}
</span>
</
template
>
</
template
>
</el-table-column>
</el-table-column>
...
@@ -89,6 +93,7 @@
...
@@ -89,6 +93,7 @@
</template>
</template>
<
script
>
<
script
>
import
{
mapGetters
}
from
'vuex'
import
{
fetchList
,
OffLineOrOnLine
}
from
'@/api/group'
import
{
fetchList
,
OffLineOrOnLine
}
from
'@/api/group'
import
Pagination
from
'@/components/Pagination'
// Secondary package based on el-pagination
import
Pagination
from
'@/components/Pagination'
// Secondary package based on el-pagination
import
waves
from
'@/directive/waves'
import
waves
from
'@/directive/waves'
...
@@ -104,15 +109,12 @@ export default {
...
@@ -104,15 +109,12 @@ export default {
0
:
'info'
,
0
:
'info'
,
}
}
return
statusMap
[
status
]
return
statusMap
[
status
]
},
genderFilter
(
status
)
{
const
statusMap
=
{
'男'
:
'success'
,
'女'
:
'info'
,
'全部'
:
'danger'
}
}
return
statusMap
[
status
]
},
},
computed
:
{
...
mapGetters
([
'roles'
])
},
},
data
()
{
data
()
{
return
{
return
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/views/tag/list.vue
View file @
39257d20
...
@@ -131,6 +131,10 @@ export default {
...
@@ -131,6 +131,10 @@ export default {
},
},
handleFilter
()
{
handleFilter
()
{
this
.
listQuery
.
offset
=
1
this
.
listQuery
.
offset
=
1
if
(
this
.
listQuery
.
filter
.
key
==
'id'
&&
!
/^
\d
+$/
.
test
(
this
.
listQuery
.
filter
.
value
)){
this
.
$message
.
error
(
"搜索条件不合法, 重新输入"
)
return
false
;
}
this
.
getList
()
this
.
getList
()
},
},
handleCreate
()
{
handleCreate
()
{
...
...
This diff is collapsed.
Click to expand it.
vu/src/views/topic/components/TopicDetail.vue
View file @
39257d20
...
@@ -407,6 +407,7 @@
...
@@ -407,6 +407,7 @@
temp
:
{
temp
:
{
user_id
:
''
,
user_id
:
''
,
content
:
''
,
content
:
''
,
be_replied_id
:
''
,
},
},
dialogFormVisible
:
false
,
dialogFormVisible
:
false
,
dialogStatus
:
''
,
dialogStatus
:
''
,
...
@@ -675,11 +676,13 @@
...
@@ -675,11 +676,13 @@
this
.
temp
=
{
this
.
temp
=
{
user_id
:
''
,
user_id
:
''
,
content
:
''
,
content
:
''
,
be_replied_id
:
''
,
}
}
},
},
reply
(
row
)
{
reply
(
row
)
{
this
.
resetTemp
()
this
.
resetTemp
()
if
(
row
){
if
(
row
){
// this.temp.be_replied_id = row.be_reply_user.id
this
.
temp
.
replied_id
=
row
.
id
this
.
temp
.
replied_id
=
row
.
id
}
}
this
.
dialogStatus
=
'create'
this
.
dialogStatus
=
'create'
...
...
This diff is collapsed.
Click to expand it.
vu/src/views/user/components/UserDetail.vue
View file @
39257d20
...
@@ -45,7 +45,8 @@
...
@@ -45,7 +45,8 @@
</el-row>
</el-row>
<el-row>
<el-row>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"75px"
label=
"用户名:"
prop=
"nick_name"
>
<el-form-item
style=
"margin-bottom: 20px;"
label-width=
"75px"
label=
"*用户名:"
prop=
"nick_name"
>
<el-input
v-model=
"postForm.nick_name"
type=
"text"
style=
"width: 230px"
/>
<el-input
v-model=
"postForm.nick_name"
type=
"text"
style=
"width: 230px"
/>
</el-form-item>
</el-form-item>
</el-col>
</el-col>
...
@@ -70,7 +71,7 @@
...
@@ -70,7 +71,7 @@
</el-row>
</el-row>
<el-row>
<el-row>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label-width=
"75px"
label=
"性别:"
prop=
"gender"
>
<el-form-item
label-width=
"75px"
label=
"
*
性别:"
prop=
"gender"
>
<el-select
v-model=
"postForm.gender"
:placeholder=
"'性别:'"
clearable
<el-select
v-model=
"postForm.gender"
:placeholder=
"'性别:'"
clearable
class=
"postInfo-container-item"
class=
"postInfo-container-item"
style=
"width: 230px"
>
style=
"width: 230px"
>
...
@@ -80,7 +81,7 @@
...
@@ -80,7 +81,7 @@
</el-form-item>
</el-form-item>
</el-col>
</el-col>
<el-col
:span=
"12"
>
<el-col
:span=
"12"
>
<el-form-item
label-width=
"75px"
label=
"城市:"
>
<el-form-item
label-width=
"75px"
label=
"
*
城市:"
>
<el-select
v-model=
"city"
:remote-method=
"getRemoteCityList"
filterable
remote
clearable
<el-select
v-model=
"city"
:remote-method=
"getRemoteCityList"
filterable
remote
clearable
value-key=
"id"
value-key=
"id"
placeholder=
"搜索城市"
style=
"width: 230px"
>
placeholder=
"搜索城市"
style=
"width: 230px"
>
...
@@ -125,7 +126,7 @@
...
@@ -125,7 +126,7 @@
</el-row>
</el-row>
<div
style=
"margin-bottom: 20px;"
>
<div
style=
"margin-bottom: 20px;"
>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"
75px"
label=
"
用户头像:"
prop=
"avatar"
>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"
85px"
label=
"*
用户头像:"
prop=
"avatar"
>
<span
v-model=
"uploadType"
></span>
<span
v-model=
"uploadType"
></span>
<Upload
v-model=
"postForm.avatar"
:uploadType=
"uploadType"
/>
<Upload
v-model=
"postForm.avatar"
:uploadType=
"uploadType"
/>
</el-form-item>
</el-form-item>
...
@@ -160,6 +161,7 @@
...
@@ -160,6 +161,7 @@
password
:
''
,
password
:
''
,
avatar
:
''
,
avatar
:
''
,
nick_name
:
''
,
nick_name
:
''
,
gender
:
''
,
tags
:
[],
tags
:
[],
is_puppet
:
1
,
is_puppet
:
1
,
...
@@ -248,6 +250,7 @@
...
@@ -248,6 +250,7 @@
this
.
loading
=
false
this
.
loading
=
false
return
false
return
false
}
}
console
.
log
(
this
.
postForm
.
gender
)
if
(
this
.
postForm
.
gender
===
''
){
if
(
this
.
postForm
.
gender
===
''
){
this
.
$message
.
error
(
'性别必填~'
)
this
.
$message
.
error
(
'性别必填~'
)
this
.
loading
=
false
this
.
loading
=
false
...
...
This diff is collapsed.
Click to expand it.
vu/src/views/user/list.vue
View file @
39257d20
...
@@ -110,6 +110,7 @@
...
@@ -110,6 +110,7 @@
import
{
fetchList
,
OffLineOrOnLine
}
from
'@/api/user'
import
{
fetchList
,
OffLineOrOnLine
}
from
'@/api/user'
import
Pagination
from
'@/components/Pagination'
// Secondary package based on el-pagination
import
Pagination
from
'@/components/Pagination'
// Secondary package based on el-pagination
import
waves
from
'@/directive/waves'
import
waves
from
'@/directive/waves'
import
{
mapGetters
}
from
'vuex'
export
default
{
export
default
{
name
:
'UserList'
,
name
:
'UserList'
,
...
@@ -134,6 +135,7 @@
...
@@ -134,6 +135,7 @@
directives
:
{
waves
},
directives
:
{
waves
},
data
()
{
data
()
{
return
{
return
{
adminRole
:
true
,
list
:
null
,
list
:
null
,
total
:
0
,
total
:
0
,
listLoading
:
true
,
listLoading
:
true
,
...
@@ -174,6 +176,11 @@
...
@@ -174,6 +176,11 @@
created
()
{
created
()
{
this
.
getList
()
this
.
getList
()
},
},
computed
:
{
...
mapGetters
([
'roles'
])
},
methods
:
{
methods
:
{
getList
()
{
getList
()
{
this
.
listLoading
=
true
this
.
listLoading
=
true
...
...
This diff is collapsed.
Click to expand it.
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