Vue学习之Vue模拟后台数据
程序员文章站
2022-05-31 19:42:12
前后端项目的开发,需要前端和后端同时进行开发,有时后端开发人员还未完成API接口可以提供给前端调用,因此就需要模拟前端请求后端接口,后端返回数据。一般开发中都是返回json数据格式来完成前后端的交互。 1. 首先下载一个vue-cli的项目模板 vue init webpack myProject ......
前后端项目的开发,需要前端和后端同时进行开发,有时后端开发人员还未完成api接口可以提供给前端调用,因此就需要模拟前端请求后端接口,后端返回数据。一般开发中都是返回json数据格式来完成前后端的交互。
1. 首先下载一个vue-cli的项目模板
vue init webpack myproject
2. 在项目根目录下创建一个data.json的模拟后台返回数据,名字可以随便写不一定非得是data.json哈,但是格式必须是json格式哈
1 { 2 "seller": { 3 "name": "粥品香坊(回龙观)", 4 "description": "蜂鸟专送", 5 "deliverytime": 38, 6 "score": 4.2, 7 "servicescore": 4.1, 8 "foodscore": 4.3, 9 "rankrate": 69.2, 10 "minprice": 20, 11 "deliveryprice": 4, 12 "ratingcount": 24, 13 "sellcount": 90, 14 "bulletin": "粥品香坊其烹饪粥料的秘方源于中国千年古法,在融和现代制作工艺,由世界烹饪大师屈浩先生领衔研发。坚守纯天然、0添加的良心品质深得消费者青睐,发展至今成为粥类的引领品牌。是2008年奥运会和2013年园博会指定餐饮服务商。", 15 "supports": [ 16 { 17 "type": 0, 18 "description": "在线支付满28减5" 19 }, 20 { 21 "type": 1, 22 "description": "vc无限橙果汁全场8折" 23 }, 24 { 25 "type": 2, 26 "description": "单人精彩套餐" 27 }, 28 { 29 "type": 3, 30 "description": "该商家支持发票,请下单写好发票抬头" 31 }, 32 { 33 "type": 4, 34 "description": "已加入“外卖保”计划,食品安全保障" 35 } 36 ], 37 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/seller_avatar_256px.jpg", 38 "pics": [ 39 "http://fuss10.elemecdn.com/8/71/c5cf5715740998d5040dda6e66abfjpeg.jpeg?imageview2/1/w/180/h/180", 40 "http://fuss10.elemecdn.com/b/6c/75bd250e5ba69868f3b1178afbda3jpeg.jpeg?imageview2/1/w/180/h/180", 41 "http://fuss10.elemecdn.com/f/96/3d608c5811bc2d902fc9ab9a5baa7jpeg.jpeg?imageview2/1/w/180/h/180", 42 "http://fuss10.elemecdn.com/6/ad/779f8620ff49f701cd4c58f6448b6jpeg.jpeg?imageview2/1/w/180/h/180" 43 ], 44 "infos": [ 45 "该商家支持发票,请下单写好发票抬头", 46 "品类:其他菜系,包子粥店", 47 "北京市昌平区回龙观西大街龙观置业大厦底商b座102单元1340", 48 "营业时间:10:00-20:30" 49 ] 50 }, 51 "goods": [ 52 { 53 "name": "热销榜", 54 "type": -1, 55 "foods": [ 56 { 57 "name": "皮蛋瘦肉粥", 58 "price": 10, 59 "oldprice": "", 60 "description": "咸粥", 61 "sellcount": 229, 62 "rating": 100, 63 "info": "一碗皮蛋瘦肉粥,总是我到粥店时的不二之选。香浓软滑,饱腹暖心,皮蛋的q弹与瘦肉的滑嫩伴着粥香溢于满口,让人喝这样的一碗粥也觉得心满意足", 64 "ratings": [ 65 { 66 "username": "3******c", 67 "ratetime": 1469281964000, 68 "ratetype": 0, 69 "text": "很喜欢的粥", 70 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 71 }, 72 { 73 "username": "2******3", 74 "ratetime": 1469271264000, 75 "ratetype": 0, 76 "text": "", 77 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 78 }, 79 { 80 "username": "3******b", 81 "ratetime": 1469261964000, 82 "ratetype": 1, 83 "text": "", 84 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 85 } 86 ], 87 "icon": "http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg?imageview2/1/w/114/h/114", 88 "image": "http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg?imageview2/1/w/750/h/750" 89 }, 90 { 91 "name": "扁豆焖面", 92 "price": 14, 93 "oldprice": "", 94 "description": "", 95 "sellcount": 188, 96 "rating": 96, 97 "ratings": [ 98 { 99 "username": "3******c", 100 "ratetime": 1469281964000, 101 "ratetype": 0, 102 "text": "", 103 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 104 }, 105 { 106 "username": "2******3", 107 "ratetime": 1469271264000, 108 "ratetype": 0, 109 "text": "", 110 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 111 }, 112 { 113 "username": "3******b", 114 "ratetime": 1469261964000, 115 "ratetype": 1, 116 "text": "", 117 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 118 } 119 ], 120 "info": "", 121 "icon": "http://fuss10.elemecdn.com/c/6b/29e3d29b0db63d36f7c500bca31d8jpeg.jpeg?imageview2/1/w/114/h/114", 122 "image": "http://fuss10.elemecdn.com/c/6b/29e3d29b0db63d36f7c500bca31d8jpeg.jpeg?imageview2/1/w/750/h/750" 123 }, 124 { 125 "name": "葱花饼", 126 "price": 10, 127 "oldprice": "", 128 "description": "", 129 "sellcount": 124, 130 "rating": 85, 131 "info": "", 132 "ratings": [ 133 { 134 "username": "3******c", 135 "ratetime": 1469281964000, 136 "ratetype": 1, 137 "text": "没啥味道", 138 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 139 }, 140 { 141 "username": "2******3", 142 "ratetime": 1469271264000, 143 "ratetype": 1, 144 "text": "很一般啊", 145 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 146 }, 147 { 148 "username": "3******b", 149 "ratetime": 1469261964000, 150 "ratetype": 0, 151 "text": "", 152 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 153 } 154 ], 155 "icon": "http://fuss10.elemecdn.com/f/28/a51e7b18751bcdf871648a23fd3b4jpeg.jpeg?imageview2/1/w/114/h/114", 156 "image": "http://fuss10.elemecdn.com/f/28/a51e7b18751bcdf871648a23fd3b4jpeg.jpeg?imageview2/1/w/750/h/750" 157 }, 158 { 159 "name": "牛肉馅饼", 160 "price": 14, 161 "oldprice": "", 162 "description": "", 163 "sellcount": 114, 164 "rating": 91, 165 "info": "", 166 "ratings": [ 167 { 168 "username": "3******c", 169 "ratetime": 1469281964000, 170 "ratetype": 1, 171 "text": "难吃不推荐", 172 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 173 }, 174 { 175 "username": "2******3", 176 "ratetime": 1469271264000, 177 "ratetype": 0, 178 "text": "", 179 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 180 }, 181 { 182 "username": "3******b", 183 "ratetime": 1469261964000, 184 "ratetype": 0, 185 "text": "", 186 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 187 } 188 ], 189 "icon": "http://fuss10.elemecdn.com/d/b9/bcab0e8ad97758e65ae5a62b2664ejpeg.jpeg?imageview2/1/w/114/h/114", 190 "image": "http://fuss10.elemecdn.com/d/b9/bcab0e8ad97758e65ae5a62b2664ejpeg.jpeg?imageview2/1/w/750/h/750" 191 }, 192 { 193 "name": "招牌猪肉白菜锅贴/10个", 194 "price": 17, 195 "oldprice": "", 196 "description": "", 197 "sellcount": 101, 198 "rating": 78, 199 "info": "", 200 "ratings": [ 201 { 202 "username": "3******c", 203 "ratetime": 1469281964000, 204 "ratetype": 1, 205 "text": "不脆,不好吃", 206 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 207 }, 208 { 209 "username": "2******3", 210 "ratetime": 1469271264000, 211 "ratetype": 0, 212 "text": "", 213 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 214 }, 215 { 216 "username": "3******b", 217 "ratetime": 1469261964000, 218 "ratetype": 0, 219 "text": "", 220 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 221 } 222 ], 223 "icon": "http://fuss10.elemecdn.com/7/72/9a580c1462ca1e4d3c07e112bc035jpeg.jpeg?imageview2/1/w/114/h/114", 224 "image": "http://fuss10.elemecdn.com/7/72/9a580c1462ca1e4d3c07e112bc035jpeg.jpeg?imageview2/1/w/750/h/750" 225 }, 226 { 227 "name": "南瓜粥", 228 "price": 9, 229 "oldprice": "", 230 "description": "甜粥", 231 "sellcount": 91, 232 "rating": 100, 233 "ratings": [ 234 { 235 "username": "3******c", 236 "ratetime": 1469281964000, 237 "ratetype": 0, 238 "text": "", 239 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 240 }, 241 { 242 "username": "2******3", 243 "ratetime": 1469271264000, 244 "ratetype": 0, 245 "text": "", 246 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 247 }, 248 { 249 "username": "3******b", 250 "ratetime": 1469261964000, 251 "ratetype": 0, 252 "text": "", 253 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 254 } 255 ], 256 "icon": "http://fuss10.elemecdn.com/8/a6/453f65f16b1391942af11511b7a90jpeg.jpeg?imageview2/1/w/114/h/114", 257 "image": "http://fuss10.elemecdn.com/8/a6/453f65f16b1391942af11511b7a90jpeg.jpeg?imageview2/1/w/750/h/750" 258 }, 259 { 260 "name": "红豆薏米美肤粥", 261 "price": 12, 262 "oldprice": "", 263 "description": "甜粥", 264 "sellcount": 86, 265 "rating": 100, 266 "info": "", 267 "ratings": [ 268 { 269 "username": "3******c", 270 "ratetime": 1469281964000, 271 "ratetype": 0, 272 "text": "", 273 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 274 }, 275 { 276 "username": "2******3", 277 "ratetime": 1469271264000, 278 "ratetype": 0, 279 "text": "", 280 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 281 }, 282 { 283 "username": "3******b", 284 "ratetime": 1469261964000, 285 "ratetype": 0, 286 "text": "", 287 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 288 } 289 ], 290 "icon": "http://fuss10.elemecdn.com/d/22/260bd78ee6ac6051136c5447fe307jpeg.jpeg?imageview2/1/w/114/h/114", 291 "image": "http://fuss10.elemecdn.com/d/22/260bd78ee6ac6051136c5447fe307jpeg.jpeg?imageview2/1/w/750/h/750" 292 }, 293 { 294 "name": "八宝酱菜", 295 "price": 4, 296 "oldprice": "", 297 "description": "", 298 "sellcount": 84, 299 "rating": 100, 300 "info": "", 301 "ratings": [ 302 { 303 "username": "3******c", 304 "ratetime": 1469281964000, 305 "ratetype": 0, 306 "text": "", 307 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 308 }, 309 { 310 "username": "2******3", 311 "ratetime": 1469271264000, 312 "ratetype": 0, 313 "text": "", 314 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 315 }, 316 { 317 "username": "3******b", 318 "ratetime": 1469261964000, 319 "ratetype": 0, 320 "text": "", 321 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 322 } 323 ], 324 "icon": "http://fuss10.elemecdn.com/9/b5/469d8854f9a3a03797933fd01398bjpeg.jpeg?imageview2/1/w/114/h/114", 325 "image": "http://fuss10.elemecdn.com/9/b5/469d8854f9a3a03797933fd01398bjpeg.jpeg?imageview2/1/w/750/h/750" 326 }, 327 { 328 "name": "红枣山药糙米粥", 329 "price": 10, 330 "oldprice": "", 331 "description": "", 332 "sellcount": 81, 333 "rating": 91, 334 "info": "", 335 "ratings": [ 336 { 337 "username": "3******c", 338 "ratetime": 1469281964000, 339 "ratetype": 0, 340 "text": "", 341 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 342 }, 343 { 344 "username": "2******3", 345 "ratetime": 1469271264000, 346 "ratetype": 0, 347 "text": "", 348 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 349 }, 350 { 351 "username": "3******b", 352 "ratetime": 1469261964000, 353 "ratetype": 0, 354 "text": "", 355 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 356 } 357 ], 358 "icon": "http://fuss10.elemecdn.com/9/b5/469d8854f9a3a03797933fd01398bjpeg.jpeg?imageview2/1/w/114/h/114", 359 "image": "http://fuss10.elemecdn.com/9/b5/469d8854f9a3a03797933fd01398bjpeg.jpeg?imageview2/1/w/750/h/750" 360 }, 361 { 362 "name": "糊塌子", 363 "price": 10, 364 "oldprice": "", 365 "description": "", 366 "sellcount": 80, 367 "rating": 93, 368 "info": "", 369 "ratings": [ 370 { 371 "username": "3******c", 372 "ratetime": 1469281964000, 373 "ratetype": 0, 374 "text": "", 375 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 376 }, 377 { 378 "username": "2******3", 379 "ratetime": 1469271264000, 380 "ratetype": 0, 381 "text": "", 382 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 383 }, 384 { 385 "username": "3******b", 386 "ratetime": 1469261964000, 387 "ratetype": 0, 388 "text": "", 389 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 390 } 391 ], 392 "icon": "http://fuss10.elemecdn.com/0/05/097a2a59fd2a2292d08067e16380cjpeg.jpeg?imageview2/1/w/114/h/114", 393 "image": "http://fuss10.elemecdn.com/0/05/097a2a59fd2a2292d08067e16380cjpeg.jpeg?imageview2/1/w/750/h/750" 394 } 395 ] 396 }, 397 { 398 "name": "单人精彩套餐", 399 "type": 2, 400 "foods": [ 401 { 402 "name": "红枣山药粥套餐", 403 "price": 29, 404 "oldprice": 36, 405 "description": "红枣山药糙米粥,素材包,爽口莴笋丝,四川泡菜或八宝酱菜,配菜可备注", 406 "sellcount": 17, 407 "rating": 100, 408 "info": "", 409 "ratings": [ 410 { 411 "username": "2******3", 412 "ratetime": 1469271264000, 413 "ratetype": 0, 414 "text": "", 415 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 416 } 417 ], 418 "icon": "http://fuss10.elemecdn.com/6/72/cb844f0bb60c502c6d5c05e0bddf5jpeg.jpeg?imageview2/1/w/114/h/114", 419 "image": "http://fuss10.elemecdn.com/6/72/cb844f0bb60c502c6d5c05e0bddf5jpeg.jpeg?imageview2/1/w/750/h/750" 420 } 421 ] 422 }, 423 { 424 "name": "冰爽饮品限时特惠", 425 "type": 1, 426 "foods": [ 427 { 428 "name": "vc无限橙果汁", 429 "price": 8, 430 "oldprice": 10, 431 "description": "", 432 "sellcount": 15, 433 "rating": 100, 434 "info": "", 435 "ratings": [ 436 { 437 "username": "3******c", 438 "ratetime": 1469281964000, 439 "ratetype": 0, 440 "text": "还可以", 441 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 442 }, 443 { 444 "username": "2******3", 445 "ratetime": 1469271264000, 446 "ratetype": 0, 447 "text": "", 448 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 449 } 450 ], 451 "icon": "http://fuss10.elemecdn.com/e/c6/f348e811772016ae24e968238bcbfjpeg.jpeg?imageview2/1/w/114/h/114", 452 "image": "http://fuss10.elemecdn.com/e/c6/f348e811772016ae24e968238bcbfjpeg.jpeg?imageview2/1/w/750/h/750" 453 } 454 ] 455 }, 456 { 457 "name": "精选热菜", 458 "type": -1, 459 "foods": [ 460 { 461 "name": "娃娃菜炖豆腐", 462 "price": 17, 463 "oldprice": "", 464 "description": "", 465 "sellcount": 43, 466 "rating": 92, 467 "info": "", 468 "ratings": [ 469 { 470 "username": "3******c", 471 "ratetime": 1469281964000, 472 "ratetype": 0, 473 "text": "菜量还可以,味道还可以", 474 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 475 }, 476 { 477 "username": "2******3", 478 "ratetime": 1469271264000, 479 "ratetype": 0, 480 "text": "", 481 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 482 } 483 ], 484 "icon": "http://fuss10.elemecdn.com/d/2d/b1eb45b305635d9dd04ddf157165fjpeg.jpeg?imageview2/1/w/114/h/114", 485 "image": "http://fuss10.elemecdn.com/d/2d/b1eb45b305635d9dd04ddf157165fjpeg.jpeg?imageview2/1/w/750/h/750" 486 }, 487 { 488 "name": "手撕包菜", 489 "price": 16, 490 "oldprice": "", 491 "description": "", 492 "sellcount": 29, 493 "rating": 100, 494 "info": "", 495 "ratings": [ 496 { 497 "username": "3******c", 498 "ratetime": 1469281964000, 499 "ratetype": 0, 500 "text": "", 501 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 502 }, 503 { 504 "username": "2******3", 505 "ratetime": 1469271264000, 506 "ratetype": 0, 507 "text": "", 508 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 509 } 510 ], 511 "icon": "http://fuss10.elemecdn.com/9/c6/f3bc84468820121112e79583c24efjpeg.jpeg?imageview2/1/w/114/h/114", 512 "image": "http://fuss10.elemecdn.com/9/c6/f3bc84468820121112e79583c24efjpeg.jpeg?imageview2/1/w/750/h/750" 513 }, 514 { 515 "name": "香酥黄金鱼/3条", 516 "price": 11, 517 "oldprice": "", 518 "description": "", 519 "sellcount": 15, 520 "rating": 100, 521 "info": "", 522 "ratings": [ 523 { 524 "username": "3******c", 525 "ratetime": 1469281964000, 526 "ratetype": 0, 527 "text": "", 528 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 529 }, 530 { 531 "username": "2******3", 532 "ratetime": 1469271264000, 533 "ratetype": 0, 534 "text": "", 535 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 536 } 537 ], 538 "icon": "http://fuss10.elemecdn.com/4/e7/8277a6a2ea0a2e97710290499fc41jpeg.jpeg?imageview2/1/w/114/h/114", 539 "image": "http://fuss10.elemecdn.com/4/e7/8277a6a2ea0a2e97710290499fc41jpeg.jpeg?imageview2/1/w/750/h/750" 540 } 541 ] 542 }, 543 { 544 "name": "爽口凉菜", 545 "type": -1, 546 "foods": [ 547 { 548 "name": "八宝酱菜", 549 "price": 4, 550 "oldprice": "", 551 "description": "", 552 "sellcount": 84, 553 "rating": 100, 554 "info": "", 555 "ratings": [ 556 { 557 "username": "3******c", 558 "ratetime": 1469281964000, 559 "ratetype": 0, 560 "text": "", 561 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 562 }, 563 { 564 "username": "2******3", 565 "ratetime": 1469271264000, 566 "ratetype": 0, 567 "text": "", 568 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 569 }, 570 { 571 "username": "3******b", 572 "ratetime": 1469261964000, 573 "ratetype": 0, 574 "text": "", 575 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 576 } 577 ], 578 "icon": "http://fuss10.elemecdn.com/9/b5/469d8854f9a3a03797933fd01398bjpeg.jpeg?imageview2/1/w/114/h/114", 579 "image": "http://fuss10.elemecdn.com/9/b5/469d8854f9a3a03797933fd01398bjpeg.jpeg?imageview2/1/w/750/h/750" 580 }, 581 { 582 "name": "拍黄瓜", 583 "price": 9, 584 "oldprice": "", 585 "description": "", 586 "sellcount": 28, 587 "rating": 100, 588 "info": "", 589 "ratings": [ 590 { 591 "username": "3******c", 592 "ratetime": 1469281964000, 593 "ratetype": 0, 594 "text": "", 595 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 596 }, 597 { 598 "username": "2******3", 599 "ratetime": 1469271264000, 600 "ratetype": 0, 601 "text": "", 602 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 603 }, 604 { 605 "username": "3******b", 606 "ratetime": 1469261964000, 607 "ratetype": 0, 608 "text": "", 609 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 610 } 611 ], 612 "icon": "http://fuss10.elemecdn.com/6/54/f654985b4e185f06eb07f8fa2b2e8jpeg.jpeg?imageview2/1/w/114/h/114", 613 "image": "http://fuss10.elemecdn.com/6/54/f654985b4e185f06eb07f8fa2b2e8jpeg.jpeg?imageview2/1/w/750/h/750" 614 } 615 ] 616 }, 617 { 618 "name": "精选套餐", 619 "type": -1, 620 "foods": [ 621 { 622 "name": "红豆薏米粥套餐", 623 "price": 37, 624 "oldprice": "", 625 "description": "红豆薏米粥,三鲜干蒸烧卖,拍黄瓜", 626 "sellcount": 3, 627 "rating": 100, 628 "info": "", 629 "ratings": [ 630 { 631 "username": "2******3", 632 "ratetime": 1469271264000, 633 "ratetype": 0, 634 "text": "", 635 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 636 } 637 ], 638 "icon": "http://fuss10.elemecdn.com/f/49/27f26ed00c025b2200a9ccbb7e67ejpeg.jpeg?imageview2/1/w/114/h/114", 639 "image": "http://fuss10.elemecdn.com/f/49/27f26ed00c025b2200a9ccbb7e67ejpeg.jpeg?imageview2/1/w/750/h/750" 640 }, 641 { 642 "name": "皮蛋瘦肉粥套餐", 643 "price": 31, 644 "oldprice": "", 645 "description": "", 646 "sellcount": 12, 647 "rating": 100, 648 "info": "", 649 "ratings": [ 650 { 651 "username": "2******3", 652 "ratetime": 1469271264000, 653 "ratetype": 0, 654 "text": "", 655 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 656 } 657 ], 658 "icon": "http://fuss10.elemecdn.com/8/96/f444a8087f0e940ef264617f9d98ajpeg.jpeg?imageview2/1/w/114/h/114", 659 "image": "http://fuss10.elemecdn.com/8/96/f444a8087f0e940ef264617f9d98ajpeg.jpeg?imageview2/1/w/750/h/750" 660 } 661 ] 662 }, 663 { 664 "name": "果拼果汁", 665 "type": -1, 666 "foods": [ 667 { 668 "name": "蜜瓜圣女萝莉杯", 669 "price": 6, 670 "oldprice": "", 671 "description": "", 672 "sellcount": 1, 673 "rating": "", 674 "info": "", 675 "ratings": [], 676 "icon": "http://fuss10.elemecdn.com/b/5f/b3b04c259d5ec9fa52e1856ee50dajpeg.jpeg?imageview2/1/w/114/h/114", 677 "image": "http://fuss10.elemecdn.com/b/5f/b3b04c259d5ec9fa52e1856ee50dajpeg.jpeg?imageview2/1/w/750/h/750" 678 }, 679 { 680 "name": "加多宝", 681 "price": 6, 682 "oldprice": "", 683 "description": "", 684 "sellcount": 7, 685 "rating": 100, 686 "info": "", 687 "ratings": [ 688 { 689 "username": "3******c", 690 "ratetime": 1469281964000, 691 "ratetype": 0, 692 "text": "", 693 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 694 }, 695 { 696 "username": "2******3", 697 "ratetime": 1469271264000, 698 "ratetype": 0, 699 "text": "", 700 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 701 }, 702 { 703 "username": "3******b", 704 "ratetime": 1469261964000, 705 "ratetype": 0, 706 "text": "", 707 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 708 } 709 ], 710 "icon": "http://fuss10.elemecdn.com/b/9f/5e6c99c593cf65229225c5661bcdejpeg.jpeg?imageview2/1/w/114/h/114", 711 "image": "http://fuss10.elemecdn.com/b/9f/5e6c99c593cf65229225c5661bcdejpeg.jpeg?imageview2/1/w/750/h/750" 712 }, 713 { 714 "name": "vc无限橙果汁", 715 "price": 8, 716 "oldprice": 10, 717 "description": "", 718 "sellcount": 15, 719 "rating": 100, 720 "info": "", 721 "ratings": [ 722 { 723 "username": "3******c", 724 "ratetime": 1469281964000, 725 "ratetype": 0, 726 "text": "还可以", 727 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 728 }, 729 { 730 "username": "2******3", 731 "ratetime": 1469271264000, 732 "ratetype": 0, 733 "text": "", 734 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 735 } 736 ], 737 "icon": "http://fuss10.elemecdn.com/e/c6/f348e811772016ae24e968238bcbfjpeg.jpeg?imageview2/1/w/114/h/114", 738 "image": "http://fuss10.elemecdn.com/e/c6/f348e811772016ae24e968238bcbfjpeg.jpeg?imageview2/1/w/750/h/750" 739 } 740 ] 741 }, 742 { 743 "name": "小吃主食", 744 "type": -1, 745 "foods": [ 746 { 747 "name": "扁豆焖面", 748 "price": 14, 749 "oldprice": "", 750 "description": "", 751 "sellcount": 188, 752 "rating": 96, 753 "info": "", 754 "ratings": [ 755 { 756 "username": "3******c", 757 "ratetime": 1469281964000, 758 "ratetype": 0, 759 "text": "", 760 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 761 }, 762 { 763 "username": "2******3", 764 "ratetime": 1469271264000, 765 "ratetype": 0, 766 "text": "", 767 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 768 }, 769 { 770 "username": "3******b", 771 "ratetime": 1469261964000, 772 "ratetype": 1, 773 "text": "", 774 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 775 } 776 ], 777 "icon": "http://fuss10.elemecdn.com/c/6b/29e3d29b0db63d36f7c500bca31d8jpeg.jpeg?imageview2/1/w/114/h/114", 778 "image": "http://fuss10.elemecdn.com/c/6b/29e3d29b0db63d36f7c500bca31d8jpeg.jpeg?imageview2/1/w/750/h/750" 779 }, 780 { 781 "name": "葱花饼", 782 "price": 10, 783 "oldprice": "", 784 "description": "", 785 "sellcount": 124, 786 "rating": 85, 787 "info": "", 788 "ratings": [ 789 { 790 "username": "3******c", 791 "ratetime": 1469281964000, 792 "ratetype": 1, 793 "text": "没啥味道", 794 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 795 }, 796 { 797 "username": "2******3", 798 "ratetime": 1469271264000, 799 "ratetype": 1, 800 "text": "很一般啊", 801 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 802 }, 803 { 804 "username": "3******b", 805 "ratetime": 1469261964000, 806 "ratetype": 0, 807 "text": "", 808 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 809 } 810 ], 811 "icon": "http://fuss10.elemecdn.com/f/28/a51e7b18751bcdf871648a23fd3b4jpeg.jpeg?imageview2/1/w/114/h/114", 812 "image": "http://fuss10.elemecdn.com/f/28/a51e7b18751bcdf871648a23fd3b4jpeg.jpeg?imageview2/1/w/750/h/750" 813 }, 814 { 815 "name": "牛肉馅饼", 816 "price": 14, 817 "oldprice": "", 818 "description": "", 819 "sellcount": 114, 820 "rating": 91, 821 "info": "", 822 "ratings": [ 823 { 824 "username": "3******c", 825 "ratetime": 1469281964000, 826 "ratetype": 1, 827 "text": "难吃不推荐", 828 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 829 }, 830 { 831 "username": "2******3", 832 "ratetime": 1469271264000, 833 "ratetype": 0, 834 "text": "", 835 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 836 }, 837 { 838 "username": "3******b", 839 "ratetime": 1469261964000, 840 "ratetype": 0, 841 "text": "", 842 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 843 } 844 ], 845 "icon": "http://fuss10.elemecdn.com/d/b9/bcab0e8ad97758e65ae5a62b2664ejpeg.jpeg?imageview2/1/w/114/h/114", 846 "image": "http://fuss10.elemecdn.com/d/b9/bcab0e8ad97758e65ae5a62b2664ejpeg.jpeg?imageview2/1/w/750/h/750" 847 }, 848 { 849 "name": "招牌猪肉白菜锅贴/10个", 850 "price": 17, 851 "oldprice": "", 852 "description": "", 853 "sellcount": 101, 854 "rating": 78, 855 "info": "", 856 "ratings": [ 857 { 858 "username": "3******c", 859 "ratetime": 1469281964000, 860 "ratetype": 1, 861 "text": "不脆,不好吃", 862 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 863 }, 864 { 865 "username": "2******3", 866 "ratetime": 1469271264000, 867 "ratetype": 0, 868 "text": "", 869 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 870 }, 871 { 872 "username": "3******b", 873 "ratetime": 1469261964000, 874 "ratetype": 0, 875 "text": "", 876 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 877 } 878 ], 879 "icon": "http://fuss10.elemecdn.com/7/72/9a580c1462ca1e4d3c07e112bc035jpeg.jpeg?imageview2/1/w/114/h/114", 880 "image": "http://fuss10.elemecdn.com/7/72/9a580c1462ca1e4d3c07e112bc035jpeg.jpeg?imageview2/1/w/750/h/750" 881 }, 882 { 883 "name": "糊塌子", 884 "price": 10, 885 "oldprice": "", 886 "description": "", 887 "sellcount": 80, 888 "rating": 93, 889 "info": "", 890 "ratings": [ 891 { 892 "username": "3******c", 893 "ratetime": 1469281964000, 894 "ratetype": 0, 895 "text": "", 896 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 897 }, 898 { 899 "username": "2******3", 900 "ratetime": 1469271264000, 901 "ratetype": 0, 902 "text": "", 903 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 904 }, 905 { 906 "username": "3******b", 907 "ratetime": 1469261964000, 908 "ratetype": 0, 909 "text": "", 910 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 911 } 912 ], 913 "icon": "http://fuss10.elemecdn.com/0/05/097a2a59fd2a2292d08067e16380cjpeg.jpeg?imageview2/1/w/114/h/114", 914 "image": "http://fuss10.elemecdn.com/0/05/097a2a59fd2a2292d08067e16380cjpeg.jpeg?imageview2/1/w/750/h/750" 915 } 916 ] 917 }, 918 { 919 "name": "特色粥品", 920 "type": -1, 921 "foods": [ 922 { 923 "name": "皮蛋瘦肉粥", 924 "price": 10, 925 "oldprice": "", 926 "description": "咸粥", 927 "sellcount": 229, 928 "rating": 100, 929 "ratings": [ 930 { 931 "username": "3******c", 932 "ratetime": 1469281964000, 933 "ratetype": 0, 934 "text": "很喜欢的粥", 935 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 936 }, 937 { 938 "username": "2******3", 939 "ratetime": 1469271264000, 940 "ratetype": 0, 941 "text": "", 942 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 943 }, 944 { 945 "username": "3******b", 946 "ratetime": 1469261964000, 947 "ratetype": 1, 948 "text": "", 949 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 950 } 951 ], 952 "icon": "http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg?imageview2/1/w/114/h/114", 953 "image": "http://fuss10.elemecdn.com/c/cd/c12745ed8a5171e13b427dbc39401jpeg.jpeg?imageview2/1/w/750/h/750" 954 }, 955 { 956 "name": "南瓜粥", 957 "price": 9, 958 "oldprice": "", 959 "description": "甜粥", 960 "sellcount": 91, 961 "rating": 100, 962 "info": "", 963 "ratings": [ 964 { 965 "username": "3******c", 966 "ratetime": 1469281964000, 967 "ratetype": 0, 968 "text": "", 969 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 970 }, 971 { 972 "username": "2******3", 973 "ratetime": 1469271264000, 974 "ratetype": 0, 975 "text": "", 976 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 977 }, 978 { 979 "username": "3******b", 980 "ratetime": 1469261964000, 981 "ratetype": 0, 982 "text": "", 983 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 984 } 985 ], 986 "icon": "http://fuss10.elemecdn.com/8/a6/453f65f16b1391942af11511b7a90jpeg.jpeg?imageview2/1/w/114/h/114", 987 "image": "http://fuss10.elemecdn.com/8/a6/453f65f16b1391942af11511b7a90jpeg.jpeg?imageview2/1/w/750/h/750" 988 }, 989 { 990 "name": "红豆薏米美肤粥", 991 "price": 12, 992 "oldprice": "", 993 "description": "甜粥", 994 "sellcount": 86, 995 "rating": 100, 996 "info": "", 997 "ratings": [ 998 { 999 "username": "3******c", 1000 "ratetime": 1469281964000, 1001 "ratetype": 0, 1002 "text": "", 1003 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1004 }, 1005 { 1006 "username": "2******3", 1007 "ratetime": 1469271264000, 1008 "ratetype": 0, 1009 "text": "", 1010 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1011 }, 1012 { 1013 "username": "3******b", 1014 "ratetime": 1469261964000, 1015 "ratetype": 0, 1016 "text": "", 1017 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1018 } 1019 ], 1020 "icon": "http://fuss10.elemecdn.com/d/22/260bd78ee6ac6051136c5447fe307jpeg.jpeg?imageview2/1/w/114/h/114", 1021 "image": "http://fuss10.elemecdn.com/d/22/260bd78ee6ac6051136c5447fe307jpeg.jpeg?imageview2/1/w/750/h/750" 1022 }, 1023 { 1024 "name": "红枣山药糙米粥", 1025 "price": 10, 1026 "oldprice": "", 1027 "description": "", 1028 "sellcount": 81, 1029 "rating": 91, 1030 "info": "", 1031 "ratings": [ 1032 { 1033 "username": "3******c", 1034 "ratetime": 1469281964000, 1035 "ratetype": 0, 1036 "text": "", 1037 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1038 }, 1039 { 1040 "username": "2******3", 1041 "ratetime": 1469271264000, 1042 "ratetype": 0, 1043 "text": "", 1044 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1045 }, 1046 { 1047 "username": "3******b", 1048 "ratetime": 1469261964000, 1049 "ratetype": 0, 1050 "text": "", 1051 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1052 } 1053 ], 1054 "icon": "http://fuss10.elemecdn.com/9/b5/469d8854f9a3a03797933fd01398bjpeg.jpeg?imageview2/1/w/114/h/114", 1055 "image": "http://fuss10.elemecdn.com/9/b5/469d8854f9a3a03797933fd01398bjpeg.jpeg?imageview2/1/w/750/h/750" 1056 }, 1057 { 1058 "name": "鲜蔬菌菇粥", 1059 "price": 11, 1060 "oldprice": "", 1061 "description": "咸粥", 1062 "sellcount": 56, 1063 "rating": 100, 1064 "info": "", 1065 "ratings": [ 1066 { 1067 "username": "3******c", 1068 "ratetime": 1469281964000, 1069 "ratetype": 0, 1070 "text": "", 1071 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1072 }, 1073 { 1074 "username": "2******3", 1075 "ratetime": 1469271264000, 1076 "ratetype": 0, 1077 "text": "" 1078 }, 1079 { 1080 "username": "3******b", 1081 "ratetime": 1469261964000, 1082 "ratetype": 0, 1083 "text": "", 1084 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1085 } 1086 ], 1087 "icon": "http://fuss10.elemecdn.com/e/a3/5317c68dd618929b6ac05804e429ajpeg.jpeg?imageview2/1/w/114/h/114", 1088 "image": "http://fuss10.elemecdn.com/e/a3/5317c68dd618929b6ac05804e429ajpeg.jpeg?imageview2/1/w/750/h/750" 1089 }, 1090 { 1091 "name": "田园蔬菜粥", 1092 "price": 10, 1093 "oldprice": "", 1094 "description": "咸粥", 1095 "sellcount": 33, 1096 "rating": 100, 1097 "info": "", 1098 "ratings": [ 1099 { 1100 "username": "3******c", 1101 "ratetime": 1469281964000, 1102 "ratetype": 0, 1103 "text": "", 1104 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1105 }, 1106 { 1107 "username": "2******3", 1108 "ratetime": 1469271264000, 1109 "ratetype": 0, 1110 "text": "", 1111 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1112 }, 1113 { 1114 "username": "3******b", 1115 "ratetime": 1469261964000, 1116 "ratetype": 0, 1117 "text": "", 1118 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png" 1119 } 1120 ], 1121 "icon": "http://fuss10.elemecdn.com/a/94/7371083792c19df00e546b29e344cjpeg.jpeg?imageview2/1/w/114/h/114", 1122 "image": "http://fuss10.elemecdn.com/a/94/7371083792c19df00e546b29e344cjpeg.jpeg?imageview2/1/w/750/h/750" 1123 } 1124 ] 1125 } 1126 ], 1127 "ratings": [ 1128 { 1129 "username": "3******c", 1130 "ratetime": 1469281964000, 1131 "deliverytime": 30, 1132 "score": 5, 1133 "ratetype": 0, 1134 "text": "不错,粥很好喝,我经常吃这一家,非常赞,以后也会常来吃,强烈推荐.", 1135 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1136 "recommend": [ 1137 "南瓜粥", 1138 "皮蛋瘦肉粥", 1139 "扁豆焖面", 1140 "娃娃菜炖豆腐", 1141 "牛肉馅饼" 1142 ] 1143 }, 1144 { 1145 "username": "2******3", 1146 "ratetime": 1469271264000, 1147 "deliverytime": "", 1148 "score": 4, 1149 "ratetype": 0, 1150 "deliverytime": "", 1151 "text": "服务态度不错", 1152 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1153 "recommend": [ 1154 "扁豆焖面" 1155 ] 1156 }, 1157 { 1158 "username": "3******b", 1159 "ratetime": 1469261964000, 1160 "score": 3, 1161 "ratetype": 1, 1162 "text": "", 1163 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1164 "recommend": [] 1165 }, 1166 { 1167 "username": "1******c", 1168 "ratetime": 1469261864000, 1169 "deliverytime": 20, 1170 "score": 5, 1171 "ratetype": 0, 1172 "text": "良心店铺", 1173 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1174 "recommend": [] 1175 }, 1176 { 1177 "username": "2******d", 1178 "ratetime": 1469251264000, 1179 "deliverytime": 10, 1180 "score": 4, 1181 "ratetype": 0, 1182 "text": "", 1183 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1184 "recommend": [] 1185 }, 1186 { 1187 "username": "9******0", 1188 "ratetime": 1469241964000, 1189 "deliverytime": 70, 1190 "score": 1, 1191 "ratetype": 1, 1192 "text": "送货速度蜗牛一样", 1193 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1194 "recommend": [] 1195 }, 1196 { 1197 "username": "d******c", 1198 "ratetime": 1469231964000, 1199 "deliverytime": 30, 1200 "score": 5, 1201 "ratetype": 0, 1202 "text": "很喜欢的粥店", 1203 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1204 "recommend": [] 1205 }, 1206 { 1207 "username": "2******3", 1208 "ratetime": 1469221264000, 1209 "deliverytime": "", 1210 "score": 4, 1211 "ratetype": 0, 1212 "text": "量给的还可以", 1213 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1214 "recommend": [] 1215 }, 1216 { 1217 "username": "3******8", 1218 "ratetime": 1469211964000, 1219 "deliverytime": "", 1220 "score": 3, 1221 "ratetype": 1, 1222 "text": "", 1223 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1224 "recommend": [] 1225 }, 1226 { 1227 "username": "a******a", 1228 "ratetime": 1469201964000, 1229 "deliverytime": "", 1230 "score": 4, 1231 "ratetype": 0, 1232 "text": "孩子喜欢吃这家", 1233 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1234 "recommend": [ 1235 "南瓜粥" 1236 ] 1237 }, 1238 { 1239 "username": "3******3", 1240 "ratetime": 1469191264000, 1241 "deliverytime": "", 1242 "score": 4, 1243 "ratetype": 0, 1244 "text": "粥挺好吃的", 1245 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1246 "recommend": [] 1247 }, 1248 { 1249 "username": "t******b", 1250 "ratetime": 1469181964000, 1251 "deliverytime": "", 1252 "score": 3, 1253 "ratetype": 1, 1254 "text": "", 1255 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1256 "recommend": [] 1257 }, 1258 { 1259 "username": "f******c", 1260 "ratetime": 1469171964000, 1261 "deliverytime": 15, 1262 "score": 5, 1263 "ratetype": 0, 1264 "text": "送货速度很快", 1265 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1266 "recommend": [] 1267 }, 1268 { 1269 "username": "k******3", 1270 "ratetime": 1469161264000, 1271 "deliverytime": "", 1272 "score": 4, 1273 "ratetype": 0, 1274 "text": "", 1275 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1276 "recommend": [] 1277 }, 1278 { 1279 "username": "u******b", 1280 "ratetime": 1469151964000, 1281 "deliverytime": "", 1282 "score": 4, 1283 "ratetype": 0, 1284 "text": "下雨天给快递小哥点个赞", 1285 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1286 "recommend": [] 1287 }, 1288 { 1289 "username": "s******c", 1290 "ratetime": 1469141964000, 1291 "deliverytime": "", 1292 "score": 4, 1293 "ratetype": 0, 1294 "text": "好", 1295 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1296 "recommend": [] 1297 }, 1298 { 1299 "username": "z******3", 1300 "ratetime": 1469131264000, 1301 "deliverytime": "", 1302 "score": 5, 1303 "ratetype": 0, 1304 "text": "吃了还想再吃", 1305 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1306 "recommend": [] 1307 }, 1308 { 1309 "username": "n******b", 1310 "ratetime": 1469121964000, 1311 "deliverytime": "", 1312 "score": 3, 1313 "ratetype": 1, 1314 "text": "发票开的不对", 1315 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1316 "recommend": [] 1317 }, 1318 { 1319 "username": "m******c", 1320 "ratetime": 1469111964000, 1321 "deliverytime": 30, 1322 "score": 5, 1323 "ratetype": 0, 1324 "text": "好吃", 1325 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1326 "recommend": [] 1327 }, 1328 { 1329 "username": "l******3", 1330 "ratetime": 1469101264000, 1331 "deliverytime": 40, 1332 "score": 5, 1333 "ratetype": 0, 1334 "text": "还不错吧", 1335 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1336 "recommend": [] 1337 }, 1338 { 1339 "username": "3******o", 1340 "ratetime": 1469091964000, 1341 "deliverytime": "", 1342 "score": 2, 1343 "ratetype": 1, 1344 "text": "", 1345 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1346 "recommend": [] 1347 }, 1348 { 1349 "username": "3******p", 1350 "ratetime": 1469081964000, 1351 "deliverytime": "", 1352 "score": 4, 1353 "ratetype": 0, 1354 "text": "很喜欢的粥", 1355 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1356 "recommend": [] 1357 }, 1358 { 1359 "username": "o******k", 1360 "ratetime": 1469071264000, 1361 "deliverytime": "", 1362 "score": 5, 1363 "ratetype": 0, 1364 "text": "", 1365 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1366 "recommend": [] 1367 }, 1368 { 1369 "username": "k******b", 1370 "ratetime": 1469061964000, 1371 "deliverytime": "", 1372 "score": 4, 1373 "ratetype": 0, 1374 "text": "", 1375 "avatar": "http://static.galileo.xiaojukeji.com/static/tms/default_header.png", 1376 "recommend": [] 1377 } 1378 ] 1379 }
3. 最重要的一步来了,由于vue-cli版本的不同,会造成误解,一种就版本是在build文件夹下有dev-server.js和dev-client.js的这两个文件,另外一个新版本就build文件夹下没有dev-server.js和dev-client.js这俩个文件,而是webpack.dev.conf.js代替,我这里使用的就是新版本的作为演示
4.在webpack.dev.conf.js文件中const portfinder = require('portfinder')后添加在如下代码
1 const express = require('express') 2 const app = express() 3 var appdata = require('../data.json')//加载本地数据文件 4 var seller = appdata.seller//获取对应的本地数据 5 var goods = appdata.goods 6 var ratings = appdata.ratings 7 var apiroutes = express.router()
5. 然后继续在webpack.dev.conf.js文件中继续添加如下代码,找到devserver
1 before(app) { 2 app.get('/api/seller', (req, res) => { 3 res.json({ 4 errno: 0, 5 data: seller 6 })//接口返回json数据,上面配置的数据seller就赋值给data请求后调用 7 }), 8 app.get('/api/goods', (req, res) => { 9 res.json({ 10 errno: 0, 11 data: goods 12 }) 13 }), 14 app.get('/api/ratings', (req, res) => { 15 res.json({ 16 errno: 0, 17 data: ratings 18 }) 19 }) 20 } 21 },
6. 最后一步就是npm run dev,然后在浏览器中输入localhost:8080/api/goods
大功告成!