Commit 30f66f17 authored by Davve's avatar Davve

修改错误

parent 192ec841
...@@ -55,7 +55,7 @@ class UpdateOrCreateView(APIView): ...@@ -55,7 +55,7 @@ class UpdateOrCreateView(APIView):
id = request.POST.get('id', '') id = request.POST.get('id', '')
pick_group_ids = list(set(map(lambda x: x.split(":")[0], json.loads(request.POST.get('pick_group', '[]'))))) pick_group_ids = list(set(map(lambda x: x.split(":")[0], json.loads(request.POST.get('pick_group', '[]')))))
city_ids = list(set(map(lambda x: x.split(":")[0], json.loads(request.POST.get('city', '[]'))))) city_ids = list(set(map(lambda x: x.split(":")[0], json.loads(request.POST.get('city', '[]')))))
position = request.POST.get('position')
gender = request.POST.get('gender') gender = request.POST.get('gender')
pick_type = request.POST.get('pick_type') pick_type = request.POST.get('pick_type')
...@@ -83,9 +83,10 @@ class UpdateOrCreateView(APIView): ...@@ -83,9 +83,10 @@ class UpdateOrCreateView(APIView):
'region': city_ids, 'region': city_ids,
'pick_type': data_dict['pick_type'] if id else pick_type, 'pick_type': data_dict['pick_type'] if id else pick_type,
'pick_group': pick_group_ids, 'pick_group': pick_group_ids,
'position': request.POST.get('position'),
'is_online': int(request.POST.get('is_online')), 'is_online': int(request.POST.get('is_online')),
} }
if position:
data.update({"position": position})
try: try:
self.rpc['venus/sun/pick/edit'](id=id, data=data).unwrap() self.rpc['venus/sun/pick/edit'](id=id, data=data).unwrap()
except Exception as e: except Exception as e:
......
...@@ -31,6 +31,7 @@ urlpatterns = [ ...@@ -31,6 +31,7 @@ urlpatterns = [
url(r'^account/create$', AccountUpdateOrCreateView.as_view()), url(r'^account/create$', AccountUpdateOrCreateView.as_view()),
# user相关 # user相关
url(r'^user/list$', UserListView.as_view()), url(r'^user/list$', UserListView.as_view()),
url(r'^user/list/update$', UserListView.as_view()),
url(r'^user/get$', UserUpdateOrCreate.as_view()), url(r'^user/get$', UserUpdateOrCreate.as_view()),
url(r'^user/create$', UserUpdateOrCreate.as_view()), url(r'^user/create$', UserUpdateOrCreate.as_view()),
url(r'^user/group/list$', UserGroupView.as_view()), url(r'^user/group/list$', UserGroupView.as_view()),
......
...@@ -25,6 +25,25 @@ class UserListView(APIView): ...@@ -25,6 +25,25 @@ class UserListView(APIView):
raise raise
return data return data
def post(self, request):
ids = json.loads(request.POST.get('ids', '[]'))
type = request.POST.get('type', '')
updates = {}
if type == 'recommend':
updates['is_recommend'] = 1
else:
pass
try:
self.rpc['venus/sun/user/batch/update'](updates=updates, ids=ids).unwrap()
except Exception as e:
error_logger.error(u'批量更新user列表失败%s', e)
raise
return {
"message": "更新成功"
}
class UserUpdateOrCreate(APIView): class UserUpdateOrCreate(APIView):
def get(self, request): def get(self, request):
......
...@@ -11,7 +11,7 @@ export function fetchList(query) { ...@@ -11,7 +11,7 @@ export function fetchList(query) {
export function OffLineOrOnLine(data) { export function OffLineOrOnLine(data) {
return request({ return request({
url: '/api/user/update_or_create', url: '/api/user/list/update',
method: 'post', method: 'post',
data data
}) })
......
...@@ -185,7 +185,6 @@ export default { ...@@ -185,7 +185,6 @@ export default {
fetchData(id) { fetchData(id) {
fetchPushDetail(id).then(response => { fetchPushDetail(id).then(response => {
this.postForm = response.data.data.data this.postForm = response.data.data.data
console.log(response.data.data.data.url_prefix, '-----', urlTypeKeyValue[response.data.data.data.url_prefix])
this.postForm.url = urlTypeKeyValue[response.data.data.data.url_prefix] this.postForm.url = urlTypeKeyValue[response.data.data.data.url_prefix]
this.is_effect = Boolean(response.data.data.data.is_effect) this.is_effect = Boolean(response.data.data.data.is_effect)
}).catch(err => { }).catch(err => {
......
...@@ -200,6 +200,7 @@ ...@@ -200,6 +200,7 @@
rules: { rules: {
nick_name: [{validator: validateRequire, trigger: 'blur'}], nick_name: [{validator: validateRequire, trigger: 'blur'}],
avatar: [{validator: validateRequire, trigger: 'blur'}], avatar: [{validator: validateRequire, trigger: 'blur'}],
avatar: [{validator: validateRequire, trigger: 'blur'}],
}, },
tempRoute: {}, tempRoute: {},
GenderTypeOptions: [ GenderTypeOptions: [
......
...@@ -204,7 +204,7 @@ ...@@ -204,7 +204,7 @@
}, },
handleOfflineOrOnline(val) { handleOfflineOrOnline(val) {
const length = this.multipleSelection.length; const length = this.multipleSelection.length;
let str = ''; var ids = [];
this.del_list = this.del_list.concat(this.multipleSelection); this.del_list = this.del_list.concat(this.multipleSelection);
for (let i = 0; i < length; i++) { for (let i = 0; i < length; i++) {
if (val === 'offline') { if (val === 'offline') {
...@@ -214,11 +214,14 @@ ...@@ -214,11 +214,14 @@
} else { } else {
this.multipleSelection[i].is_online = 1 this.multipleSelection[i].is_online = 1
} }
str += this.multipleSelection[i].id + ' '; ids.push(this.multipleSelection[i].user_id)
} }
OffLineOrOnLine({type: val, ids: str}).then(response => { OffLineOrOnLine({type: val, ids: JSON.stringify(ids)}).then(response => {
this.multipleSelection = []; this.multipleSelection = [];
this.$message.success(response.data.data.message); this.$message.success(response.data.data.message);
setTimeout(() => {
this.$router.go(0)
}, 1500)
}) })
}, },
handleFilter() { handleFilter() {
......
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