主要更新: 1. 按H5网页端完全重构匹配功能(match页面) - 4种匹配类型: 创业合伙/资源对接/导师顾问/团队招募 - 资源对接等类型弹出手机号/微信号输入框 - 去掉重新匹配按钮,改为返回按钮 2. 修复所有卡片对齐和宽度问题 - 目录页附录卡片居中 - 首页阅读进度卡片满宽度 - 我的页面菜单卡片对齐 - 推广中心分享卡片统一宽度 3. 修复目录页图标和文字对齐 - section-icon固定40rpx宽高 - section-title与图标垂直居中 4. 更新真实完整文章标题(62篇) - 从book目录读取真实markdown文件名 - 替换之前的简化标题 5. 新增文章数据API - /api/db/chapters - 获取完整书籍结构 - 支持按ID获取单篇文章内容
161 lines
4.1 KiB
JavaScript
161 lines
4.1 KiB
JavaScript
/**
|
|
* Soul创业实验 - 分销中心页
|
|
* 1:1还原Web版本
|
|
*/
|
|
const app = getApp()
|
|
|
|
Page({
|
|
data: {
|
|
statusBarHeight: 44,
|
|
isLoggedIn: false,
|
|
userInfo: null,
|
|
|
|
// 收益数据
|
|
earnings: 0,
|
|
pendingEarnings: 0,
|
|
distributorShare: 90,
|
|
|
|
// 统计数据
|
|
referralCount: 0,
|
|
expiringCount: 0,
|
|
|
|
// 邀请码
|
|
referralCode: '',
|
|
|
|
// 绑定用户
|
|
showBindingList: true,
|
|
activeTab: 'active',
|
|
activeBindings: [],
|
|
convertedBindings: [],
|
|
expiredBindings: [],
|
|
currentBindings: [],
|
|
totalBindings: 0
|
|
},
|
|
|
|
onLoad() {
|
|
this.setData({ statusBarHeight: app.globalData.statusBarHeight })
|
|
this.initData()
|
|
},
|
|
|
|
onShow() {
|
|
this.initData()
|
|
},
|
|
|
|
// 初始化数据
|
|
initData() {
|
|
const { isLoggedIn, userInfo } = app.globalData
|
|
if (isLoggedIn && userInfo) {
|
|
// 生成邀请码
|
|
const referralCode = userInfo.referralCode || 'REFM' + (userInfo.id || Date.now().toString(36)).toUpperCase().slice(-6)
|
|
|
|
// 模拟绑定用户数据
|
|
const activeBindings = [
|
|
{ id: '1', nickname: '小明', bindingDate: '2025/12/25', daysRemaining: 5, status: 'active' },
|
|
{ id: '2', nickname: '小红', bindingDate: '2026/1/9', daysRemaining: 20, status: 'active' },
|
|
{ id: '3', nickname: '阿强', bindingDate: '2025/12/22', daysRemaining: 2, status: 'active' }
|
|
]
|
|
|
|
const convertedBindings = [
|
|
{ id: '4', nickname: '小李', bindingDate: '2025/12/10', commission: '8.91', orderAmount: '9.90', status: 'converted' }
|
|
]
|
|
|
|
const expiredBindings = [
|
|
{ id: '5', nickname: '小王', bindingDate: '2025/11/15', status: 'expired' }
|
|
]
|
|
|
|
const expiringCount = activeBindings.filter(b => b.daysRemaining <= 7).length
|
|
|
|
this.setData({
|
|
isLoggedIn: true,
|
|
userInfo,
|
|
earnings: (userInfo.earnings || 0).toFixed(2),
|
|
pendingEarnings: (userInfo.pendingEarnings || 0).toFixed(2),
|
|
referralCount: userInfo.referralCount || 0,
|
|
referralCode,
|
|
activeBindings,
|
|
convertedBindings,
|
|
expiredBindings,
|
|
expiringCount,
|
|
currentBindings: activeBindings,
|
|
totalBindings: activeBindings.length + convertedBindings.length + expiredBindings.length
|
|
})
|
|
}
|
|
},
|
|
|
|
// 切换Tab
|
|
switchTab(e) {
|
|
const tab = e.currentTarget.dataset.tab
|
|
let currentBindings = []
|
|
|
|
if (tab === 'active') {
|
|
currentBindings = this.data.activeBindings
|
|
} else if (tab === 'converted') {
|
|
currentBindings = this.data.convertedBindings
|
|
} else {
|
|
currentBindings = this.data.expiredBindings
|
|
}
|
|
|
|
this.setData({ activeTab: tab, currentBindings })
|
|
},
|
|
|
|
// 切换绑定列表显示
|
|
toggleBindingList() {
|
|
this.setData({ showBindingList: !this.data.showBindingList })
|
|
},
|
|
|
|
// 复制邀请链接
|
|
copyLink() {
|
|
const link = `https://soul.ckb.fit/?ref=${this.data.referralCode}`
|
|
wx.setClipboardData({
|
|
data: link,
|
|
success: () => wx.showToast({ title: '链接已复制', icon: 'success' })
|
|
})
|
|
},
|
|
|
|
// 生成海报
|
|
generatePoster() {
|
|
wx.showToast({ title: '海报功能开发中', icon: 'none' })
|
|
},
|
|
|
|
// 提现
|
|
handleWithdraw() {
|
|
const earnings = parseFloat(this.data.earnings)
|
|
if (earnings < 10) {
|
|
wx.showToast({ title: '满10元可提现', icon: 'none' })
|
|
return
|
|
}
|
|
wx.showToast({ title: '提现功能开发中', icon: 'none' })
|
|
},
|
|
|
|
// 显示通知
|
|
showNotification() {
|
|
wx.showToast({ title: '暂无新消息', icon: 'none' })
|
|
},
|
|
|
|
// 显示设置
|
|
showSettings() {
|
|
wx.showActionSheet({
|
|
itemList: ['自动提现设置', '收益通知设置'],
|
|
success: (res) => {
|
|
if (res.tapIndex === 0) {
|
|
wx.showToast({ title: '自动提现功能开发中', icon: 'none' })
|
|
} else {
|
|
wx.showToast({ title: '通知设置开发中', icon: 'none' })
|
|
}
|
|
}
|
|
})
|
|
},
|
|
|
|
// 分享
|
|
onShareAppMessage() {
|
|
return {
|
|
title: '📚 一场SOUL的创业实验场 - 来自派对房的真实商业故事',
|
|
path: `/pages/index/index?ref=${this.data.referralCode}`
|
|
}
|
|
},
|
|
|
|
goBack() {
|
|
wx.navigateBack()
|
|
}
|
|
})
|