diff --git a/README.md b/README.md index 7d80a85..883d8ce 100644 --- a/README.md +++ b/README.md @@ -3,13 +3,38 @@ git http://39.106.86.127:3000/hb_rd/front_dist.git branch proj_icampus_dev powershell 软链形式 + ``` New-Item -ItemType Junction -Path "src/images" -Target C:\Users\kola\project\school-system\web_dist\images ``` +接口文档 + +``` +New-Item -ItemType SymbolicLink -Path mini小程序端接口设计文档.md -Target C:\Users\kola\project\school-prompt\backend\mini小程序端接口设计文档.md +``` + 测试账号 ``` 账号 2026050122123 密码 123456 ``` + + +未联调模块 + +小程序端 +1. 智能体模块 + 1. 通知模块智能体列表 + 2. 首页智能体相关内容 + 3. 个人中心我的整能体,我的评论-智能体 + 4. 搜索页智能体相关 +2. 课表 +3. 校车 + +管理端 +1. 智能体管理 +2. 数据统计 +3. 数据总揽 +4. 权限相关内容 diff --git a/mini小程序端接口设计文档.md b/mini小程序端接口设计文档.md new file mode 120000 index 0000000..fb5e877 --- /dev/null +++ b/mini小程序端接口设计文档.md @@ -0,0 +1 @@ +C:/Users/kola/project/school-prompt/backend/mini小程序端接口设计文档.md \ No newline at end of file diff --git a/src/app.json b/src/app.json index 7021e8f..b21974f 100644 --- a/src/app.json +++ b/src/app.json @@ -23,7 +23,8 @@ "pages/myComment/index", "pages/schedule/index", "pages/feedback/index", - "pages/search/index" + "pages/search/index", + "pages/webview/index" ], "window": { "backgroundTextStyle": "light", diff --git a/src/components/popup/index.wxml b/src/components/popup/index.wxml index 8d880d4..44e7293 100644 --- a/src/components/popup/index.wxml +++ b/src/components/popup/index.wxml @@ -17,13 +17,13 @@ - + 提交成功 感谢您的反馈,我们会尽快处理 - + 创建您专属智能体 请登陆电脑端创建您的专属智能体 www.tencent.yuanqi.com @@ -36,14 +36,14 @@ 通识基础 创新思维 - + 授课老师 丁蔚健 - + 授课地点 西丽湖园区 日新楼北406 @@ -51,14 +51,14 @@ - + 绩点 2 - + 课时 32 diff --git a/src/images/icon100.png b/src/images/icon100.png new file mode 100644 index 0000000..fdf1e08 Binary files /dev/null and b/src/images/icon100.png differ diff --git a/src/images/icon101.png b/src/images/icon101.png new file mode 100644 index 0000000..7762ce2 Binary files /dev/null and b/src/images/icon101.png differ diff --git a/src/images/icon102.png b/src/images/icon102.png new file mode 100644 index 0000000..a371523 Binary files /dev/null and b/src/images/icon102.png differ diff --git a/src/images/temporary/agent1.png b/src/images/temporary/agent1.png new file mode 100644 index 0000000..0d62ad9 Binary files /dev/null and b/src/images/temporary/agent1.png differ diff --git a/src/images/temporary/agent10.png b/src/images/temporary/agent10.png new file mode 100644 index 0000000..09bb42e Binary files /dev/null and b/src/images/temporary/agent10.png differ diff --git a/src/images/temporary/agent11.png b/src/images/temporary/agent11.png new file mode 100644 index 0000000..435bf91 Binary files /dev/null and b/src/images/temporary/agent11.png differ diff --git a/src/images/temporary/agent12.png b/src/images/temporary/agent12.png new file mode 100644 index 0000000..69e91a1 Binary files /dev/null and b/src/images/temporary/agent12.png differ diff --git a/src/images/temporary/agent2.png b/src/images/temporary/agent2.png new file mode 100644 index 0000000..dc2c7f5 Binary files /dev/null and b/src/images/temporary/agent2.png differ diff --git a/src/images/temporary/agent3.png b/src/images/temporary/agent3.png new file mode 100644 index 0000000..6408719 Binary files /dev/null and b/src/images/temporary/agent3.png differ diff --git a/src/images/temporary/agent4.png b/src/images/temporary/agent4.png new file mode 100644 index 0000000..c666626 Binary files /dev/null and b/src/images/temporary/agent4.png differ diff --git a/src/images/temporary/agent5.png b/src/images/temporary/agent5.png new file mode 100644 index 0000000..280af25 Binary files /dev/null and b/src/images/temporary/agent5.png differ diff --git a/src/images/temporary/agent6.png b/src/images/temporary/agent6.png new file mode 100644 index 0000000..45451a2 Binary files /dev/null and b/src/images/temporary/agent6.png differ diff --git a/src/images/temporary/agent7.png b/src/images/temporary/agent7.png new file mode 100644 index 0000000..02358f9 Binary files /dev/null and b/src/images/temporary/agent7.png differ diff --git a/src/images/temporary/agent8.png b/src/images/temporary/agent8.png new file mode 100644 index 0000000..fab9d80 Binary files /dev/null and b/src/images/temporary/agent8.png differ diff --git a/src/images/temporary/agent9.png b/src/images/temporary/agent9.png new file mode 100644 index 0000000..1c66f84 Binary files /dev/null and b/src/images/temporary/agent9.png differ diff --git a/src/pages/act/index.scss b/src/pages/act/index.scss index 7381c32..0f3288f 100644 --- a/src/pages/act/index.scss +++ b/src/pages/act/index.scss @@ -62,17 +62,14 @@ page { } } .filter-btn { - margin-top: 2rpx; - align-self: start; - padding: 8rpx 24rpx; + padding: 16rpx 0 18rpx 64rpx; flex-shrink: 0; display: flex; align-items: center; gap: 6rpx; - background-color: rgba(247, 248, 250, 1); - border-radius: 40rpx; font-size: 28rpx; color: rgba(74, 184, 253, 1); + background: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, #fff 100%); .icon { width: 32rpx; height: 32rpx; @@ -261,8 +258,9 @@ page { color: rgba(100, 116, 139, 1); display: flex; gap: 8rpx; + line-height: 32rpx; .icon { - margin-top: 8rpx; + margin-top: 4rpx; flex-shrink: 0; width: 22rpx; height: 22rpx; diff --git a/src/pages/act/index.wxml b/src/pages/act/index.wxml index 15e2070..7205848 100644 --- a/src/pages/act/index.wxml +++ b/src/pages/act/index.wxml @@ -18,7 +18,6 @@ - 筛选 diff --git a/src/pages/actAdd/index.scss b/src/pages/actAdd/index.scss index e666d1f..0f73c7e 100644 --- a/src/pages/actAdd/index.scss +++ b/src/pages/actAdd/index.scss @@ -68,7 +68,7 @@ page { } .step-num { - font-size: 26rpx; + font-size: 28rpx; color: rgba(148, 163, 184, 1); font-weight: 500; } @@ -144,6 +144,27 @@ page { margin-left: 6rpx; font-size: 28rpx; } + .extra { + flex: 1; + display: flex; + justify-content: flex-end; + .ai-img { + width: 203rpx; + height: 56rpx; + display: flex; + align-items: center; + justify-content: center; + gap: 12rpx; + background: linear-gradient(90deg, #9ddffd 0%, #4ab8fd 100%); + border-radius: 68rpx 68rpx 68rpx 68rpx; + font-size: 28rpx; + color: rgba(255, 255, 255, 1); + .icon { + width: 32rpx; + height: 32rpx; + } + } + } } .input-wrap { @@ -325,7 +346,7 @@ page { text-align: center; font-size: 32rpx; color: rgba(100, 116, 139, 1); - background: rgba(247, 248, 250, 1); + background: #F7F8FA; transition: all 0.2s; &.is-active { @@ -696,3 +717,27 @@ page { .bottom-safe { height: 40rpx; } + +.slidebar-add { + padding-top: 17rpx; + position: fixed; + right: 16rpx; + bottom: 320rpx; + width: 110rpx; + height: 110rpx; + background: linear-gradient(90deg, #9ddffd 0%, #4ab8fd 100%); + box-shadow: + inset 0rpx 4rpx 24rpx 0rpx rgba(255, 255, 255, 0.25), + 0rpx 15rpx 30rpx -6rpx rgba(74, 172, 219, 0.4); + border-radius: 50%; + text-align: center; + box-sizing: border-box; + .icon { + width: 48rpx; + height: 48rpx; + } + .name { + font-size: 20rpx; + color: rgba(255, 255, 255, 1); + } +} diff --git a/src/pages/actAdd/index.ts b/src/pages/actAdd/index.ts index 9193013..d82eca2 100644 --- a/src/pages/actAdd/index.ts +++ b/src/pages/actAdd/index.ts @@ -200,7 +200,7 @@ Page({ // 分类和标签 const selectedCategoryIds = res.categoryIds || [] - const selectedTagIds = (res.tags || []).map((t: any) => typeof t === 'object' ? t.id : t) + const selectedTagIds = (res.tags || []).map((t: any) => (typeof t === 'object' ? t.id : t)) // 报名设置 const needRegister = res.regType === 1 @@ -919,6 +919,11 @@ Page({ this.clearDraft() wx.switchTab({ url: '/pages/index/index' }) }, + handleAiAdd() { + wx.navigateTo({ + url: '/pages/chat/index', + }) + }, }) export {} diff --git a/src/pages/actAdd/index.wxml b/src/pages/actAdd/index.wxml index 7fc1990..9f70cee 100644 --- a/src/pages/actAdd/index.wxml +++ b/src/pages/actAdd/index.wxml @@ -25,6 +25,12 @@ 活动头图 * + + + + 智能出图 + + 报名时间 * - + {{registerStartTime || '开始时间'}} - + {{registerEndTime || '结束时间'}} @@ -376,21 +374,13 @@ 签到时间 * - + {{checkinStartTime || '开始时间'}} - + {{checkinEndTime || '结束时间'}} @@ -520,3 +510,8 @@ bind:cancel="onCloseAgendaDatePicker" /> + + + + 智能创建 + diff --git a/src/pages/actDetail/index.scss b/src/pages/actDetail/index.scss index d432459..fa19efd 100644 --- a/src/pages/actDetail/index.scss +++ b/src/pages/actDetail/index.scss @@ -6,7 +6,7 @@ page { color: #fff; } .page-back { - font-size: 32rpx; + font-size: 38rpx; color: #fff; } diff --git a/src/pages/actPoster/index.wxml b/src/pages/actPoster/index.wxml index 5084244..4df528a 100644 --- a/src/pages/actPoster/index.wxml +++ b/src/pages/actPoster/index.wxml @@ -1,6 +1,6 @@ - + diff --git a/src/pages/actQrcode/index.scss b/src/pages/actQrcode/index.scss index 4b2de2d..d37af89 100644 --- a/src/pages/actQrcode/index.scss +++ b/src/pages/actQrcode/index.scss @@ -7,7 +7,7 @@ page { color: #fff; } .page-back { - font-size: 32rpx; + font-size: 38rpx; color: #fff; } .page { diff --git a/src/pages/actQrcode/index.wxml b/src/pages/actQrcode/index.wxml index db26cb3..581f71b 100644 --- a/src/pages/actQrcode/index.wxml +++ b/src/pages/actQrcode/index.wxml @@ -2,7 +2,7 @@ - + {{detail.name}} 活动签到 @@ -12,7 +12,7 @@ - + 长按保存二维码 签到时间: {{detail.checkinStartTime}} diff --git a/src/pages/agent/index.ts b/src/pages/agent/index.ts index 112506c..5a4bc80 100644 --- a/src/pages/agent/index.ts +++ b/src/pages/agent/index.ts @@ -3,9 +3,68 @@ const _app = getApp() Page({ data: { // 弹窗 - popupShow: true, + popupShow: false, popupType: 'popup3', popupParams: {} as any, + + list1: [ + { + name: 'PPT小助手', + icon: 'agent8', + }, + { + name: '雅思考官', + icon: 'agent9', + }, + { + name: 'PDF翻译', + icon: 'agent10', + }, + { + name: '文章去AI', + icon: 'agent2', + }, + ], + list2: [ + { + name: '写作检测', + icon: 'agent2', + }, + { + name: '文章去AI', + icon: 'agent3', + }, + { + name: '文章去AI', + icon: 'agent4', + }, + ], + list3: [ + { + name: '写作检测', + icon: 'agent5', + }, + { + name: '文章去AI', + icon: 'agent6', + }, + { + name: 'PDF翻译', + icon: 'agent7', + }, + ], + list4: [ + { + name: '应用包生成助手', + content: '智能规划课表,轻松掌握学习节奏', + icon: 'agent11', + }, + { + name: '社交平台文案生成助手', + content: '智能规划课表,轻松掌握学习节奏', + icon: 'agent12', + }, + ], }, onLoad() {}, handleEva() { @@ -41,6 +100,12 @@ Page({ }, }) }, + handleDetail() { + const url = `https://app.gohighedu.cn/statics_h5/` + wx.navigateTo({ + url: `/pages/webview/index?url=${encodeURIComponent(url)}`, + }) + }, // 弹窗取消 handlePopupCancel() { diff --git a/src/pages/agent/index.wxml b/src/pages/agent/index.wxml index 1328aa0..60bcd27 100644 --- a/src/pages/agent/index.wxml +++ b/src/pages/agent/index.wxml @@ -20,7 +20,7 @@ indicator-active-color="rgba(74, 184, 253, 1)" > - + @@ -33,9 +33,9 @@ - - - PPT小助手 + + + {{item.name}} @@ -43,8 +43,8 @@ 最近使用 - - + + PPT小助 @@ -52,8 +52,8 @@ 我的收藏 - - + + 文章去 @@ -72,7 +72,7 @@ > - + @@ -80,21 +80,21 @@ {{index+1}} - + - 应用包生成助手 - 智能规划课表,轻松掌握学习轻松掌握学习 + {{item.name}} + {{item.content}} 15.6w人使用 - - + + 评级 - - + + 收藏 使用 @@ -112,7 +112,7 @@ - + - + - + 最近对话 你好呀~我是你的活动创建小助手你可以直接告诉我想创建什么活动,比如 @@ -27,7 +27,10 @@ - 查看当前草稿 + + 查看当前草稿 + + a.sort - b.sort) + data.sortedModuleTypes = moduleSorts.map((m) => m.type) + this.setData(data) }) .catch((err) => { @@ -215,6 +229,57 @@ Page({ const { index } = e.currentTarget.dataset const { quickEntries } = this.data const { jumpType, jumpTarget } = quickEntries[index] + this.handleJump(jumpType, jumpTarget) + }, + + handleBannerTap(e) { + const { index } = e.currentTarget.dataset + const { bannerItems } = this.data + const { jumpType, jumpTarget } = bannerItems[index] || {} + this.handleJump(jumpType, jumpTarget) + }, + + handleNotificationTap(e) { + const { index } = e.currentTarget.dataset + const { notifications } = this.data + const idx = index ?? 0 + const { jumpType, jumpTarget } = notifications[idx] || {} + if (!jumpType || jumpType === 0) return + this.handleJump(jumpType, jumpTarget) + }, + + handleJump(jumpType: number | string, jumpTarget: string) { + const jt = Number(jumpType) + if (!jt || !jumpTarget) return + switch (jt) { + case 2: + wx.navigateTo({ url: `/pages/actDetail/index?id=${jumpTarget}` }) + break + case 3: { + const tabPages = [ + '/pages/index/index', + '/pages/act/index', + '/pages/notice/index', + '/pages/agent/index', + '/pages/my/index', + ] + const isTab = tabPages.some((p) => jumpTarget.startsWith(p)) + if (isTab) { + wx.switchTab({ url: jumpTarget }) + } else { + wx.navigateTo({ url: jumpTarget }) + } + break + } + case 4: + wx.navigateTo({ url: `/pages/webview/index?url=${encodeURIComponent(jumpTarget)}` }) + break + case 5: + wx.navigateToMiniProgram({ appId: jumpTarget }) + break + default: + break + } }, onAgentTap(e: WechatMiniprogram.TouchEvent) { @@ -235,6 +300,21 @@ Page({ wx.switchTab({ url: '/pages/my/index' }) } }, + handleSearchTap() { + wx.navigateTo({ + url: '/pages/search/index', + }) + }, + handleActMore() { + wx.switchTab({ + url: '/pages/act/index', + }) + }, + handleAgentMore() { + wx.switchTab({ + url: '/pages/agent/index', + }) + }, }) export {} diff --git a/src/pages/index/index.wxml b/src/pages/index/index.wxml index 2e7d0f8..849157b 100644 --- a/src/pages/index/index.wxml +++ b/src/pages/index/index.wxml @@ -2,56 +2,67 @@ class="page" style="background: url('{{currentBannerImage || imageUrl + 'bg1.png?t=' + Timestamp}}') no-repeat top center/100% 655rpx;padding-top: {{pageTop}}px;" > - + {{searchPlaceholder}} - - - - - - {{item.title}} - - + - - - - {{item.name}} - - - - - 热门活动 - - 查看详情 - + + + + + + + + {{notice.title}} + + + - - - + + + + + {{entry.name}} - - - - 推荐智能体 - - 查看详情 - + + + + 热门活动 + + 查看详情 + + + + + + + - - - - {{item.name}} + + + + 推荐智能体 + + 查看详情 + + + + + + + {{agent.name}} + - + - + 驳回原因:{{item.reviewReason}} diff --git a/src/pages/myComment/index.wxml b/src/pages/myComment/index.wxml index c4c43ec..599179b 100644 --- a/src/pages/myComment/index.wxml +++ b/src/pages/myComment/index.wxml @@ -18,13 +18,13 @@ 匿名 - + 公开 - + 删除 @@ -76,13 +76,13 @@ 匿名 - + 公开 - + 删除 diff --git a/src/pages/notice/index.scss b/src/pages/notice/index.scss index 629dbad..ca115e1 100644 --- a/src/pages/notice/index.scss +++ b/src/pages/notice/index.scss @@ -4,6 +4,51 @@ page { .page { padding-bottom: calc(env(safe-area-inset-bottom) + 120rpx); + .page-header { + position: sticky; + top: 0; + left: 0; + padding-bottom: 32rpx; + background-color: #fff; + .search-wrap { + margin: 32rpx 0 0 32rpx; + display: flex; + align-content: inherit; + .date-range { + padding: 0 32rpx; + flex: 1; + display: flex; + align-items: center; + gap: 16rpx; + background-color: rgba(247, 248, 250, 1); + border-radius: 80rpx; + .icon { + flex-shrink: 0; + width: 34rpx; + height: 34rpx; + } + .date { + padding: 20rpx 0; + text-align: center; + font-size: 32rpx; + color: rgba(71, 85, 105, 1); + } + .picker { + flex: 1; + } + .arrow { + font-size: 24rpx; + color: rgba(148, 163, 184, 1); + } + } + .clear { + padding: 20rpx; + flex-shrink: 0; + width: 34rpx; + height: 34rpx; + } + } + } .tabs { .van-tabs__line { width: 32rpx !important; diff --git a/src/pages/notice/index.ts b/src/pages/notice/index.ts index 63c8d70..57bf971 100644 --- a/src/pages/notice/index.ts +++ b/src/pages/notice/index.ts @@ -64,7 +64,6 @@ Page({ onLoad() { app.waitLogin({ type: 1 }).then(() => { - this.clearNotice('announcement') this.fetchAnnouncementList() }) }, @@ -77,7 +76,14 @@ Page({ } }, - // 自动清空当前tab类型的通知(进入列表时即清空) + // 用户点击清除按钮 + handleClearNotice() { + const types = ['announcement', 'important', 'activity'] as const + const type = types[this.data.active] + this.clearNotice(type) + }, + + // 清空指定类型的通知 async clearNotice(type: string) { try { await wx.ajax({ @@ -101,13 +107,10 @@ Page({ this.setData({ active }) if (active === 0 && this.data.announcementList.length === 0) { - this.clearNotice('announcement') this.fetchAnnouncementList() } else if (active === 1 && this.data.importantList.length === 0) { - this.clearNotice('important') this.fetchNoticeList('important') } else if (active === 2 && this.data.activityList.length === 0) { - this.clearNotice('activity') this.fetchNoticeList('activity') } }, @@ -204,10 +207,33 @@ Page({ handleActNotice(e) { const { index } = e.currentTarget.dataset const { activityList } = this.data - const { jumpTarget } = activityList[index] - wx.navigateTo({ - url: `/pages/actDetail/index?id=${jumpTarget}`, - }) + const { jumpType, jumpTarget } = activityList[index] + if (!jumpType || !jumpTarget) return + const jt = Number(jumpType) + const tabPages = ['/pages/index/index', '/pages/act/index', '/pages/notice/index', '/pages/agent/index', '/pages/my/index'] + switch (jt) { + case 1: + wx.navigateTo({ url: `/pages/actDetail/index?id=${jumpTarget}` }) + break + case 2: { + const isTab = tabPages.some(p => jumpTarget.startsWith(p)) + if (isTab) { + wx.switchTab({ url: jumpTarget }) + } + else { + wx.navigateTo({ url: jumpTarget }) + } + break + } + case 3: + wx.navigateTo({ url: `/pages/webview/index?url=${encodeURIComponent(jumpTarget)}` }) + break + case 4: + wx.navigateToMiniProgram({ appId: jumpTarget }) + break + default: + break + } }, // 下拉刷新 diff --git a/src/pages/notice/index.wxml b/src/pages/notice/index.wxml index b96dad2..36ed03d 100644 --- a/src/pages/notice/index.wxml +++ b/src/pages/notice/index.wxml @@ -1,89 +1,101 @@ - - - - - - {{item.createdAt}} - - {{item.title}} - - - - 查看详情 - - - + + + + + + + + + + + + 2026-05-28 + + 至 + + 2026-05-28 + + + + + + + + + + + {{item.createdAt}} + + {{item.title}} + + + + 查看详情 + - - + + + - - - - - {{item.scheduleAt}} - - {{item.title}} - - - - 查看详情 - - - + + + + {{item.scheduleAt}} + + {{item.title}} + + + + 查看详情 + - - + + + - - - - - {{item.scheduleAt}} - - {{item.title}} - {{item.subtitle}} - - {{item.subTypeName}} - - 查看详情 - - - + + + + {{item.scheduleAt}} + + {{item.title}} + {{item.subtitle}} + + {{item.subTypeName}} + + 查看详情 + - - + + + - - - 暂未开放 - - + + 暂未开放 diff --git a/src/pages/noticeDetail/index.scss b/src/pages/noticeDetail/index.scss index 2bc5fe8..6891f88 100644 --- a/src/pages/noticeDetail/index.scss +++ b/src/pages/noticeDetail/index.scss @@ -1,5 +1,5 @@ .page { - padding: 32rpx; + padding: 32rpx 32rpx 220rpx; .info { .row { display: flex; diff --git a/src/pages/noticeDetail/index.ts b/src/pages/noticeDetail/index.ts index 7152d99..a76356d 100644 --- a/src/pages/noticeDetail/index.ts +++ b/src/pages/noticeDetail/index.ts @@ -92,26 +92,31 @@ Page({ // 跳转 handleJump() { const { detail } = this.data - if (!detail || detail.jumpType === 0) return - - if (detail.jumpType === 1) { - // 不跳转 - } else if (detail.jumpType === 2) { - // 跳转活动 - wx.navigateTo({ url: `/pages/actDetail/index?id=${detail.jumpTarget}` }) - } else if (detail.jumpType === 3) { - // 跳转小程序页面 - wx.navigateTo({ - url: detail.jumpTarget, - fail() { + if (!detail || !detail.jumpType || !detail.jumpTarget) return + const jt = Number(detail.jumpType) + const tabPages = ['/pages/index/index', '/pages/act/index', '/pages/notice/index', '/pages/agent/index', '/pages/my/index'] + switch (jt) { + case 2: + wx.navigateTo({ url: `/pages/actDetail/index?id=${detail.jumpTarget}` }) + break + case 3: { + const isTab = tabPages.some(p => detail.jumpTarget.startsWith(p)) + if (isTab) { wx.switchTab({ url: detail.jumpTarget }) - }, - }) - } else if (detail.jumpType === 4) { - // 跳转H5链接 - wx.navigateTo({ - url: `/pages/webview/index?url=${encodeURIComponent(detail.jumpTarget)}`, - }) + } + else { + wx.navigateTo({ url: detail.jumpTarget }) + } + break + } + case 4: + wx.navigateTo({ url: `/pages/webview/index?url=${encodeURIComponent(detail.jumpTarget)}` }) + break + case 5: + wx.navigateToMiniProgram({ appId: detail.jumpTarget }) + break + default: + break } }, diff --git a/src/pages/noticeDetail/index.wxml b/src/pages/noticeDetail/index.wxml index 3794a31..42694d3 100644 --- a/src/pages/noticeDetail/index.wxml +++ b/src/pages/noticeDetail/index.wxml @@ -21,7 +21,7 @@ - + {{detail.buttonText}} diff --git a/src/pages/schedule/index.scss b/src/pages/schedule/index.scss index b1b5b3a..264fd28 100644 --- a/src/pages/schedule/index.scss +++ b/src/pages/schedule/index.scss @@ -3,7 +3,7 @@ color: rgba(30, 41, 59, 1); } .page-back { - font-size: 32rpx; + font-size: 38rpx; color: rgba(30, 41, 59, 1); } diff --git a/src/pages/search/index.scss b/src/pages/search/index.scss index 08193e5..4e0af2e 100644 --- a/src/pages/search/index.scss +++ b/src/pages/search/index.scss @@ -1,10 +1,12 @@ .page { + padding-bottom: calc(60px + env(safe-area-inset-bottom)); .header { position: sticky; top: 0; left: 0; padding: 32rpx; background-color: #fff; + z-index: 10; .search { display: flex; align-items: center; @@ -26,7 +28,7 @@ color: rgba(71, 85, 105, 1); height: 80rpx; } - .input-place { + .place-input { color: rgba(148, 163, 184, 0.7); } } @@ -69,6 +71,9 @@ } } } + .tabs-wrap { + background-color: #fff; + } .tabs { .van-tabs__line { width: 42rpx !important; @@ -77,12 +82,166 @@ --tab-font-size: 32rpx; } } - .page0 { - min-height: 100vh; - background-color: rgba(247, 248, 250, 1); - } - .page1 { - min-height: 100vh; - background-color: rgba(247, 248, 250, 1); + .list { + margin: 30rpx; + .card { + margin-bottom: 24rpx; + padding: 24rpx; + display: flex; + gap: 24rpx; + background-color: #fff; + border-radius: 24rpx; + .photo { + flex-shrink: 0; + position: relative; + width: 262rpx; + height: 196rpx; + border-radius: 16rpx; + overflow: hidden; + .status { + position: absolute; + top: 0; + left: 0; + padding: 8rpx 16rpx; + font-size: 22rpx; + border-radius: 16rpx 0rpx 16rpx 0rpx; + display: flex; + align-items: center; + gap: 8rpx; + .icon { + display: none; + width: 24rpx; + height: 24rpx; + } + &.status1 { + color: rgba(74, 184, 253, 1); + background: rgba(226, 244, 255, 1); + } + &.status2 { + color: rgba(255, 255, 255, 1); + background: rgba(254, 181, 74, 1); + .icon { + display: block; + } + } + &.status3 { + color: rgba(255, 255, 255, 1); + background: rgba(111, 220, 174, 1); + .icon { + display: block; + } + } + &.status4 { + color: rgba(255, 255, 255, 1); + background: rgba(253, 91, 89, 1); + } + &.status5 { + color: rgba(255, 255, 255, 1); + background: rgba(111, 220, 174, 1); + } + &.status6 { + color: rgba(255, 255, 255, 1); + background: rgba(254, 181, 74, 1); + } + &.status7 { + color: rgba(255, 255, 255, 1); + background: rgba(203, 213, 225, 1); + } + &.status8 { + color: rgba(100, 116, 139, 1); + background: rgba(233, 239, 245, 1); + } + &.status9 { + .icon { + display: block; + } + color: rgba(255, 255, 255, 1); + background: rgba(74, 184, 253, 1); + } + } + .p-img { + border-radius: 16rpx; + display: block; + width: 100%; + height: 100%; + } + .user { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + box-sizing: border-box; + text-align: center; + line-height: 44rpx; + font-size: 24rpx; + color: rgba(255, 255, 255, 1); + background-color: rgba(0, 0, 0, 0.36); + backdrop-filter: blur(8rpx); + } + } + .wrap { + display: flex; + flex-direction: column; + justify-content: space-between; + .title { + font-size: 32rpx; + color: rgba(17, 24, 39, 1); + line-height: 48rpx; + font-weight: bold; + height: 96rpx; + overflow: hidden; + text-overflow: ellipsis; + display: -webkit-box; + -webkit-box-orient: vertical; + -webkit-line-clamp: 2; + } + .date, + .site { + margin-top: 12rpx; + font-size: 28rpx; + color: rgba(100, 116, 139, 1); + display: flex; + gap: 8rpx; + line-height: 32rpx; + .icon { + margin-top: 4rpx; + flex-shrink: 0; + width: 22rpx; + height: 22rpx; + } + } + } + } + .agent-card { + display: flex; + align-items: center; + gap: 24rpx; + margin-bottom: 24rpx; + padding: 24rpx; + background-color: #fff; + border-radius: 24rpx; + .agent-icon { + flex-shrink: 0; + width: 112rpx; + height: 112rpx; + border-radius: 16rpx; + } + .agent-info { + flex: 1; + .agent-name { + font-size: 32rpx; + color: rgba(17, 24, 39, 1); + font-weight: bold; + } + .agent-brief { + margin-top: 8rpx; + font-size: 28rpx; + color: rgba(100, 116, 139, 1); + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + } + } + } } } diff --git a/src/pages/search/index.ts b/src/pages/search/index.ts index 067b6bb..7d8a3c0 100644 --- a/src/pages/search/index.ts +++ b/src/pages/search/index.ts @@ -1,8 +1,230 @@ -const _app = getApp(); +const app = getApp() Page({ - data: {}, - onLoad() {}, -}); + data: { + imageUrl: app.globalData.imageUrl, + Timestamp: app.globalData.Timestamp, + keyword: '', + active: 0, + // 搜索历史 + historyList: [] as any[], + // 是否已搜索 + searched: false, + // 头部高度(用于 tabs 吸顶定位) + headerHeight: 0, + // 活动搜索结果 + activityList: [] as any[], + activityPagination: { page: 1, pages: 1, count: 0 }, + activityLoading: false, + // 智能体搜索结果 + agentList: [] as any[], + agentPagination: { page: 1, pages: 1, count: 0 }, + agentLoading: false, + }, + + onLoad() { + app.waitLogin().then(() => { + this.fetchHistory() + }) + }, + + onReady() { + this.measureHeader() + }, + + onReachBottom() { + if (this.data.active === 0) { + this.loadMoreActivities() + } + else if (this.data.active === 1) { + this.loadMoreAgents() + } + }, + + // 获取搜索历史 + fetchHistory() { + wx.ajax({ + url: '/search/history', + method: 'GET', + }) + .then((res: any) => { + if (res?.list?.length) { + this.setData({ historyList: res.list }) + } + }) + .catch((err) => { + console.error('获取搜索历史失败', err) + }) + }, + + // 清除搜索历史 + handleClearHistory() { + wx.ajax({ + url: '/search/clear-history', + method: 'POST', + }) + .then(() => { + this.setData({ historyList: [] }) + }) + .catch((err) => { + console.error('清除搜索历史失败', err) + }) + }, + + // 测量头部高度 + measureHeader() { + this.createSelectorQuery() + .select('.header') + .boundingClientRect((rect) => { + if (rect) { + this.setData({ headerHeight: rect.height }) + } + }) + .exec() + }, + + // 点击历史标签搜索 + handleTagTap(e: WechatMiniprogram.TouchEvent) { + const keyword = e.currentTarget.dataset.keyword + this.setData({ keyword }, () => { + this.doSearch() + }) + }, + + // 输入关键词 + handleInput(e: WechatMiniprogram.Input) { + this.setData({ keyword: e.detail.value }) + }, + + // 点击搜索按钮 + handleSearch() { + this.doSearch() + }, + + // 执行搜索 + doSearch() { + const { keyword } = this.data + if (!keyword.trim()) return + + this.setData({ + searched: true, + activityList: [], + agentList: [], + activityPagination: { page: 1, pages: 1, count: 0 }, + agentPagination: { page: 1, pages: 1, count: 0 }, + }, () => { + this.measureHeader() + }) + + // 根据当前 tab 决定搜索类型 + const tabToType: Record = { 0: '2', 1: '3' } + const type = tabToType[this.data.active] || '1' + this.fetchSearch(keyword, type, 1) + + // 刷新搜索历史 + this.fetchHistory() + }, + + // 切换 tab + onChange(e: WechatMiniprogram.CustomEvent) { + const active = e.detail.index ?? 0 + this.setData({ active }) + + if (!this.data.searched) return + + const tabToType: Record = { 0: '2', 1: '3' } + const type = tabToType[active] || '1' + const list = active === 0 ? this.data.activityList : this.data.agentList + if (list.length === 0) { + this.fetchSearch(this.data.keyword, type, 1) + } + }, + + // 搜索接口 + fetchSearch(keyword: string, type: string, page: number) { + const loadingKey = type === '2' ? 'activityLoading' : 'agentLoading' + this.setData({ [loadingKey]: true } as any) + + wx.ajax({ + url: '/search/search', + method: 'GET', + data: { keyword, type, page, pageSize: 20 }, + }) + .then((res: any) => { + const data: any = {} + + if (type === '1' || type === '2') { + const acts = res?.activities?.list || [] + const pagination = res?.activities?.pagination || {} + // 处理 mainImages + const activityList = acts.map((item: any) => { + let mainImages = item.mainImages + if (typeof mainImages === 'string') { + try { + mainImages = JSON.parse(mainImages) + } + catch (_) { + mainImages = [] + } + } + return { ...item, mainImages } + }) + + const newList = page === 1 ? activityList : [...this.data.activityList, ...activityList] + data.activityList = newList + data.activityPagination = { + page: pagination.page || page, + pages: pagination.totalPages || 1, + count: pagination.total || 0, + } + } + + if (type === '1' || type === '3') { + const agents = res?.agents?.list || [] + const pagination = res?.agents?.pagination || {} + const newList = page === 1 ? agents : [...this.data.agentList, ...agents] + data.agentList = newList + data.agentPagination = { + page: pagination.page || page, + pages: pagination.totalPages || 1, + count: pagination.total || 0, + } + } + + data[loadingKey] = false + this.setData(data) + }) + .catch((err) => { + console.error('搜索失败', err) + this.setData({ [loadingKey]: false } as any) + }) + }, + + // 活动触底加载 + loadMoreActivities() { + const { activityPagination, activityLoading } = this.data + if (activityLoading || activityPagination.page >= activityPagination.pages) return + this.fetchSearch(this.data.keyword, '2', activityPagination.page + 1) + }, + + // 智能体触底加载 + loadMoreAgents() { + const { agentPagination, agentLoading } = this.data + if (agentLoading || agentPagination.page >= agentPagination.pages) return + this.fetchSearch(this.data.keyword, '3', agentPagination.page + 1) + }, + + // 跳转活动详情 + handleActivityTap(e: WechatMiniprogram.TouchEvent) { + const id = e.currentTarget.dataset.id + wx.navigateTo({ url: `/pages/actDetail/index?id=${id}` }) + }, + + // 跳转智能体详情 + handleAgentTap(e: WechatMiniprogram.TouchEvent) { + const id = e.currentTarget.dataset.id + wx.navigateTo({ url: `/pages/agent/index?id=${id}` }) + }, +}) export {} diff --git a/src/pages/search/index.wxml b/src/pages/search/index.wxml index bb35e4a..8ec3426 100644 --- a/src/pages/search/index.wxml +++ b/src/pages/search/index.wxml @@ -2,18 +2,35 @@ - - + + - 搜索 + 搜索 - + 历史记录 - + - 暑假活动 + + {{item.keyword}} + @@ -25,12 +42,50 @@ active="{{ active }}" bind:change="onChange" sticky + offset-top="{{headerHeight}}" > - - + + + + + + + {{item.activityStatusName}} + + + {{item.regCount}}人已报名 + + + {{item.name}} + + + {{item.startAt}} - {{item.endAt}} + + + + {{item.location}} + + + + + - + + + + + + {{item.name}} + {{item.brief}} + + + +