【类 型】:feat
【原 因】:从接口拿banner列表数据 参数配置文件里面加banner的路径参数 【过 程】: 【影 响】: # 类型 包含: # feat:新功能(feature) # fix:修补bug # docs:文档(documentation) # style: 格式(不影响代码运行的变动) # refactor:重构(即不是新增功能,也不是修改bug的代码变动) # test:增加测试 # chore:构建过程或辅助工具的变动
This commit is contained in:
parent
0b85c6c77d
commit
f69f6e7c62
9
App.vue
9
App.vue
@ -11,6 +11,8 @@
|
||||
this.$store.dispatch('fetchSiteList')
|
||||
//异步加载分类列表
|
||||
this.$store.dispatch('fetchMenuList')
|
||||
//异步获取banner列表
|
||||
this.$store.dispatch('fetchBannerList')
|
||||
// 创建一个数组存放两个需要等待的异步操作的 Promise
|
||||
const promises = []
|
||||
//异步获取spu列表
|
||||
@ -372,6 +374,10 @@
|
||||
.h100 {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.h80{
|
||||
height: 80%;
|
||||
}
|
||||
|
||||
.vw100 {
|
||||
width: 100vw;
|
||||
@ -380,6 +386,9 @@
|
||||
.w100 {
|
||||
width: 100%;
|
||||
}
|
||||
.w80{
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.w-80rpx {
|
||||
width: 80rpx;
|
||||
|
@ -1,6 +1,7 @@
|
||||
const host = 'https://szdot.top'
|
||||
const baseURL = host + '/flycube.php'
|
||||
const listPath = host + '/Data/UploadFiles/category/'
|
||||
const bannerPath = host + '/Data/UploadFiles/banner/'
|
||||
const spuPath = host + '/Data/UploadFiles/spu/'
|
||||
const skuPath = host + '/Data/UploadFiles/sku/'
|
||||
const sitePath = host + '/Data/UploadFiles/site/'
|
||||
@ -11,6 +12,7 @@ export default {
|
||||
* host 主站
|
||||
* api接口地址
|
||||
* 分类列表路径
|
||||
* banner图片路径
|
||||
* spu产品图片路径
|
||||
* sku产品图片路径
|
||||
* 站点图片路径
|
||||
@ -19,6 +21,7 @@ export default {
|
||||
"host": host,
|
||||
"baseURL": baseURL,
|
||||
"listPath": listPath,
|
||||
"bannerPath": bannerPath,
|
||||
"spuPath": spuPath,
|
||||
"skuPath": skuPath,
|
||||
"sitePath": sitePath,
|
||||
|
@ -10,6 +10,7 @@ const {
|
||||
host,
|
||||
baseURL,
|
||||
listPath,
|
||||
bannerPath,
|
||||
spuPath,
|
||||
skuPath,
|
||||
sitePath,
|
||||
@ -35,6 +36,7 @@ const store = new Vuex.Store({
|
||||
menuList: [], //分类列表
|
||||
spuList: [], //spu列表
|
||||
skuList: [], //sku列表
|
||||
bannerList: [], //banner列表
|
||||
shopCon: {}, //商铺信息
|
||||
cartList: [], //购物车列表 结构:[{"spu_id":"id","skuG":[sku_id,sku_id],"conutG":[数量,数量],"priceG":[单价,单价]},{.....}]
|
||||
|
||||
@ -102,6 +104,10 @@ const store = new Vuex.Store({
|
||||
setSkuList(state, list) {
|
||||
state.skuList = list
|
||||
},
|
||||
//设置banner列表
|
||||
setBannerList(state, list) {
|
||||
state.bannerList = list
|
||||
},
|
||||
//设置商铺信息
|
||||
setShopCon(state, 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列表
|
||||
fetchSpuList({
|
||||
state,
|
||||
|
Loading…
Reference in New Issue
Block a user