Commit 938e4cf3 authored by Davve's avatar Davve

完成pick后端接口

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