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
ca033122
Commit
ca033122
authored
Dec 17, 2018
by
Davve
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加标签类型
parent
cf0a6d09
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
541 additions
and
43 deletions
+541
-43
search.py
api/search.py
+13
-0
tag.py
api/tag.py
+60
-1
topic.py
api/topic.py
+1
-0
urls.py
api/urls.py
+13
-6
settings_local.py.bak
sun/settings_local.py.bak
+0
-4
remoteSearch.js
vu/src/api/remoteSearch.js
+8
-0
tagtype.js
vu/src/api/tagtype.js
+33
-0
tag.js
vu/src/router/modules/tag.js
+21
-1
TagDetail.vue
vu/src/views/tag/components/TagDetail.vue
+27
-29
list.vue
vu/src/views/tag/list.vue
+1
-1
TagTypeDetail.vue
vu/src/views/tag_type/components/TagTypeDetail.vue
+170
-0
create.vue
vu/src/views/tag_type/create.vue
+13
-0
edit.vue
vu/src/views/tag_type/edit.vue
+13
-0
list.vue
vu/src/views/tag_type/list.vue
+159
-0
TopicDetail.vue
vu/src/views/topic/components/TopicDetail.vue
+9
-1
No files found.
api/search.py
View file @
ca033122
...
...
@@ -89,3 +89,15 @@ class TopicSearchView(APIView):
return
{
'data'
:
[
'{id}:{name}'
.
format
(
id
=
search_data
[
'id'
],
name
=
search_data
[
'name'
])
for
search_data
in
data
]
}
class
TagTypeSearchView
(
APIView
):
def
get
(
self
,
request
):
name
=
request
.
GET
.
get
(
'name'
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag/tagtype_search'
](
name
=
name
)
.
unwrap
()
except
Exception
as
e
:
raise
e
return
{
'data'
:
[
'{id}:{name}'
.
format
(
id
=
search_data
[
'id'
],
name
=
search_data
[
'name'
])
for
search_data
in
data
]
}
\ No newline at end of file
api/tag.py
View file @
ca033122
...
...
@@ -56,12 +56,13 @@ class TagUpdateOrCreateView(APIView):
id
=
request
.
POST
.
get
(
'id'
)
down_tags
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'down_tags'
,
'[]'
))))))
up_tags
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'up_tags'
,
'[]'
))))))
tagtypes
=
list
(
set
(
map
(
lambda
x
:
x
.
split
(
":"
)[
0
],
json
.
loads
((
request
.
POST
.
get
(
'tagtypes'
,
'[]'
))))))
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
),
'description'
:
request
.
POST
.
get
(
'description'
),
'down_tags'
:
down_tags
,
'up_tags'
:
up_tags
,
'tagtypes'
:
tagtypes
,
}
try
:
data
=
self
.
rpc
[
'venus/sun/tag/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
@@ -69,3 +70,60 @@ class TagUpdateOrCreateView(APIView):
error_logger
.
error
(
u'创建/编辑标签
%
d信息失败
%
s'
%
(
id
,
e
))
raise
return
data
class
TagTypeListView
(
APIView
):
def
get
(
self
,
request
):
offset
=
int
(
request
.
GET
.
get
(
'offset'
,
1
))
limit
=
int
(
request
.
GET
.
get
(
'limit'
,
10
))
filter
=
self
.
handle_filter
(
request
.
GET
.
get
(
'filter'
,
""
))
try
:
data
=
self
.
rpc
[
'venus/sun/tag/tagtype/list'
](
offset
=
(
offset
-
1
)
*
limit
,
limit
=
limit
,
filters
=
filter
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取标签类型列表失败
%
s'
,
e
)
raise
return
data
def
post
(
self
,
request
):
ids
=
request
.
POST
.
get
(
'ids'
,
''
)
.
split
()
update
=
int
(
request
.
POST
.
get
(
'update'
,
''
))
updates
=
{
'is_online'
:
bool
(
update
)
}
try
:
self
.
rpc
[
'venus/sun/tag/tagtype/batch/update'
](
updates
=
updates
,
ids
=
ids
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'批量更新标签类型列表失败
%
s'
,
e
)
raise
return
{
"message"
:
"更新成功"
}
class
TagTypeUpdateOrCreateView
(
APIView
):
def
get
(
self
,
request
):
id
=
request
.
GET
.
get
(
'id'
)
try
:
data
=
self
.
rpc
[
'venus/sun/tag/tagtype/get'
](
id
=
id
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'获取标签
%
d信息失败
%
s'
%
(
id
,
e
))
raise
if
not
data
:
data
=
{}
else
:
pass
return
{
'data'
:
data
}
def
post
(
self
,
request
):
id
=
request
.
POST
.
get
(
'id'
)
data
=
{
'name'
:
request
.
POST
.
get
(
'name'
),
}
try
:
data
=
self
.
rpc
[
'venus/sun/tag/tagtype/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
except
Exception
as
e
:
error_logger
.
error
(
u'创建/编辑标签类型
%
d信息失败
%
s'
%
(
id
,
e
))
raise
return
data
\ No newline at end of file
api/topic.py
View file @
ca033122
...
...
@@ -53,6 +53,7 @@ class TopicUpdateOrCreateView(APIView):
'star_id'
:
request
.
POST
.
get
(
'star'
,
''
)
.
split
(
':'
)[
0
],
'tag_ids'
:
tag_ids
,
'is_online'
:
int
(
request
.
POST
.
get
(
'is_online'
)),
'drop_score'
:
int
(
request
.
POST
.
get
(
'drop_score'
)),
}
try
:
self
.
rpc
[
'venus/sun/topic/edit'
](
id
=
id
,
data
=
data
)
.
unwrap
()
...
...
api/urls.py
View file @
ca033122
...
...
@@ -87,6 +87,12 @@ urlpatterns = [
url
(
r'^tag/create$'
,
TagUpdateOrCreateView
.
as_view
()),
url
(
r'^tag/detail$'
,
TagUpdateOrCreateView
.
as_view
()),
# 标签类型相关
url
(
r'^tag/tagtype/list$'
,
TagTypeListView
.
as_view
()),
url
(
r'^tag/tagtype/list/update$'
,
TagTypeListView
.
as_view
()),
url
(
r'^tag/tagtype/create$'
,
TagTypeUpdateOrCreateView
.
as_view
()),
url
(
r'^tag/tagtype/detail$'
,
TagTypeUpdateOrCreateView
.
as_view
()),
url
(
r'^face/star/create$'
,
FaceStarEdit
.
as_view
()),
url
(
r'^face/star/list$'
,
StarListView
.
as_view
()),
url
(
r'^face/star/list/update$'
,
StarListView
.
as_view
()),
...
...
@@ -95,12 +101,13 @@ urlpatterns = [
search_urlpatterns
=
[
url
(
r'search/group$'
,
GroupSearchView
.
as_view
()),
url
(
r'search/country'
,
CountrySearchView
.
as_view
()),
url
(
r'search/user'
,
UserSearchView
.
as_view
()),
url
(
r'search/tag'
,
TagSearchView
.
as_view
()),
url
(
r'search/celebrity'
,
CelebritySearchView
.
as_view
()),
url
(
r'search/city'
,
CitySearchView
.
as_view
()),
url
(
r'search/topic'
,
TopicSearchView
.
as_view
()),
url
(
r'search/country$'
,
CountrySearchView
.
as_view
()),
url
(
r'search/user$'
,
UserSearchView
.
as_view
()),
url
(
r'search/tag$'
,
TagSearchView
.
as_view
()),
url
(
r'search/celebrity$'
,
CelebritySearchView
.
as_view
()),
url
(
r'search/city$'
,
CitySearchView
.
as_view
()),
url
(
r'search/topic$'
,
TopicSearchView
.
as_view
()),
url
(
r'search/tagtype$'
,
TagTypeSearchView
.
as_view
()),
]
common_urlpatterns
=
[
...
...
sun/settings_local.py.bak
deleted
100644 → 0
View file @
cf0a6d09
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2018/11/15
vu/src/api/remoteSearch.js
View file @
ca033122
...
...
@@ -63,3 +63,11 @@ export function topicSearch(name) {
params
:
{
name
}
})
}
export
function
tagTypeSearch
(
name
)
{
return
request
({
url
:
'api/search/tagtype'
,
method
:
'get'
,
params
:
{
name
}
})
}
vu/src/api/tagtype.js
0 → 100644
View file @
ca033122
import
request
from
'@/utils/request'
export
function
fetchList
(
query
)
{
return
request
({
url
:
'/api/tag/tagtype/list'
,
method
:
'get'
,
params
:
query
})
}
export
function
OffLineOrOnLine
(
data
)
{
return
request
({
url
:
'/api/tag/tagtype/list/update'
,
method
:
'post'
,
data
})
}
export
function
CreateTagType
(
data
)
{
return
request
({
url
:
'/api/tag/tagtype/create'
,
method
:
'post'
,
data
})
}
export
function
fetchTagTypeDetail
(
id
)
{
return
request
({
url
:
'/api/tag/tagtype/detail'
,
method
:
'get'
,
params
:
{
id
}
})
}
vu/src/router/modules/tag.js
View file @
ca033122
...
...
@@ -29,7 +29,27 @@ const TagRouter = {
name
:
'EditTag'
,
meta
:
{
title
:
'编辑标签'
,
noCache
:
true
},
hidden
:
true
}
},
{
path
:
'tagtype/list'
,
component
:
()
=>
import
(
'@/views/tag_type/list'
),
name
:
'TagTypeList'
,
meta
:
{
title
:
'标签类型列表'
,
icon
:
'list'
}
},
{
path
:
'tagtype/create'
,
component
:
()
=>
import
(
'@/views/tag_type/create'
),
name
:
'CreateTagType'
,
meta
:
{
title
:
'创建标签类型'
,
icon
:
'edit'
},
hidden
:
true
},
{
path
:
'tagtype/edit/:id(
\\
d+)'
,
component
:
()
=>
import
(
'@/views/tag_type/edit'
),
name
:
'EditTagType'
,
meta
:
{
title
:
'编辑标签类型'
,
noCache
:
true
},
hidden
:
true
},
]
}
...
...
vu/src/views/tag/components/TagDetail.vue
View file @
ca033122
...
...
@@ -71,6 +71,18 @@
</el-form-item>
</el-col>
</el-row>
<el-row>
<el-col
:span=
"12"
>
<el-form-item
label-width=
"75px"
label=
"标签类型:"
class=
"postInfo-container-item"
>
<el-select
v-model=
"tagtypes"
:remote-method=
"getRemoteTagTypeList"
filterable
remote
multiple
value-key=
"id"
placeholder=
"搜索类型"
style=
"width: 70%"
>
<el-option
v-for=
"(item,index) in TagTypeListOptions"
:key=
"item+index"
:label=
"item"
:value=
"item"
/>
</el-select>
</el-form-item>
</el-col>
</el-row>
<el-form-item
style=
"margin-bottom: 40px;"
label-width=
"75px"
label=
"标签简介:"
prop=
"desc"
>
<el-input
:rows=
"1"
v-model=
"postForm.description"
type=
"textarea"
class=
"article-textarea"
autosize
placeholder=
"请输入内容"
/>
...
...
@@ -86,31 +98,9 @@
import
MDinput
from
'@/components/MDinput'
import
Sticky
from
'@/components/Sticky'
// 粘性header组件
import
{
fetchTagDetail
,
CreateTag
}
from
'@/api/tag'
import
{
tagSearch
}
from
'@/api/remoteSearch'
import
{
isInArray
,
removeByvale
}
from
"@/utils"
;
import
{
tagSearch
,
tagTypeSearch
}
from
'@/api/remoteSearch'
import
{
isInArray
}
from
"@/utils"
;
function
Assembledata
(
target
,
source
)
{
var
region_data
=
[]
for
(
var
i
=
0
;
i
<
target
.
length
;
i
++
)
{
if
(
isInArray
(
source
,
target
[
i
][
'name'
]))
{
region_data
.
push
(
target
[
i
][
'id'
])
removeByvale
(
source
,
target
[
i
][
'name'
]);
}
}
region_data
.
push
(...
source
)
return
region_data
.
join
(
','
)
}
function
removeNull
(
parkingList
)
{
for
(
let
i
=
0
;
i
<
parkingList
.
length
;
i
++
)
{
if
(
parkingList
[
i
]
==
''
||
parkingList
[
i
]
==
null
||
typeof
(
parkingList
[
i
])
==
undefined
)
{
parkingList
.
splice
(
i
,
1
);
i
=
i
-
1
;
}
}
return
parkingList
}
const
defaultForm
=
{
status
:
'draft'
,
...
...
@@ -118,6 +108,7 @@
description
:
''
,
up_tags
:
[],
down_tags
:
[],
tagtypes
:
[],
}
export
default
{
...
...
@@ -146,16 +137,14 @@
postForm
:
Object
.
assign
({},
defaultForm
),
loading
:
false
,
TagListOptions
:
[],
TagTypeListOptions
:
[],
up_tags
:
[],
down_tags
:
[],
tagtypes
:
[],
rules
:
{
name
:
[{
validator
:
validateRequire
,
trigger
:
'blur'
}],
},
tempRoute
:
{},
temparray
:
{
'up_tags'
:
[],
'down_tags'
:
[],
}
}
},
computed
:
{
...
...
@@ -184,6 +173,9 @@
for
(
let
i
=
0
;
i
<
rep
.
down_tags
.
length
;
i
++
)
{
this
.
down_tags
.
push
(
rep
.
down_tags
[
i
][
'id'
]
+
':'
+
rep
.
down_tags
[
i
][
'name'
])
}
for
(
let
i
=
0
;
i
<
rep
.
tagtypes
.
length
;
i
++
){
this
.
tagtypes
.
push
(
rep
.
tagtypes
[
i
][
'id'
]
+
':'
+
rep
.
tagtypes
[
i
][
'name'
])
}
this
.
postForm
=
rep
}).
catch
(
err
=>
{
console
.
log
(
err
)
...
...
@@ -209,8 +201,8 @@
}
this
.
postForm
.
up_tags
=
JSON
.
stringify
(
this
.
up_tags
)
this
.
postForm
.
down_tags
=
JSON
.
stringify
(
this
.
down_tags
);
this
.
postForm
.
tagtypes
=
JSON
.
stringify
(
this
.
tagtypes
);
CreateTag
(
this
.
postForm
).
then
(
response
=>
{
console
.
log
()
if
(
response
.
data
.
data
.
code
==
500
)
{
this
.
$notify
({
title
:
'失败'
,
...
...
@@ -255,6 +247,12 @@
this
.
TagListOptions
=
response
.
data
.
data
.
data
})
},
getRemoteTagTypeList
(
query
)
{
tagTypeSearch
(
query
).
then
(
response
=>
{
if
(
!
response
.
data
.
data
.
data
)
return
this
.
TagTypeListOptions
=
response
.
data
.
data
.
data
})
}
}
}
</
script
>
...
...
vu/src/views/tag/list.vue
View file @
ca033122
...
...
@@ -30,7 +30,7 @@
</el-table-column>
<el-table-column
align=
"center"
label=
"
下
线"
>
<el-table-column
align=
"center"
label=
"
是否在
线"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"scope.row.is_online | isOnlineFilter"
>
{{
scope
.
row
.
is_online
==
1
?
'是'
:
'否'
}}
</el-tag>
</
template
>
...
...
vu/src/views/tag_type/components/TagTypeDetail.vue
0 → 100644
View file @
ca033122
<
template
>
<div
class=
"createPost-container"
>
<el-form
ref=
"postForm"
:model=
"postForm"
:rules=
"rules"
class=
"form-container"
>
<sticky
:class-name=
"'sub-navbar'"
>
<el-button
v-loading=
"loading"
style=
"margin-left: 10px;"
type=
"success"
@
click=
"submitForm"
>
保存
</el-button>
</sticky>
<div
class=
"createPost-main-container"
>
<el-row>
<el-col
:span=
"24"
>
<el-form-item
style=
"margin-bottom: 40px;"
prop=
"name"
>
<MDinput
v-model=
"postForm.name"
:maxlength=
"100"
name=
"name"
required
>
标签类型名称
</MDinput>
</el-form-item>
</el-col>
</el-row>
<el-row>
</el-row>
</div>
</el-form>
</div>
</
template
>
<
script
>
import
MDinput
from
'@/components/MDinput'
import
Sticky
from
'@/components/Sticky'
// 粘性header组件
import
{
fetchTagTypeDetail
,
CreateTagType
}
from
'@/api/tagtype'
import
{
tagSearch
}
from
'@/api/remoteSearch'
import
{
isInArray
,
removeByvale
}
from
"@/utils"
;
const
defaultForm
=
{
status
:
'draft'
,
name
:
''
,
}
export
default
{
name
:
'TagTypeDetail'
,
components
:
{
MDinput
,
Sticky
},
props
:
{
isEdit
:
{
type
:
Boolean
,
default
:
false
}
},
data
()
{
const
validateRequire
=
(
rule
,
value
,
callback
)
=>
{
value
=
value
.
trim
()
if
(
value
===
''
)
{
this
.
$message
({
message
:
rule
.
field
+
'为必传项'
,
type
:
'error'
})
callback
(
new
Error
(
rule
.
field
+
'为必传项'
))
}
else
{
callback
()
}
}
return
{
postForm
:
Object
.
assign
({},
defaultForm
),
loading
:
false
,
rules
:
{
name
:
[{
validator
:
validateRequire
,
trigger
:
'blur'
}],
},
tempRoute
:
{},
}
},
created
()
{
if
(
this
.
isEdit
)
{
const
id
=
this
.
$route
.
params
&&
this
.
$route
.
params
.
id
this
.
fetchData
(
id
)
}
else
{
this
.
postForm
=
Object
.
assign
({},
defaultForm
)
}
this
.
tempRoute
=
Object
.
assign
({},
this
.
$route
)
},
methods
:
{
fetchData
(
id
)
{
fetchTagTypeDetail
(
id
).
then
(
response
=>
{
this
.
postForm
=
response
.
data
.
data
.
data
}).
catch
(
err
=>
{
console
.
log
(
err
)
})
},
submitForm
()
{
this
.
$refs
.
postForm
.
validate
(
valid
=>
{
if
(
valid
)
{
this
.
loading
=
true
;
CreateTagType
(
this
.
postForm
).
then
(
response
=>
{
if
(
response
.
data
.
data
.
code
==
500
)
{
this
.
$notify
({
title
:
'失败'
,
message
:
response
.
data
.
data
.
message
,
type
:
'error'
,
duration
:
2000
})
this
.
loading
=
false
return
false
}
this
.
$notify
({
title
:
'成功'
,
message
:
response
.
data
.
data
.
message
,
type
:
'success'
,
duration
:
2000
})
setTimeout
(()
=>
{
this
.
$router
.
push
(
'/tag/tagtype/list'
)
},
1000
)
}).
catch
(
err
=>
{
this
.
$notify
({
title
:
'失败'
,
message
:
'操作失败'
,
type
:
'danger'
,
duration
:
2000
})
});
this
.
postForm
.
status
=
'published'
this
.
loading
=
false
}
else
{
console
.
log
(
'error submit!!'
)
return
false
}
})
},
}
}
</
script
>
<
style
rel=
"stylesheet/scss"
lang=
"scss"
scoped
>
@import
"src/styles/mixin.scss"
;
.createPost-container
{
position
:
relative
;
.createPost-main-container
{
padding
:
40px
45px
20px
50px
;
.postInfo-container
{
position
:
relative
;
@include
clearfix
;
margin-bottom
:
10px
;
.postInfo-container-item
{
float
:
left
;
}
}
.editor-container
{
min-height
:
500px
;
margin
:
0
0
30px
;
.editor-upload-btn-container
{
text-align
:
right
;
margin-right
:
10px
;
.editor-upload-btn
{
display
:
inline-block
;
}
}
}
}
.word-counter
{
width
:
40px
;
position
:
absolute
;
right
:
-10px
;
top
:
0px
;
}
}
</
style
>
vu/src/views/tag_type/create.vue
0 → 100644
View file @
ca033122
<
template
>
<tag-type-detail
:is-edit=
"false"
/>
</
template
>
<
script
>
import
TagTypeDetail
from
'./components/TagTypeDetail'
export
default
{
name
:
'CreateTagType'
,
components
:
{
TagTypeDetail
}
}
</
script
>
vu/src/views/tag_type/edit.vue
0 → 100644
View file @
ca033122
<
template
>
<tag-type-detail
:is-edit=
"true"
/>
</
template
>
<
script
>
import
TagTypeDetail
from
'./components/TagTypeDetail'
export
default
{
name
:
'EditTagType'
,
components
:
{
TagTypeDetail
}
}
</
script
>
vu/src/views/tag_type/list.vue
0 → 100644
View file @
ca033122
<
template
>
<div
class=
"app-container"
>
<div
class=
"filter-container"
>
<el-input
:placeholder=
"'搜素'"
v-model=
"listQuery.filter.value"
style=
"width: 150px;"
class=
"filter-item"
@
keyup
.
enter
.
native=
"handleFilter"
/>
<el-select
v-model=
"listQuery.filter.key"
:placeholder=
"'搜索字段'"
clearable
class=
"filter-item"
style=
"width: 110px"
>
<el-option
v-for=
"item in SearchTypeOptions"
:key=
"item.key"
:label=
"item.display_name"
:value=
"item.key"
/>
</el-select>
<el-select
v-model=
"listQuery.filter.is_online"
:placeholder=
"'上线'"
clearable
class=
"filter-item"
style=
"width: 100px"
>
<el-option
v-for=
"item in BooleanTypeOptions"
:key=
"item.key"
:label=
"item.display_name"
:value=
"item.key"
/>
</el-select>
<el-button
v-waves
class=
"filter-item"
type=
"primary"
icon=
"el-icon-search"
@
click=
"handleFilter"
>
搜索
</el-button>
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"handleCreate"
>
创建
</el-button>
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"handleOfflineOrOnline('offline')"
>
下线
</el-button>
<el-button
class=
"filter-item"
style=
"margin-left: 10px;"
type=
"primary"
icon=
"el-icon-edit"
@
click=
"handleOfflineOrOnline('online')"
>
上线
</el-button>
</div>
<el-table
v-loading=
"listLoading"
:data=
"list"
border
fit
highlight-current-row
style=
"width: 100%"
ref=
"multipleTable"
@
selection-change=
"handleSelectionChange"
>
<el-table-column
type=
"selection"
align=
"center"
></el-table-column>
<el-table-column
align=
"center"
label=
"标签类型ID"
>
<template
slot-scope=
"scope"
>
<router-link
:to=
"'/tag/tagtype/edit/'+scope.row.id"
class=
"link-type"
>
<span>
{{
scope
.
row
.
id
}}
</span>
</router-link>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"标签类型名称"
>
<
template
slot-scope=
"scope"
>
<span>
{{
scope
.
row
.
name
}}
</span>
</
template
>
</el-table-column>
<el-table-column
align=
"center"
label=
"是否在线"
>
<
template
slot-scope=
"scope"
>
<el-tag
:type=
"scope.row.is_online | isOnlineFilter"
>
{{
scope
.
row
.
is_online
==
1
?
'是'
:
'否'
}}
</el-tag>
</
template
>
</el-table-column>
</el-table>
<pagination
v-show=
"total>0"
:total=
"total"
:page
.
sync=
"listQuery.offset"
:limit
.
sync=
"listQuery.limit"
style=
"margin-left: 250px;"
@
pagination=
"getList"
/>
</div>
</template>
<
script
>
import
{
fetchList
,
OffLineOrOnLine
}
from
'@/api/tagtype'
import
Pagination
from
'@/components/Pagination'
// Secondary package based on el-pagination
import
waves
from
'@/directive/waves'
export
default
{
name
:
'TagTypeList'
,
components
:
{
Pagination
},
filters
:
{
isOnlineFilter
(
status
)
{
const
statusMap
=
{
1
:
'success'
,
0
:
'info'
,
}
return
statusMap
[
status
]
},
},
directives
:
{
waves
},
data
()
{
return
{
list
:
null
,
total
:
0
,
listLoading
:
true
,
multipleSelection
:
[],
del_list
:
[],
listQuery
:
{
offset
:
1
,
limit
:
10
,
filter
:
{
value
:
''
,
key
:
''
,
is_online
:
''
,
name
:
''
,
type
:
''
,
},
},
BooleanTypeOptions
:
[
{
'key'
:
1
,
'display_name'
:
'是'
},
{
'key'
:
0
,
'display_name'
:
'否'
}
],
SearchTypeOptions
:[
{
'key'
:
'id'
,
'display_name'
:
'ID'
},
{
'key'
:
'name'
,
'display_name'
:
'类型名称'
},
]
}
},
created
()
{
this
.
getList
()
},
methods
:
{
getList
()
{
this
.
listLoading
=
true
fetchList
(
this
.
listQuery
).
then
(
response
=>
{
this
.
list
=
response
.
data
.
data
.
data
this
.
total
=
response
.
data
.
data
.
total
this
.
listLoading
=
false
})
},
handleSelectionChange
(
val
)
{
this
.
multipleSelection
=
val
;
},
handleSizeChange
(
val
)
{
this
.
listQuery
.
limit
=
val
this
.
getList
()
},
handleCurrentChange
(
val
)
{
this
.
listQuery
.
offset
=
val
this
.
getList
()
},
handleOfflineOrOnline
(
val
){
const
length
=
this
.
multipleSelection
.
length
;
let
str
=
''
;
var
update
=
''
this
.
del_list
=
this
.
del_list
.
concat
(
this
.
multipleSelection
);
for
(
let
i
=
0
;
i
<
length
;
i
++
)
{
if
(
val
===
'offline'
){
this
.
multipleSelection
[
i
].
is_online
=
0
update
=
0
;
}
else
{
this
.
multipleSelection
[
i
].
is_online
=
1
update
=
1
;
}
str
+=
this
.
multipleSelection
[
i
].
id
+
' '
;
}
OffLineOrOnLine
({
update
:
update
,
ids
:
str
}).
then
(
response
=>
{
this
.
multipleSelection
=
[];
this
.
$message
.
success
(
response
.
data
.
data
.
message
);
})
},
handleFilter
()
{
this
.
listQuery
.
offset
=
1
if
(
this
.
listQuery
.
filter
.
key
==
'id'
&&
!
/^
\d
+$/
.
test
(
this
.
listQuery
.
filter
.
value
)){
this
.
$message
.
error
(
"搜索条件不合法, 重新输入"
)
return
false
;
}
this
.
getList
()
},
handleCreate
()
{
this
.
$router
.
push
(
'/tag/tagtype/create'
)
}
}
}
</
script
>
<
style
scoped
>
.edit-input
{
padding-right
:
100px
;
}
.cancel-btn
{
position
:
absolute
;
right
:
15px
;
top
:
10px
;
}
</
style
>
vu/src/views/topic/components/TopicDetail.vue
View file @
ca033122
...
...
@@ -10,7 +10,11 @@
<el-row
:gutter=
"20"
>
<el-card
class=
"box-card"
>
<div
slot=
"header"
class=
"clearfix"
>
<span>
帖子相关
</span>
<div
style=
"float: left; text-align: center;"
>
帖子相关
</div>
</div>
<el-row>
<el-col
:span=
"24"
>
...
...
@@ -103,6 +107,9 @@
</div>
</el-col>
</el-row>
<el-form-item
label-width=
"75px"
label=
"人工减分:"
class=
"postInfo-container-item"
style=
"margin-bottom: 20px"
>
<el-input
v-model=
"postForm.drop_score"
type=
"number"
style=
"width: 80%"
/>
</el-form-item>
<el-form-item
style=
"margin-bottom: 20px"
label-width=
"75px"
label=
"是否在线:"
>
<el-radio-group
v-model=
"postForm.is_online"
>
<el-radio
:label=
"1"
>
是
</el-radio>
...
...
@@ -306,6 +313,7 @@
star
:
''
,
is_puppet
:
''
,
is_online
:
0
,
drop_score
:
0
,
}
export
default
{
...
...
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