Merge pull request '完成小程序端首页轮播图对接' (#40) from Brunch_LPQ into main
commit
830c9dbe90
@ -0,0 +1,57 @@
|
|||||||
|
package com.itmk.web.wxapi.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.itmk.utils.ResultUtils;
|
||||||
|
import com.itmk.utils.ResultVo;
|
||||||
|
import com.itmk.web.goods.entity.SysGoods;
|
||||||
|
import com.itmk.web.goods.service.SysGoodsService;
|
||||||
|
import com.itmk.web.goods_specs.entity.SysGoodsSpecs;
|
||||||
|
import com.itmk.web.goods_specs.service.SysGoodsSpecsService;
|
||||||
|
import com.itmk.web.banner.entity.SysBanner;
|
||||||
|
import com.itmk.web.banner.service.SysBannerService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api/home")
|
||||||
|
public class HomeController {
|
||||||
|
@Autowired
|
||||||
|
private SysBannerService sysBannerService;
|
||||||
|
@Autowired
|
||||||
|
private SysGoodsService sysGoodsService;
|
||||||
|
@Autowired
|
||||||
|
private SysGoodsSpecsService sysGoodsSpecsService;
|
||||||
|
|
||||||
|
//首页轮播图
|
||||||
|
@GetMapping("/getSwipperList")
|
||||||
|
public ResultVo getSwipperList(){
|
||||||
|
QueryWrapper<SysBanner> query = new QueryWrapper<>();
|
||||||
|
query.lambda().eq(SysBanner::getStatus,"1");
|
||||||
|
List<SysBanner> list = sysBannerService.list(query);
|
||||||
|
return ResultUtils.success("查询成功",list);
|
||||||
|
}
|
||||||
|
|
||||||
|
//首页热推
|
||||||
|
@GetMapping("/getHotList")
|
||||||
|
public ResultVo getHotList(){
|
||||||
|
QueryWrapper<SysGoods> query = new QueryWrapper<>();
|
||||||
|
query.lambda().eq(SysGoods::getStatus,"1")
|
||||||
|
.orderByAsc(SysGoods::getOrderNum);
|
||||||
|
List<SysGoods> list = sysGoodsService.list(query);
|
||||||
|
if(list.size() > 0){
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
//查询价格
|
||||||
|
QueryWrapper<SysGoodsSpecs> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.lambda().eq(SysGoodsSpecs::getGoodsId,list.get(i).getGoodsId())
|
||||||
|
.orderByAsc(SysGoodsSpecs::getOrderNum);
|
||||||
|
List<SysGoodsSpecs> specs = sysGoodsSpecsService.list(queryWrapper);
|
||||||
|
list.get(i).setSpecs(specs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ResultUtils.success("查询成功",list);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,25 @@
|
|||||||
|
{
|
||||||
|
"setting": {
|
||||||
|
"es6": true,
|
||||||
|
"postcss": true,
|
||||||
|
"minified": true,
|
||||||
|
"uglifyFileName": false,
|
||||||
|
"enhance": true,
|
||||||
|
"packNpmRelationList": [],
|
||||||
|
"babelSetting": {
|
||||||
|
"ignore": [],
|
||||||
|
"disablePlugins": [],
|
||||||
|
"outputPath": ""
|
||||||
|
},
|
||||||
|
"useCompilerPlugins": false,
|
||||||
|
"minifyWXML": true
|
||||||
|
},
|
||||||
|
"compileType": "miniprogram",
|
||||||
|
"simulatorPluginLibVersion": {},
|
||||||
|
"packOptions": {
|
||||||
|
"ignore": [],
|
||||||
|
"include": []
|
||||||
|
},
|
||||||
|
"appid": "wx6a41b250d82adc97",
|
||||||
|
"editorSetting": {}
|
||||||
|
}
|
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
"libVersion": "3.9.1",
|
||||||
|
"projectname": "order-app",
|
||||||
|
"setting": {
|
||||||
|
"urlCheck": true,
|
||||||
|
"coverView": true,
|
||||||
|
"lazyloadPlaceholderEnable": false,
|
||||||
|
"skylineRenderEnable": false,
|
||||||
|
"preloadBackgroundData": false,
|
||||||
|
"autoAudits": false,
|
||||||
|
"showShadowRootInWxmlPanel": true,
|
||||||
|
"compileHotReLoad": true
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,5 @@
|
|||||||
|
import http from '../common/http.js'
|
||||||
|
//轮播图
|
||||||
|
export const getSwipperListApi = ()=>{
|
||||||
|
return http.get("/api/home/getSwipperList")
|
||||||
|
}
|
@ -0,0 +1,39 @@
|
|||||||
|
const baseUrl = 'http://localhost:8089'
|
||||||
|
const http = (options = {}) => {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
uni.request({
|
||||||
|
url: baseUrl + options.url || '',
|
||||||
|
method:options.type || 'GET' ,
|
||||||
|
data: options.data || {},
|
||||||
|
header: options.header || {},
|
||||||
|
}).then((response) => {
|
||||||
|
console.log(response)
|
||||||
|
resolve(response.data);
|
||||||
|
}).catch(error => {
|
||||||
|
reject(error)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
}
|
||||||
|
const get=(url,data,options={})=>{
|
||||||
|
options.type='get';
|
||||||
|
options.data = data;
|
||||||
|
options.url = url;
|
||||||
|
return http(options)
|
||||||
|
}
|
||||||
|
const post = (url, data, options = {}) => {
|
||||||
|
options.type = 'post';
|
||||||
|
options.data = data;
|
||||||
|
options.url = url;
|
||||||
|
return http(options)
|
||||||
|
}
|
||||||
|
const put = (url, data, options = {}) => {
|
||||||
|
options.type = 'put';
|
||||||
|
options.data = data;
|
||||||
|
options.url = url;
|
||||||
|
return http(options)
|
||||||
|
}
|
||||||
|
export default {
|
||||||
|
get,
|
||||||
|
post,
|
||||||
|
put
|
||||||
|
}
|
Loading…
Reference in new issue