wangfukang 1 month ago
parent
commit
569a5004e7
  1. 135
      pages/index/index.vue

135
pages/index/index.vue

@ -137,9 +137,9 @@
<view class="like-box"> <view class="like-box">
<view class="like-content-box"> <view class="like-content-box">
<view class="brand-memory-strip"> <view class="brand-memory-strip">
<text>省钱榜 Top1</text> <view class="campus-switch campus-switch--strip" @tap.stop="checkArea">
<text>爆款指数 </text> <text class="campus-switch-name">{{areaName || '选择校区'}}</text>
<text>拼团王在线</text> </view>
</view> </view>
<view class="seckill-entry seckill-entry--in-card" @tap="goSeckillGroup"> <view class="seckill-entry seckill-entry--in-card" @tap="goSeckillGroup">
<view class="heat-dot heat-dot-a"></view> <view class="heat-dot heat-dot-a"></view>
@ -465,7 +465,7 @@
</view> </view>
</view> </view>
<!-- 弹出区域选择 --> <!-- 弹出区域选择 -->
<uni-popup ref="areaPopup" class="home-popup-layer" :is-mask-click="false" background-color="transparent"> <uni-popup ref="areaPopup" class="home-popup-layer" :is-mask-click="areaPopupCanClose" background-color="transparent">
<view class="campus-area-popup"> <view class="campus-area-popup">
<view class="area-popup-glow area-popup-glow-a"></view> <view class="area-popup-glow area-popup-glow-a"></view>
<view class="area-popup-glow area-popup-glow-b"></view> <view class="area-popup-glow area-popup-glow-b"></view>
@ -707,6 +707,7 @@
dataList: [], dataList: [],
areaList: [], areaList: [],
areaKeyword: '', areaKeyword: '',
areaPopupCanClose: false,
orderLists: [], orderLists: [],
waimaiCount: 0, waimaiCount: 0,
kuaidiCount: 0, kuaidiCount: 0,
@ -735,6 +736,10 @@
}, },
checked: 'waimai', checked: 'waimai',
navBarHeight: 0, navBarHeight: 0,
menuButtonInfo: {
top: 44,
height: 32
},
menuListOffsetTop: 0, menuListOffsetTop: 0,
stickyTrigger: 583, stickyTrigger: 583,
lastScrollTop: 0, lastScrollTop: 0,
@ -868,6 +873,7 @@
}, },
onLoad(option) { onLoad(option) {
this.startDeliveryTimeTimer() this.startDeliveryTimeTimer()
this.enableShareMenu()
if (option && option.tabIndex !== undefined) { if (option && option.tabIndex !== undefined) {
const tabIndex = Number(option.tabIndex) const tabIndex = Number(option.tabIndex)
if (!isNaN(tabIndex) && tabIndex > 0) { if (!isNaN(tabIndex) && tabIndex > 0) {
@ -884,6 +890,7 @@
} }
}, },
onShow() { onShow() {
this.enableShareMenu()
this.startDeliveryTimeTimer() this.startDeliveryTimeTimer()
this.runHomeInit() this.runHomeInit()
if (this.openShareTargetIfNeeded()) return if (this.openShareTargetIfNeeded()) return
@ -931,7 +938,31 @@
this.closeProductPopup() this.closeProductPopup()
this.stopDeliveryTimeTimer() this.stopDeliveryTimeTimer()
}, },
onShareAppMessage() {
return this.buildHomeShareInfo()
},
methods: { methods: {
enableShareMenu() {
if (!uni.showShareMenu) return
uni.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage']
})
},
buildHomeShareInfo() {
const tabIndex = Number(this.currentIndex) || 0
const path = tabIndex > 0 ? '/pages/index/index?tabIndex=' + tabIndex : '/pages/index/index'
const tabTitleMap = {
1: '校园兼职配送,顺路赚点零花钱',
2: '校园新鲜事和搭子都在这里',
3: '同校二手好物,来鱼塘逛逛',
4: '半径里个人中心'
}
return {
title: tabTitleMap[tabIndex] || '半径里,校园生活更省心',
path
}
},
setTabBarVisible(visible) { setTabBarVisible(visible) {
this.isTabBarVisible = visible this.isTabBarVisible = visible
}, },
@ -1122,6 +1153,18 @@
// sticky offsetstatusBarHeight + 40px // sticky offsetstatusBarHeight + 40px
const info = uni.getSystemInfoSync(); const info = uni.getSystemInfoSync();
this.navBarHeight = info.statusBarHeight; this.navBarHeight = info.statusBarHeight;
if (uni.getMenuButtonBoundingClientRect) {
const menuButtonInfo = uni.getMenuButtonBoundingClientRect()
this.menuButtonInfo = {
top: menuButtonInfo.top || this.navBarHeight + 8,
height: menuButtonInfo.height || 32
}
} else {
this.menuButtonInfo = {
top: this.navBarHeight + 8,
height: 32
}
}
this.swipeOrderBaseWidth = info.windowWidth * 0.86; this.swipeOrderBaseWidth = info.windowWidth * 0.86;
this.swipeOrderThumbWidth = uni.upx2px ? uni.upx2px(82) : 41; this.swipeOrderThumbWidth = uni.upx2px ? uni.upx2px(82) : 41;
const iosVersionMatch = info.platform === 'ios' && info.system ? String(info.system).match(/\d+/) : null; const iosVersionMatch = info.platform === 'ios' && info.system ? String(info.system).match(/\d+/) : null;
@ -1777,7 +1820,7 @@
// //
onClickArea(item) { onClickArea(item) {
uni.setStorageSync('area', JSON.stringify(item)) uni.setStorageSync('area', JSON.stringify(item))
this.areaName = item.title this.areaName = uni.getStorageSync('schoolName') || item.title || '沧州师范学院'
this.areaKeyword = '' this.areaKeyword = ''
this.searchForm.regionId = item.id this.searchForm.regionId = item.id
this.resetDeliveryQuery() this.resetDeliveryQuery()
@ -1787,7 +1830,7 @@
if(uni.getStorageSync('hiver_token')){ if(uni.getStorageSync('hiver_token')){
that.tui.request("/worker/admin/add", "POST", { that.tui.request("/worker/admin/add", "POST", {
userId: uni.getStorageSync('id'), userId: uni.getStorageSync('id'),
isChangeArea: 0, isChangeArea: 1,
region: item.id region: item.id
}, false, true).then((res) => { }, false, true).then((res) => {
if (res.code == 200) { if (res.code == 200) {
@ -1803,6 +1846,10 @@
} }
this.$refs.areaPopup.close() this.$refs.areaPopup.close()
this.tui.toast('切换成功')
if (this.$refs.myCenterPage && this.$refs.myCenterPage.init) {
this.$refs.myCenterPage.init()
}
this.pendingShareTargetPath = uni.getStorageSync('pendingShareTargetPath') || this.pendingShareTargetPath this.pendingShareTargetPath = uni.getStorageSync('pendingShareTargetPath') || this.pendingShareTargetPath
setTimeout(() => { setTimeout(() => {
this.openShareTargetIfNeeded() this.openShareTargetIfNeeded()
@ -1813,6 +1860,7 @@
if (res.code == 200) { if (res.code == 200) {
this.areaList = res.result this.areaList = res.result
this.areaKeyword = '' this.areaKeyword = ''
this.areaPopupCanClose = !!uni.getStorageSync('area')
this.$refs.areaPopup.open(); this.$refs.areaPopup.open();
} else { } else {
this.tui.toast(res.message) this.tui.toast(res.message)
@ -2112,6 +2160,45 @@
radial-gradient(circle at 8% 12%, rgba(166, 255, 234, 0.18) 0, rgba(166, 255, 234, 0) 170rpx); radial-gradient(circle at 8% 12%, rgba(166, 255, 234, 0.18) 0, rgba(166, 255, 234, 0) 170rpx);
} }
.campus-switch {
position: absolute;
left: 14rpx;
z-index: 6;
height: 56rpx;
margin-bottom: 4rpx;
padding: 0 22rpx;
box-sizing: border-box;
display: inline-flex;
align-items: center;
border-radius: 999rpx;
background: rgba(255, 255, 255, 0.76);
border: 1px solid rgba(255, 255, 255, 0.88);
box-shadow: 0 8rpx 22rpx rgba(18, 52, 46, 0.09);
backdrop-filter: saturate(160%) blur(14rpx);
}
.campus-switch-icon {
margin-right: 10rpx;
color: #05745f;
font-size: 27rpx;
font-weight: 900;
line-height: 1;
text-align: center;
}
.campus-switch-name {
position: relative;
z-index: 1;
max-width: 320rpx;
color: #004638;
font-size: 30rpx;
font-weight: 900;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
text-shadow: 0 0 10rpx rgba(31, 214, 151, 0.26);
}
.hero-live-strip { .hero-live-strip {
display: flex; display: flex;
align-items: center; align-items: center;
@ -3153,27 +3240,35 @@
position: absolute; position: absolute;
left: 20rpx; left: 20rpx;
right: 240rpx; right: 240rpx;
top: 26rpx; top: 16rpx;
height: 36rpx; height: 56rpx;
display: flex; display: flex;
align-items: center; align-items: center;
overflow: hidden; overflow: hidden;
z-index: 4; z-index: 4;
pointer-events: none; pointer-events: auto;
} }
.brand-memory-strip text { .campus-switch--strip {
flex-shrink: 0; position: relative;
height: 32rpx; left: auto;
margin-right: 10rpx; height: 56rpx;
padding: 0 12rpx; width: auto;
max-width: 100%;
min-width: 0;
flex: 0 1 auto;
}
.campus-switch--strip::after {
content: '';
position: absolute;
left: 18rpx;
right: 18rpx;
bottom: 10rpx;
height: 10rpx;
border-radius: 999rpx; border-radius: 999rpx;
background: rgba(255, 255, 255, 0.8); background: linear-gradient(90deg, rgba(44, 232, 158, 0), rgba(44, 232, 158, 0.46), rgba(44, 232, 158, 0));
color: #0f695b; box-shadow: 0 0 16rpx rgba(44, 232, 158, 0.36);
font-size: 18rpx;
font-weight: 900;
line-height: 32rpx;
box-shadow: 0 6rpx 14rpx rgba(0, 35, 28, 0.06);
} }
.group-flat-row { .group-flat-row {

Loading…
Cancel
Save