Commit d3822bc9 authored by Davve's avatar Davve

修改样式

parent 84afe8a7
......@@ -59,8 +59,8 @@ class GroupUpdateOrCreate(APIView):
'description': request.POST.get('description', ''),
'creator_id': request.POST.get('user_id', ''),
'celebrity_ids': json.loads(request.POST.get('star', '')),
'is_online': request.POST.get('is_online', ''),
'is_recommend': request.POST.get('is_recommend', ''),
'is_online': int(request.POST.get('is_online', 0)),
'is_recommend': int(request.POST.get('is_recommend', 0)),
'group_user_ids': json.loads(request.POST.get('user_ids', '')),
'icon': request.POST.get('icon', '')[:-2]
}
......
......@@ -97,4 +97,24 @@ class PickUserListView(APIView):
raise e
return {
'message': '操作失败'
}
\ No newline at end of file
}
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):
return {'data': data}
class StarSearchView(APIView):
class CelebritySearchView(APIView):
def get(self, request):
name = request.GET.get('name')
try:
......@@ -65,3 +65,13 @@ class CitySearchView(APIView):
except Exception as e:
raise e
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):
id = request.POST.get('id', '')
data = {
'name': request.POST.get('name'),
'gender': request.POST.get('gender'),
'gender': int(request.POST.get('gender')),
'city_id': request.POST.get('city'),
'is_online': int(request.POST.get('is_online')),
'desc': request.POST.get('description'),
......
......@@ -70,6 +70,8 @@ urlpatterns = [
url(r'^pick/detail/', UpdateOrCreateView.as_view()),
url(r'^pick/user/list$', 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()),
......@@ -83,8 +85,9 @@ search_urlpatterns = [
url(r'search/country', CountrySearchView.as_view()),
url(r'search/user', UserSearchView.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/topic', TopicSearchView.as_view()),
]
common_urlpatterns = [
......
......@@ -48,3 +48,19 @@ export function AddFakePickNums(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) {
export function starSearch(name) {
return request({
url: '/api/search/star',
url: '/api/search/celebrity',
method: 'get',
params: { name }
})
......@@ -47,3 +47,19 @@ export function citySearch(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 @@
user_id: '',
star: [],
icon: '',
is_online: 1,
is_online: 0,
is_recommend: 1,
user_ids: [],
}
......@@ -338,7 +338,8 @@
duration: 2000
})
setTimeout(() => {
this.$router.push('/group/list')
// this.$router.push('/group/list')
this.$router.go(0)
}, 1000)
}).catch(err => {
......@@ -372,7 +373,7 @@
this.getList()
},
appendUser() {
if (this.temp_user_ids){
if (this.temp_user_ids == ""){
this.$message.error('还没输入小组呢~~')
this.temp_user_ids = ''
return false
......@@ -431,7 +432,6 @@
starSearch(query).then(response => {
if (!response.data.data.data) return
this.starListOptions = response.data.data.data
console.log(response.data.data.data)
})
},
}
......
......@@ -134,6 +134,7 @@
</el-card>
</el-row>
<!--pick明星相关-->
<el-row :gutter="20" style="margin-top:50px;" v-if="this.postForm.pick_type_origin == 1 && this.isEdit">
<el-card class="box-card">
<div slot="header" class="clearfix">
......@@ -141,15 +142,27 @@
</div>
<div style="margin-bottom:50px;">
<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>
<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">
<el-table-column type="selection" align="center"></el-table-column>
<el-table-column align="center" label="明星ID">
<template slot-scope="scope">
<span>{{ scope.row.celebrity_id }}</span>
<router-link :to="'/star/edit/'+scope.row.celebrity_id" class="link-type">
<span>{{ scope.row.celebrity_id }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column align="center" label="明星名称">
......@@ -165,27 +178,27 @@
<el-table-column align="center" min-width="100" label="添加pick值">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.fake_pick_nums" type="number" class="edit-input" size="small"/>
<el-button class="cancel-btn" size="small" icon="el-icon-refresh" type="warning"
@click="cancelEdit(scope.row)">取消
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.fake_pick_nums" type="number" class="edit-input" size="small"/>
<el-button class="cancel-btn" size="small" icon="el-icon-refresh" type="warning"
@click="cancelEdit(scope.row)">取消
</el-button>
</template>
<span v-else>{{ scope.row.fake_pick_nums }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="120">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" icon="el-icon-circle-check-outline"
@click="confirmEdit(scope.row)">确认
</el-button>
<el-button v-else type="primary" size="small" icon="el-icon-edit"
@click="scope.row.edit=!scope.row.edit">添加
</el-button>
</template>
<span v-else>{{ scope.row.fake_pick_nums }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="120">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" icon="el-icon-circle-check-outline"
@click="confirmEdit(scope.row)">确认
</el-button>
<el-button v-else type="primary" size="small" icon="el-icon-edit"
@click="scope.row.edit=!scope.row.edit">添加
</el-button>
</template>
</el-table-column>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"
......@@ -193,8 +206,7 @@
</div>
</el-card>
</el-row>
<!--pick帖子相关-->
<el-row :gutter="20" style="margin-top:50px;" v-if="this.postForm.pick_type_origin == 0 && this.isEdit">
<el-card class="box-card">
<div slot="header" class="clearfix">
......@@ -202,15 +214,30 @@
</div>
<div style="margin-bottom:50px;">
<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>
<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">
<el-table-column type="selection" align="center"></el-table-column>
<el-table-column align="center" label="帖子ID">
<template slot-scope="scope">
<span>{{ scope.row.topic_id }}</span>
<router-link :to="'/topic/edit/'+scope.row.topic_id" class="link-type">
<span>{{ scope.row.topic_id }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column align="center" label="帖子名称">
......@@ -226,33 +253,30 @@
<el-table-column align="center" min-width="100" label="添加pick值">
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.fake_pick_nums" type="number" class="edit-input" size="small"/>
<el-button class="cancel-btn" size="small" icon="el-icon-refresh" type="warning"
@click="cancelEdit(scope.row)">取消
<template slot-scope="scope">
<template v-if="scope.row.edit">
<el-input v-model="scope.row.fake_pick_nums" type="number" class="edit-input" size="small"/>
<el-button class="cancel-btn" size="small" icon="el-icon-refresh" type="warning"
@click="cancelEdit(scope.row)">取消
</el-button>
</template>
<span v-else>{{ scope.row.fake_pick_nums }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="120">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" icon="el-icon-circle-check-outline"
@click="confirmEdit(scope.row)">确认
</el-button>
<el-button v-else type="primary" size="small" icon="el-icon-edit"
@click="scope.row.edit=!scope.row.edit">添加
</el-button>
</template>
<span v-else>{{ scope.row.fake_pick_nums }}</span>
</template>
</el-table-column>
<el-table-column align="center" label="操作" width="120">
<template slot-scope="scope">
<el-button v-if="scope.row.edit" type="success" size="small" icon="el-icon-circle-check-outline"
@click="confirmEdit(scope.row)">确认
</el-button>
<el-button v-else type="primary" size="small" icon="el-icon-edit"
@click="scope.row.edit=!scope.row.edit">添加
</el-button>
</template>
</el-table-column>
</el-table-column>
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit"
style="margin-left: 150px;" @pagination="getList"/>
</div>
......@@ -269,8 +293,16 @@
import MDinput from '@/components/MDinput'
import Sticky from '@/components/Sticky' // 粘性header组件
import Pagination from '@/components/Pagination'
import {fetchPickDetail, CreatePick, fetchPickUserList, AddFakePickNums} from '@/api/pick'
import {groupSearch, citySearch} from '@/api/remoteSearch'
import waves from '@/directive/waves'
import {
fetchPickDetail,
CreatePick,
fetchPickUserList,
AddFakePickNums,
PickTopicDetail,
PickCelebrityDetail
} from '@/api/pick'
import {groupSearch, citySearch, celebritySearch, topicSearch} from '@/api/remoteSearch'
import {isInArray, removeByvale} from "@/utils";
function Assembledata(target, source) {
......@@ -300,6 +332,7 @@
export default {
name: 'PickDetail',
components: {MDinput, Sticky, Pagination},
directives: {waves},
props: {
isEdit: {
type: Boolean,
......@@ -322,8 +355,13 @@
postForm: Object.assign({}, defaultForm),
loading: false,
pick_type_origin: '',
celebrity_id: '',
topic_id: '',
del_list: [],
regionListOptions: [],
groupListOptions: [],
celebrityListOptions: [],
topicListOptions: [],
GenderTypeOptions: [
{'key': 2, 'display_name': '全部'},
{'key': 0, 'display_name': '男'},
......@@ -350,17 +388,33 @@
pick_type: '',
page: 1,
limit: 10,
filter: {
},
filter: {},
},
list: null,
total: 0,
listLoading: true,
origin_len: 0,
topic_ids: [],
celebrity_ids: [],
}
},
computed: {
contentShortLength() {
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() {
......@@ -449,15 +503,22 @@
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) {
this.multipleSelection = val;
},
reply() {
},
getList() {
this.listLoading = true
this.listQuery.id = this.$route.params && this.$route.params.id
......@@ -470,6 +531,7 @@
return v
})
this.total = response.data.data.total
this.origin_len = response.data.data.total
this.listLoading = false;
})
},
......@@ -493,7 +555,75 @@
}).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>
......@@ -532,12 +662,14 @@
top: 0px;
}
}
.edit-input {
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
padding-right: 100px;
}
.cancel-btn {
position: absolute;
right: 15px;
top: 10px;
}
</style>
......@@ -298,7 +298,7 @@
this.postForm.city = this.temp_city_id;
}
console.log(this.postForm, '=====================')
starCreate(this.postForm).then(response => {
this.$notify({
title: '成功',
......
......@@ -101,6 +101,17 @@
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',
name: '',
......@@ -196,11 +207,10 @@
}
let flag = false;
let up_tag_arrays = this.postForm.up_tags.split(',')
let down_tags_arrays = this.postForm.down_tags.split(',')
for (let i = 0; i< up_tag_arrays.length; i++){
if (isInArray(down_tags_arrays, up_tag_arrays[i])){
let up_tag_arrays = removeNull(this.postForm.up_tags.split(','))
let down_tags_arrays = removeNull(this.postForm.down_tags.split(','))
for (let i = 0; i < up_tag_arrays.length; i++) {
if (isInArray(down_tags_arrays, up_tag_arrays[i])) {
this.$message.error('上下级标签不能存相同标签')
this.postForm.up_tags = [];
this.postForm.down_tags = [];
......@@ -208,7 +218,7 @@
break
}
}
if (flag){
if (flag) {
return false;
}
......
......@@ -146,6 +146,7 @@ export default {
SearchTypeOptions:[
{'key': 'id', 'display_name': '帖子ID'},
{'key': 'content', 'display_name': '帖子内容'},
{'key': 'group__name', 'display_name': '小组'},
],
ContentLevelTypeOptions:[
{'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