api.js 2.57 KB
Newer Older
1
import { stringify } from 'qs';
2
import request from '@/utils/request';
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18

export async function queryProjectNotice() {
  return request('/api/project/notice');
}

export async function queryActivities() {
  return request('/api/activities');
}

export async function queryRule(params) {
  return request(`/api/rule?${stringify(params)}`);
}

export async function removeRule(params) {
  return request('/api/rule', {
    method: 'POST',
陈帅's avatar
陈帅 committed
19
    data: {
20 21 22 23 24 25 26 27 28
      ...params,
      method: 'delete',
    },
  });
}

export async function addRule(params) {
  return request('/api/rule', {
    method: 'POST',
陈帅's avatar
陈帅 committed
29
    data: {
30 31 32 33 34 35
      ...params,
      method: 'post',
    },
  });
}

36 37
export async function updateRule(params = {}) {
  return request(`/api/rule?${stringify(params.query)}`, {
ddcat1115's avatar
ddcat1115 committed
38
    method: 'POST',
陈帅's avatar
陈帅 committed
39
    data: {
40
      ...params.body,
ddcat1115's avatar
ddcat1115 committed
41 42 43 44 45
      method: 'update',
    },
  });
}

46 47 48
export async function fakeSubmitForm(params) {
  return request('/api/forms', {
    method: 'POST',
陈帅's avatar
陈帅 committed
49
    data: params,
50 51 52 53 54 55 56 57 58 59 60
  });
}

export async function fakeChartData() {
  return request('/api/fake_chart_data');
}

export async function queryTags() {
  return request('/api/tags');
}

61 62
export async function queryBasicProfile(id) {
  return request(`/api/profile/basic?id=${id}`);
ddcat1115's avatar
ddcat1115 committed
63 64 65 66
}

export async function queryAdvancedProfile() {
  return request('/api/profile/advanced');
67 68 69 70 71 72
}

export async function queryFakeList(params) {
  return request(`/api/fake_list?${stringify(params)}`);
}

valleykid's avatar
valleykid committed
73 74 75 76
export async function removeFakeList(params) {
  const { count = 5, ...restParams } = params;
  return request(`/api/fake_list?count=${count}`, {
    method: 'POST',
陈帅's avatar
陈帅 committed
77
    data: {
valleykid's avatar
valleykid committed
78 79 80 81 82 83 84 85 86 87
      ...restParams,
      method: 'delete',
    },
  });
}

export async function addFakeList(params) {
  const { count = 5, ...restParams } = params;
  return request(`/api/fake_list?count=${count}`, {
    method: 'POST',
陈帅's avatar
陈帅 committed
88
    data: {
valleykid's avatar
valleykid committed
89 90 91 92 93 94 95 96 97 98
      ...restParams,
      method: 'post',
    },
  });
}

export async function updateFakeList(params) {
  const { count = 5, ...restParams } = params;
  return request(`/api/fake_list?count=${count}`, {
    method: 'POST',
陈帅's avatar
陈帅 committed
99
    data: {
valleykid's avatar
valleykid committed
100 101 102 103 104 105
      ...restParams,
      method: 'update',
    },
  });
}

106 107 108
export async function fakeAccountLogin(params) {
  return request('/api/login/account', {
    method: 'POST',
陈帅's avatar
陈帅 committed
109
    data: params,
110 111 112 113 114 115
  });
}

export async function fakeRegister(params) {
  return request('/api/register', {
    method: 'POST',
陈帅's avatar
陈帅 committed
116
    data: params,
117 118 119
  });
}

何乐's avatar
何乐 committed
120 121
export async function queryNotices(params = {}) {
  return request(`/api/notices?${stringify(params)}`);
122
}
123 124 125 126

export async function getFakeCaptcha(mobile) {
  return request(`/api/captcha?mobile=${mobile}`);
}