分析:
移动端的首页为/pages/index.html
效果如下:
完善页面
前端
1.1展示套餐信息
1.2获取套餐列表数据
后端代码
1.1Controller
在healthmobile_web工程中创建SetmealController并提供getSetmeal方法,在此方法中通过Dubbo远程调用套餐服务获取套餐列表数据
package com.itheima.controller;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.Setmeal;
import com.itheima.service.SetmealService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/***
* 动态展示信息
* 获取套餐信息
*控制层管理
*/
@RestController
@RequestMapping("/setmeal")
public class SetmealController {
private SetmealService setmealService;
//获取套餐所有的信息
@RequestMapping("/getSetmeal")
public Result getSetmal() {
try {
List<Setmeal> list = setmealService.findAll();
return new Result(true, MessageConstant.GET_SETMEAL_COUNT_REPORT_SUCCESS,list);
} catch (Exception e) {
e.printStackTrace();
//查询套餐组失败
return new Result(true,MessageConstant.GET_SETMEAL_LIST_FAIL);
}
}
}