更新项目索引,新增2026-03-24的开发进度同步会议记录,补充各角色的项目索引信息,确保文档同步原则得到确认。

This commit is contained in:
Alex-larget
2026-03-25 15:47:31 +08:00
parent f3d74ce94a
commit c040e5609b
21 changed files with 2939 additions and 1509 deletions

View File

@@ -118,7 +118,7 @@ App({
const pages = getCurrentPages()
const cur = pages[pages.length - 1]
const route = (cur && cur.route) || ''
const needPrivacyPages = ['avatar-nickname', 'profile-edit', 'read', 'my', 'gift-pay/detail', 'index', 'settings']
const needPrivacyPages = ['avatar-nickname', 'profile-edit', 'read', 'my', 'gift-pay/detail', 'settings']
const needShow = needPrivacyPages.some(p => route.includes(p))
if (cur && typeof cur.setData === 'function' && needShow) {
cur.setData({ showPrivacyModal: true })

View File

@@ -9,9 +9,10 @@ const { trackClick } = require('../../utils/trackClick')
const { cleanSingleLineField } = require('../../utils/contentParser')
const { navigateMpPath } = require('../../utils/mpNavigate.js')
const { isSafeImageSrc } = require('../../utils/imageUrl.js')
const { submitCkbLead } = require('../../utils/soulBridge')
/** 置顶人物无头像时的占位图 */
const DEFAULT_KARUO_LINK_AVATAR = '/assets/images/karuo-link-avatar.png'
const KARUO_USER_ID = 'ogpTW5Wbbo9DfSyB3-xCWN6EGc-g'
/** 与首页固定「卡若」获客位重复时从横滑列表剔除(含历史误写「卡路」) */
function isKaruoHostDuplicateName(displayName) {
@@ -72,11 +73,6 @@ Page({
// 加载状态
loading: true,
// 链接卡若 - 留资弹窗
showLeadModal: false,
leadPhone: '',
showPrivacyModal: false,
// 展开状态(首页精选/最新)
featuredExpanded: false,
latestExpanded: false,
@@ -91,15 +87,18 @@ Page({
// mp_config.mpUi.homePage后台系统设置 mpUi
mpUiLogoTitle: '卡若创业派对',
mpUiLogoSubtitle: '来自派对房的真实故事',
mpUiLinkKaruoText: '点击链接卡若',
/** 最终展示:后台 linkKaruoAvatar 或本包默认卡若照片 */
/** 仅当有置顶 @人物时展示,文案与头像由 _applyHomeMpUi 写入 */
mpUiLinkKaruoText: '',
mpUiLinkKaruoDisplay: DEFAULT_KARUO_LINK_AVATAR,
mpUiSearchPlaceholder: '搜索章节标题或内容...',
mpUiBannerTag: '推荐',
mpUiBannerReadMore: '点击阅读',
mpUiSuperTitle: '超级个体',
mpUiPickTitle: '精选推荐',
mpUiLatestTitle: '最新新增'
mpUiLatestTitle: '最新新增',
/** 后台 @列表置顶人物:有则右上角展示绑定用户头像 + @名称,点击走 ckb/lead */
homePinnedPerson: null,
},
onLoad(options) {
@@ -125,7 +124,7 @@ Page({
onShow() {
console.log('[Index] onShow 触发')
this.setData({ auditMode: app.globalData.auditMode || false })
this._applyHomeMpUi()
void this.loadHomePinnedPerson()
// 设置TabBar选中状态
if (typeof this.getTabBar === 'function' && this.getTabBar()) {
@@ -322,31 +321,52 @@ Page({
_applyHomeMpUi() {
const h = app.globalData.configCache?.mpConfig?.mpUi?.homePage || {}
let linkKaruoAvatar = String(h.linkKaruoAvatar || h.linkKaruoImage || '').trim()
if (linkKaruoAvatar && !isSafeImageSrc(linkKaruoAvatar)) linkKaruoAvatar = ''
this.setData({
const patch = {
mpUiLogoTitle: String(h.logoTitle || '卡若创业派对').trim() || '卡若创业派对',
mpUiLogoSubtitle: String(h.logoSubtitle || '来自派对房的真实故事').trim() || '来自派对房的真实故事',
mpUiLinkKaruoText: String(h.linkKaruoText || '点击链接卡若').trim() || '点击链接卡若',
mpUiLinkKaruoDisplay: linkKaruoAvatar || DEFAULT_KARUO_LINK_AVATAR,
mpUiSearchPlaceholder: String(h.searchPlaceholder || '搜索章节标题或内容...').trim() || '搜索章节标题或内容...',
mpUiBannerTag: String(h.bannerTag || '推荐').trim() || '推荐',
mpUiBannerReadMore: String(h.bannerReadMoreText || '点击阅读').trim() || '点击阅读',
mpUiSuperTitle: String(h.superSectionTitle || '超级个体').trim() || '超级个体',
mpUiPickTitle: String(h.pickSectionTitle || '精选推荐').trim() || '精选推荐',
mpUiLatestTitle: String(h.latestSectionTitle || '最新新增').trim() || '最新新增'
})
if (!linkKaruoAvatar) this._loadKaruoAvatarLazy()
mpUiLatestTitle: String(h.latestSectionTitle || '最新新增').trim() || '最新新增',
}
const pinned = this.data.homePinnedPerson
if (pinned && pinned.token) {
const displayAv =
pinned.avatar && isSafeImageSrc(pinned.avatar) ? pinned.avatar : DEFAULT_KARUO_LINK_AVATAR
patch.mpUiLinkKaruoText = `点击链接${pinned.name || '好友'}`
patch.mpUiLinkKaruoDisplay = displayAv
} else {
patch.mpUiLinkKaruoText = ''
patch.mpUiLinkKaruoDisplay = DEFAULT_KARUO_LINK_AVATAR
}
this.setData(patch)
},
_loadKaruoAvatarLazy() {
app.request({ url: `/api/miniprogram/user/profile?userId=${KARUO_USER_ID}`, silent: true, timeout: 3000 })
.then(res => {
if (res?.success && res.data?.avatar && isSafeImageSrc(res.data.avatar)) {
this.setData({ mpUiLinkKaruoDisplay: res.data.avatar })
}
})
.catch(() => {})
/** 拉取后台置顶 @人物,合并到首页右上角「链接」区 */
async loadHomePinnedPerson() {
try {
const res = await app.request({ url: '/api/miniprogram/ckb/pinned-person', silent: true })
if (res && res.success && res.data && res.data.token) {
const name = cleanSingleLineField(res.data.name) || '好友'
let av = String(res.data.avatar || '').trim()
if (!isSafeImageSrc(av)) av = ''
this.setData({
homePinnedPerson: {
token: String(res.data.token).trim(),
name,
avatar: av,
},
})
} else {
this.setData({ homePinnedPerson: null })
}
} catch (e) {
console.log('[Index] pinned-person:', e)
this.setData({ homePinnedPerson: null })
}
this._applyHomeMpUi()
},
async loadFeatureConfig() {
@@ -380,6 +400,7 @@ Page({
})
this._applyHomeMpUi()
}
await this.loadHomePinnedPerson()
},
// 跳转到搜索页
@@ -409,187 +430,14 @@ Page({
},
async onLinkKaruo() {
trackClick('home', 'btn_click', '链接卡若')
const app = getApp()
if (!app.globalData.isLoggedIn || !app.globalData.userInfo) {
wx.showModal({
title: '提示',
content: '请先登录后再链接卡若',
confirmText: '去登录',
cancelText: '取消',
success: (res) => {
if (res.confirm) wx.switchTab({ url: '/pages/my/my' })
}
})
return
}
const userId = app.globalData.userInfo.id
let phone = (app.globalData.userInfo.phone || '').trim()
let wechatId = (app.globalData.userInfo.wechatId || app.globalData.userInfo.wechat_id || '').trim()
if (!phone && !wechatId) {
try {
const profileRes = await app.request({ url: `/api/miniprogram/user/profile?userId=${userId}`, silent: true })
if (profileRes?.success && profileRes.data) {
phone = (profileRes.data.phone || '').trim()
wechatId = (profileRes.data.wechatId || profileRes.data.wechat_id || '').trim()
}
} catch (e) {}
}
if (phone || wechatId) {
wx.showLoading({ title: '提交中...', mask: true })
try {
const res = await app.request({
url: '/api/miniprogram/ckb/index-lead',
method: 'POST',
data: {
userId,
phone: phone || undefined,
wechatId: wechatId || undefined,
name: (app.globalData.userInfo.nickname || '').trim() || undefined
}
})
wx.hideLoading()
if (res && res.success) {
wx.setStorageSync('lead_last_submit_ts', Date.now())
wx.showToast({ title: res.message || '提交成功', icon: 'success' })
} else {
wx.showToast({ title: (res && res.message) || '提交失败', icon: 'none' })
}
} catch (e) {
wx.hideLoading()
wx.showToast({ title: e.message || '提交失败', icon: 'none' })
}
return
}
this.setData({ showLeadModal: true, leadPhone: '' })
},
closeLeadModal() {
this.setData({ showLeadModal: false, leadPhone: '', showPrivacyModal: false })
},
// 阻止弹窗内部点击事件冒泡到遮罩层
stopPropagation() {},
preventMove() {},
onLeadPrivacyAuthorize() {
this.onAgreePrivacyForLead()
},
onDisagreePrivacyForLead() {
if (app._privacyResolve) {
try {
app._privacyResolve({ event: 'disagree' })
} catch (_) {}
app._privacyResolve = null
}
this.setData({ showPrivacyModal: false })
},
onLeadPhoneInput(e) {
this.setData({ leadPhone: (e.detail.value || '').trim() })
},
// 微信隐私协议同意getPhoneNumber 需先同意)
onAgreePrivacyForLead() {
if (app._privacyResolve) {
app._privacyResolve({ buttonId: 'agree-privacy-btn', event: 'agree' })
app._privacyResolve = null
}
this.setData({ showPrivacyModal: false })
},
// 一键获取手机号(微信能力),成功后直接提交链接卡若
async onGetPhoneNumberForLead(e) {
if (e.detail.errMsg !== 'getPhoneNumber:ok') {
wx.showToast({ title: '未获取到手机号,请手动输入', icon: 'none' })
return
}
const code = e.detail.code
if (!code) {
wx.showToast({ title: '获取失败,请手动输入', icon: 'none' })
return
}
const app = getApp()
const userId = app.globalData.userInfo?.id
wx.showLoading({ title: '获取中...', mask: true })
try {
const res = await app.request({
url: '/api/miniprogram/phone',
method: 'POST',
data: { code, userId }
})
wx.hideLoading()
if (res && res.success && res.phoneNumber) {
await this._submitLeadWithPhone(res.phoneNumber)
} else {
wx.showToast({ title: '获取失败,请手动输入', icon: 'none' })
}
} catch (err) {
wx.hideLoading()
wx.showToast({ title: err.message || '获取失败,请手动输入', icon: 'none' })
}
},
// 内部:用手机号提交链接卡若(一键获取与手动输入共用)
async _submitLeadWithPhone(phone) {
const p = (phone || '').trim().replace(/\s/g, '')
if (!p || p.length < 11) {
wx.showToast({ title: '请输入正确的手机号', icon: 'none' })
return
}
const app = getApp()
const userId = app.globalData.userInfo?.id
wx.showLoading({ title: '提交中...', mask: true })
try {
const res = await app.request({
url: '/api/miniprogram/ckb/index-lead',
method: 'POST',
data: {
userId,
phone: p,
name: (app.globalData.userInfo?.nickname || '').trim() || undefined,
},
})
wx.hideLoading()
this.setData({ showLeadModal: false, leadPhone: '' })
if (res && res.success) {
wx.setStorageSync('lead_last_submit_ts', Date.now())
// 同步手机号到用户资料
try {
if (userId) {
await app.request({
url: '/api/miniprogram/user/profile',
method: 'POST',
data: { userId, phone: p },
})
if (app.globalData.userInfo) {
app.globalData.userInfo.phone = p
wx.setStorageSync('userInfo', app.globalData.userInfo)
}
wx.setStorageSync('user_phone', p)
}
} catch (e) {
console.log('[Index] 同步手机号到用户资料失败:', e && e.message)
}
wx.showToast({ title: res.message || '提交成功,卡若会尽快联系您', icon: 'success' })
} else {
wx.showToast({ title: (res && res.message) || '提交失败', icon: 'none' })
}
} catch (e) {
wx.hideLoading()
wx.showToast({ title: e.message || '提交失败', icon: 'none' })
}
},
async submitLead() {
const phone = (this.data.leadPhone || '').trim().replace(/\s/g, '')
if (!phone) {
wx.showToast({ title: '请输入手机号', icon: 'none' })
return
}
await this._submitLeadWithPhone(phone)
const pinned = this.data.homePinnedPerson
if (!pinned || !pinned.token) return
trackClick('home', 'btn_click', '置顶@人物留资')
await submitCkbLead(getApp(), {
targetUserId: pinned.token,
targetNickname: pinned.name,
source: 'home_pinned_person',
})
},
goToSuperList() {

View File

@@ -4,7 +4,7 @@
<!-- 自定义导航栏占位 -->
<view class="nav-placeholder" style="height: {{statusBarHeight + 44}}px;"></view>
<!-- 顶部区域:中文标识 + 标题副标题 | 链接卡若 -->
<!-- 顶部区域:中文标识 + 标题副标题 | 置顶@人物留资(无置顶不展示) -->
<view class="header">
<view class="header-content">
<view class="logo-section">
@@ -16,7 +16,7 @@
<text class="logo-subtitle">{{mpUiLogoSubtitle}}</text>
</view>
</view>
<view class="header-right" wx:if="{{!auditMode}}">
<view class="header-right" wx:if="{{!auditMode && homePinnedPerson && homePinnedPerson.token}}">
<view class="contact-btn" catchtap="onLinkKaruo" hover-class="none">
<image class="contact-avatar" src="{{mpUiLinkKaruoDisplay}}" mode="aspectFill"/>
<text class="contact-name">{{mpUiLinkKaruoText}}</text>
@@ -163,31 +163,4 @@
<!-- 底部留白 -->
<view class="bottom-space"></view>
<!-- 隐私授权(首页在 needPrivacy 列表内,需有遮罩否则无法完成 agree -->
<view class="privacy-mask" wx:if="{{showPrivacyModal}}" catchtouchmove="preventMove">
<view class="privacy-modal">
<text class="privacy-title">温馨提示</text>
<text class="privacy-desc">使用手机号能力前,请先同意《用户隐私保护指引》</text>
<button id="agree-privacy-btn" class="privacy-btn" open-type="agreePrivacyAuthorization" bindagreeprivacyauthorization="onLeadPrivacyAuthorize">同意</button>
<view class="privacy-cancel" bindtap="onDisagreePrivacyForLead">拒绝</view>
</view>
</view>
<!-- 链接卡若 - 留资弹窗 -->
<view class="lead-mask" wx:if="{{showLeadModal}}" catchtap="closeLeadModal">
<view class="lead-box" catchtap="stopPropagation">
<text class="lead-title">留下联系方式</text>
<text class="lead-desc">方便卡若与您联系</text>
<button class="lead-get-phone-btn" open-type="getPhoneNumber" bindgetphonenumber="onGetPhoneNumberForLead">一键获取手机号</button>
<text class="lead-divider">或手动输入</text>
<view class="lead-input-wrap">
<input class="lead-input" placeholder="请输入手机号" type="number" maxlength="11" value="{{leadPhone}}" bindinput="onLeadPhoneInput"/>
</view>
<view class="lead-actions">
<button class="lead-btn lead-btn-cancel" bindtap="closeLeadModal">取消</button>
<button class="lead-btn lead-btn-submit" bindtap="submitLead">提交</button>
</view>
</view>
</view>
</view>

View File

@@ -966,159 +966,3 @@
.bottom-space {
height: 40rpx;
}
/* ===== 隐私授权(与 avatar-nickname 对齐) ===== */
.privacy-mask {
position: fixed;
inset: 0;
background: rgba(0, 0, 0, 0.6);
z-index: 2000;
display: flex;
align-items: center;
justify-content: center;
padding: 48rpx;
box-sizing: border-box;
}
.privacy-modal {
width: 100%;
max-width: 560rpx;
background: #17212F;
border-radius: 24rpx;
padding: 48rpx;
display: flex;
flex-direction: column;
align-items: center;
box-sizing: border-box;
}
.privacy-title {
font-size: 36rpx;
font-weight: 700;
color: #fff;
margin-bottom: 24rpx;
}
.privacy-desc {
font-size: 28rpx;
color: #94A3B8;
text-align: center;
line-height: 1.5;
margin-bottom: 40rpx;
}
.privacy-btn {
width: 100%;
height: 88rpx;
line-height: 88rpx;
text-align: center;
background: #5EEAD4;
color: #000;
font-size: 30rpx;
font-weight: 600;
border-radius: 16rpx;
border: none;
}
.privacy-btn::after { border: none; }
.privacy-cancel {
margin-top: 24rpx;
font-size: 28rpx;
color: #64748B;
}
/* ===== 链接卡若 - 留资弹窗 ===== */
.lead-mask {
position: fixed;
left: 0;
right: 0;
top: 0;
bottom: 0;
background: rgba(0, 0, 0, 0.6);
z-index: 2100;
display: flex;
align-items: center;
justify-content: center;
padding: 48rpx;
box-sizing: border-box;
}
.lead-box {
width: 100%;
max-width: 560rpx;
background: #1C1C1E;
border-radius: 24rpx;
padding: 48rpx 40rpx;
border: 2rpx solid rgba(56, 189, 172, 0.3);
}
.lead-title {
display: block;
font-size: 34rpx;
font-weight: 600;
color: #ffffff;
margin-bottom: 12rpx;
}
.lead-desc {
display: block;
font-size: 26rpx;
color: #A0AEC0;
margin-bottom: 24rpx;
}
.lead-get-phone-btn {
width: 100%;
height: 88rpx;
background: rgba(56, 189, 172, 0.2);
border: 2rpx solid rgba(56, 189, 172, 0.5);
border-radius: 16rpx;
font-size: 30rpx;
color: #38bdac;
display: flex;
align-items: center;
justify-content: center;
margin-bottom: 24rpx;
line-height: normal;
}
.lead-get-phone-btn::after { border: none; }
.privacy-wechat-row { margin: 24rpx 0; padding: 24rpx; background: rgba(0,206,209,0.1); border-radius: 16rpx; }
.privacy-wechat-desc { display: block; font-size: 26rpx; color: rgba(255,255,255,0.8); margin-bottom: 16rpx; }
.privacy-agree-btn { width: 100%; padding: 20rpx; background: #07C160; color: #fff; font-size: 28rpx; border-radius: 16rpx; border: none; }
.privacy-agree-btn::after { border: none; }
.lead-divider {
display: block;
font-size: 24rpx;
color: #6B7280;
text-align: center;
margin-bottom: 16rpx;
}
.lead-input-wrap {
padding: 16rpx 24rpx;
background: #0a1628;
border: 2rpx solid rgba(255, 255, 255, 0.1);
border-radius: 16rpx;
margin-bottom: 32rpx;
}
.lead-input {
width: 100%;
font-size: 30rpx;
color: #ffffff;
background: transparent;
}
.lead-actions {
display: flex;
gap: 24rpx;
}
.lead-btn {
flex: 1;
height: 80rpx;
/* 使用 flex 垂直居中文本,避免小程序默认 padding 导致按钮文字下沉 */
display: flex;
align-items: center;
justify-content: center;
padding: 0;
border-radius: 16rpx;
font-size: 30rpx;
font-weight: 500;
border: none;
}
.lead-btn-cancel {
background: rgba(255, 255, 255, 0.1);
color: #A0AEC0;
}
.lead-btn-submit {
background: #38bdac;
color: #ffffff;
}

View File

@@ -137,10 +137,17 @@ async function submitCkbLead(app, opts) {
})
wx.hideLoading()
if (res && res.success) {
try {
wx.setStorageSync('lead_last_submit_ts', Date.now())
} catch (e) {}
wx.showToast({ title: res.message || '提交成功,对方会尽快联系您', icon: 'success' })
const data = res.data && typeof res.data === 'object' ? res.data : {}
const skipped = !!(data.skipped || data.alreadySubmitted)
if (!skipped) {
try {
wx.setStorageSync('lead_last_submit_ts', Date.now())
} catch (e) {}
}
wx.showToast({
title: res.message || (skipped ? '无需重复提交' : '提交成功,对方会尽快联系您'),
icon: skipped ? 'none' : 'success',
})
return true
}
wx.showToast({ title: (res && res.message) || '提交失败', icon: 'none' })