Compare commits

...

4 Commits

Author SHA1 Message Date
wangfukang ff3f675cf5 1 2 weeks ago
wangfukang b6240b7fb4 1 2 weeks ago
wangfukang 8d2f14fe94 1 2 weeks ago
wangfukang 94a1638e6f 1 2 weeks ago
  1. 8
      package2/group/groupBuySingle.vue
  2. 810
      package2/invite/reward.vue
  3. 195
      package2/login/login.vue
  4. 6
      pages.json
  5. 117
      pages/index/index.vue
  6. 144
      utils/sharePath.js

8
package2/group/groupBuySingle.vue

@ -873,6 +873,7 @@
<script> <script>
import { requireLoginToCurrentPage } from '@/utils/authRedirect.js' import { requireLoginToCurrentPage } from '@/utils/authRedirect.js'
import { rememberInviteParams } from '@/utils/sharePath.js'
export default { export default {
data() { data() {
return { return {
@ -1097,6 +1098,7 @@
this.initWaitRuleKnown(); this.initWaitRuleKnown();
this.type = option.type; this.type = option.type;
this.orderScene = option.orderScene || ''; this.orderScene = option.orderScene || '';
rememberInviteParams(option || {});
this.rememberShareTarget(option || {}); this.rememberShareTarget(option || {});
if (option.groupId) { if (option.groupId) {
this.groupId = option.groupId; this.groupId = option.groupId;
@ -1178,6 +1180,12 @@
if (option.orderScene) { if (option.orderScene) {
targetPath += '&orderScene=' + encodeURIComponent(option.orderScene); targetPath += '&orderScene=' + encodeURIComponent(option.orderScene);
} }
if (option.inviterId) {
targetPath += '&inviterId=' + encodeURIComponent(option.inviterId);
}
if (option.regionId) {
targetPath += '&regionId=' + encodeURIComponent(option.regionId);
}
uni.setStorageSync('authPendingTargetPath', targetPath); uni.setStorageSync('authPendingTargetPath', targetPath);
uni.removeStorageSync('pendingShareTargetPath'); uni.removeStorageSync('pendingShareTargetPath');
}, },

810
package2/invite/reward.vue

@ -0,0 +1,810 @@
<template>
<view class="invite-page">
<view class="ambient ambient-one"></view>
<view class="ambient ambient-two"></view>
<view class="ambient ambient-three"></view>
<view class="back-btn glass-card" @tap="goBack">
<text class="back-arrow">‹</text>
<text>返回</text>
</view>
<view class="invite-hero glass-card">
<view class="hero-copy">
<view class="invite-badge">半径里邀友计划</view>
<view class="invite-title">叫上好友一起来省钱</view>
<view class="invite-subtitle">{{activityDesc}}</view>
<view class="reward-panel" :class="{'reward-panel-empty': !hasRewardActivity}">
<view class="reward-label">{{hasRewardActivity ? '当前区域奖励' : '当前区域'}}</view>
<view class="reward-amount" v-if="hasRewardActivity">¥{{formatAmount(rewardAmount)}}</view>
<view class="reward-empty-text" v-else>暂无拉新奖励活动</view>
</view>
</view>
<view class="hero-ip">
<view class="ip-halo"></view>
<image class="squirrel" src="https://jewel-shop.oss-cn-beijing.aliyuncs.com/f7227759d693497a8beab87ff437a875.png" mode="aspectFit"></image>
<view class="sticker sticker-a">好友 +1</view>
<view class="sticker sticker-b">现金奖励</view>
</view>
</view>
<view class="rule-card glass-card">
<view class="section-title">奖励规则</view>
<view class="rule-grid">
<view class="rule-item">
<text class="rule-dot">1</text>
<text>新用户首次注册并绑定手机号才可计奖</text>
</view>
<view class="rule-item">
<text class="rule-dot">2</text>
<text>同一手机号、同一设备只奖励一次</text>
</view>
<view class="rule-item">
<text class="rule-dot">3</text>
<text>好友需在分享时所在区域范围内登录</text>
</view>
<view class="rule-item">
<text class="rule-dot">4</text>
<text>奖励通过微信商家转账发放到微信零钱</text>
</view>
</view>
</view>
<view v-if="hasRewardActivity" class="auth-card glass-card">
<view>
<view class="section-title">微信收款授权</view>
<view class="auth-desc">{{transferAuthDesc}}</view>
</view>
<view class="auth-action" :class="{'auth-action-done': isTransferAuthorized}" @tap="openTransferAuth">
{{isTransferAuthorized ? '已开通' : '开通免确认收款'}}
</view>
</view>
<button class="share-btn" :class="{'share-btn-disabled': !hasRewardActivity}" :disabled="!hasRewardActivity" open-type="share">
{{hasRewardActivity ? '立即邀请好友' : '暂无活动'}}
</button>
<view class="record-card glass-card">
<view class="record-head">
<view>
<view class="section-title">我的拉新记录</view>
<view class="record-subtitle">只展示已进入奖励处理流程的记录</view>
</view>
<view class="record-refresh" @tap="refreshRecords">刷新</view>
</view>
<view v-if="records.length === 0 && !recordLoading" class="record-empty">
暂无拉新奖励记录
</view>
<view v-for="item in records" :key="item.id" class="record-item">
<view class="record-row">
<text class="record-phone">{{maskMobile(item.invitedMobile)}}</text>
<text class="record-status" :class="'record-status-' + Number(item.status)">{{statusText(item.status)}}</text>
</view>
<view class="record-row record-row-sub">
<text>奖励金额 ¥{{formatAmount(item.amount)}}</text>
<text>{{item.createTime || ''}}</text>
</view>
<view v-if="item.failReason" class="record-reason">{{item.failReason}}</view>
<view v-if="canConfirmTransfer(item)" class="confirm-transfer-btn" @tap="confirmTransfer(item)">
确认收款
</view>
</view>
<view v-if="records.length > 0" class="record-more" @tap="loadMoreRecords">
{{recordLoading ? '加载中...' : (recordFinished ? '没有更多了' : '加载更多')}}
</view>
</view>
</view>
</template>
<script>
import { buildInviteHomeSharePath } from '@/utils/sharePath.js'
import { requireLoginToCurrentPage } from '@/utils/authRedirect.js'
export default {
data() {
return {
records: [],
recordPageNumber: 1,
recordPageSize: 10,
recordTotal: 0,
recordLoading: false,
recordFinished: false,
rewardAmount: 0,
configLoaded: false,
transferAuth: {
state: '',
authNo: '',
authId: '',
mchId: '',
appId: '',
packageInfo: ''
},
transferAuthLoading: false,
authStatusLoaded: false,
autoAuthTriggered: false
}
},
computed: {
hasRewardActivity() {
return Number(this.rewardAmount || 0) > 0
},
isTransferAuthorized() {
return this.transferAuth && this.transferAuth.state === 'TAKING_EFFECT'
},
transferAuthDesc() {
if (this.isTransferAuthorized) {
return '已授权微信收款,后续奖励将自动到账微信零钱。'
}
return '开通后无需每笔确认,好友完成注册奖励会自动发放到微信零钱。'
},
activityDesc() {
return this.hasRewardActivity
? '好友在当前区域完成新用户注册并绑定手机号后,你将获得现金奖励。'
: '当前区域暂未开启拉新奖励,活动开启后这里会第一时间展示金额。'
}
},
onLoad() {
if (!requireLoginToCurrentPage()) return
this.enableShareMenu()
this.loadInviteConfig()
this.loadTransferAuthStatus()
this.refreshRecords()
},
onReachBottom() {
this.loadMoreRecords()
},
onShareAppMessage() {
return {
title: '来半径里一起拼团,注册后我还能领现金奖励',
path: buildInviteHomeSharePath()
}
},
methods: {
goBack() {
const pages = getCurrentPages ? getCurrentPages() : []
if (pages && pages.length > 1) {
uni.navigateBack()
return
}
uni.switchTab({
url: '/pages/index/index',
fail: () => {
uni.redirectTo({
url: '/pages/index/index'
})
}
})
},
enableShareMenu() {
if (!uni.showShareMenu) return
uni.showShareMenu({
withShareTicket: true,
menus: ['shareAppMessage']
})
},
readCurrentRegionId() {
try {
const area = uni.getStorageSync('area')
if (!area) return ''
const data = typeof area === 'string' ? JSON.parse(area) : area
return data && data.id ? String(data.id) : ''
} catch (e) {
return ''
}
},
loadInviteConfig() {
const regionId = this.readCurrentRegionId()
if (!regionId) {
this.rewardAmount = 0
this.configLoaded = true
this.tryAutoOpenTransferAuth()
return
}
this.tui.request('/app/inviteReward/config', 'GET', {
regionId
}, false, true, true).then((res) => {
this.configLoaded = true
const config = res && res.code == 200 ? (res.result || null) : null
this.rewardAmount = config && Number(config.rewardAmount || 0) > 0 ? Number(config.rewardAmount || 0) : 0
this.tryAutoOpenTransferAuth()
}).catch(() => {
this.configLoaded = true
this.rewardAmount = 0
this.tryAutoOpenTransferAuth()
})
},
loadTransferAuthStatus() {
this.tui.request('/app/inviteReward/transferAuth/status', 'GET', {}, false, true, true).then((res) => {
if (res && res.code == 200 && res.result) {
this.transferAuth = Object.assign({}, this.transferAuth, res.result)
}
this.authStatusLoaded = true
this.tryAutoOpenTransferAuth()
}).catch(() => {
this.authStatusLoaded = true
this.tryAutoOpenTransferAuth()
})
},
tryAutoOpenTransferAuth() {
if (!this.configLoaded || !this.authStatusLoaded || this.autoAuthTriggered) return
if (!this.hasRewardActivity || this.isTransferAuthorized) return
this.autoAuthTriggered = true
setTimeout(() => this.openTransferAuth(), 300)
},
openTransferAuth() {
if (this.isTransferAuthorized || this.transferAuthLoading) return
this.transferAuthLoading = true
this.tui.request('/app/inviteReward/transferAuth/apply', 'POST', {}, false, true, true).then((res) => {
this.transferAuthLoading = false
if (!res || res.code != 200 || !res.result) {
this.tui.toast((res && res.message) || '收款授权申请失败')
return
}
this.transferAuth = Object.assign({}, this.transferAuth, res.result)
if (this.isTransferAuthorized) {
this.tui.toast('已开通自动收款')
return
}
this.requestMerchantTransferAuth(res.result)
}).catch(() => {
this.transferAuthLoading = false
this.tui.toast('收款授权申请失败')
})
},
requestMerchantTransferAuth(authInfo) {
const packageInfo = authInfo && authInfo.packageInfo
if (!packageInfo) {
this.tui.toast('缺少微信授权信息')
return
}
if (typeof wx === 'undefined' || !wx.requestMerchantTransfer) {
this.tui.toast('当前微信版本暂不支持收款授权')
return
}
wx.requestMerchantTransfer({
mchId: authInfo.mchId,
appId: authInfo.appId,
'package': packageInfo,
success: () => {
this.tui.toast('授权完成,正在同步状态', 1600, true)
},
fail: () => {
this.tui.toast('未完成收款授权')
},
complete: () => {
setTimeout(() => this.refreshTransferAuth(2), 1500)
}
})
},
refreshTransferAuth(retryLeft = 0) {
this.tui.request('/app/inviteReward/transferAuth/query', 'POST', {}, false, true, true).then((res) => {
if (res && res.code == 200 && res.result) {
this.transferAuth = Object.assign({}, this.transferAuth, res.result)
if (this.isTransferAuthorized) {
this.tui.toast('已开通自动收款')
} else if (retryLeft > 0) {
setTimeout(() => this.refreshTransferAuth(retryLeft - 1), 1500)
}
}
})
},
refreshRecords() {
this.recordPageNumber = 1
this.recordFinished = false
this.loadRecords(true)
},
loadMoreRecords() {
if (this.recordLoading || this.recordFinished) return
this.recordPageNumber += 1
this.loadRecords(false)
},
loadRecords(reset) {
this.recordLoading = true
this.tui.request('/app/inviteReward/my/page', 'GET', {
pageNumber: this.recordPageNumber,
pageSize: this.recordPageSize
}, false, true, true).then((res) => {
this.recordLoading = false
if (res.code != 200 || !res.result) {
if (!reset) this.recordPageNumber -= 1
this.tui.toast(res.message || '拉新记录加载失败')
return
}
const page = res.result || {}
const nextRecords = page.records || []
this.recordTotal = Number(page.total || 0)
this.records = reset ? nextRecords : this.records.concat(nextRecords)
this.recordFinished = this.records.length >= this.recordTotal || nextRecords.length < this.recordPageSize
}).catch(() => {
this.recordLoading = false
if (!reset) this.recordPageNumber -= 1
this.tui.toast('拉新记录加载失败')
})
},
statusText(status) {
const map = {
0: '处理中',
1: '已发放',
2: '发放失败',
3: '已跳过'
}
return map[Number(status)] || '未知'
},
formatAmount(value) {
const num = Number(value || 0)
return num.toFixed(2)
},
maskMobile(mobile) {
const value = String(mobile || '')
if (value.length < 7) return value || '新用户'
return value.slice(0, 3) + '****' + value.slice(-4)
},
parseWxResponse(item) {
try {
return item && item.wxResponse ? JSON.parse(item.wxResponse) : {}
} catch (e) {
return {}
}
},
transferPackageInfo(item) {
const wxResponse = this.parseWxResponse(item)
return wxResponse.package_info || ''
},
canConfirmTransfer(item) {
return Number(item && item.status) === 0 && !!this.transferPackageInfo(item)
},
confirmTransfer(item) {
const packageInfo = this.transferPackageInfo(item)
if (!packageInfo) {
this.tui.toast('缺少收款确认信息,请刷新后再试')
return
}
if (typeof wx === 'undefined' || !wx.openBusinessView) {
this.tui.toast('当前微信版本暂不支持确认收款')
return
}
wx.openBusinessView({
businessType: 'weappBusinessTransfer',
extraData: {
mchId: WECHAT_TRANSFER_MCH_ID,
appId: WECHAT_TRANSFER_APP_ID,
package: packageInfo
},
success: () => {
this.tui.toast('请按微信页面提示确认收款', 1600, true)
setTimeout(() => this.refreshRecords(), 1200)
},
fail: () => {
this.tui.toast('未完成收款确认')
}
})
}
}
}
</script>
<style lang="scss" scoped>
.invite-page {
position: relative;
min-height: 100vh;
overflow: hidden;
padding: 132rpx 34rpx 56rpx;
box-sizing: border-box;
background:
radial-gradient(circle at 12% 8%, rgba(255, 255, 255, 0.96) 0, rgba(255, 255, 255, 0) 260rpx),
radial-gradient(circle at 84% 0, rgba(199, 248, 219, 0.72) 0, rgba(199, 248, 219, 0) 300rpx),
linear-gradient(160deg, #f8f5e8 0%, #eefbe8 42%, #e7f8ef 72%, #fbf7ed 100%);
color: #123b31;
}
.ambient {
position: absolute;
border-radius: 999rpx;
pointer-events: none;
}
.ambient-one {
top: 88rpx;
left: -94rpx;
width: 270rpx;
height: 270rpx;
background: rgba(255, 255, 255, 0.58);
box-shadow: 0 0 90rpx rgba(255, 255, 255, 0.78);
}
.ambient-two {
top: 268rpx;
right: -84rpx;
width: 230rpx;
height: 230rpx;
background: rgba(166, 255, 234, 0.42);
box-shadow: 0 0 88rpx rgba(42, 191, 139, 0.14);
}
.ambient-three {
left: 84rpx;
bottom: 190rpx;
width: 150rpx;
height: 150rpx;
background: rgba(255, 240, 199, 0.48);
box-shadow: 0 0 76rpx rgba(255, 213, 127, 0.24);
}
.glass-card {
position: relative;
z-index: 1;
box-sizing: border-box;
border: 1rpx solid rgba(255, 255, 255, 0.72);
background: rgba(255, 255, 255, 0.58);
box-shadow:
0 24rpx 64rpx rgba(62, 116, 91, 0.14),
inset 0 1rpx 0 rgba(255, 255, 255, 0.76);
backdrop-filter: blur(24rpx);
}
.back-btn {
position: absolute;
top: 62rpx;
left: 34rpx;
z-index: 5;
display: inline-flex;
align-items: center;
gap: 4rpx;
height: 56rpx;
padding: 0 20rpx 0 14rpx;
border-radius: 999rpx;
color: #123b31;
font-size: 24rpx;
font-weight: 800;
}
.back-arrow {
font-size: 40rpx;
line-height: 1;
transform: translateY(-2rpx);
}
.invite-hero {
display: flex;
min-height: 392rpx;
padding: 34rpx 30rpx 28rpx;
overflow: hidden;
border-radius: 46rpx;
}
.hero-copy {
position: relative;
z-index: 2;
flex: 1;
min-width: 0;
}
.invite-badge {
display: inline-flex;
align-items: center;
height: 46rpx;
padding: 0 18rpx;
border-radius: 999rpx;
background: rgba(18, 59, 49, 0.92);
color: #fff5cf;
font-size: 22rpx;
font-weight: 800;
}
.invite-title {
width: 420rpx;
margin-top: 28rpx;
color: #17372d;
font-size: 43rpx;
font-weight: 900;
line-height: 1.22;
}
.invite-subtitle {
width: 410rpx;
margin-top: 18rpx;
color: rgba(43, 83, 70, 0.66);
font-size: 25rpx;
line-height: 1.58;
}
.reward-panel {
display: inline-flex;
align-items: center;
gap: 18rpx;
margin-top: 26rpx;
padding: 14rpx 18rpx;
border-radius: 999rpx;
background: linear-gradient(90deg, rgba(227, 255, 150, 0.95), rgba(166, 255, 234, 0.95));
box-shadow: 0 16rpx 36rpx rgba(42, 191, 139, 0.18);
}
.reward-panel-empty {
background: rgba(255, 255, 255, 0.66);
box-shadow: none;
}
.reward-label {
color: rgba(7, 61, 51, 0.7);
font-size: 22rpx;
font-weight: 700;
}
.reward-amount {
color: #073d33;
font-size: 36rpx;
font-weight: 950;
line-height: 1;
}
.reward-empty-text {
color: rgba(43, 83, 70, 0.62);
font-size: 24rpx;
font-weight: 800;
}
.hero-ip {
position: absolute;
right: -18rpx;
bottom: 8rpx;
width: 260rpx;
height: 300rpx;
}
.ip-halo {
position: absolute;
left: 22rpx;
bottom: 42rpx;
width: 220rpx;
height: 150rpx;
border-radius: 50%;
background: radial-gradient(circle, rgba(255, 255, 255, 0.82), rgba(245, 225, 177, 0.18) 64%, rgba(255, 255, 255, 0));
}
.squirrel {
position: absolute;
right: 22rpx;
bottom: 28rpx;
width: 150rpx;
height: 150rpx;
filter: drop-shadow(0 28rpx 28rpx rgba(80, 103, 79, 0.16));
}
.sticker {
position: absolute;
z-index: 2;
padding: 10rpx 16rpx;
border: 1rpx solid rgba(255, 255, 255, 0.76);
border-radius: 999rpx;
background: rgba(255, 255, 255, 0.62);
box-shadow: 0 14rpx 38rpx rgba(93, 132, 101, 0.12);
color: rgba(26, 69, 55, 0.72);
font-size: 21rpx;
font-weight: 800;
}
.sticker-a {
right: 150rpx;
top: 58rpx;
transform: rotate(-7deg);
}
.sticker-b {
right: 18rpx;
top: 26rpx;
color: #8a6834;
transform: rotate(5deg);
}
.rule-card {
margin-top: 28rpx;
padding: 30rpx;
border-radius: 38rpx;
}
.section-title {
color: #17372d;
font-size: 32rpx;
font-weight: 900;
}
.rule-grid {
margin-top: 22rpx;
}
.rule-item {
display: flex;
align-items: flex-start;
gap: 16rpx;
margin-top: 18rpx;
color: rgba(18, 59, 49, 0.76);
font-size: 25rpx;
line-height: 1.55;
}
.rule-dot {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
width: 34rpx;
height: 34rpx;
margin-top: 2rpx;
border-radius: 14rpx;
background: rgba(42, 191, 139, 0.14);
color: #15956a;
font-size: 21rpx;
font-weight: 900;
}
.auth-card {
display: flex;
align-items: center;
justify-content: space-between;
gap: 22rpx;
margin-top: 28rpx;
padding: 30rpx;
border-radius: 38rpx;
}
.auth-desc {
margin-top: 12rpx;
color: rgba(18, 59, 49, 0.58);
font-size: 24rpx;
line-height: 1.5;
}
.auth-action {
flex-shrink: 0;
padding: 16rpx 24rpx;
border-radius: 999rpx;
background: linear-gradient(90deg, #dcff8d, #8fffe7);
color: #0b5b47;
font-size: 24rpx;
font-weight: 900;
box-shadow: 0 12rpx 28rpx rgba(44, 175, 121, 0.18);
}
.auth-action-done {
background: rgba(42, 191, 139, 0.12);
color: #198861;
box-shadow: none;
}
.share-btn {
position: relative;
z-index: 1;
margin-top: 34rpx;
height: 96rpx;
line-height: 96rpx;
border-radius: 999rpx;
border: 0;
background: linear-gradient(90deg, #123b31, #2abf8b);
color: #ffffff;
font-size: 31rpx;
font-weight: 900;
box-shadow: 0 22rpx 42rpx rgba(42, 191, 139, 0.3);
}
.share-btn::after {
border: 0;
}
.share-btn-disabled {
background: rgba(255, 255, 255, 0.64);
color: rgba(43, 83, 70, 0.48);
box-shadow: none;
}
.record-card {
margin-top: 34rpx;
padding: 32rpx;
border-radius: 38rpx;
}
.record-head {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 20rpx;
}
.record-subtitle {
margin-top: 8rpx;
color: rgba(18, 59, 49, 0.52);
font-size: 23rpx;
}
.record-refresh {
padding: 10rpx 22rpx;
border-radius: 999rpx;
background: rgba(42, 191, 139, 0.12);
color: #198861;
font-size: 24rpx;
font-weight: 700;
}
.record-empty {
padding: 54rpx 0;
color: rgba(18, 59, 49, 0.48);
font-size: 26rpx;
text-align: center;
}
.record-item {
padding: 22rpx 0;
border-top: 1rpx solid rgba(18, 59, 49, 0.08);
}
.record-row {
display: flex;
align-items: center;
justify-content: space-between;
gap: 18rpx;
}
.record-row-sub {
margin-top: 12rpx;
color: rgba(18, 59, 49, 0.58);
font-size: 24rpx;
}
.record-phone {
font-size: 29rpx;
font-weight: 800;
}
.record-status {
padding: 6rpx 16rpx;
border-radius: 999rpx;
background: #edf3f1;
color: #50615c;
font-size: 22rpx;
font-weight: 700;
}
.record-status-0 {
background: #eaf3ff;
color: #2f74c0;
}
.record-status-1 {
background: #e9fbf2;
color: #1b9a66;
}
.record-status-2 {
background: #fff0f0;
color: #d94f4f;
}
.record-reason {
margin-top: 12rpx;
color: #d94f4f;
font-size: 23rpx;
line-height: 1.5;
}
.confirm-transfer-btn {
display: inline-flex;
align-items: center;
justify-content: center;
height: 56rpx;
margin-top: 16rpx;
padding: 0 24rpx;
border-radius: 999rpx;
background: linear-gradient(90deg, #dcff8d, #8fffe7);
color: #0b5b47;
font-size: 24rpx;
font-weight: 900;
box-shadow: 0 12rpx 28rpx rgba(44, 175, 121, 0.18);
}
.record-more {
padding-top: 24rpx;
border-top: 1rpx solid rgba(18, 59, 49, 0.08);
color: rgba(18, 59, 49, 0.58);
font-size: 25rpx;
text-align: center;
}
</style>

195
package2/login/login.vue

@ -93,7 +93,7 @@
</template> </template>
<script> <script>
import { resolveHomeShareTarget, getEnterShareTarget, resolveMiniCodeSceneTarget, reopenShareEnter } from '@/utils/sharePath.js' import { resolveHomeShareTarget, getEnterShareTarget, resolveMiniCodeSceneTarget, reopenShareEnter, rememberInviteParams, getStoredInviteParams, normalizeInviteParams, extractInviteParamsFromUrl, getInviteDeviceId } from '@/utils/sharePath.js'
export default { export default {
data() { data() {
return { return {
@ -105,7 +105,10 @@
customId: '', customId: '',
saleId: '', saleId: '',
redirectKey: '', redirectKey: '',
areaKind: 1 areaKind: 1,
inviteContext: { inviterId: '', regionId: '' },
inviteLat: '',
inviteLng: ''
} }
}, },
computed: { computed: {
@ -133,6 +136,7 @@
}, },
onLoad(option) { onLoad(option) {
this.syncAreaKind() this.syncAreaKind()
this.syncInviteContext(option)
if (option.redirect) { if (option.redirect) {
this.redirectKey = option.redirect this.redirectKey = option.redirect
} }
@ -147,6 +151,79 @@
} }
}, },
methods: { methods: {
syncInviteContext(option) {
rememberInviteParams(option || {})
let invite = normalizeInviteParams(option || {})
const mergeInvite = (next) => {
next = normalizeInviteParams(next || {})
if (!invite.inviterId && next.inviterId) invite.inviterId = next.inviterId
if (!invite.regionId && next.regionId) invite.regionId = next.regionId
}
try {
if (this.redirectKey) {
mergeInvite(extractInviteParamsFromUrl(uni.getStorageSync(this.redirectKey) || ''))
}
mergeInvite(extractInviteParamsFromUrl(uni.getStorageSync('authPendingTargetPath') || ''))
mergeInvite(extractInviteParamsFromUrl(uni.getStorageSync('pendingShareTargetPath') || ''))
mergeInvite(getStoredInviteParams())
} catch (e) {}
if (invite.inviterId && invite.regionId) {
this.inviteContext = invite
rememberInviteParams(invite)
}
return this.inviteContext
},
hasInviteContext() {
this.syncInviteContext({})
return !!(this.inviteContext && this.inviteContext.inviterId && this.inviteContext.regionId)
},
getInvitePayload() {
this.syncInviteContext({})
if (!this.inviteContext || !this.inviteContext.inviterId || !this.inviteContext.regionId) {
return {}
}
const payload = {
inviterId: this.inviteContext.inviterId,
regionId: this.inviteContext.regionId,
deviceId: getInviteDeviceId()
}
if (this.inviteLat !== '' && this.inviteLng !== '') {
payload.lat = this.inviteLat
payload.lng = this.inviteLng
}
return payload
},
ensureInviteRegionMatched() {
if (!this.hasInviteContext()) return Promise.resolve(true)
return new Promise((resolve) => {
uni.getLocation({
type: 'gcj02',
success: (location) => {
this.inviteLat = location.latitude
this.inviteLng = location.longitude
this.tui.request('/app/shopArea/matchByLocation', 'GET', {
lat: location.latitude,
lng: location.longitude
}, false, true).then((res) => {
const matchedId = res && res.code == 200 && res.result ? res.result.id : ''
if (matchedId && String(matchedId) === String(this.inviteContext.regionId)) {
resolve(true)
return
}
this.tui.toast('当前定位不在邀请区域内,无法领取拉新奖励')
resolve(false)
}).catch(() => {
this.tui.toast('区域校验失败,请稍后再试')
resolve(false)
})
},
fail: () => {
this.tui.toast('需要授权定位后领取拉新奖励')
resolve(false)
}
})
})
},
syncAreaKind(areaObj) { syncAreaKind(areaObj) {
let area = areaObj let area = areaObj
if (!area) { if (!area) {
@ -169,39 +246,46 @@
const that = this const that = this
this.loginLoading = true this.loginLoading = true
uni.login({ this.ensureInviteRegionMatched().then((matched) => {
provider: 'weixin', if (!matched) {
success(loginRes) { that.loginLoading = false
that.getWechatProfile().then((profile) => { return
that.cacheWechatProfile(profile) }
that.tui.request('/user/login', 'post', { uni.login({
jsCode: loginRes.code, provider: 'weixin',
customId: that.customId, success(loginRes) {
wechatName: profile.nickName || uni.getStorageSync('nickname') || that.defaultWechatName, that.getWechatProfile().then((profile) => {
userType: '2' that.cacheWechatProfile(profile)
}, false, false).then((res) => { const loginPayload = Object.assign({
that.loginLoading = false jsCode: loginRes.code,
if (res.code == 200) { customId: that.customId,
that.saveLoginResult(res.result) wechatName: profile.nickName || uni.getStorageSync('nickname') || that.defaultWechatName,
if (!res.result || !res.result.user || res.result.user.mobile == null || res.result.user.mobile === '') { userType: '2'
that.needPhoneAuth = true }, that.getInvitePayload())
that.tui.toast('绑定手机号,解锁完整半径') that.tui.request('/user/login', 'post', loginPayload, false, false).then((res) => {
that.loginLoading = false
if (res.code == 200) {
that.saveLoginResult(res.result)
if (!res.result || !res.result.user || res.result.user.mobile == null || res.result.user.mobile === '') {
that.needPhoneAuth = true
that.tui.toast('绑定手机号,解锁完整半径')
} else {
that.enterHome()
}
} else { } else {
that.enterHome() that.tui.toast(res.message)
} }
} else { }).catch(() => {
that.tui.toast(res.message) that.loginLoading = false
} that.tui.toast('登录失败,请稍后再试')
}).catch(() => { })
that.loginLoading = false
that.tui.toast('登录失败,请稍后再试')
}) })
}) },
}, fail() {
fail() { that.loginLoading = false
that.loginLoading = false that.tui.toast('微信登录失败,请稍后再试')
that.tui.toast('微信登录失败,请稍后再试') }
} })
}) })
}, },
getWechatProfile() { getWechatProfile() {
@ -250,29 +334,36 @@
} }
this.phoneLoading = true this.phoneLoading = true
this.tui.request('/social/wechat/getPhone', 'POST', { this.ensureInviteRegionMatched().then((matched) => {
code: e.detail.code if (!matched) {
}, false, true).then((res) => { this.phoneLoading = false
this.phoneLoading = false return
if (res.code == 200) { }
if (res.result) { const phonePayload = Object.assign({
if (res.result.accessToken) { code: e.detail.code
uni.setStorageSync('hiver_token', res.result.accessToken) }, this.getInvitePayload())
this.tui.request('/social/wechat/getPhone', 'POST', phonePayload, false, true).then((res) => {
this.phoneLoading = false
if (res.code == 200) {
if (res.result) {
if (res.result.accessToken) {
uni.setStorageSync('hiver_token', res.result.accessToken)
}
if (res.result.mobile) {
uni.setStorageSync('mobile', res.result.mobile)
}
} }
if (res.result.mobile) { this.enterHome()
uni.setStorageSync('mobile', res.result.mobile) } else {
if (res.code == 401) {
this.needPhoneAuth = false
} }
this.tui.toast(res.message || '手机号绑定失败')
} }
this.enterHome() }).catch(() => {
} else { this.phoneLoading = false
if (res.code == 401) { this.tui.toast('手机号绑定失败,请稍后再试')
this.needPhoneAuth = false })
}
this.tui.toast(res.message || '手机号绑定失败')
}
}).catch(() => {
this.phoneLoading = false
this.tui.toast('手机号绑定失败,请稍后再试')
}) })
}, },
saveLoginResult(result) { saveLoginResult(result) {

6
pages.json

@ -318,6 +318,12 @@
"style": { "style": {
"navigationBarTitleText": "隐私政策" "navigationBarTitleText": "隐私政策"
} }
},{
"path": "invite/reward",
"style": {
"navigationBarTitleText": "拉新奖励",
"navigationStyle": "custom"
}
},{ },{
"path": "group/groupBuyDetail", "path": "group/groupBuyDetail",
"style": { "style": {

117
pages/index/index.vue

@ -455,20 +455,20 @@
<my-center ref="myCenterPage"></my-center> <my-center ref="myCenterPage"></my-center>
</view> </view>
</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}"> :class="{'campus-wiki-float--collapsed': campusWikiCollapsed}">
<view class="campus-wiki-puller" @tap.stop="toggleCampusWiki"> <view class="campus-wiki-puller" @tap.stop="toggleCampusWiki">
<text>{{campusWikiCollapsed ? '拉出' : '隐藏'}}</text> <text>{{campusWikiCollapsed ? '拉出' : '隐藏'}}</text>
</view> </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-a"></view>
<view class="campus-wiki-glow campus-wiki-glow-b"></view> <view class="campus-wiki-glow campus-wiki-glow-b"></view>
<image class="campus-wiki-image" :src="campusWikiImage" mode="aspectFill"></image> <image class="campus-wiki-image" :src="campusWikiImage" mode="aspectFill"></image>
<view class="campus-wiki-copy"> <view class="campus-wiki-copy">
<view class="campus-wiki-kicker">校园百科</view> <view class="campus-wiki-kicker">拉新奖励</view>
</view> </view>
</view> </view>
</view> --> </view>
<!-- 弹出区域选择 --> <!-- 弹出区域选择 -->
<uni-popup ref="areaPopup" class="home-popup-layer area-popup-layer" :is-mask-click="areaPopupCanClose" <uni-popup ref="areaPopup" class="home-popup-layer area-popup-layer" :is-mask-click="areaPopupCanClose"
background-color="transparent" borderRadius="42rpx" @change="onAreaPopupChange"> background-color="transparent" borderRadius="42rpx" @change="onAreaPopupChange">
@ -482,7 +482,7 @@
</view> </view>
<view v-if="suggestedArea && suggestedArea.id" class="campus-area-suggest"> <view v-if="suggestedArea && suggestedArea.id" class="campus-area-suggest">
<view class="campus-area-suggest-text"> <view class="campus-area-suggest-text">
检测到您当前在「{{ suggestedArea.title }}」区域,是否选中该区域?或可下方选择其他区域。 检测到您当前在「{{ suggestedArea.title }}」区域,是否选中该区域?也可点击更多区域手动选择。
</view> </view>
<view class="campus-area-suggest-btn" @tap.stop="onClickArea(suggestedArea)">选中该区域</view> <view class="campus-area-suggest-btn" @tap.stop="onClickArea(suggestedArea)">选中该区域</view>
</view> </view>
@ -510,6 +510,10 @@
<view class="area-empty-title">没找到这个区域</view> <view class="area-empty-title">没找到这个区域</view>
<view class="area-empty-desc">换个关键词试试,比如学校简称或区域名</view> <view class="area-empty-desc">换个关键词试试,比如学校简称或区域名</view>
</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> </scroll-view>
</view> </view>
</uni-popup> </uni-popup>
@ -574,7 +578,7 @@
import myCenter from "@/components/tab-bar/myCenter.vue"; import myCenter from "@/components/tab-bar/myCenter.vue";
import homeGroupPending from "@/components/tab-bar/homeGroupPending.vue"; import homeGroupPending from "@/components/tab-bar/homeGroupPending.vue";
import { getIeRealNameAuditSetting } from '@/common/ieApi.js' 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_AD_IMAGE_CACHE_KEY = 'home_ad_image_cache_v1'
const HOME_POPUP_AD_SHOWN_KEY_PREFIX = 'home_popup_ad_shown_v1' const HOME_POPUP_AD_SHOWN_KEY_PREFIX = 'home_popup_ad_shown_v1'
@ -755,6 +759,7 @@
dataList: [], dataList: [],
areaList: [], areaList: [],
areaKeyword: '', areaKeyword: '',
areaShowAll: false,
areaPopupCanClose: false, areaPopupCanClose: false,
areaPopupVisible: false, areaPopupVisible: false,
suggestedArea: null, suggestedArea: null,
@ -871,12 +876,22 @@
}, },
filteredAreaList() { filteredAreaList() {
const keyword = this.areaKeyword.trim().toLowerCase() const keyword = this.areaKeyword.trim().toLowerCase()
if (!keyword) return this.areaList const list = this.areaList || []
return this.areaList.filter((item) => { 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() : '' const title = item.title ? String(item.title).toLowerCase() : ''
return title.indexOf(keyword) > -1 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() { homeCenterAds() {
return (this.mallAds || []) return (this.mallAds || [])
.filter(item => item && item.position != 'home_top' && item.position != 'home_popup') .filter(item => item && item.position != 'home_top' && item.position != 'home_popup')
@ -982,6 +997,7 @@
if (option && option.deliveryRuleEdited == 1) { if (option && option.deliveryRuleEdited == 1) {
this.pendingDeliveryRuleConfirm = true this.pendingDeliveryRuleConfirm = true
} }
rememberInviteParams(option)
const shareTargetPath = resolveMiniCodeSceneTarget(option && option.scene) || resolveHomeShareTarget(option) const shareTargetPath = resolveMiniCodeSceneTarget(option && option.scene) || resolveHomeShareTarget(option)
if (shareTargetPath) { if (shareTargetPath) {
reopenShareEnter(shareTargetPath) reopenShareEnter(shareTargetPath)
@ -1052,6 +1068,9 @@
const detail = e && e.detail ? e.detail : e const detail = e && e.detail ? e.detail : e
this.areaPopupVisible = !!(detail && detail.show) this.areaPopupVisible = !!(detail && detail.show)
}, },
showAllAreas() {
this.areaShowAll = true
},
enableShareMenu() { enableShareMenu() {
if (!uni.showShareMenu) return if (!uni.showShareMenu) return
uni.showShareMenu({ uni.showShareMenu({
@ -1061,7 +1080,7 @@
}, },
buildHomeShareInfo() { buildHomeShareInfo() {
const tabIndex = Number(this.currentIndex) || 0 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 = { const tabTitleMap = {
1: '兼职配送,顺路赚点零花钱', 1: '兼职配送,顺路赚点零花钱',
2: '新鲜事和搭子都在这里', 2: '新鲜事和搭子都在这里',
@ -1079,6 +1098,11 @@
toggleCampusWiki() { toggleCampusWiki() {
this.campusWikiCollapsed = !this.campusWikiCollapsed this.campusWikiCollapsed = !this.campusWikiCollapsed
}, },
goInviteReward() {
uni.navigateTo({
url: '/package2/invite/reward'
})
},
refreshTabCounts() { refreshTabCounts() {
if (this.$refs.tabBar && this.$refs.tabBar.getWorkerCounts) { if (this.$refs.tabBar && this.$refs.tabBar.getWorkerCounts) {
return this.$refs.tabBar.getWorkerCounts() return this.$refs.tabBar.getWorkerCounts()
@ -2085,6 +2109,7 @@
this.areaName = uni.getStorageSync('schoolName') || item.title || '沧州师范学院' this.areaName = uni.getStorageSync('schoolName') || item.title || '沧州师范学院'
this.syncAreaKind(item) this.syncAreaKind(item)
this.areaKeyword = '' this.areaKeyword = ''
this.areaShowAll = false
this.suggestedArea = null this.suggestedArea = null
this.searchForm.regionId = item.id this.searchForm.regionId = item.id
this.resetDeliveryQuery() this.resetDeliveryQuery()
@ -2249,10 +2274,12 @@
}, },
checkArea(suggestedArea) { checkArea(suggestedArea) {
this.suggestedArea = suggestedArea && suggestedArea.id ? suggestedArea : null this.suggestedArea = suggestedArea && suggestedArea.id ? suggestedArea : null
this.areaShowAll = false
this.tui.request("/app/shopArea/getByParentId/0", "get", {}, false, false).then((res) => { this.tui.request("/app/shopArea/getByParentId/0", "get", {}, false, false).then((res) => {
if (res.code == 200) { if (res.code == 200) {
this.areaList = res.result || [] this.areaList = res.result || []
this.areaKeyword = '' this.areaKeyword = ''
this.areaShowAll = false
this.areaPopupCanClose = !!uni.getStorageSync('area') this.areaPopupCanClose = !!uni.getStorageSync('area')
// 若推荐项不在列表中,仍保留提示,列表以接口为准 // 若推荐项不在列表中,仍保留提示,列表以接口为准
if (this.suggestedArea && this.suggestedArea.id) { if (this.suggestedArea && this.suggestedArea.id) {
@ -2578,6 +2605,20 @@
overflow: hidden; 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 { .campus-wiki-card:active {
transform: scale(0.98); transform: scale(0.98);
} }
@ -2616,6 +2657,37 @@
box-shadow: 0 10rpx 24rpx rgba(20, 146, 119, 0.16); box-shadow: 0 10rpx 24rpx rgba(20, 146, 119, 0.16);
position: relative; position: relative;
z-index: 1; 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 { .campus-wiki-copy {
@ -4831,6 +4903,33 @@
line-height: 50rpx; 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 { .campus-area-empty {
padding: 70rpx 0 56rpx; padding: 70rpx 0 56rpx;
text-align: center; text-align: center;

144
utils/sharePath.js

@ -1,6 +1,136 @@
export function buildHomeSharePath(targetPath) { const INVITE_CONTEXT_KEY = 'inviteShareContext'
if (!targetPath) return '/pages/index/index' const INVITE_DEVICE_KEY = 'inviteDeviceId'
return '/pages/index/index?targetPath=' + encodeURIComponent(targetPath)
function isBlank(value) {
return value === undefined || value === null || String(value).trim() === ''
}
function readCurrentRegionId() {
try {
const area = uni.getStorageSync('area')
if (!area) return ''
const data = typeof area === 'string' ? JSON.parse(area) : area
return data && data.id ? String(data.id) : ''
} catch (e) {
return ''
}
}
function appendParam(query, key, value) {
if (isBlank(value)) return
query.push(key + '=' + encodeURIComponent(String(value)))
}
export function getInviteDeviceId() {
let deviceId = ''
try {
deviceId = uni.getStorageSync(INVITE_DEVICE_KEY) || ''
} catch (e) {}
if (deviceId) return deviceId
deviceId = 'dev_' + Date.now() + '_' + Math.random().toString(36).slice(2, 12)
try {
uni.setStorageSync(INVITE_DEVICE_KEY, deviceId)
} catch (e) {}
return deviceId
}
export function getCurrentInviteParams() {
return {
inviterId: uni.getStorageSync('id') || '',
regionId: readCurrentRegionId()
}
}
export function normalizeInviteParams(params) {
params = params || {}
const inviterId = params.inviterId || params.inviteUserId || ''
const regionId = params.regionId || params.inviteRegionId || ''
return {
inviterId: isBlank(inviterId) ? '' : String(inviterId),
regionId: isBlank(regionId) ? '' : String(regionId)
}
}
function resolveInviteParams(params, useCurrentFallback) {
const invite = normalizeInviteParams(params)
if ((!invite.inviterId || !invite.regionId) && useCurrentFallback) {
const current = getCurrentInviteParams()
if (!invite.inviterId) invite.inviterId = current.inviterId
if (!invite.regionId) invite.regionId = current.regionId
}
return invite
}
function appendInviteParams(query, params, useCurrentFallback) {
const invite = resolveInviteParams(params, useCurrentFallback)
appendParam(query, 'inviterId', invite.inviterId)
appendParam(query, 'regionId', invite.regionId)
}
export function rememberInviteParams(params) {
const invite = normalizeInviteParams(params)
if (!invite.inviterId || !invite.regionId) return invite
try {
uni.setStorageSync(INVITE_CONTEXT_KEY, invite)
} catch (e) {}
return invite
}
export function getStoredInviteParams() {
try {
const stored = uni.getStorageSync(INVITE_CONTEXT_KEY)
if (!stored) return { inviterId: '', regionId: '' }
return normalizeInviteParams(typeof stored === 'string' ? JSON.parse(stored) : stored)
} catch (e) {
return { inviterId: '', regionId: '' }
}
}
export function parseQueryString(queryString) {
const result = {}
String(queryString || '').split('&').forEach((item) => {
if (!item) return
const pair = item.split('=')
const key = pair[0]
if (!key) return
const value = pair.slice(1).join('=')
try {
result[key] = decodeURIComponent(value || '')
} catch (e) {
result[key] = value || ''
}
})
return result
}
export function extractInviteParamsFromUrl(url) {
const value = String(url || '')
const queryIndex = value.indexOf('?')
if (queryIndex === -1) return { inviterId: '', regionId: '' }
return normalizeInviteParams(parseQueryString(value.slice(queryIndex + 1)))
}
export function buildInviteHomeSharePath(params) {
params = params || {}
const query = ['shareType=invite']
if (!isBlank(params.tabIndex)) {
appendParam(query, 'tabIndex', params.tabIndex)
}
appendInviteParams(query, params, true)
return '/pages/index/index?' + query.join('&')
}
export function buildHomeSharePath(targetPath, params) {
const inviteQuery = []
appendInviteParams(inviteQuery, params || {}, true)
if (!targetPath) {
return inviteQuery.length > 0 ? '/pages/index/index?' + inviteQuery.join('&') : '/pages/index/index'
}
let finalTargetPath = targetPath
if (inviteQuery.length > 0) {
finalTargetPath += (finalTargetPath.indexOf('?') === -1 ? '?' : '&') + inviteQuery.join('&')
}
return '/pages/index/index?targetPath=' + encodeURIComponent(finalTargetPath)
} }
export function buildGroupHomeSharePath(params) { export function buildGroupHomeSharePath(params) {
@ -16,6 +146,7 @@ export function buildGroupHomeSharePath(params) {
if (params.orderScene) { if (params.orderScene) {
query.push('orderScene=' + encodeURIComponent(params.orderScene)) query.push('orderScene=' + encodeURIComponent(params.orderScene))
} }
appendInviteParams(query, params, true)
return '/pages/index/index?' + query.join('&') return '/pages/index/index?' + query.join('&')
} }
@ -30,6 +161,11 @@ export function buildGroupTargetPath(params) {
if (params.orderScene) { if (params.orderScene) {
targetPath += '&orderScene=' + encodeURIComponent(params.orderScene) targetPath += '&orderScene=' + encodeURIComponent(params.orderScene)
} }
const inviteQuery = []
appendInviteParams(inviteQuery, params, false)
if (inviteQuery.length > 0) {
targetPath += '&' + inviteQuery.join('&')
}
return targetPath return targetPath
} }
@ -68,6 +204,7 @@ export function normalizeShareTargetPath(value) {
export function resolveHomeShareTarget(query) { export function resolveHomeShareTarget(query) {
query = query || {} query = query || {}
rememberInviteParams(query)
if (query.shareType === 'group') { if (query.shareType === 'group') {
return buildGroupTargetPath(query) return buildGroupTargetPath(query)
} }
@ -102,6 +239,7 @@ export function getEnterShareTarget(options) {
const handledShareTargets = Object.create(null) const handledShareTargets = Object.create(null)
export function stageShareEnter(options) { export function stageShareEnter(options) {
rememberInviteParams(options && options.query)
const targetPath = resolveMiniCodeSceneTarget(options && options.query && options.query.scene) || getEnterShareTarget(options) const targetPath = resolveMiniCodeSceneTarget(options && options.query && options.query.scene) || getEnterShareTarget(options)
if (!targetPath) return { targetPath: '', alreadyHandled: false } if (!targetPath) return { targetPath: '', alreadyHandled: false }
if (handledShareTargets[targetPath]) return { targetPath: '', alreadyHandled: true } if (handledShareTargets[targetPath]) return { targetPath: '', alreadyHandled: true }

Loading…
Cancel
Save