Compare commits
4 Commits
d8179ff2fa
...
754963fe17
Author | SHA1 | Date | |
---|---|---|---|
754963fe17 | |||
1cd4d15bac | |||
f69f6e7c62 | |||
0b85c6c77d |
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;
|
||||
|
@ -8,8 +8,11 @@
|
||||
<u-avatar size="80rpx" :src="avatarSrc"></u-avatar>
|
||||
</view>
|
||||
<view class="flex1 m-l-24 flex mac h100">
|
||||
<navigator open-type="redirect" url="/pages/main/login">
|
||||
<view class="fb fz32">{{userInfo.tel}}</view>
|
||||
<!-- 已登录:只显示手机号 -->
|
||||
<view v-if="userInfo.tel" class="fb fz32">{{ userInfo.tel }}</view>
|
||||
<!-- 未登录:显示“请登录”并跳转 -->
|
||||
<navigator v-else open-type="redirect" url="/pages/main/login">
|
||||
<view class="fb fz32">请登录</view>
|
||||
</navigator>
|
||||
<u-icon name="arrow-right"></u-icon>
|
||||
</view>
|
||||
@ -28,12 +31,39 @@
|
||||
</view> -->
|
||||
<!-- 主按钮 -->
|
||||
<view class="flex mse" style="margin-top: 30rpx;">
|
||||
<mainBut url="/pages/shop/list" bg="#D43030" imgSrc="/static/icons/ordernow.svg" butBt="开始点餐" butSt="Order Now" />
|
||||
<mainBut url="/pages/shop/list" bg="#FF8D1A" imgSrc="/static/icons/buggoods.svg" butBt="购买商品" butSt="Buy Goods" />
|
||||
<mainBut url="/pages/shop/list" bg="#D43030" imgSrc="/static/icons/ordernow.svg" butBt="开始点餐"
|
||||
butSt="Order Now" />
|
||||
<mainBut url="/pages/shop/list?tag=shop" bg="#FF8D1A" imgSrc="/static/icons/buggoods.svg" butBt="购买商品"
|
||||
butSt="Buy Goods" />
|
||||
<!-- <mainBut bg="#FFC300" imgSrc="/static/icons/franchise.svg" butBt="项目介绍" butSt="Introduction" /> -->
|
||||
</view>
|
||||
<!-- 站长推荐 -->
|
||||
|
||||
<view class="flex mc">
|
||||
<view class="flex recommendBox column mc">
|
||||
<!-- 站长推荐标题 -->
|
||||
<view class="flex recommendTit column">
|
||||
<view class="flex recommendTitBut rad16 column mac">
|
||||
<view class="flex w80 mse">
|
||||
<view class="recommendTitButTiao" v-for="i in 11" :key="i"></view>
|
||||
</view>
|
||||
<view class="flex mc mac h100">
|
||||
<view class="fz32 fb" style="color: #fff">站长推荐</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex mse" style="height: 18rpx;width: 252rpx; ">
|
||||
<view style="width:6rpx;background-color: #383838;" v-for="i in 2" :key="i"></view>
|
||||
</view>
|
||||
</view>
|
||||
<!-- 站长推荐内容 -->
|
||||
<swiper class="recommendSwiper" circular autoplay interval="6000">
|
||||
<swiper-item v-for="(item, index) in recommendList" :key="index">
|
||||
<!-- <view class="recommendSwiper-item rad8 h100 boxshadow m-l-12 m-r-12" ></view> -->
|
||||
<listItem :spu="item">
|
||||
</listItem>
|
||||
</swiper-item>
|
||||
</swiper>
|
||||
</view>
|
||||
</view>
|
||||
<!-- tabbar -->
|
||||
<view>
|
||||
<tabbar></tabbar>
|
||||
@ -50,9 +80,6 @@
|
||||
data() {
|
||||
return {
|
||||
avatarSrc: "", //头像地址
|
||||
bannerList: [{ //banner
|
||||
url: '/static/banner1.png'
|
||||
}],
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -62,8 +89,21 @@
|
||||
//订单列表 过滤出 已付款的状态订单
|
||||
orderList() {
|
||||
return this.$store.state.orderList.filter(item => item.main_status === '已付款')
|
||||
},
|
||||
//推荐的商品spu列表
|
||||
recommendList() {
|
||||
return this.$store.state.spuList.filter(item => item.recommend === '1')
|
||||
},
|
||||
//获取首页banner列表
|
||||
bannerList() {
|
||||
return this.$store.state.bannerList
|
||||
.filter(item => item.type === 'index')
|
||||
.map(item => ({
|
||||
url: item.photo
|
||||
}))
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
created() {
|
||||
//检查token 没有则进行无感登录
|
||||
this.checkUserInfo()
|
||||
@ -87,4 +127,36 @@
|
||||
transform: translateX(-50%);
|
||||
top: 494rpx;
|
||||
}
|
||||
|
||||
.recommendBox {
|
||||
width: 702rpx;
|
||||
margin-top: 48rpx;
|
||||
}
|
||||
|
||||
.recommendTit {
|
||||
height: 90rpx;
|
||||
}
|
||||
|
||||
.recommendTitBut {
|
||||
width: 252rpx;
|
||||
height: 72rpx;
|
||||
background-color: $uni-color-error;
|
||||
}
|
||||
|
||||
.recommendTitButTiao {
|
||||
width: 8rpx;
|
||||
height: 4rpx;
|
||||
background-color: $uni-text-color-inverse;
|
||||
}
|
||||
|
||||
.recommendSwiper {
|
||||
width: 702rpx;
|
||||
height: 224rpx;
|
||||
}
|
||||
|
||||
.recommendSwiper-item {
|
||||
background-color: $uni-bg-color;
|
||||
width: 680rpx;
|
||||
height: 184rpx;
|
||||
}
|
||||
</style>
|
@ -97,8 +97,22 @@
|
||||
scrollingTiemout: null, //timeout对象
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
//get参数里面有shop 页面加载完成后 跳转对应标签的导航高度位置
|
||||
if (options.tag === 'shop') {
|
||||
this.$nextTick(() => {
|
||||
setTimeout(() => {
|
||||
const index = this.menuList.findIndex(item => item.tag === 'shop')
|
||||
if (index !== -1) {
|
||||
this.swichMenu(index)
|
||||
}
|
||||
}, 300) // 延迟300ms确保menuList有时间加载
|
||||
})
|
||||
}
|
||||
},
|
||||
onReady() {
|
||||
this.getMenuItemTop()
|
||||
//this.swichMenu(this.menuList.length - 1) // 激活最后一项
|
||||
},
|
||||
onShow() {
|
||||
// 当页面显示时,设置tabber的激活项
|
||||
|
@ -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,
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 60 KiB |
@ -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