Commit 626302b9 authored by Davve's avatar Davve

完善用户获取信息

parent 6b6f5db0
......@@ -12,7 +12,7 @@ class PickListView(APIView):
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/pick/get'](offset=offset, limit=limit, filters=filter).unwrap()
data = self.rpc['venus/sun/pick/list'](offset=(offset - 1) * limit, limit=limit, filters=filter).unwrap()
except Exception as e:
raise e
return data
......@@ -20,8 +20,15 @@ class PickListView(APIView):
def post(self, request):
ids = request.POST.get('ids', '').split()
type = request.POST.get('type', '')
updates = {}
if type == 'offline':
updates['is_online'] = 0
else:
updates['is_online'] = 1
try:
self.rpc['venus/community/pick/offline_pick'](type=type, ids=ids).unwrap()
self.rpc['venus/sun/pick/batch/update'](updates=updates, ids=ids).unwrap()
except Exception as e:
raise e
return {
......@@ -33,12 +40,13 @@ class UpdateOrCreateView(APIView):
def get(self, request):
id = request.GET.get('id')
try:
data = self.rpc['venus/community/pick/detail'](id=id).unwrap()
data = self.rpc['venus/sun/pick/get'](id=id).unwrap()
except Exception as e:
raise e
return {'data': data}
def post(self, request):
id = request.POST.get('id', '')
data = {
'name': request.POST.get('name'),
'desc': request.POST.get('desc'),
......@@ -50,7 +58,7 @@ class UpdateOrCreateView(APIView):
'is_online': request.POST.get('is_online'),
}
try:
self.rpc['venus/community/pick/update_or_create'](data=data).unwrap()
self.rpc['venus/sun/pick/edit'](id=id, data=data).unwrap()
except Exception as e:
raise e
return {
......
......@@ -13,7 +13,7 @@ class PushListView(APIView):
limit = int(request.GET.get('limit', 10))
filter = self.handle_filter(request.GET.get('filter', ""))
try:
data = self.rpc['venus/community/push/sun_list'](offset=page, limit=limit, filters=filter).unwrap()
data = self.rpc['venus/sun/push/list'](offset=(page-1) * limit, limit=limit, filters=filter).unwrap()
except Exception as e:
raise e
return data
......@@ -23,7 +23,7 @@ class PushUpdateOrCreateView(APIView):
def get(self, request):
id = request.GET.get('id')
try:
data = self.rpc['venus/community/push/get'](id=id).unwrap()
data = self.rpc['venus/sun/push/get'](id=id).unwrap()
except Exception as e:
raise e
return {'data': data}
......@@ -38,9 +38,10 @@ class PushUpdateOrCreateView(APIView):
'icon': request.POST.get('icon', '')[:-2],
'content': request.POST.get('content', ''),
'title': request.POST.get('title', ''),
'creator_id': '' # TODO 运营ID
}
try:
self.rpc['venus/community/push/update_or_create'](id=id, data=data).unwrap()
self.rpc['venus/sun/push/edit'](id=id, data=data).unwrap()
except Exception as e:
raise e
return {
......
......@@ -3,6 +3,7 @@
# __author__ = "chenwei"
# Date: 2018/11/15
import time
import json
from utils.base import APIView
from utils.time_utils import analysis_time
......@@ -33,16 +34,19 @@ class UserUpdateOrCreate(APIView):
return data
def post(self, request):
id = request.POST.get('id', '')
user_id = request.POST.get('id', '')
show_time = analysis_time(request.POST.get('show_time', 0))
tag_ids = list(set(request.POST.get('tag_ids').split(',')))
if not user_id:
user_id = time.time()
data = {
'user_id': user_id,
'is_recommend': request.POST.get('is_recommend'),
'profile_pic': request.POST.get('avatar')[:-2],
'nick_name': request.POST.get('nick_name'),
'tag_ids': request.POST.get('tag_ids'),
'tag_ids': list(filter(lambda x: x, tag_ids)),
'is_puppet': request.POST.get('is_puppet'),
'city': request.POST.get('city'),
'city_id': request.POST.get('city'),
'show_time': show_time,
'phone': request.POST.get('phone'),
'email': request.POST.get('email'),
......
......@@ -75,7 +75,7 @@
<el-row>
<el-col :span="12">
<el-form-item label-width="45px" label="地区:" class="postInfo-container-item">
<el-select v-model="postForm.region" :remote-method="getRemoteRegionList" filterable remote multiple value-key="id"
<el-select v-model="postForm.region" :remote-method="getRemoteCityList" filterable remote multiple value-key="id"
placeholder="搜索地区" style="width: 100%">
<el-option v-for="(item,index) in regionListOptions" :key="item+index" :label="item.name" :value="item.id"/>
</el-select>
......@@ -122,7 +122,7 @@
import MDinput from '@/components/MDinput'
import Sticky from '@/components/Sticky' // 粘性header组件
import {fetchPickDetail, CreatePick} from '@/api/pick'
import {groupSearch, regionSearch} from '@/api/remoteSearch'
import {groupSearch, regionSearch, citySearch} from '@/api/remoteSearch'
import { isInArray, removeByvale} from "@/utils";
function Assembledata(target, source) {
......@@ -241,7 +241,6 @@
this.postForm.region = Assembledata(this.temparray['region'], this.postForm.region);
this.postForm.pick_group = Assembledata(this.temparray['pick_group'], this.postForm.pick_group);
}else{
this.postForm.region = this.postForm.region.join(',')
this.postForm.region = this.postForm.region.join(',')
this.postForm.pick_group = this.postForm.pick_group.join(',')
}
......@@ -274,8 +273,8 @@
}
})
},
getRemoteRegionList(query) {
regionSearch(query).then(response => {
getRemoteCityList(query) {
citySearch(query).then(response => {
if (!response.data.data.data) return
this.regionListOptions = response.data.data.data
})
......
......@@ -80,10 +80,10 @@
</el-form-item>
</el-col>
<el-col :span="12">
<el-form-item label-width="75px" label="地区:">
<el-form-item label-width="75px" label="城市:">
<el-select v-model="postForm.city" :remote-method="getRemoteCityList" filterable remote
value-key="id"
placeholder="搜索地区" style="width: 230px">
placeholder="搜索城市" style="width: 230px">
<el-option v-for="(item,index) in regionListOptions" :key="item+index" :label="item.name"
:value="item.id"/>
</el-select>
......@@ -307,7 +307,8 @@
del_list: [],
temp: {
tags:[],
city_temp:'',
city_temp_id:'',
city_temp_name: '',
group_ids: []
}
}
......@@ -333,7 +334,8 @@
let rep = response.data.data
let temp_tags = []
this.postForm = response.data.data
console.log(rep.tag_list.length)
this.temp.city_temp_id = response.data.data.city.id
this.postForm.city = this.temp.city_temp_name = response.data.data.city.name
for (let i = 0;i < rep.tag_list.length; i++){
temp_tags.push(rep.tag_list[i].name)
this.temp.tags.push(rep.tag_list[i])
......@@ -351,6 +353,10 @@
this.loading = true
this.postForm.group_ids = JSON.stringify(this.temp.group_ids)
if (this.temp.city_temp_name === this.postForm.city){
this.postForm.city = this.temp.city_temp_id
}
if (this.isEdit){
this.postForm.tag_ids = Assembledata(this.temp.tags, this.postForm.tag_ids)
}else{
......@@ -418,8 +424,8 @@
},
getRemoteTagList(query) {
tagSearch(query).then(response => {
if (!response.data.items) return
this.userListOptions = response.data.data.data
if (!response.data.data.data) return
this.tagListOptions = response.data.data.data
})
},
getList() {
......
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