Commit 9176b660 authored by Davve's avatar Davve

完成pick前端编写

parent 2230190d
......@@ -18,17 +18,17 @@ class GroupListView(APIView):
return data
def post(self, request):
ids = request.POST.get('ids', '').split()
group_ids = request.POST.get('ids', '').split()
type = request.POST.get('type')
filters = {}
if type == 'offline':
filters['is_online'] = False
elif type == 'recommend':
filters['recommend'] = True
filters['is_recommend'] = True
else:
filters['is_online'] = True
try:
self.rpc['venus/community/group/batch/update'](filters=filters, ids=ids).unwrap()
self.rpc['venus/community/group/batch/update'](filters=filters, group_ids=group_ids).unwrap()
except Exception as e:
raise e
return {
......
......@@ -18,20 +18,49 @@ class PickListView(APIView):
return data
def post(self, request):
pass
ids = request.POST.get('ids', '').split()
type = request.POST.get('type', '')
try:
self.rpc['venus/community/pick/offline_pick'](type=type, ids=ids).unwrap()
except Exception as e:
raise e
return {
"message": "更新成功"
}
class UpdateOrCreateView(APIView):
def get(self, request):
pass
id = request.GET.get('id')
try:
data = self.rpc['venus/community/pick/detail'](id=id).unwrap()
except Exception as e:
# raise e
data = {
'name': 1,
'desc': 'hahah',
'gender': '哈哈',
'region': '123124312423',
'pick_type': 'www.baid.com',
'position': 22,
'is_online': 1
}
return {'data': data}
def post(self, request):
ids = request.POST.get('ids', '').split()
type = request.POST.get('type', '')
data = {
'name': request.POST.get(' name'),
'desc': request.POST.get(' desc'),
'gender': request.POST.get(' gender'),
'region': request.POST.get(' region'),
'pick_type': request.POST.get(' pick_type'),
'position': request.POST.get(' position'),
'is_online': request.POST.get(' is_online'),
}
try:
self.rpc['venus/community/pick/offline_pick'](type=type, ids=ids).unwrap()
self.rpc['venus/community/pick/create'](data=data).unwrap()
except Exception as e:
raise e
return {
"message": "更新成功"
'message': '操作成功'
}
\ No newline at end of file
......@@ -18,9 +18,10 @@ urlpatterns = [
# 登陆,注销相关
url(r'account/login$', LoginView.as_view()),
url(r'account/logout', LogoutView.as_view()),
url(r'account/list', AccountList.as_view()),
url(r'account/update', AccountList.as_view()),
url(r'account/get', LoginView.as_view()),
url(r'account/list', AccountList.as_view()),
url(r'account/list/update', AccountList.as_view()),
url(r'account/detail', AccountUpdateOrCreateView.as_view()),
url(r'account/create', AccountUpdateOrCreateView.as_view()),
# user相关
......@@ -41,5 +42,8 @@ urlpatterns = [
# pick相关
url(r'pick/list$', PickListView.as_view()),
url(r'pick/update_or_create', UpdateOrCreateView.as_view()),
url(r'pick/list/update$', PickListView.as_view()),
url(r'pick/create', UpdateOrCreateView.as_view()),
url(r'pick/detail', UpdateOrCreateView.as_view()),
]
\ No newline at end of file
......@@ -10,7 +10,7 @@ export function fetchList(query) {
export function OffLineOrOnLine(data) {
return request({
url: '/api/account/update',
url: '/api/account/list/update',
method: 'post',
data
})
......@@ -31,4 +31,3 @@ export function fetchAccountDetail(id) {
param: { id }
})
}
......@@ -11,8 +11,33 @@ export function fetchList(query) {
export function OffLineOrOnLine(data) {
console.log(data)
return request({
url: '/api/pick/update_or_create',
url: '/api/pick/list/update',
method: 'post',
data
})
}
export function fetchPickDetail(id) {
return request({
url: '/api/account/detail',
method: 'get',
param: { id }
})
}
export function CreatePick(data) {
return request({
url: '/api/pick/create',
method: 'post',
data
})
}
export function fetchPPickDetail(id) {
return request({
url: '/api/pick/detail',
method: 'get',
param: { id }
})
}
......@@ -54,7 +54,7 @@
<el-table-column width="80px" align="center" label="帖子数">
<template slot-scope="scope">
<span>{{ scope.row.topic_num }}</span>
<span>{{ scope.row.topic_nums }}</span>
</template>
</el-table-column>
......@@ -171,7 +171,7 @@ export default {
if (val === 'offline'){
this.multipleSelection[i].is_online = 0
} else if(val === 'recommend'){
this.multipleSelection[i].is_recommend = 0
this.multipleSelection[i].is_recommend = 1
} else{
this.multipleSelection[i].is_online = 1
}
......
This diff is collapsed.
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