diff --git a/app/admin/page.tsx b/app/admin/page.tsx index 5ff0734..d6b0c4b 100644 --- a/app/admin/page.tsx +++ b/app/admin/page.tsx @@ -3,22 +3,39 @@ import { useState, useEffect } from "react" import { useRouter } from "next/navigation" import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card" -import { useStore } from "@/lib/store" import { Users, BookOpen, ShoppingBag, TrendingUp, RefreshCw, ChevronRight } from "lucide-react" export default function AdminDashboard() { const router = useRouter() - const { getAllUsers, getAllPurchases } = useStore() const [mounted, setMounted] = useState(false) const [users, setUsers] = useState([]) const [purchases, setPurchases] = useState([]) + // 从API获取数据 + async function loadData() { + try { + // 获取用户数据 + const usersRes = await fetch('/api/db/users') + const usersData = await usersRes.json() + if (usersData.success && usersData.users) { + setUsers(usersData.users) + } + + // 获取订单数据 + const ordersRes = await fetch('/api/orders') + const ordersData = await ordersRes.json() + if (ordersData.success && ordersData.orders) { + setPurchases(ordersData.orders) + } + } catch (e) { + console.log('加载数据失败', e) + } + } + useEffect(() => { setMounted(true) - // 客户端加载数据 - setUsers(getAllUsers()) - setPurchases(getAllPurchases()) - }, [getAllUsers, getAllPurchases]) + loadData() + }, []) // 防止Hydration错误:服务端渲染时显示加载状态 if (!mounted) { diff --git a/miniprogram/pages/match/match.js b/miniprogram/pages/match/match.js index ea47d38..7cc8c9b 100644 --- a/miniprogram/pages/match/match.js +++ b/miniprogram/pages/match/match.js @@ -54,6 +54,11 @@ Page({ joinError: '', needBindFirst: false, + // 资源对接表单 + canHelp: '', + needHelp: '', + goodAt: '', + // 解锁弹窗 showUnlockModal: false, @@ -417,6 +422,17 @@ Page({ joinError: '' }) }, + + // 资源对接表单输入 + onCanHelpInput(e) { + this.setData({ canHelp: e.detail.value }) + }, + onNeedHelpInput(e) { + this.setData({ needHelp: e.detail.value }) + }, + onGoodAtInput(e) { + this.setData({ goodAt: e.detail.value }) + }, // 微信号输入 onWechatInput(e) { diff --git a/miniprogram/pages/match/match.wxml b/miniprogram/pages/match/match.wxml index 0ccc79c..ff1f7d0 100644 --- a/miniprogram/pages/match/match.wxml +++ b/miniprogram/pages/match/match.wxml @@ -207,7 +207,25 @@ - + + + + + 我能帮到什么 + + + + 我需要什么帮助 + + + + 我擅长什么 + + + + + + {{contactType === 'phone' ? '+86' : '@'}} diff --git a/miniprogram/pages/match/match.wxss b/miniprogram/pages/match/match.wxss index 7670b45..378e1c9 100644 --- a/miniprogram/pages/match/match.wxss +++ b/miniprogram/pages/match/match.wxss @@ -1175,3 +1175,28 @@ border-radius: 40rpx; border: 1rpx solid rgba(255, 255, 255, 0.2); } + +/* 资源对接表单 */ +.resource-form { + display: flex; + flex-direction: column; + gap: 20rpx; + margin-bottom: 24rpx; +} +.resource-form .form-item { + display: flex; + flex-direction: column; + gap: 8rpx; +} +.resource-form .form-label { + font-size: 26rpx; + color: rgba(255,255,255,0.6); +} +.resource-form .form-input-new { + background: #1c1c1e; + border: 2rpx solid rgba(0,206,209,0.3); + border-radius: 16rpx; + padding: 20rpx; + font-size: 28rpx; + color: #fff; +} diff --git a/miniprogram/pages/my/my.js b/miniprogram/pages/my/my.js index bfbdb7f..cfdc332 100644 --- a/miniprogram/pages/my/my.js +++ b/miniprogram/pages/my/my.js @@ -77,10 +77,14 @@ Page({ const userId = userInfo.id || '' const userIdShort = userId.length > 20 ? userId.slice(0, 10) + '...' + userId.slice(-6) : userId + // 获取微信号(优先显示) + const userWechat = wx.getStorageSync('user_wechat') || userInfo.wechat || '' + this.setData({ isLoggedIn: true, userInfo, userIdShort, + userWechat, purchasedCount: hasFullBook ? this.data.totalSections : (purchasedSections?.length || 0), referralCount: userInfo.referralCount || 0, earnings: userInfo.earnings || 0, diff --git a/miniprogram/pages/my/my.wxml b/miniprogram/pages/my/my.wxml index 6be8252..7dfde30 100644 --- a/miniprogram/pages/my/my.wxml +++ b/miniprogram/pages/my/my.wxml @@ -42,7 +42,7 @@ - ID: {{userIdShort}} + {{userWechat ? '微信: ' + userWechat : 'ID: ' + userIdShort}} 📋 diff --git a/miniprogram/pages/settings/settings.js b/miniprogram/pages/settings/settings.js index 192630a..cf51467 100644 --- a/miniprogram/pages/settings/settings.js +++ b/miniprogram/pages/settings/settings.js @@ -156,22 +156,37 @@ Page({ }) }, - // 绑定微信号 - bindWechat() { - this.setData({ - showBindModal: true, - bindType: 'wechat', - bindValue: '' - }) + // 微信号输入 + onWechatInput(e) { + this.setData({ wechatId: e.detail.value }) }, - - // 绑定支付宝 - bindAlipay() { - this.setData({ - showBindModal: true, - bindType: 'alipay', - bindValue: '' - }) + + // 保存微信号 + async saveWechat() { + const { wechatId } = this.data + if (!wechatId || wechatId.length < 6) return + + wx.setStorageSync('user_wechat', wechatId) + + // 更新用户信息 + if (app.globalData.userInfo) { + app.globalData.userInfo.wechat = wechatId + wx.setStorageSync('userInfo', app.globalData.userInfo) + } + + // 同步到服务器 + try { + await app.request('/api/user/update', { + method: 'POST', + data: { + userId: app.globalData.userInfo?.id, + wechat: wechatId + } + }) + wx.showToast({ title: '微信号已保存', icon: 'success' }) + } catch (e) { + console.log('保存微信号失败', e) + } }, // 输入绑定值 diff --git a/miniprogram/pages/settings/settings.wxml b/miniprogram/pages/settings/settings.wxml index 0917bbc..d11b6e5 100644 --- a/miniprogram/pages/settings/settings.wxml +++ b/miniprogram/pages/settings/settings.wxml @@ -38,33 +38,23 @@ - - + + 💬 微信号 - {{wechatId || '未绑定'}} + - 去绑定 - - - - - - - 💳 - - 支付宝 - {{alipayAccount || '未绑定'}} - - - - - 去绑定 @@ -86,12 +76,12 @@ - + 💰 自动提现 - 收益自动打款到您的账户 + 收益自动打款到微信零钱 @@ -104,11 +94,11 @@ 提现方式 - {{alipayAccount ? '支付宝' : '微信零钱'}} + 微信零钱 提现账户 - {{alipayAccount || wechatId}} + {{wechatId}} 收益将在每笔订单完成后自动打款 @@ -116,8 +106,8 @@ - - 提示:绑定至少一个支付方式(微信或支付宝)才能使用提现功能 + + 提示:绑定微信号才能使用提现功能 退出登录 diff --git a/miniprogram/pages/settings/settings.wxss b/miniprogram/pages/settings/settings.wxss index 899ff34..a0d5649 100644 --- a/miniprogram/pages/settings/settings.wxss +++ b/miniprogram/pages/settings/settings.wxss @@ -25,9 +25,10 @@ .bind-icon.phone-icon { background: rgba(0,206,209,0.2); } .bind-icon.wechat-icon { background: rgba(158,158,158,0.2); } .bind-icon.alipay-icon { background: rgba(158,158,158,0.2); } -.bind-info { display: flex; flex-direction: column; gap: 4rpx; } +.bind-info { display: flex; flex-direction: column; gap: 4rpx; flex: 1; } .bind-label { font-size: 28rpx; color: #fff; font-weight: 500; } .bind-value { font-size: 24rpx; color: rgba(255,255,255,0.5); } +.bind-input { font-size: 24rpx; color: #00CED1; background: transparent; padding: 8rpx 0; } .bind-right { display: flex; align-items: center; } .bind-check { color: #00CED1; font-size: 32rpx; } .bind-btn { color: #00CED1; font-size: 26rpx; } diff --git a/开发文档/10、项目管理/小程序20260129.pdf b/开发文档/10、项目管理/小程序20260129.pdf new file mode 100644 index 0000000..7e51ed0 Binary files /dev/null and b/开发文档/10、项目管理/小程序20260129.pdf differ