Commit 3338d367 authored by Davve's avatar Davve

修改小组信息获取

parent 09a60479
......@@ -58,10 +58,11 @@ class GroupUpdateOrCreate(APIView):
'name': request.POST.get('name', ''),
'description': request.POST.get('description', ''),
'creator_id': request.POST.get('user_id', ''),
'star_ids': json.loads(request.POST.get('star', '')),
'celebrity_ids': json.loads(request.POST.get('star', '')),
'is_online': request.POST.get('is_online', ''),
'is_recommend': request.POST.get('is_recommend', ''),
'user_ids': json.loads(request.POST.get('user_ids', ''))
'group_user_ids': json.loads(request.POST.get('user_ids', '')),
'icon': request.POST.get('icon', '')[:-2]
}
try:
self.rpc['venus/sun/group/edit'](id=id, data=data).unwrap()
......
......@@ -51,7 +51,7 @@ class StarSearchView(APIView):
def get(self, request):
name = request.GET.get('name')
try:
data = self.rpc['venus/sun/star/search'](name=name).unwrap()
data = self.rpc['venus/sun/celebrity/search'](name=name).unwrap()
except Exception as e:
raise e
return {'data': data}
......
......@@ -32,10 +32,10 @@ export function OffLineOrOnLine(data) {
})
}
export function fetchStarRelatedGroup(id) {
export function fetchStarRelatedGroup(query) {
return request({
url: '/api/celebrity/celebrity_related_group_info',
method: 'get',
params: { id }
params: query
})
}
......@@ -89,6 +89,13 @@
</el-form-item>
<div style="margin-bottom: 20px;">
<el-form-item style="margin-bottom: 40px;" label-width="75px" label="小组头像:" prop="icon" >
<span v-model="uploadType"></span>
<Upload v-model="postForm.icon" :uploadType="uploadType" />
</el-form-item>
</div>
</el-card>
</el-row>
......@@ -163,14 +170,15 @@
<script>
import MDinput from '@/components/MDinput'
import Upload from '@/components/Upload/singleImage3'
import Sticky from '@/components/Sticky' // 粘性header组件
import waves from '@/directive/waves'
import Pagination from '@/components/Pagination'
import {isInArray, removeByvale} from "@/utils";
import {createGroup, GroupDetail, fetchGroupRelateduser, GroupUserDetail} from '@/api/group'
import {starSearch, userSearch} from '@/api/remoteSearch'
import { isInArray, removeByvale} from "@/utils";
function Assembledata(target, source) {
var region_data = []
......@@ -193,6 +201,7 @@
user_nums: 0,
user_id: '',
star: [],
icon: '',
is_online: 1,
is_recommend: 1,
user_ids: [],
......@@ -200,7 +209,7 @@
export default {
name: 'GroupDetail',
components: {MDinput, Sticky, Pagination},
components: {MDinput, Sticky, Pagination, Upload},
directives: {waves},
props: {
isEdit: {
......@@ -230,6 +239,7 @@
tempRoute: {},
temp_user_ids: '',
user_ids: [],
uploadType: 98,
starListOptions: [],
userListOptions: [],
......@@ -239,7 +249,6 @@
temp:{
user_id: '',
user_name: '',
user_ids: [],
star_ids: [],
},
del_list: [],
......@@ -314,15 +323,13 @@
if (this.postForm.user_id === this.temp.user_name){
this.postForm.user_id = this.temp.user_id
}
let user_ids = []
for (let i = 0;i < this.tableData.length; i++){
user_ids.push(this.tableData[i].user_id)
}
if (this.isEdit){
this.postForm.star = Assembledata(this.temp.star_ids, this.postForm.star)
} else{
this.postForm.star = JSON.stringify(this.postForm.star)
}
this.postForm.star = JSON.stringify(this.postForm.star)
this.postForm.user_ids = JSON.stringify(user_ids);
this.postForm.user_ids = JSON.stringify(this.user_ids);
createGroup(this.postForm).then(response => {
this.$notify({
title: '成功',
......@@ -365,13 +372,6 @@
this.getList()
},
appendUser() {
if (isInArray(this.user_ids, this.temp_user_ids)) {
this.$message({
message: '数据添加重复',
type: 'error'
})
return false;
}
GroupUserDetail(this.temp_user_ids).then(response => {
if (!response.data.data) return
this.tableData.push(...response.data.data)
......@@ -381,7 +381,24 @@
this.temp_user_ids = ''
},
delUser() {
let origin_user_ids = [];
var left_user_ids = [];
let select_user_ids = []
this.del_list.push(...this.multipleSelection)
for (let i = 0; i < this.tableData.length; i++){
origin_user_ids.push(this.tableData[i].user_id)
}
for (let i = 0; i < this.multipleSelection.length; i++){
select_user_ids.push(this.multipleSelection[i].user_id)
}
for (let i =0; i < origin_user_ids.length; i++){
if (!isInArray(select_user_ids ,origin_user_ids[i])){
left_user_ids.push(origin_user_ids[i])
}
}
this.user_ids = left_user_ids;
},
getList() {
this.listLoading = true
......
......@@ -149,7 +149,7 @@
</el-table-column>
<el-table-column align="center" label="组长">
<template slot-scope="scope">
<span>{{ scope.row.creator_name }}</span>
<span>{{ scope.row.creator.name }}</span>
</template>
</el-table-column>
......@@ -232,6 +232,7 @@
multipleSelection: [],
del_list: [],
listQuery: {
id: '',
page: 0,
limit: 10,
},
......@@ -265,7 +266,7 @@
if (this.isEdit) {
const id = this.$route.params && this.$route.params.id
this.fetchData(id)
this.getList(id)
this.getList()
} else {
this.postForm = Object.assign({}, defaultForm)
}
......@@ -365,9 +366,10 @@
this.listQuery.page = val
this.getList()
},
getList(id) {
getList() {
this.listLoading = true
fetchStarRelatedGroup(id).then(response => {
this.listQuery.id = this.$route.params && this.$route.params.id
fetchStarRelatedGroup(this.listQuery).then(response => {
let rep = response.data.data.data;
for (let i = 0; i < rep.length; i++){
this.group_ids.push(rep[i].id)
......
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