wangfukang 2 weeks ago
parent
commit
8d2f14fe94
  1. 117
      pages/index/index.vue

117
pages/index/index.vue

@ -455,20 +455,20 @@
<my-center ref="myCenterPage"></my-center>
</view>
</view>
<!-- <view v-if="currentIndex == 0" class="campus-wiki-float"
<view v-if="currentIndex == 0" class="campus-wiki-float"
:class="{'campus-wiki-float--collapsed': campusWikiCollapsed}">
<view class="campus-wiki-puller" @tap.stop="toggleCampusWiki">
<text>{{campusWikiCollapsed ? '拉出' : '隐藏'}}</text>
</view>
<view class="campus-wiki-card">
<view class="campus-wiki-card" @tap="goInviteReward">
<view class="campus-wiki-glow campus-wiki-glow-a"></view>
<view class="campus-wiki-glow campus-wiki-glow-b"></view>
<image class="campus-wiki-image" :src="campusWikiImage" mode="aspectFill"></image>
<view class="campus-wiki-copy">
<view class="campus-wiki-kicker">校园百科</view>
<view class="campus-wiki-kicker">拉新奖励</view>
</view>
</view>
</view> -->
</view>
<!-- 弹出区域选择 -->
<uni-popup ref="areaPopup" class="home-popup-layer area-popup-layer" :is-mask-click="areaPopupCanClose"
background-color="transparent" borderRadius="42rpx" @change="onAreaPopupChange">
@ -482,7 +482,7 @@
</view>
<view v-if="suggestedArea && suggestedArea.id" class="campus-area-suggest">
<view class="campus-area-suggest-text">
检测到您当前在「{{ suggestedArea.title }}」区域,是否选中该区域?或可下方选择其他区域。
检测到您当前在「{{ suggestedArea.title }}」区域,是否选中该区域?也可点击更多区域手动选择。
</view>
<view class="campus-area-suggest-btn" @tap.stop="onClickArea(suggestedArea)">选中该区域</view>
</view>
@ -510,6 +510,10 @@
<view class="area-empty-title">没找到这个区域</view>
<view class="area-empty-desc">换个关键词试试,比如学校简称或区域名</view>
</view>
<view v-if="showMoreAreaButton" class="campus-area-more" @tap.stop="showAllAreas">
<text>查看更多区域</text>
<text class="campus-area-more-arrow">›</text>
</view>
</scroll-view>
</view>
</uni-popup>
@ -574,7 +578,7 @@
import myCenter from "@/components/tab-bar/myCenter.vue";
import homeGroupPending from "@/components/tab-bar/homeGroupPending.vue";
import { getIeRealNameAuditSetting } from '@/common/ieApi.js'
import { resolveHomeShareTarget, normalizeShareTargetPath, resolveMiniCodeSceneTarget, isShareTargetHandled, completeShareEnter, reopenShareEnter, consumeShareRedirectSuppression } from '@/utils/sharePath.js'
import { resolveHomeShareTarget, normalizeShareTargetPath, resolveMiniCodeSceneTarget, isShareTargetHandled, completeShareEnter, reopenShareEnter, consumeShareRedirectSuppression, rememberInviteParams, buildInviteHomeSharePath } from '@/utils/sharePath.js'
const HOME_AD_IMAGE_CACHE_KEY = 'home_ad_image_cache_v1'
const HOME_POPUP_AD_SHOWN_KEY_PREFIX = 'home_popup_ad_shown_v1'
@ -755,6 +759,7 @@
dataList: [],
areaList: [],
areaKeyword: '',
areaShowAll: false,
areaPopupCanClose: false,
areaPopupVisible: false,
suggestedArea: null,
@ -871,12 +876,22 @@
},
filteredAreaList() {
const keyword = this.areaKeyword.trim().toLowerCase()
if (!keyword) return this.areaList
return this.areaList.filter((item) => {
const list = this.areaList || []
if (!keyword && this.suggestedArea && this.suggestedArea.id && !this.areaShowAll) {
const hit = list.find((item) => item && item.id == this.suggestedArea.id)
return hit ? [hit] : [this.suggestedArea]
}
if (!keyword) return list
return list.filter((item) => {
const title = item.title ? String(item.title).toLowerCase() : ''
return title.indexOf(keyword) > -1
})
},
showMoreAreaButton() {
if (this.areaKeyword.trim()) return false
if (!this.suggestedArea || !this.suggestedArea.id || this.areaShowAll) return false
return (this.areaList || []).some((item) => item && item.id != this.suggestedArea.id)
},
homeCenterAds() {
return (this.mallAds || [])
.filter(item => item && item.position != 'home_top' && item.position != 'home_popup')
@ -982,6 +997,7 @@
if (option && option.deliveryRuleEdited == 1) {
this.pendingDeliveryRuleConfirm = true
}
rememberInviteParams(option)
const shareTargetPath = resolveMiniCodeSceneTarget(option && option.scene) || resolveHomeShareTarget(option)
if (shareTargetPath) {
reopenShareEnter(shareTargetPath)
@ -1052,6 +1068,9 @@
const detail = e && e.detail ? e.detail : e
this.areaPopupVisible = !!(detail && detail.show)
},
showAllAreas() {
this.areaShowAll = true
},
enableShareMenu() {
if (!uni.showShareMenu) return
uni.showShareMenu({
@ -1061,7 +1080,7 @@
},
buildHomeShareInfo() {
const tabIndex = Number(this.currentIndex) || 0
const path = tabIndex > 0 ? '/pages/index/index?tabIndex=' + tabIndex : '/pages/index/index'
const path = tabIndex > 0 ? buildInviteHomeSharePath({ tabIndex }) : buildInviteHomeSharePath()
const tabTitleMap = {
1: '兼职配送,顺路赚点零花钱',
2: '新鲜事和搭子都在这里',
@ -1079,6 +1098,11 @@
toggleCampusWiki() {
this.campusWikiCollapsed = !this.campusWikiCollapsed
},
goInviteReward() {
uni.navigateTo({
url: '/package2/invite/reward'
})
},
refreshTabCounts() {
if (this.$refs.tabBar && this.$refs.tabBar.getWorkerCounts) {
return this.$refs.tabBar.getWorkerCounts()
@ -2085,6 +2109,7 @@
this.areaName = uni.getStorageSync('schoolName') || item.title || '沧州师范学院'
this.syncAreaKind(item)
this.areaKeyword = ''
this.areaShowAll = false
this.suggestedArea = null
this.searchForm.regionId = item.id
this.resetDeliveryQuery()
@ -2249,10 +2274,12 @@
},
checkArea(suggestedArea) {
this.suggestedArea = suggestedArea && suggestedArea.id ? suggestedArea : null
this.areaShowAll = false
this.tui.request("/app/shopArea/getByParentId/0", "get", {}, false, false).then((res) => {
if (res.code == 200) {
this.areaList = res.result || []
this.areaKeyword = ''
this.areaShowAll = false
this.areaPopupCanClose = !!uni.getStorageSync('area')
// 若推荐项不在列表中,仍保留提示,列表以接口为准
if (this.suggestedArea && this.suggestedArea.id) {
@ -2578,6 +2605,20 @@
overflow: hidden;
}
.campus-wiki-card::after {
content: '';
position: absolute;
left: 50%;
top: 30rpx;
width: 92rpx;
height: 92rpx;
border-radius: 28rpx;
border: 2rpx solid rgba(66, 215, 185, 0.42);
transform: translateX(-50%);
animation: campusWikiPulse 2.4s ease-out infinite;
pointer-events: none;
}
.campus-wiki-card:active {
transform: scale(0.98);
}
@ -2616,6 +2657,37 @@
box-shadow: 0 10rpx 24rpx rgba(20, 146, 119, 0.16);
position: relative;
z-index: 1;
transform-origin: 50% 70%;
animation: campusWikiFloat 2.4s ease-in-out infinite;
}
@keyframes campusWikiFloat {
0%, 100% {
transform: translate3d(0, 0, 0) rotate(0deg) scale(1);
box-shadow: 0 10rpx 24rpx rgba(20, 146, 119, 0.16);
}
32% {
transform: translate3d(0, -8rpx, 0) rotate(-4deg) scale(1.06);
box-shadow: 0 18rpx 34rpx rgba(20, 146, 119, 0.24);
}
58% {
transform: translate3d(0, 2rpx, 0) rotate(3deg) scale(1.02);
}
}
@keyframes campusWikiPulse {
0% {
opacity: 0.58;
transform: translateX(-50%) scale(0.86);
}
70% {
opacity: 0;
transform: translateX(-50%) scale(1.34);
}
100% {
opacity: 0;
transform: translateX(-50%) scale(1.34);
}
}
.campus-wiki-copy {
@ -4831,6 +4903,33 @@
line-height: 50rpx;
}
.campus-area-more {
display: flex;
align-items: center;
justify-content: center;
gap: 10rpx;
height: 82rpx;
margin: 8rpx 0 18rpx;
border-radius: 999rpx;
background: linear-gradient(90deg, rgba(18, 59, 49, 0.94), rgba(42, 191, 139, 0.94));
color: #ffffff;
font-size: 26rpx;
font-weight: 900;
text-align: center;
box-shadow: 0 16rpx 34rpx rgba(42, 191, 139, 0.22);
}
.campus-area-more:active {
transform: scale(0.985);
opacity: 0.9;
}
.campus-area-more-arrow {
font-size: 38rpx;
line-height: 1;
transform: translateY(-1rpx);
}
.campus-area-empty {
padding: 70rpx 0 56rpx;
text-align: center;

Loading…
Cancel
Save