Commit 51e1a750 authored by Davve's avatar Davve

pick接口调通

parent 938e4cf3
......@@ -40,13 +40,14 @@ class UpdateOrCreateView(APIView):
def post(self, request):
data = {
'name': request.POST.get(' name'),
'desc': request.POST.get(' desc'),
'gender': request.POST.get(' gender'),
'region': request.POST.get(' region'),
'pick_type': request.POST.get(' pick_type'),
'position': request.POST.get(' position'),
'is_online': request.POST.get(' is_online'),
'name': request.POST.get('name'),
'desc': request.POST.get('desc'),
'gender': request.POST.get('gender'),
'region': list(set(request.POST.get('region', '').split(','))),
'pick_type': request.POST.get('pick_type'),
'pick_group': list(set(request.POST.get('pick_group', '').split(','))),
'position': request.POST.get('position'),
'is_online': request.POST.get('is_online'),
}
try:
self.rpc['venus/community/pick/update_or_create'](data=data).unwrap()
......
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# __author__ = "chenwei"
# Date: 2018/11/17
from utils.base import APIView
class GroupSearchView(APIView):
def get(self, request):
name = request.GET.get('name')
print(name, '0------')
try:
pass
except Exception as e:
raise e
return {
'total': 100,
'data': [
{'name': '小组1', 'id': 1},
{'name': '小组2', 'id': 2},
{'name': '小组3', 'id': 3},
{'name': '小组4', 'id': 4},
{'name': '小组5', 'id': 5},
{'name': '小组6', 'id': 6},
]
}
class RegionSearchView(APIView):
def get(self, request):
name = request.GET.get('name')
print(request.GET)
try:
pass
except Exception as e:
raise e
return {
'total': 100,
'data': [
{'name': '北京', 'id': 1},
{'name': '上海', 'id': 2},
{'name': '深圳', 'id': 3},
{'name': '武汉', 'id': 4},
{'name': '成都', 'id': 5},
{'name': '宁波', 'id': 6},
]
}
class UserSearchView(APIView):
def get(self, request):
pass
\ No newline at end of file
......@@ -13,17 +13,18 @@ from .user import *
from .topic import *
from .star import *
from .account import *
from .search import *
urlpatterns = [
# 登陆,注销相关
url(r'account/login$', LoginView.as_view()),
url(r'account/logout', LogoutView.as_view()),
url(r'account/get', LoginView.as_view()),
url(r'account/logout$', LogoutView.as_view()),
url(r'account/get$', LoginView.as_view()),
url(r'account/list', AccountList.as_view()),
url(r'account/list/update', AccountList.as_view()),
url(r'account/detail', AccountUpdateOrCreateView.as_view()),
url(r'account/create', AccountUpdateOrCreateView.as_view()),
url(r'account/list$', AccountList.as_view()),
url(r'account/list/update$', AccountList.as_view()),
url(r'account/detail$', AccountUpdateOrCreateView.as_view()),
url(r'account/create$', AccountUpdateOrCreateView.as_view()),
# user相关
url(r'user/list$', UserListView.as_view()),
......@@ -44,6 +45,14 @@ urlpatterns = [
url(r'pick/list$', PickListView.as_view()),
url(r'pick/list/update$', PickListView.as_view()),
url(r'pick/create', UpdateOrCreateView.as_view()),
url(r'pick/detail', UpdateOrCreateView.as_view()),
]
\ No newline at end of file
url(r'pick/create$', UpdateOrCreateView.as_view()),
url(r'pick/detail/', UpdateOrCreateView.as_view()),
]
searchurlpatterns = [
url(r'search/group$', GroupSearchView.as_view()),
url(r'search/region', RegionSearchView.as_view()),
url(r'search/user', UserSearchView.as_view()),
]
urlpatterns += searchurlpatterns
......@@ -9,7 +9,6 @@ function resolve(dir) {
return path.join(__dirname, '..', dir)
}
module.exports = {
context: path.resolve(__dirname, '../'),
entry: {
......
var api = require('./api')
//
// const target = 'http://doctor.test.env'
const target = 'http://172.30.8.231:8000'
// const target = 'http://192.168.1.6:8000'
......
......@@ -47,6 +47,7 @@
"js-cookie": "2.2.0",
"jsonlint": "1.6.3",
"jszip": "3.1.5",
"linq": "^3.1.1",
"mockjs": "1.0.1-beta3",
"normalize.css": "7.0.0",
"nprogress": "0.2.0",
......
......@@ -28,6 +28,6 @@ export function fetchAccountDetail(id) {
return request({
url: '/api/account/detail',
method: 'get',
param: { id }
params: { id }
})
}
......@@ -8,7 +8,6 @@ export function fetchList(query) {
})
}
export function OffLineOrOnLine(data) {
return request({
url: '/api/group/update',
......
......@@ -20,6 +20,7 @@ export function logout() {
}
export function getUserInfo(token) {
console.log(token)
return request({
url: '/api/account/get',
method: 'get',
......
......@@ -29,6 +29,6 @@ export function fetchPickDetail(id) {
return request({
url: '/api/pick/detail',
method: 'get',
param: { id }
params: { id }
})
}
......@@ -7,3 +7,19 @@ export function userSearch(name) {
params: { name }
})
}
export function groupSearch(name) {
return request({
url: '/api/search/group',
method: 'get',
params: { name }
})
}
export function regionSearch(name) {
return request({
url: '/api/search/region',
method: 'get',
params: { name }
})
}
......@@ -26,12 +26,16 @@ export function parseTime(time, cFormat) {
const time_str = format.replace(/{(y|m|d|h|i|s|a)+}/g, (result, key) => {
let value = formatObj[key]
// Note: getDay() returns 0 on Sunday
if (key === 'a') { return ['日', '一', '二', '三', '四', '五', '六'][value ] }
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
if(key === 'a'
)
{
return ['日', '一', '二', '三', '四', '五', '六'][value]
}
if (result.length > 0 && value < 10) {
value = '0' + value
}
return value || 0
})
return time_str
}
......@@ -81,7 +85,8 @@ export function getQueryObject(url) {
val = String(val)
obj[name] = val
return rs
})
}
)
return obj
}
......@@ -116,10 +121,12 @@ export function param(json) {
if (!json) return ''
return cleanArray(
Object.keys(json).map(key => {
if (json[key] === undefined) return ''
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
})
).join('&')
if(json[key] === undefined)
return ''
return encodeURIComponent(key) + '=' + encodeURIComponent(json[key])
})
).
join('&')
}
export function param2Obj(url) {
......@@ -127,14 +134,13 @@ export function param2Obj(url) {
if (!search) {
return {}
}
console.log(url)
return JSON.parse(
'{"' +
decodeURIComponent(search)
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"') +
'"}'
decodeURIComponent(search)
.replace(/"/g, '\\"')
.replace(/&/g, '","')
.replace(/=/g, '":"') +
'"}'
)
}
......@@ -156,12 +162,16 @@ export function objectMerge(target, source) {
}
Object.keys(source).forEach(property => {
const sourceProperty = source[property]
if (typeof sourceProperty === 'object') {
target[property] = objectMerge(target[property], sourceProperty)
} else {
target[property] = sourceProperty
}
})
if(typeof sourceProperty === 'object'
)
{
target[property] = objectMerge(target[property], sourceProperty)
}
else
{
target[property] = sourceProperty
}
})
return target
}
......@@ -231,7 +241,7 @@ export function getTime(type) {
export function debounce(func, wait, immediate) {
let timeout, args, context, timestamp, result
const later = function() {
const later = function () {
// 据上一次触发时间间隔
const last = +new Date() - timestamp
......@@ -248,7 +258,9 @@ export function debounce(func, wait, immediate) {
}
}
return function(...args) {
return function (...args
)
{
context = this
timestamp = +new Date()
const callNow = immediate && !timeout
......@@ -274,12 +286,16 @@ export function deepClone(source) {
}
const targetObj = source.constructor === Array ? [] : {}
Object.keys(source).forEach(keys => {
if (source[keys] && typeof source[keys] === 'object') {
targetObj[keys] = deepClone(source[keys])
} else {
targetObj[keys] = source[keys]
}
})
if(source[keys] && typeof source[keys] === 'object'
)
{
targetObj[keys] = deepClone(source[keys])
}
else
{
targetObj[keys] = source[keys]
}
})
return targetObj
}
......@@ -290,3 +306,21 @@ export function uniqueArr(arr) {
export function isExternal(path) {
return /^(https?:|mailto:|tel:)/.test(path)
}
export function isInArray(arr, value) {
for (var i = 0; i < arr.length; i++) {
if (value === arr[i]) {
return true;
}
}
return false;
}
export function removeByvale(arr, val) {
for (var i=0;i<arr.length;i++){
if (arr[i] == val){
arr.splice(i, 1);
break
}
}
}
This diff is collapsed.
......@@ -29,7 +29,7 @@
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="pick简介">
<el-table-column width="280px" align="center" label="pick简介">
<template slot-scope="scope">
<span>{{ scope.row.desc }}</span>
</template>
......@@ -41,6 +41,12 @@
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="pick小组数">
<template slot-scope="scope">
<span>{{ scope.row.pick_group_nums }}</span>
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="pick属性">
<template slot-scope="scope">
<span>{{ scope.row.pick_type }}</span>
......@@ -53,7 +59,7 @@
</template>
</el-table-column>
<el-table-column width="120px" align="center" label="地区">
<el-table-column width="130px" align="center" label="地区">
<template slot-scope="scope">
<span>{{ scope.row.region }}</span>
</template>
......
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