正在显示
8 个修改的文件
包含
32 行增加
和
486 行删除
| 1 | -import moment from 'moment'; | |
| 2 | -import React from 'react'; | |
| 3 | -import nzh from 'nzh/cn'; | |
| 4 | -import { parse, stringify } from 'qs'; | |
| 5 | - | |
| 6 | -export function fixedZero(val) { | |
| 7 | - return val * 1 < 10 ? `0${val}` : val; | |
| 8 | -} | |
| 9 | - | |
| 10 | -export function getTimeDistance(type) { | |
| 11 | - const now = new Date(); | |
| 12 | - const oneDay = 1000 * 60 * 60 * 24; | |
| 13 | - | |
| 14 | - if (type === 'today') { | |
| 15 | - now.setHours(0); | |
| 16 | - now.setMinutes(0); | |
| 17 | - now.setSeconds(0); | |
| 18 | - return [moment(now), moment(now.getTime() + (oneDay - 1000))]; | |
| 19 | - } | |
| 20 | - | |
| 21 | - if (type === 'week') { | |
| 22 | - let day = now.getDay(); | |
| 23 | - now.setHours(0); | |
| 24 | - now.setMinutes(0); | |
| 25 | - now.setSeconds(0); | |
| 26 | - | |
| 27 | - if (day === 0) { | |
| 28 | - day = 6; | |
| 29 | - } else { | |
| 30 | - day -= 1; | |
| 31 | - } | |
| 32 | - | |
| 33 | - const beginTime = now.getTime() - day * oneDay; | |
| 34 | - | |
| 35 | - return [moment(beginTime), moment(beginTime + (7 * oneDay - 1000))]; | |
| 36 | - } | |
| 37 | - | |
| 38 | - if (type === 'month') { | |
| 39 | - const year = now.getFullYear(); | |
| 40 | - const month = now.getMonth(); | |
| 41 | - const nextDate = moment(now).add(1, 'months'); | |
| 42 | - const nextYear = nextDate.year(); | |
| 43 | - const nextMonth = nextDate.month(); | |
| 44 | - | |
| 45 | - return [ | |
| 46 | - moment(`${year}-${fixedZero(month + 1)}-01 00:00:00`), | |
| 47 | - moment(moment(`${nextYear}-${fixedZero(nextMonth + 1)}-01 00:00:00`).valueOf() - 1000), | |
| 48 | - ]; | |
| 49 | - } | |
| 50 | - | |
| 51 | - const year = now.getFullYear(); | |
| 52 | - return [moment(`${year}-01-01 00:00:00`), moment(`${year}-12-31 23:59:59`)]; | |
| 53 | -} | |
| 54 | - | |
| 55 | -export function getPlainNode(nodeList, parentPath = '') { | |
| 56 | - const arr = []; | |
| 57 | - nodeList.forEach(node => { | |
| 58 | - const item = node; | |
| 59 | - item.path = `${parentPath}/${item.path || ''}`.replace(/\/+/g, '/'); | |
| 60 | - item.exact = true; | |
| 61 | - if (item.children && !item.component) { | |
| 62 | - arr.push(...getPlainNode(item.children, item.path)); | |
| 63 | - } else { | |
| 64 | - if (item.children && item.component) { | |
| 65 | - item.exact = false; | |
| 66 | - } | |
| 67 | - arr.push(item); | |
| 68 | - } | |
| 69 | - }); | |
| 70 | - return arr; | |
| 71 | -} | |
| 72 | - | |
| 73 | -export function digitUppercase(n) { | |
| 74 | - return nzh.toMoney(n); | |
| 75 | -} | |
| 76 | - | |
| 77 | -function getRelation(str1, str2) { | |
| 78 | - if (str1 === str2) { | |
| 79 | - console.warn('Two path are equal!'); // eslint-disable-line | |
| 80 | - } | |
| 81 | - const arr1 = str1.split('/'); | |
| 82 | - const arr2 = str2.split('/'); | |
| 83 | - if (arr2.every((item, index) => item === arr1[index])) { | |
| 84 | - return 1; | |
| 85 | - } | |
| 86 | - if (arr1.every((item, index) => item === arr2[index])) { | |
| 87 | - return 2; | |
| 88 | - } | |
| 89 | - return 3; | |
| 90 | -} | |
| 91 | - | |
| 92 | -function getRenderArr(routes) { | |
| 93 | - let renderArr = []; | |
| 94 | - renderArr.push(routes[0]); | |
| 95 | - for (let i = 1; i < routes.length; i += 1) { | |
| 96 | - // 去重 | |
| 97 | - renderArr = renderArr.filter(item => getRelation(item, routes[i]) !== 1); | |
| 98 | - // 是否包含 | |
| 99 | - const isAdd = renderArr.every(item => getRelation(item, routes[i]) === 3); | |
| 100 | - if (isAdd) { | |
| 101 | - renderArr.push(routes[i]); | |
| 102 | - } | |
| 103 | - } | |
| 104 | - return renderArr; | |
| 105 | -} | |
| 106 | - | |
| 107 | -/** | |
| 108 | - * Get router routing configuration | |
| 109 | - * { path:{name,...param}}=>Array<{name,path ...param}> | |
| 110 | - * @param {string} path | |
| 111 | - * @param {routerData} routerData | |
| 112 | - */ | |
| 113 | -export function getRoutes(path, routerData) { | |
| 114 | - let routes = Object.keys(routerData).filter( | |
| 115 | - routePath => routePath.indexOf(path) === 0 && routePath !== path | |
| 116 | - ); | |
| 117 | - // Replace path to '' eg. path='user' /user/name => name | |
| 118 | - routes = routes.map(item => item.replace(path, '')); | |
| 119 | - // Get the route to be rendered to remove the deep rendering | |
| 120 | - const renderArr = getRenderArr(routes); | |
| 121 | - // Conversion and stitching parameters | |
| 122 | - const renderRoutes = renderArr.map(item => { | |
| 123 | - const exact = !routes.some(route => route !== item && getRelation(route, item) === 1); | |
| 124 | - return { | |
| 125 | - exact, | |
| 126 | - ...routerData[`${path}${item}`], | |
| 127 | - key: `${path}${item}`, | |
| 128 | - path: `${path}${item}`, | |
| 129 | - }; | |
| 130 | - }); | |
| 131 | - return renderRoutes; | |
| 132 | -} | |
| 133 | - | |
| 134 | -export function getPageQuery() { | |
| 135 | - return parse(window.location.href.split('?')[1]); | |
| 136 | -} | |
| 137 | - | |
| 138 | -export function getQueryPath(path = '', query = {}) { | |
| 139 | - const search = stringify(query); | |
| 140 | - if (search.length) { | |
| 141 | - return `${path}?${search}`; | |
| 142 | - } | |
| 143 | - return path; | |
| 144 | -} | |
| 145 | - | |
| 146 | -/* eslint no-useless-escape:0 */ | |
| 147 | -const reg = /(((^https?:(?:\/\/)?)(?:[-;:&=\+\$,\w]+@)?[A-Za-z0-9.-]+(?::\d+)?|(?:www.|[-;:&=\+\$,\w]+@)[A-Za-z0-9.-]+)((?:\/[\+~%\/.\w-_]*)?\??(?:[-\+=&;%@.\w_]*)#?(?:[\w]*))?)$/; | |
| 148 | - | |
| 149 | -export function isUrl(path) { | |
| 150 | - return reg.test(path); | |
| 151 | -} | |
| 152 | - | |
| 153 | -export function formatWan(val) { | |
| 154 | - const v = val * 1; | |
| 155 | - if (!v || Number.isNaN(v)) return ''; | |
| 156 | - | |
| 157 | - let result = val; | |
| 158 | - if (val > 10000) { | |
| 159 | - result = Math.floor(val / 10000); | |
| 160 | - result = ( | |
| 161 | - <span> | |
| 162 | - {result} | |
| 163 | - <span | |
| 164 | - style={{ | |
| 165 | - position: 'relative', | |
| 166 | - top: -2, | |
| 167 | - fontSize: 14, | |
| 168 | - fontStyle: 'normal', | |
| 169 | - marginLeft: 2, | |
| 170 | - }} | |
| 171 | - > | |
| 172 | - 万 | |
| 173 | - </span> | |
| 174 | - </span> | |
| 175 | - ); | |
| 176 | - } | |
| 177 | - return result; | |
| 178 | -} | |
| 179 | - | |
| 180 | -// 给官方演示站点用,用于关闭真实开发环境不需要使用的特性 | |
| 181 | -export function isAntdPro() { | |
| 182 | - return window.location.hostname === 'preview.pro.ant.design'; | |
| 183 | -} |
| 1 | -import mockjs from 'mockjs'; | |
| 2 | - | |
| 3 | 1 | const titles = [ |
| 4 | 2 | 'Alipay', |
| 5 | 3 | 'Angular', |
| ... | ... | @@ -21,19 +19,6 @@ const avatars = [ |
| 21 | 19 | 'https://gw.alipayobjects.com/zos/rmsportal/nxkuOJlFJuAUhzlMTCEe.png', // Webpack |
| 22 | 20 | ]; |
| 23 | 21 | |
| 24 | -const avatars2 = [ | |
| 25 | - 'https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png', | |
| 26 | - 'https://gw.alipayobjects.com/zos/rmsportal/cnrhVkzwxjPwAaCfPbdc.png', | |
| 27 | - 'https://gw.alipayobjects.com/zos/rmsportal/gaOngJwsRYRaVAuXXcmB.png', | |
| 28 | - 'https://gw.alipayobjects.com/zos/rmsportal/ubnKSIfAJTxIgXOKlciN.png', | |
| 29 | - 'https://gw.alipayobjects.com/zos/rmsportal/WhxKECPNujWoWEFNdnJE.png', | |
| 30 | - 'https://gw.alipayobjects.com/zos/rmsportal/jZUIxmJycoymBprLOUbT.png', | |
| 31 | - 'https://gw.alipayobjects.com/zos/rmsportal/psOgztMplJMGpVEqfcgF.png', | |
| 32 | - 'https://gw.alipayobjects.com/zos/rmsportal/ZpBqSxLxVEXfcUNoPKrz.png', | |
| 33 | - 'https://gw.alipayobjects.com/zos/rmsportal/laiEnJdGHVOhJrUShBaJ.png', | |
| 34 | - 'https://gw.alipayobjects.com/zos/rmsportal/UrQsqscbKEpNuJcvBZBu.png', | |
| 35 | -]; | |
| 36 | - | |
| 37 | 22 | const covers = [ |
| 38 | 23 | 'https://gw.alipayobjects.com/zos/rmsportal/uMfMFlvUuceEyPpotzlq.png', |
| 39 | 24 | 'https://gw.alipayobjects.com/zos/rmsportal/iZBVOIhGJiAnhplqjvZW.png', |
| ... | ... | @@ -153,184 +138,7 @@ function postFakeList(req, res) { |
| 153 | 138 | return res.json(result); |
| 154 | 139 | } |
| 155 | 140 | |
| 156 | -const getNotice = [ | |
| 157 | - { | |
| 158 | - id: 'xxx1', | |
| 159 | - title: titles[0], | |
| 160 | - logo: avatars[0], | |
| 161 | - description: '那是一种内在的东西,他们到达不了,也无法触及的', | |
| 162 | - updatedAt: new Date(), | |
| 163 | - member: '科学搬砖组', | |
| 164 | - href: '', | |
| 165 | - memberLink: '', | |
| 166 | - }, | |
| 167 | - { | |
| 168 | - id: 'xxx2', | |
| 169 | - title: titles[1], | |
| 170 | - logo: avatars[1], | |
| 171 | - description: '希望是一个好东西,也许是最好的,好东西是不会消亡的', | |
| 172 | - updatedAt: new Date('2017-07-24'), | |
| 173 | - member: '全组都是吴彦祖', | |
| 174 | - href: '', | |
| 175 | - memberLink: '', | |
| 176 | - }, | |
| 177 | - { | |
| 178 | - id: 'xxx3', | |
| 179 | - title: titles[2], | |
| 180 | - logo: avatars[2], | |
| 181 | - description: '城镇中有那么多的酒馆,她却偏偏走进了我的酒馆', | |
| 182 | - updatedAt: new Date(), | |
| 183 | - member: '中二少女团', | |
| 184 | - href: '', | |
| 185 | - memberLink: '', | |
| 186 | - }, | |
| 187 | - { | |
| 188 | - id: 'xxx4', | |
| 189 | - title: titles[3], | |
| 190 | - logo: avatars[3], | |
| 191 | - description: '那时候我只会想自己想要什么,从不想自己拥有什么', | |
| 192 | - updatedAt: new Date('2017-07-23'), | |
| 193 | - member: '程序员日常', | |
| 194 | - href: '', | |
| 195 | - memberLink: '', | |
| 196 | - }, | |
| 197 | - { | |
| 198 | - id: 'xxx5', | |
| 199 | - title: titles[4], | |
| 200 | - logo: avatars[4], | |
| 201 | - description: '凛冬将至', | |
| 202 | - updatedAt: new Date('2017-07-23'), | |
| 203 | - member: '高逼格设计天团', | |
| 204 | - href: '', | |
| 205 | - memberLink: '', | |
| 206 | - }, | |
| 207 | - { | |
| 208 | - id: 'xxx6', | |
| 209 | - title: titles[5], | |
| 210 | - logo: avatars[5], | |
| 211 | - description: '生命就像一盒巧克力,结果往往出人意料', | |
| 212 | - updatedAt: new Date('2017-07-23'), | |
| 213 | - member: '骗你来学计算机', | |
| 214 | - href: '', | |
| 215 | - memberLink: '', | |
| 216 | - }, | |
| 217 | -]; | |
| 218 | - | |
| 219 | -const getActivities = [ | |
| 220 | - { | |
| 221 | - id: 'trend-1', | |
| 222 | - updatedAt: new Date(), | |
| 223 | - user: { | |
| 224 | - name: '曲丽丽', | |
| 225 | - avatar: avatars2[0], | |
| 226 | - }, | |
| 227 | - group: { | |
| 228 | - name: '高逼格设计天团', | |
| 229 | - link: 'http://github.com/', | |
| 230 | - }, | |
| 231 | - project: { | |
| 232 | - name: '六月迭代', | |
| 233 | - link: 'http://github.com/', | |
| 234 | - }, | |
| 235 | - template: '在 @{group} 新建项目 @{project}', | |
| 236 | - }, | |
| 237 | - { | |
| 238 | - id: 'trend-2', | |
| 239 | - updatedAt: new Date(), | |
| 240 | - user: { | |
| 241 | - name: '付小小', | |
| 242 | - avatar: avatars2[1], | |
| 243 | - }, | |
| 244 | - group: { | |
| 245 | - name: '高逼格设计天团', | |
| 246 | - link: 'http://github.com/', | |
| 247 | - }, | |
| 248 | - project: { | |
| 249 | - name: '六月迭代', | |
| 250 | - link: 'http://github.com/', | |
| 251 | - }, | |
| 252 | - template: '在 @{group} 新建项目 @{project}', | |
| 253 | - }, | |
| 254 | - { | |
| 255 | - id: 'trend-3', | |
| 256 | - updatedAt: new Date(), | |
| 257 | - user: { | |
| 258 | - name: '林东东', | |
| 259 | - avatar: avatars2[2], | |
| 260 | - }, | |
| 261 | - group: { | |
| 262 | - name: '中二少女团', | |
| 263 | - link: 'http://github.com/', | |
| 264 | - }, | |
| 265 | - project: { | |
| 266 | - name: '六月迭代', | |
| 267 | - link: 'http://github.com/', | |
| 268 | - }, | |
| 269 | - template: '在 @{group} 新建项目 @{project}', | |
| 270 | - }, | |
| 271 | - { | |
| 272 | - id: 'trend-4', | |
| 273 | - updatedAt: new Date(), | |
| 274 | - user: { | |
| 275 | - name: '周星星', | |
| 276 | - avatar: avatars2[4], | |
| 277 | - }, | |
| 278 | - project: { | |
| 279 | - name: '5 月日常迭代', | |
| 280 | - link: 'http://github.com/', | |
| 281 | - }, | |
| 282 | - template: '将 @{project} 更新至已发布状态', | |
| 283 | - }, | |
| 284 | - { | |
| 285 | - id: 'trend-5', | |
| 286 | - updatedAt: new Date(), | |
| 287 | - user: { | |
| 288 | - name: '朱偏右', | |
| 289 | - avatar: avatars2[3], | |
| 290 | - }, | |
| 291 | - project: { | |
| 292 | - name: '工程效能', | |
| 293 | - link: 'http://github.com/', | |
| 294 | - }, | |
| 295 | - comment: { | |
| 296 | - name: '留言', | |
| 297 | - link: 'http://github.com/', | |
| 298 | - }, | |
| 299 | - template: '在 @{project} 发布了 @{comment}', | |
| 300 | - }, | |
| 301 | - { | |
| 302 | - id: 'trend-6', | |
| 303 | - updatedAt: new Date(), | |
| 304 | - user: { | |
| 305 | - name: '乐哥', | |
| 306 | - avatar: avatars2[5], | |
| 307 | - }, | |
| 308 | - group: { | |
| 309 | - name: '程序员日常', | |
| 310 | - link: 'http://github.com/', | |
| 311 | - }, | |
| 312 | - project: { | |
| 313 | - name: '品牌迭代', | |
| 314 | - link: 'http://github.com/', | |
| 315 | - }, | |
| 316 | - template: '在 @{group} 新建项目 @{project}', | |
| 317 | - }, | |
| 318 | -]; | |
| 319 | - | |
| 320 | -function getFakeCaptcha(req, res) { | |
| 321 | - return res.json('captcha-xxx'); | |
| 322 | -} | |
| 323 | - | |
| 324 | 141 | export default { |
| 325 | - 'GET /api/project/notice': getNotice, | |
| 326 | - 'GET /api/activities': getActivities, | |
| 327 | - 'POST /api/forms': (req, res) => { | |
| 328 | - res.send({ message: 'Ok' }); | |
| 329 | - }, | |
| 330 | - 'GET /api/tags': mockjs.mock({ | |
| 331 | - 'list|100': [{ name: '@city', 'value|1-100': 150, 'type|0-2': 1 }], | |
| 332 | - }), | |
| 333 | - 'GET /api/fake_list': getFakeList, | |
| 334 | - 'POST /api/fake_list': postFakeList, | |
| 335 | - 'GET /api/captcha': getFakeCaptcha, | |
| 142 | + 'GET /api/BLOCK_NAME/fake_list': getFakeList, | |
| 143 | + 'POST /api/BLOCK_NAME/fake_list': postFakeList, | |
| 336 | 144 | }; | ... | ... |
| ... | ... | @@ -32,12 +32,12 @@ const RadioGroup = Radio.Group; |
| 32 | 32 | const SelectOption = Select.Option; |
| 33 | 33 | const { Search, TextArea } = Input; |
| 34 | 34 | |
| 35 | -@connect(({ list, loading }) => ({ | |
| 36 | - list, | |
| 37 | - loading: loading.models.list, | |
| 35 | +@connect(({ BLOCK_NAME, loading }) => ({ | |
| 36 | + BLOCK_NAME, | |
| 37 | + loading: loading.models.BLOCK_NAME, | |
| 38 | 38 | })) |
| 39 | 39 | @Form.create() |
| 40 | -class BasicList extends PureComponent { | |
| 40 | +class PAGE_NAME_UPPER_CAMEL_CASE extends PureComponent { | |
| 41 | 41 | state = { visible: false, done: false }; |
| 42 | 42 | |
| 43 | 43 | formLayout = { |
| ... | ... | @@ -48,7 +48,7 @@ class BasicList extends PureComponent { |
| 48 | 48 | componentDidMount() { |
| 49 | 49 | const { dispatch } = this.props; |
| 50 | 50 | dispatch({ |
| 51 | - type: 'list/fetch', | |
| 51 | + type: 'BLOCK_NAME/fetch', | |
| 52 | 52 | payload: { |
| 53 | 53 | count: 5, |
| 54 | 54 | }, |
| ... | ... | @@ -97,7 +97,7 @@ class BasicList extends PureComponent { |
| 97 | 97 | done: true, |
| 98 | 98 | }); |
| 99 | 99 | dispatch({ |
| 100 | - type: 'list/submit', | |
| 100 | + type: 'BLOCK_NAME/submit', | |
| 101 | 101 | payload: { id, ...fieldsValue }, |
| 102 | 102 | }); |
| 103 | 103 | }); |
| ... | ... | @@ -106,14 +106,14 @@ class BasicList extends PureComponent { |
| 106 | 106 | deleteItem = id => { |
| 107 | 107 | const { dispatch } = this.props; |
| 108 | 108 | dispatch({ |
| 109 | - type: 'list/submit', | |
| 109 | + type: 'BLOCK_NAME/submit', | |
| 110 | 110 | payload: { id }, |
| 111 | 111 | }); |
| 112 | 112 | }; |
| 113 | 113 | |
| 114 | 114 | render() { |
| 115 | 115 | const { |
| 116 | - list: { list }, | |
| 116 | + BLOCK_NAME: { list }, | |
| 117 | 117 | loading, |
| 118 | 118 | } = this.props; |
| 119 | 119 | const { |
| ... | ... | @@ -337,4 +337,4 @@ class BasicList extends PureComponent { |
| 337 | 337 | } |
| 338 | 338 | } |
| 339 | 339 | |
| 340 | -export default BasicList; | |
| 340 | +export default PAGE_NAME_UPPER_CAMEL_CASE; | ... | ... |
| 1 | -import { stringify } from 'qs'; | |
| 2 | -import request from 'umi-request'; | |
| 3 | - | |
| 4 | -export async function queryProjectNotice() { | |
| 5 | - return request('/api/project/notice'); | |
| 6 | -} | |
| 7 | - | |
| 8 | -export async function queryActivities() { | |
| 9 | - return request('/api/activities'); | |
| 10 | -} | |
| 11 | - | |
| 12 | -export async function queryRule(params) { | |
| 13 | - return request(`/api/rule?${stringify(params)}`); | |
| 14 | -} | |
| 15 | 1 | |
| 16 | -export async function removeRule(params) { | |
| 17 | - return request('/api/rule', { | |
| 18 | - method: 'POST', | |
| 19 | - body: { | |
| 20 | - ...params, | |
| 21 | - method: 'delete', | |
| 22 | - }, | |
| 23 | - }); | |
| 24 | -} | |
| 25 | - | |
| 26 | -export async function addRule(params) { | |
| 27 | - return request('/api/rule', { | |
| 28 | - method: 'POST', | |
| 29 | - body: { | |
| 30 | - ...params, | |
| 31 | - method: 'post', | |
| 32 | - }, | |
| 33 | - }); | |
| 34 | -} | |
| 35 | - | |
| 36 | -export async function updateRule(params) { | |
| 37 | - return request('/api/rule', { | |
| 38 | - method: 'POST', | |
| 39 | - body: { | |
| 40 | - ...params, | |
| 41 | - method: 'update', | |
| 42 | - }, | |
| 43 | - }); | |
| 44 | -} | |
| 45 | - | |
| 46 | -export async function fakeSubmitForm(params) { | |
| 47 | - return request('/api/forms', { | |
| 48 | - method: 'POST', | |
| 49 | - body: params, | |
| 50 | - }); | |
| 51 | -} | |
| 52 | - | |
| 53 | -export async function fakeChartData() { | |
| 54 | - return request('/api/fake_chart_data'); | |
| 55 | -} | |
| 56 | - | |
| 57 | -export async function queryTags() { | |
| 58 | - return request('/api/tags'); | |
| 59 | -} | |
| 60 | - | |
| 61 | -export async function queryBasicProfile() { | |
| 62 | - return request('/api/profile/basic'); | |
| 63 | -} | |
| 64 | - | |
| 65 | -export async function queryAdvancedProfile() { | |
| 66 | - return request('/api/profile/advanced'); | |
| 67 | -} | |
| 2 | +import request from 'umi-request'; | |
| 68 | 3 | |
| 69 | 4 | export async function queryFakeList(params) { |
| 70 | - return request(`/api/fake_list?${stringify(params)}`); | |
| 5 | + return request('/api/BLOCK_NAME/fake_list', { | |
| 6 | + params, | |
| 7 | + }); | |
| 71 | 8 | } |
| 72 | 9 | |
| 73 | 10 | export async function removeFakeList(params) { |
| 74 | 11 | const { count = 5, ...restParams } = params; |
| 75 | - return request(`/api/fake_list?count=${count}`, { | |
| 12 | + return request('/api/BLOCK_NAME/fake_list', { | |
| 76 | 13 | method: 'POST', |
| 77 | - body: { | |
| 14 | + params: { | |
| 15 | + count, | |
| 16 | + }, | |
| 17 | + data: { | |
| 78 | 18 | ...restParams, |
| 79 | 19 | method: 'delete', |
| 80 | 20 | }, |
| ... | ... | @@ -83,9 +23,12 @@ export async function removeFakeList(params) { |
| 83 | 23 | |
| 84 | 24 | export async function addFakeList(params) { |
| 85 | 25 | const { count = 5, ...restParams } = params; |
| 86 | - return request(`/api/fake_list?count=${count}`, { | |
| 26 | + return request('/api/BLOCK_NAME/fake_list', { | |
| 87 | 27 | method: 'POST', |
| 88 | - body: { | |
| 28 | + params: { | |
| 29 | + count, | |
| 30 | + }, | |
| 31 | + data: { | |
| 89 | 32 | ...restParams, |
| 90 | 33 | method: 'post', |
| 91 | 34 | }, |
| ... | ... | @@ -94,33 +37,14 @@ export async function addFakeList(params) { |
| 94 | 37 | |
| 95 | 38 | export async function updateFakeList(params) { |
| 96 | 39 | const { count = 5, ...restParams } = params; |
| 97 | - return request(`/api/fake_list?count=${count}`, { | |
| 40 | + return request('/api/BLOCK_NAME/fake_list', { | |
| 98 | 41 | method: 'POST', |
| 99 | - body: { | |
| 42 | + params: { | |
| 43 | + count, | |
| 44 | + }, | |
| 45 | + data: { | |
| 100 | 46 | ...restParams, |
| 101 | 47 | method: 'update', |
| 102 | 48 | }, |
| 103 | 49 | }); |
| 104 | 50 | } |
| 105 | - | |
| 106 | -export async function fakeAccountLogin(params) { | |
| 107 | - return request('/api/login/account', { | |
| 108 | - method: 'POST', | |
| 109 | - body: params, | |
| 110 | - }); | |
| 111 | -} | |
| 112 | - | |
| 113 | -export async function fakeRegister(params) { | |
| 114 | - return request('/api/register', { | |
| 115 | - method: 'POST', | |
| 116 | - body: params, | |
| 117 | - }); | |
| 118 | -} | |
| 119 | - | |
| 120 | -export async function queryNotices() { | |
| 121 | - return request('/api/notices'); | |
| 122 | -} | |
| 123 | - | |
| 124 | -export async function getFakeCaptcha(mobile) { | |
| 125 | - return request(`/api/captcha?mobile=${mobile}`); | |
| 126 | -} | ... | ... |
请
注册
或
登录
后发表评论