Commit 30f66f17 authored by Davve's avatar Davve

修改错误

parent 192ec841
......@@ -55,7 +55,7 @@ class UpdateOrCreateView(APIView):
id = request.POST.get('id', '')
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', '[]')))))
position = request.POST.get('position')
gender = request.POST.get('gender')
pick_type = request.POST.get('pick_type')
......@@ -83,9 +83,10 @@ class UpdateOrCreateView(APIView):
'region': city_ids,
'pick_type': data_dict['pick_type'] if id else pick_type,
'pick_group': pick_group_ids,
'position': request.POST.get('position'),
'is_online': int(request.POST.get('is_online')),
}
if position:
data.update({"position": position})
try:
self.rpc['venus/sun/pick/edit'](id=id, data=data).unwrap()
except Exception as e:
......
......@@ -31,6 +31,7 @@ urlpatterns = [
url(r'^account/create$', AccountUpdateOrCreateView.as_view()),
# user相关
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/create$', UserUpdateOrCreate.as_view()),
url(r'^user/group/list$', UserGroupView.as_view()),
......
......@@ -25,6 +25,25 @@ class UserListView(APIView):
raise
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):
def get(self, request):
......
......@@ -11,7 +11,7 @@ export function fetchList(query) {
export function OffLineOrOnLine(data) {
return request({
url: '/api/user/update_or_create',
url: '/api/user/list/update',
method: 'post',
data
})
......
......@@ -185,7 +185,6 @@ export default {
fetchData(id) {
fetchPushDetail(id).then(response => {
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.is_effect = Boolean(response.data.data.data.is_effect)
}).catch(err => {
......
......@@ -200,6 +200,7 @@
rules: {
nick_name: [{validator: validateRequire, trigger: 'blur'}],
avatar: [{validator: validateRequire, trigger: 'blur'}],
avatar: [{validator: validateRequire, trigger: 'blur'}],
},
tempRoute: {},
GenderTypeOptions: [
......
......@@ -204,7 +204,7 @@
},
handleOfflineOrOnline(val) {
const length = this.multipleSelection.length;
let str = '';
var ids = [];
this.del_list = this.del_list.concat(this.multipleSelection);
for (let i = 0; i < length; i++) {
if (val === 'offline') {
......@@ -214,11 +214,14 @@
} else {
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.$message.success(response.data.data.message);
setTimeout(() => {
this.$router.go(0)
}, 1500)
})
},
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