Commit 938e4cf3 authored by Davve's avatar Davve

完成pick后端接口

parent 9176b660
......@@ -35,16 +35,7 @@ class UpdateOrCreateView(APIView):
try:
data = self.rpc['venus/community/pick/detail'](id=id).unwrap()
except Exception as e:
# raise e
data = {
'name': 1,
'desc': 'hahah',
'gender': '哈哈',
'region': '123124312423',
'pick_type': 'www.baid.com',
'position': 22,
'is_online': 1
}
raise e
return {'data': data}
def post(self, request):
......@@ -58,7 +49,7 @@ class UpdateOrCreateView(APIView):
'is_online': request.POST.get(' is_online'),
}
try:
self.rpc['venus/community/pick/create'](data=data).unwrap()
self.rpc['venus/community/pick/update_or_create'](data=data).unwrap()
except Exception as e:
raise e
return {
......
......@@ -17,15 +17,6 @@ export function OffLineOrOnLine(data) {
})
}
export function fetchPickDetail(id) {
return request({
url: '/api/account/detail',
method: 'get',
param: { id }
})
}
export function CreatePick(data) {
return request({
url: '/api/pick/create',
......@@ -34,7 +25,7 @@ export function CreatePick(data) {
})
}
export function fetchPPickDetail(id) {
export function fetchPickDetail(id) {
return request({
url: '/api/pick/detail',
method: 'get',
......
......@@ -2,7 +2,7 @@
<div class="createPost-container">
<el-form ref="postForm" :model="postForm" :rules="rules" class="form-container">
<sticky :class-name="'sub-navbar '+postForm.status">
<sticky :class-name="'sub-navbar'">
<el-button v-loading="loading" style="margin-left: 10px;" type="success" @click="submitForm">发布
</el-button>
</sticky>
......@@ -72,11 +72,11 @@
<script>
import MDinput from '@/components/MDinput'
import Sticky from '@/components/Sticky' // 粘性header组件
import { fetchPickDetail, CreatePick,fetchPPickDetail} from '@/api/pick'
import { fetchPickDetail, CreatePick} from '@/api/pick'
import { userSearch } from '@/api/remoteSearch'
const defaultForm = {
status: 'draft',
// status: 'draft',
name: '',
desc: '',
gender: '',
......@@ -87,7 +87,7 @@ const defaultForm = {
}
export default {
name: 'ArticleDetail',
name: 'PickDetail',
components: { MDinput, Sticky},
props: {
isEdit: {
......@@ -127,6 +127,7 @@ export default {
created() {
if (this.isEdit) {
const id = this.$route.params && this.$route.params.id
console.log(id)
this.fetchData(id)
} else {
this.postForm = Object.assign({}, defaultForm)
......@@ -136,8 +137,9 @@ export default {
},
methods: {
fetchData(id) {
fetchPPickDetail(id).then(response => {
this.postForm = response.data.data.data
fetchPickDetail(id).then(response => {
console.log(response.data.data.data)
// this.postForm = response.data.data.data
}).catch(err => {
console.log(err)
......@@ -169,7 +171,7 @@ export default {
});
this.postForm.status = 'published'
// this.postForm.status = 'published'
this.loading = false
} else {
console.log('error submit!!')
......
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