Commit d3822bc9 authored by Davve's avatar Davve

修改样式

parent 84afe8a7
...@@ -59,8 +59,8 @@ class GroupUpdateOrCreate(APIView): ...@@ -59,8 +59,8 @@ class GroupUpdateOrCreate(APIView):
'description': request.POST.get('description', ''), 'description': request.POST.get('description', ''),
'creator_id': request.POST.get('user_id', ''), 'creator_id': request.POST.get('user_id', ''),
'celebrity_ids': json.loads(request.POST.get('star', '')), 'celebrity_ids': json.loads(request.POST.get('star', '')),
'is_online': request.POST.get('is_online', ''), 'is_online': int(request.POST.get('is_online', 0)),
'is_recommend': request.POST.get('is_recommend', ''), 'is_recommend': int(request.POST.get('is_recommend', 0)),
'group_user_ids': json.loads(request.POST.get('user_ids', '')), 'group_user_ids': json.loads(request.POST.get('user_ids', '')),
'icon': request.POST.get('icon', '')[:-2] 'icon': request.POST.get('icon', '')[:-2]
} }
......
...@@ -98,3 +98,23 @@ class PickUserListView(APIView): ...@@ -98,3 +98,23 @@ class PickUserListView(APIView):
return { return {
'message': '操作失败' 'message': '操作失败'
} }
class PickTopicView(APIView):
def get(self, request):
topic_id = request.GET.get('id')
try:
data = self.rpc['venus/sun/topic/pick_topic'](id=topic_id).unwrap()
except Exception as e:
raise e
return [data, ]
class PickCelebrityListView(APIView):
def get(self, request):
celebrity_id = request.GET.get('id')
try:
data = self.rpc['venus/sun/pick/pick_celebrity'](id=celebrity_id).unwrap()
except Exception as e:
raise e
return [data, ]
\ No newline at end of file
...@@ -47,7 +47,7 @@ class TagSearchView(APIView): ...@@ -47,7 +47,7 @@ class TagSearchView(APIView):
return {'data': data} return {'data': data}
class StarSearchView(APIView): class CelebritySearchView(APIView):
def get(self, request): def get(self, request):
name = request.GET.get('name') name = request.GET.get('name')
try: try:
...@@ -65,3 +65,13 @@ class CitySearchView(APIView): ...@@ -65,3 +65,13 @@ class CitySearchView(APIView):
except Exception as e: except Exception as e:
raise e raise e
return {'data': data} return {'data': data}
class TopicSearchView(APIView):
def get(self, request):
name = request.GET.get('name')
try:
data = self.rpc['venus/sun/topic/search'](name=name).unwrap()
except Exception as e:
raise e
return {'data': data}
...@@ -50,7 +50,7 @@ class CelebrityUpdateOrCreate(APIView): ...@@ -50,7 +50,7 @@ class CelebrityUpdateOrCreate(APIView):
id = request.POST.get('id', '') id = request.POST.get('id', '')
data = { data = {
'name': request.POST.get('name'), 'name': request.POST.get('name'),
'gender': request.POST.get('gender'), 'gender': int(request.POST.get('gender')),
'city_id': request.POST.get('city'), 'city_id': request.POST.get('city'),
'is_online': int(request.POST.get('is_online')), 'is_online': int(request.POST.get('is_online')),
'desc': request.POST.get('description'), 'desc': request.POST.get('description'),
......
...@@ -70,6 +70,8 @@ urlpatterns = [ ...@@ -70,6 +70,8 @@ urlpatterns = [
url(r'^pick/detail/', UpdateOrCreateView.as_view()), url(r'^pick/detail/', UpdateOrCreateView.as_view()),
url(r'^pick/user/list$', PickUserListView.as_view()), url(r'^pick/user/list$', PickUserListView.as_view()),
url(r'^pick/add_fake_pick_nums$', PickUserListView.as_view()), url(r'^pick/add_fake_pick_nums$', PickUserListView.as_view()),
url(r'^pick/topic', PickTopicView.as_view()),
url(r'^pick/celebrity', PickCelebrityListView.as_view()),
# 标签相关 # 标签相关
url(r'^tag/list$', TagListView.as_view()), url(r'^tag/list$', TagListView.as_view()),
...@@ -83,8 +85,9 @@ search_urlpatterns = [ ...@@ -83,8 +85,9 @@ search_urlpatterns = [
url(r'search/country', CountrySearchView.as_view()), url(r'search/country', CountrySearchView.as_view()),
url(r'search/user', UserSearchView.as_view()), url(r'search/user', UserSearchView.as_view()),
url(r'search/tag', TagSearchView.as_view()), url(r'search/tag', TagSearchView.as_view()),
url(r'search/star', StarSearchView.as_view()), url(r'search/celebrity', CelebritySearchView.as_view()),
url(r'search/city', CitySearchView.as_view()), url(r'search/city', CitySearchView.as_view()),
url(r'search/topic', TopicSearchView.as_view()),
] ]
common_urlpatterns = [ common_urlpatterns = [
......
...@@ -48,3 +48,19 @@ export function AddFakePickNums(data) { ...@@ -48,3 +48,19 @@ export function AddFakePickNums(data) {
data data
}) })
} }
export function PickTopicDetail(id) {
return request({
url: '/api/pick/topic',
method: 'get',
params: { id }
})
}
export function PickCelebrityDetail(id) {
return request({
url: '/api/pick/celebrity',
method: 'get',
params: { id }
})
}
...@@ -34,7 +34,7 @@ export function tagSearch(name) { ...@@ -34,7 +34,7 @@ export function tagSearch(name) {
export function starSearch(name) { export function starSearch(name) {
return request({ return request({
url: '/api/search/star', url: '/api/search/celebrity',
method: 'get', method: 'get',
params: { name } params: { name }
}) })
...@@ -47,3 +47,19 @@ export function citySearch(name) { ...@@ -47,3 +47,19 @@ export function citySearch(name) {
params: { name } params: { name }
}) })
} }
export function celebritySearch(name) {
return request({
url: '/api/search/celebrity',
method: 'get',
params: { name }
})
}
export function topicSearch(name) {
return request({
url: '/api/search/topic',
method: 'get',
params: { name }
})
}
...@@ -202,7 +202,7 @@ ...@@ -202,7 +202,7 @@
user_id: '', user_id: '',
star: [], star: [],
icon: '', icon: '',
is_online: 1, is_online: 0,
is_recommend: 1, is_recommend: 1,
user_ids: [], user_ids: [],
} }
...@@ -338,7 +338,8 @@ ...@@ -338,7 +338,8 @@
duration: 2000 duration: 2000
}) })
setTimeout(() => { setTimeout(() => {
this.$router.push('/group/list') // this.$router.push('/group/list')
this.$router.go(0)
}, 1000) }, 1000)
}).catch(err => { }).catch(err => {
...@@ -372,7 +373,7 @@ ...@@ -372,7 +373,7 @@
this.getList() this.getList()
}, },
appendUser() { appendUser() {
if (this.temp_user_ids){ if (this.temp_user_ids == ""){
this.$message.error('还没输入小组呢~~') this.$message.error('还没输入小组呢~~')
this.temp_user_ids = '' this.temp_user_ids = ''
return false return false
...@@ -431,7 +432,6 @@ ...@@ -431,7 +432,6 @@
starSearch(query).then(response => { starSearch(query).then(response => {
if (!response.data.data.data) return if (!response.data.data.data) return
this.starListOptions = response.data.data.data this.starListOptions = response.data.data.data
console.log(response.data.data.data)
}) })
}, },
} }
......
...@@ -134,6 +134,7 @@ ...@@ -134,6 +134,7 @@
</el-card> </el-card>
</el-row> </el-row>
<!--pick明星相关-->
<el-row :gutter="20" style="margin-top:50px;" v-if="this.postForm.pick_type_origin == 1 && this.isEdit"> <el-row :gutter="20" style="margin-top:50px;" v-if="this.postForm.pick_type_origin == 1 && this.isEdit">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
...@@ -141,15 +142,27 @@ ...@@ -141,15 +142,27 @@
</div> </div>
<div style="margin-bottom:50px;"> <div style="margin-bottom:50px;">
<div class="filter-container"> <div class="filter-container">
<el-select v-model="celebrity_id" :remote-method="getRemoteCelebrityList" filterable remote
value-key="id"
placeholder="添加明星" style="width: 220px">
<el-option v-for="(item,index) in celebrityListOptions" :key="item+index"
:label="item.id + ':' + item.name" :value="item.id"/>
</el-select>
<el-button v-waves class="filter-item" type="primary" icon="el-icon-edit" @click="append">添加
</el-button>
<el-button v-waves class="filter-item" type="primary" icon="el-icon-delete" @click="del">移除
</el-button>
</div> </div>
<el-table :data="list" border fit highlight-current-row style="width: 100%" <el-table :data="data" border fit highlight-current-row style="width: 100%"
ref="multipleTable" @selection-change="handleSelectionChange"> ref="multipleTable" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center"></el-table-column> <el-table-column type="selection" align="center"></el-table-column>
<el-table-column align="center" label="明星ID"> <el-table-column align="center" label="明星ID">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/star/edit/'+scope.row.celebrity_id" class="link-type">
<span>{{ scope.row.celebrity_id }}</span> <span>{{ scope.row.celebrity_id }}</span>
</router-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="明星名称"> <el-table-column align="center" label="明星名称">
...@@ -193,8 +206,7 @@ ...@@ -193,8 +206,7 @@
</div> </div>
</el-card> </el-card>
</el-row> </el-row>
<!--pick帖子相关-->
<el-row :gutter="20" style="margin-top:50px;" v-if="this.postForm.pick_type_origin == 0 && this.isEdit"> <el-row :gutter="20" style="margin-top:50px;" v-if="this.postForm.pick_type_origin == 0 && this.isEdit">
<el-card class="box-card"> <el-card class="box-card">
<div slot="header" class="clearfix"> <div slot="header" class="clearfix">
...@@ -202,15 +214,30 @@ ...@@ -202,15 +214,30 @@
</div> </div>
<div style="margin-bottom:50px;"> <div style="margin-bottom:50px;">
<div class="filter-container"> <div class="filter-container">
<el-select v-model="topic_id" :remote-method="getRemoteTopicList" filterable remote
value-key="id"
placeholder="添加帖子" style="width: 220px">
<el-option v-for="(item, index) in topicListOptions" :key="item+index"
:label="item.id + ':' + item.name" :value="item.id"/>
</el-select>
<el-button v-waves class="filter-item" type="primary" icon="el-icon-edit" @click="append">添加
</el-button>
<el-button v-waves class="filter-item" type="primary" icon="el-icon-delete" @click="del">移除
</el-button>
</div> </div>
<el-table :data="list" border fit highlight-current-row style="width: 100%"
<el-table :data="data" border fit highlight-current-row style="width: 100%"
ref="multipleTable" @selection-change="handleSelectionChange"> ref="multipleTable" @selection-change="handleSelectionChange">
<el-table-column type="selection" align="center"></el-table-column> <el-table-column type="selection" align="center"></el-table-column>
<el-table-column align="center" label="帖子ID"> <el-table-column align="center" label="帖子ID">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/topic/edit/'+scope.row.topic_id" class="link-type">
<span>{{ scope.row.topic_id }}</span> <span>{{ scope.row.topic_id }}</span>
</router-link>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column align="center" label="帖子名称"> <el-table-column align="center" label="帖子名称">
...@@ -250,9 +277,6 @@ ...@@ -250,9 +277,6 @@
</el-table> </el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" <pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"
style="margin-left: 150px;" @pagination="getList"/> style="margin-left: 150px;" @pagination="getList"/>
</div> </div>
...@@ -269,8 +293,16 @@ ...@@ -269,8 +293,16 @@
import MDinput from '@/components/MDinput' import MDinput from '@/components/MDinput'
import Sticky from '@/components/Sticky' // 粘性header组件 import Sticky from '@/components/Sticky' // 粘性header组件
import Pagination from '@/components/Pagination' import Pagination from '@/components/Pagination'
import {fetchPickDetail, CreatePick, fetchPickUserList, AddFakePickNums} from '@/api/pick' import waves from '@/directive/waves'
import {groupSearch, citySearch} from '@/api/remoteSearch' import {
fetchPickDetail,
CreatePick,
fetchPickUserList,
AddFakePickNums,
PickTopicDetail,
PickCelebrityDetail
} from '@/api/pick'
import {groupSearch, citySearch, celebritySearch, topicSearch} from '@/api/remoteSearch'
import {isInArray, removeByvale} from "@/utils"; import {isInArray, removeByvale} from "@/utils";
function Assembledata(target, source) { function Assembledata(target, source) {
...@@ -300,6 +332,7 @@ ...@@ -300,6 +332,7 @@
export default { export default {
name: 'PickDetail', name: 'PickDetail',
components: {MDinput, Sticky, Pagination}, components: {MDinput, Sticky, Pagination},
directives: {waves},
props: { props: {
isEdit: { isEdit: {
type: Boolean, type: Boolean,
...@@ -322,8 +355,13 @@ ...@@ -322,8 +355,13 @@
postForm: Object.assign({}, defaultForm), postForm: Object.assign({}, defaultForm),
loading: false, loading: false,
pick_type_origin: '', pick_type_origin: '',
celebrity_id: '',
topic_id: '',
del_list: [],
regionListOptions: [], regionListOptions: [],
groupListOptions: [], groupListOptions: [],
celebrityListOptions: [],
topicListOptions: [],
GenderTypeOptions: [ GenderTypeOptions: [
{'key': 2, 'display_name': '全部'}, {'key': 2, 'display_name': '全部'},
{'key': 0, 'display_name': '男'}, {'key': 0, 'display_name': '男'},
...@@ -350,17 +388,33 @@ ...@@ -350,17 +388,33 @@
pick_type: '', pick_type: '',
page: 1, page: 1,
limit: 10, limit: 10,
filter: { filter: {},
},
}, },
list: null, list: null,
total: 0, total: 0,
listLoading: true, listLoading: true,
origin_len: 0,
topic_ids: [],
celebrity_ids: [],
} }
}, },
computed: { computed: {
contentShortLength() { contentShortLength() {
return this.postForm.desc.length return this.postForm.desc.length
},
data() {
return this.list.filter((d) => {
let is_del = false;
for (let i = 0; i < this.del_list.length; i++) {
if (d.topic_id == this.del_list[i].topic_id) {
is_del = true;
break
}
}
if (!is_del) {
return d
}
})
} }
}, },
created() { created() {
...@@ -449,15 +503,22 @@ ...@@ -449,15 +503,22 @@
this.groupListOptions = response.data.data.data this.groupListOptions = response.data.data.data
}) })
}, },
getRemoteTopicList(query) {
topicSearch(query).then(response => {
if (!response.data.data.data) return
this.topicListOptions = response.data.data.data
})
},
getRemoteCelebrityList(query) {
celebritySearch(query).then(response => {
if (!response.data.data.data) return
this.celebrityListOptions = response.data.data.data
})
},
// 分页相关 // 分页相关
handleSelectionChange(val) { handleSelectionChange(val) {
this.multipleSelection = val; this.multipleSelection = val;
}, },
reply() {
},
getList() { getList() {
this.listLoading = true this.listLoading = true
this.listQuery.id = this.$route.params && this.$route.params.id this.listQuery.id = this.$route.params && this.$route.params.id
...@@ -470,6 +531,7 @@ ...@@ -470,6 +531,7 @@
return v return v
}) })
this.total = response.data.data.total this.total = response.data.data.total
this.origin_len = response.data.data.total
this.listLoading = false; this.listLoading = false;
}) })
}, },
...@@ -493,8 +555,76 @@ ...@@ -493,8 +555,76 @@
}).catch(err => { }).catch(err => {
}) })
},
append() {
if (this.postForm.pick_type_origin == 0) {
if (this.topic_id == "") {
this.$message.error('请输入搜索内容~~')
this.topic_id = ''
return false
}
PickTopicDetail(this.topic_id).then(response => {
if (!response.data.data) return
this.list.unshift(...response.data.data)
this.total = this.list.length
})
// this.user_ids.push(this.temp_user_ids)
this.topic_id = ''
} else if (this.postForm.pick_type_origin == 1) {
if (this.celebrity_id == "") {
this.$message.error('请输入搜索内容~~')
this.celebrity_id = ''
return false;
} else {
PickCelebrityDetail(this.celebrity_id).then(response => {
if (!response.data.data) return
this.list.unshift(...response.data.data)
this.total = this.list.length
})
// this.user_ids.push(this.temp_user_ids)
this.celebrity_id = ''
} }
} }
},
del() {
this.topic_ids = left__ids;
this.total = this.origin_len - this.del_list.length
let origin__ids = [];
var left__ids = [];
let select__ids = []
this.del_list.push(...this.multipleSelection)
if (this.postForm.pick_type_origin == 0) {
for (let i = 0; i < this.list.length; i++) {
origin__ids.push(this.list[i].topic_id)
}
for (let i = 0; i < this.multipleSelection.length; i++) {
select__ids.push(this.multipleSelection[i].topic_id)
}
} else {
for (let i = 0; i < this.list.length; i++) {
origin__ids.push(this.list[i].celebrity_id)
}
for (let i = 0; i < this.multipleSelection.length; i++) {
select__ids.push(this.multipleSelection[i].celebrity_id)
}
}
for (let i = 0; i < origin__ids.length; i++) {
if (!isInArray(select__ids, origin__ids[i])) {
left__ids.push(origin__ids[i])
}
}
},
}
} }
</script> </script>
...@@ -532,12 +662,14 @@ ...@@ -532,12 +662,14 @@
top: 0px; top: 0px;
} }
} }
.edit-input { .edit-input {
padding-right: 100px; padding-right: 100px;
} }
.cancel-btn {
.cancel-btn {
position: absolute; position: absolute;
right: 15px; right: 15px;
top: 10px; top: 10px;
} }
</style> </style>
...@@ -298,7 +298,7 @@ ...@@ -298,7 +298,7 @@
this.postForm.city = this.temp_city_id; this.postForm.city = this.temp_city_id;
} }
console.log(this.postForm, '=====================')
starCreate(this.postForm).then(response => { starCreate(this.postForm).then(response => {
this.$notify({ this.$notify({
title: '成功', title: '成功',
......
...@@ -101,6 +101,17 @@ ...@@ -101,6 +101,17 @@
return region_data.join(',') 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 = { const defaultForm = {
status: 'draft', status: 'draft',
name: '', name: '',
...@@ -196,11 +207,10 @@ ...@@ -196,11 +207,10 @@
} }
let flag = false; let flag = false;
let up_tag_arrays = this.postForm.up_tags.split(',') let up_tag_arrays = removeNull(this.postForm.up_tags.split(','))
let down_tags_arrays = this.postForm.down_tags.split(',') let down_tags_arrays = removeNull(this.postForm.down_tags.split(','))
for (let i = 0; i < up_tag_arrays.length; i++) {
for (let i = 0; i< up_tag_arrays.length; i++){ if (isInArray(down_tags_arrays, up_tag_arrays[i])) {
if (isInArray(down_tags_arrays, up_tag_arrays[i])){
this.$message.error('上下级标签不能存相同标签') this.$message.error('上下级标签不能存相同标签')
this.postForm.up_tags = []; this.postForm.up_tags = [];
this.postForm.down_tags = []; this.postForm.down_tags = [];
...@@ -208,7 +218,7 @@ ...@@ -208,7 +218,7 @@
break break
} }
} }
if (flag){ if (flag) {
return false; return false;
} }
......
...@@ -146,6 +146,7 @@ export default { ...@@ -146,6 +146,7 @@ export default {
SearchTypeOptions:[ SearchTypeOptions:[
{'key': 'id', 'display_name': '帖子ID'}, {'key': 'id', 'display_name': '帖子ID'},
{'key': 'content', 'display_name': '帖子内容'}, {'key': 'content', 'display_name': '帖子内容'},
{'key': 'group__name', 'display_name': '小组'},
], ],
ContentLevelTypeOptions:[ ContentLevelTypeOptions:[
{'key': 0, 'display_name': '未审核'}, {'key': 0, 'display_name': '未审核'},
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment