Commit 1f233f9b authored by Davve's avatar Davve

完成tag

parent ec7de05e
......@@ -8,8 +8,8 @@ from utils.base import APIView
class AccountList(APIView):
def get(self, request):
page = request.GET.get('page', 1)
limit = request.GET.get('limit', 10)
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/account/get'](offset=page, limit=limit, filters=filter).unwrap()
......
......@@ -8,11 +8,11 @@ from utils.base import APIView
class PickListView(APIView):
def get(self, request):
page = request.GET.get('page', 1)
limit = request.GET.get('limit', 10)
offset = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/pick/get'](offset=page, limit=limit, filters=filter).unwrap()
data = self.rpc['venus/community/pick/get'](offset=offset, limit=limit, filters=filter).unwrap()
except Exception as e:
raise e
return data
......
......@@ -8,8 +8,8 @@ from utils.base import APIView
class PushListView(APIView):
def get(self, request):
page = request.GET.get('page', 1)
limit = request.GET.get('limit', 10)
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/push/get'](offset=page, limit=limit, filters=filter).unwrap()
......
......@@ -8,8 +8,8 @@ from utils.base import APIView
class StarListView(APIView):
def get(self, request):
page = request.GET.get('page', 1)
limit = request.GET.get('limit', 10)
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/star/get'](offset=page, limit=limit, filters=filter).unwrap()
......
......@@ -8,15 +8,44 @@ from utils.base import APIView
class TagListView(APIView):
def get(self, request):
pass
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/community/tag/get'](offset=offset, limit=limit, filters=filter).unwrap()
except Exception as e:
raise e
return data
def post(self, request):
pass
ids = request.POST.get('ids', '').split()
type = request.POST.get('type', '')
filters = {}
if type == 'offline':
filters['is_online'] = False
else:
filters['is_online'] = True
try:
self.rpc['venus/community/tag/batch/update'](filters=filters, tag_ids=ids).unwrap()
except Exception as e:
raise e
return {
"message": "更新成功"
}
class TagUpdateOrCreateView(APIView):
def get(self, request):
pass
id = request.GET.get('id')
try:
data = self.rpc['venus/community/tag/get'](id=id).unwrap()
except Exception as e:
raise e
if not data:
data = {}
else:
data = data['data'][0]
return {'data': data}
def post(self, request):
data = {
......
......@@ -8,8 +8,8 @@ from utils.base import APIView
class TopicListView(APIView):
def get(self, request):
page = request.GET.get('page', 1)
limit = request.GET.get('limit', 10)
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/topic/get'](offset=page, limit=limit, filters=filter).unwrap()
......
......@@ -8,8 +8,8 @@ from utils.base import APIView
class UserListView(APIView):
def get(self, request):
page = request.GET.get('page', 1)
limit = request.GET.get('limit', 10)
page = int(request.GET.get('page', 1))
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/user/get'](offset=page, limit=limit, filters=filter).unwrap()
......
......@@ -39,6 +39,24 @@
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="24">
<div class="postInfo-container">
<el-row>
<el-col :span="12">
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="标签ID:" prop="position">
<el-input :rows="1" v-model="postForm.id" type="number" class="article-textarea" style="width: 300px" readonly v-if="isEdit"/>
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item style="margin-bottom: 20px;" label-width="75px" label="创建时间:" prop="position">
<el-input :rows="1" v-model="postForm.create_time" type="text" class="article-textarea" style="width: 300px" readonly v-if="isEdit"/>
</el-form-item>
</el-col>
</el-row>
</div>
</el-col>
</el-row>
<el-row>
<el-col :span="12">
<el-form-item label-width="75px" label="上级标签:" class="postInfo-container-item">
......@@ -174,21 +192,21 @@
},
methods: {
fetchData(id) {
fetchPickDetail(id).then(response => {
fetchTagDetail(id).then(response => {
// select 回填数据处理,后期再进行优化
let rep = response.data.data.data;
let pick_temp = []
let region_temp = []
for (let i=0;i<rep.pick_group.length;i++){
pick_temp.push(rep.pick_group[i]['name']);
this.temparray['pick_group'].push(rep.pick_group[i])
let up_temp = []
let down_temp = []
for (let i=0;i<rep.up_tag.length;i++){
up_temp.push(rep.up_tag[i]['name']);
this.temparray['up_tag'].push(rep.up_tag[i])
}
for (let i=0;i<rep.region.length;i++){
region_temp.push(rep.region[i]['name']);
this.temparray['region'].push(rep.region[i])
for (let i=0;i<rep.down_tag.length;i++){
down_temp.push(rep.down_tag[i]['name']);
this.temparray['down_tag'].push(rep.down_tag[i])
}
rep.region = region_temp
rep.pick_group = pick_temp
rep.down_tag = down_temp
rep.up_tag = up_temp
this.postForm = rep
}).catch(err => {
console.log(err)
......
<template>
<div class="app-container">
<div class="filter-container">
<el-input :placeholder="'搜素'" v-model="listQuery.filter.value" style="width: 200px;" class="filter-item" @keyup.enter.native="handleFilter"/>
<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.level" :placeholder="'标签等级'" clearable class="filter-item" style="width: 110px">
<el-option v-for="item in TagLevelTypeOptions" :key="item.key" :label="item.display_name" :value="item.key"/>
</el-select>
<el-select v-model="listQuery.filter.type" :placeholder="'标签类型'" clearable class="filter-item" style="width: 110px">
<el-option v-for="item in TagtypeTypeOptions" :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>
......@@ -15,57 +21,33 @@
</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" width="55" align="center"></el-table-column>
<el-table-column align="center" label="pickID" width="80">
<el-table-column align="center" label="标签ID" width="148">
<template slot-scope="scope">
<router-link :to="'/pick/edit/'+scope.row.id" class="link-type">
<router-link :to="'/tag/edit/'+scope.row.id" class="link-type">
<span>{{ scope.row.id }}</span>
</router-link>
</template>
</el-table-column>
<el-table-column width="180px" align="center" label="pick名称">
<el-table-column width="280px" align="center" label="标签名称">
<template slot-scope="scope">
<span>{{ scope.row.name }}</span>
</template>
</el-table-column>
<el-table-column width="280px" align="center" label="pick简介">
<template slot-scope="scope">
<span>{{ scope.row.desc }}</span>
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="pick用户">
<template slot-scope="scope">
<span>{{ scope.row.user_nums }}</span>
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="pick小组数">
<el-table-column width="280px" align="center" label="标签类型">
<template slot-scope="scope">
<span>{{ scope.row.pick_group_nums }}</span>
<span>{{ scope.row.type }}</span>
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="pick属性">
<el-table-column width="220px" align="center" label="标签等级">
<template slot-scope="scope">
<span>{{ scope.row.pick_type }}</span>
<span>{{ scope.row.level }}</span>
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="性别">
<template slot-scope="scope">
<el-tag :type="scope.row.gender | genderFilter">{{scope.row.gender}}</el-tag>
</template>
</el-table-column>
<el-table-column width="130px" align="center" label="地区">
<template slot-scope="scope">
<span>{{ scope.row.region }}</span>
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="下线">
<el-table-column width="220px" align="center" label="下线">
<template slot-scope="scope">
<el-tag :type="scope.row.is_online | isOnlineFilter">{{ scope.row.is_online==1 ? '是' : '否' }}</el-tag>
</template>
......@@ -73,13 +55,13 @@
</el-table>
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" style="margin-left: 150px;" @pagination="getList" />
<pagination v-show="total>0" :total="total" :page.sync="listQuery.offset" :limit.sync="listQuery.limit" style="margin-left: 150px;" @pagination="getList" />
</div>
</template>
<script>
import { fetchList, OffLineOrOnLine } from '@/api/pick'
import { fetchList, OffLineOrOnLine } from '@/api/tag'
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination
import waves from '@/directive/waves'
......@@ -112,21 +94,34 @@ export default {
multipleSelection: [],
del_list: [],
listQuery: {
page: 1,
offset: 1,
limit: 10,
filter: {
value: '',
key: '',
is_online: ''
is_online: '',
name: '',
type:'',
},
},
BooleanTypeOptions: [
{'key': 1, 'display_name': '是'},
{'key': 0, 'display_name': '否'}
],
TagLevelTypeOptions: [
{'key': 1, 'display_name': '一级'},
{'key': 2, 'display_name': '二级'},
{'key': 3, 'display_name': '三级'},
{'key': 4, 'display_name': '四级'},
{'key': 5, 'display_name': '五级'},
],
TagtypeTypeOptions: [
{'key': 0, 'display_name': '用户标签'},
{'key': 1, 'display_name': '帖子标签'}
],
SearchTypeOptions:[
{'key': 'id', 'display_name': 'ID'},
{'key': 'name', 'display_name': 'pick名称'},
{'key': 'name', 'display_name': '标签名称'},
]
}
},
......@@ -150,7 +145,7 @@ export default {
this.getList()
},
handleCurrentChange(val) {
this.listQuery.page = val
this.listQuery.offset = val
this.getList()
},
handleOfflineOrOnline(val){
......@@ -172,11 +167,11 @@ export default {
})
},
handleFilter() {
this.listQuery.page = 1
this.listQuery.offset = 1
this.getList()
},
handleCreate() {
this.$router.push('/pick/create')
this.$router.push('/tag/create')
}
}
}
......
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