【类 型】:feat

【原  因】:从接口拿banner列表数据 参数配置文件里面加banner的路径参数
【过  程】:
【影  响】:

# 类型 包含:
# feat:新功能(feature)
# fix:修补bug
# docs:文档(documentation)
# style: 格式(不影响代码运行的变动)
# refactor:重构(即不是新增功能,也不是修改bug的代码变动)
# test:增加测试
# chore:构建过程或辅助工具的变动
This commit is contained in:
szdot 2025-05-12 02:16:53 +08:00
parent 0b85c6c77d
commit f69f6e7c62
3 changed files with 39 additions and 0 deletions

View File

@ -11,6 +11,8 @@
this.$store.dispatch('fetchSiteList') this.$store.dispatch('fetchSiteList')
// //
this.$store.dispatch('fetchMenuList') this.$store.dispatch('fetchMenuList')
//banner
this.$store.dispatch('fetchBannerList')
// Promise // Promise
const promises = [] const promises = []
//spu //spu
@ -372,6 +374,10 @@
.h100 { .h100 {
height: 100%; height: 100%;
} }
.h80{
height: 80%;
}
.vw100 { .vw100 {
width: 100vw; width: 100vw;
@ -380,6 +386,9 @@
.w100 { .w100 {
width: 100%; width: 100%;
} }
.w80{
width: 80%;
}
.w-80rpx { .w-80rpx {
width: 80rpx; width: 80rpx;

View File

@ -1,6 +1,7 @@
const host = 'https://szdot.top' const host = 'https://szdot.top'
const baseURL = host + '/flycube.php' const baseURL = host + '/flycube.php'
const listPath = host + '/Data/UploadFiles/category/' const listPath = host + '/Data/UploadFiles/category/'
const bannerPath = host + '/Data/UploadFiles/banner/'
const spuPath = host + '/Data/UploadFiles/spu/' const spuPath = host + '/Data/UploadFiles/spu/'
const skuPath = host + '/Data/UploadFiles/sku/' const skuPath = host + '/Data/UploadFiles/sku/'
const sitePath = host + '/Data/UploadFiles/site/' const sitePath = host + '/Data/UploadFiles/site/'
@ -11,6 +12,7 @@ export default {
* host 主站 * host 主站
* api接口地址 * api接口地址
* 分类列表路径 * 分类列表路径
* banner图片路径
* spu产品图片路径 * spu产品图片路径
* sku产品图片路径 * sku产品图片路径
* 站点图片路径 * 站点图片路径
@ -19,6 +21,7 @@ export default {
"host": host, "host": host,
"baseURL": baseURL, "baseURL": baseURL,
"listPath": listPath, "listPath": listPath,
"bannerPath": bannerPath,
"spuPath": spuPath, "spuPath": spuPath,
"skuPath": skuPath, "skuPath": skuPath,
"sitePath": sitePath, "sitePath": sitePath,

View File

@ -10,6 +10,7 @@ const {
host, host,
baseURL, baseURL,
listPath, listPath,
bannerPath,
spuPath, spuPath,
skuPath, skuPath,
sitePath, sitePath,
@ -35,6 +36,7 @@ const store = new Vuex.Store({
menuList: [], //分类列表 menuList: [], //分类列表
spuList: [], //spu列表 spuList: [], //spu列表
skuList: [], //sku列表 skuList: [], //sku列表
bannerList: [], //banner列表
shopCon: {}, //商铺信息 shopCon: {}, //商铺信息
cartList: [], //购物车列表 结构:[{"spu_id":"id","skuG":[sku_id,sku_id],"conutG":[数量,数量],"priceG":[单价,单价]},{.....}] cartList: [], //购物车列表 结构:[{"spu_id":"id","skuG":[sku_id,sku_id],"conutG":[数量,数量],"priceG":[单价,单价]},{.....}]
@ -102,6 +104,10 @@ const store = new Vuex.Store({
setSkuList(state, list) { setSkuList(state, list) {
state.skuList = list state.skuList = list
}, },
//设置banner列表
setBannerList(state, list) {
state.bannerList = list
},
//设置商铺信息 //设置商铺信息
setShopCon(state, obj) { setShopCon(state, obj) {
state.shopCon = obj state.shopCon = obj
@ -270,6 +276,27 @@ const store = new Vuex.Store({
} }
}) })
}, },
//获取banner列表
async fetchBannerList({
state,
commit
}) {
await uni.$u.http.get('/Api/Normal/getBannerList', {
params: {
shop_id: state.shop_id
}
}).then(res => {
if (res.data.status === 1) {
res.data.bannerList.forEach(banner => {
banner.photo = bannerPath + banner.photo
})
//更新数据
commit('setBannerList', res.data.bannerList)
} else {
commit('setBannerList', [])
}
})
},
// 获取spu列表 // 获取spu列表
fetchSpuList({ fetchSpuList({
state, state,