Commit 53f4d763 authored by Davve's avatar Davve

修复问题

parent d379da40
...@@ -55,24 +55,29 @@ class UpdateOrCreateView(APIView): ...@@ -55,24 +55,29 @@ class UpdateOrCreateView(APIView):
gender = request.POST.get('gender') gender = request.POST.get('gender')
pick_type = request.POST.get('pick_type') pick_type = request.POST.get('pick_type')
data_dict = {
'gender': '',
'gender_value': '',
}
if gender == '全部': if gender == '全部':
gender_value = 2 data_dict['gender'] = 2
elif gender == '男': elif gender == '男':
gender_value = 0 data_dict['gender'] = 0
elif gender == '女': elif gender == '女':
gender_value = 1 data_dict['gender'] = 1
if pick_type == '明星打榜': if pick_type == '明星打榜':
pick_type_vale = 1 data_dict['pick_type'] = 1
elif pick_type == 'PICK帖子': elif pick_type == 'PICK帖子':
pick_type_vale = 0 data_dict['pick_type'] = 0
data = { data = {
'name': request.POST.get('name'), 'name': request.POST.get('name'),
'desc': request.POST.get('desc'), 'desc': request.POST.get('desc'),
'gender': gender_value, 'gender': data_dict['gender'] if id else gender,
'region': city_ids, 'region': city_ids,
'pick_type': pick_type_vale, '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'), 'position': request.POST.get('position'),
'is_online': int(request.POST.get('is_online')), 'is_online': int(request.POST.get('is_online')),
......
...@@ -89,7 +89,7 @@ class ReplyUpdateOrCreateView(APIView): ...@@ -89,7 +89,7 @@ class ReplyUpdateOrCreateView(APIView):
class ReplyCreate(APIView): class ReplyCreate(APIView):
def post(self, request): def post(self, request):
data = { data = {
'user_id': request.POST.get('user_id'), 'user_id': request.POST.get('user_id').split(':')[0],
'replied_id': request.POST.get("replied_id", None), 'replied_id': request.POST.get("replied_id", None),
'topic_id': request.POST.get("topic_id", None), 'topic_id': request.POST.get("topic_id", None),
'content': request.POST.get('content'), 'content': request.POST.get('content'),
...@@ -100,3 +100,21 @@ class ReplyCreate(APIView): ...@@ -100,3 +100,21 @@ class ReplyCreate(APIView):
raise e raise e
return {'data': data} return {'data': data}
class TopicListBatchUpdate(APIView):
def post(self, request):
ids = request.POST.get('ids', '').split()
type = request.POST.get('type')
updates = {}
if type == 'offline':
updates['is_online'] = False
else:
updates['is_online'] = True
try:
self.rpc['venus/sun/topic/batch/update'](updates=updates, ids=ids).unwrap()
except Exception as e:
raise e
return {
"message": "更新成功"
}
...@@ -47,6 +47,7 @@ urlpatterns = [ ...@@ -47,6 +47,7 @@ urlpatterns = [
url(r'^topic/list$', TopicListView.as_view()), url(r'^topic/list$', TopicListView.as_view()),
url(r'^topic/detail$', TopicUpdateOrCreateView.as_view()), url(r'^topic/detail$', TopicUpdateOrCreateView.as_view()),
url(r'^topic/create$', TopicUpdateOrCreateView.as_view()), url(r'^topic/create$', TopicUpdateOrCreateView.as_view()),
url(r'^topic/batch_update$', TopicListBatchUpdate.as_view()),
url(r'^topic/reply/list$', ReplyUpdateOrCreateView.as_view()), url(r'^topic/reply/list$', ReplyUpdateOrCreateView.as_view()),
url(r'^topic/reply/batch_delete$', ReplyUpdateOrCreateView.as_view()), url(r'^topic/reply/batch_delete$', ReplyUpdateOrCreateView.as_view()),
url(r'^topic/reply/create$', ReplyCreate.as_view()), url(r'^topic/reply/create$', ReplyCreate.as_view()),
......
...@@ -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/topic/update_or_create', url: '/api/topic/batch_update',
method: 'post', method: 'post',
data data
}) })
......
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
</el-form-item> </el-form-item>
</el-col> </el-col>
<el-col :span="8"> <el-col :span="8">
<el-form-item label-width="75px" label="小组组长:" class="postInfo-container-item"> <el-form-item label-width="75px" label="小组组长:" class="postInfo-container-item" prop="user">
<el-select v-model="user" :remote-method="getRemoteUserList" filterable remote clearable <el-select v-model="user" :remote-method="getRemoteUserList" filterable remote clearable
value-key="id" value-key="id"
placeholder="搜索用户" style="width: 100%"> placeholder="搜索用户" style="width: 100%">
...@@ -123,7 +123,7 @@ ...@@ -123,7 +123,7 @@
<el-table-column type="selection" width="76" align="center"></el-table-column> <el-table-column type="selection" width="76" align="center"></el-table-column>
<el-table-column align="center" label="用户ID "> <el-table-column align="center" label="用户ID ">
<template slot-scope="scope"> <template slot-scope="scope">
<router-link :to="'/push/edit/'+scope.row.user_id" class="link-type"> <router-link :to="'/user/edit/'+scope.row.user_id" class="link-type">
<span>{{ scope.row.user_id }}</span> <span>{{ scope.row.user_id }}</span>
</router-link> </router-link>
</template> </template>
...@@ -235,14 +235,16 @@ ...@@ -235,14 +235,16 @@
postForm: Object.assign({}, defaultForm), postForm: Object.assign({}, defaultForm),
loading: false, loading: false,
rules: { rules: {
title: [{validator: validateRequire}], name: [{validator: validateRequire, trigger: 'blur'}],
content: [{validator: validateRequire}], user: [{validator: validateRequire, trigger: 'blur'}],
icon: [{validator: validateRequire, trigger: 'blur'}],
}, },
user: '', user: '',
star: [], star: [],
temp_user_ids: '', temp_user_ids: '',
group_users: [], group_users: [],
judge_user_ids: [],
tempRoute: {}, tempRoute: {},
uploadType: 98, uploadType: 98,
...@@ -365,12 +367,21 @@ ...@@ -365,12 +367,21 @@
this.temp_user_ids = '' this.temp_user_ids = ''
return false return false
} }
let append_user_id = parseInt(this.temp_user_ids.split(':')[0])
for (let i = 0;i < this.tableData.length; i++){
if (append_user_id == this.tableData[i].user_id){
this.$message.error('存在同样数据, 请勿重复操作')
this.temp_user_ids = ''
return false;
}
}
GroupUserDetail(this.temp_user_ids).then(response => { GroupUserDetail(this.temp_user_ids).then(response => {
if (!response.data.data) return if (!response.data.data) return
if (!response.data.data[0].user_id){ if (!response.data.data[0].user_id){
this.$message.error('这条数据错误, 请换条数据') this.$message.error('这条数据错误, 请换条数据')
return return
} }
this.judge_user_ids.push(response.data.data[0].user_id)
this.tableData.push(...response.data.data) this.tableData.push(...response.data.data)
this.total = this.tableData.length this.total = this.tableData.length
this.group_users.push(this.temp_user_ids) this.group_users.push(this.temp_user_ids)
......
...@@ -198,7 +198,6 @@ export default { ...@@ -198,7 +198,6 @@ export default {
} }
OffLineOrOnLine({type:val, ids:str}).then(response => { OffLineOrOnLine({type:val, ids:str}).then(response => {
this.multipleSelection = []; this.multipleSelection = [];
response.data.data.message
this.$message.success(response.data.data.message); this.$message.success(response.data.data.message);
this.$router.go(0) this.$router.go(0)
}) })
......
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