diff --git a/project.private.config.json b/project.private.config.json index 336503e..2816fb7 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -4,13 +4,20 @@ "miniprogram": { "list": [ { - "name": "我要反馈", - "pathName": "pages/feedback/index", + "name": "搜索", + "pathName": "pages/search/index", "query": "", "scene": null, "launchMode": "default" }, { + "name": "我要反馈", + "pathName": "pages/feedback/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { "name": "活动报名成功页", "pathName": "pages/actResult/index", "query": "id=59", diff --git a/src/app.json b/src/app.json index 1d72841..619ccca 100644 --- a/src/app.json +++ b/src/app.json @@ -12,6 +12,7 @@ "pages/actPoster/index", "pages/actAdd/index", "pages/actAddResult/index", + "pages/actQrcode/index", "pages/noticeDetail/index", "pages/login/index", "pages/chat/index", @@ -21,7 +22,8 @@ "pages/myAgent/index", "pages/myComment/index", "pages/schedule/index", - "pages/feedback/index" + "pages/feedback/index", + "pages/search/index" ], "window": { "backgroundTextStyle": "light", diff --git a/src/components/popup/index.scss b/src/components/popup/index.scss index 9da7845..1e503af 100644 --- a/src/components/popup/index.scss +++ b/src/components/popup/index.scss @@ -28,6 +28,74 @@ } } +.popup2 { + .container { + padding: 231rpx 55rpx 55rpx; + background: linear-gradient(180deg, #e9f6ff 0%, #ffffff 32.53%, #ffffff 100%); + border-radius: 32rpx; + width: 590rpx; + height: 394rpx; + box-sizing: border-box; + .title { + font-size: 48rpx; + color: rgba(74, 184, 253, 1); + font-weight: bold; + text-align: center; + } + .content { + margin-top: 16rpx; + font-size: 32rpx; + color: rgba(17, 24, 39, 1); + text-align: center; + } + } +} + +.popup3 { + .container { + padding: 293rpx 40rpx 0; + background: linear-gradient(180deg, #e9f6ff 0%, #ffffff 32.53%, #ffffff 100%); + border-radius: 32rpx; + width: 670rpx; + height: 732rpx; + box-sizing: border-box; + .title { + font-size: 40rpx; + color: rgba(17, 24, 39, 1); + font-weight: bold; + text-align: center; + } + .content { + margin-top: 16rpx; + font-size: 32rpx; + color: rgba(71, 85, 105, 1); + text-align: center; + } + .link { + margin-top: 38rpx; + padding: 23rpx; + text-align: center; + font-size: 36rpx; + color: rgba(71, 85, 105, 1); + background-color: rgba(247, 248, 250, 1); + border: 1px solid #fff; + border-radius: 16rpx; + } + .btn { + margin-top: 45rpx; + height: 96rpx; + font-size: 32rpx; + color: rgba(255, 255, 255, 1); + display: flex; + align-items: center; + justify-content: center; + background: linear-gradient(90deg, #9ddffd 0%, #4ab8fd 100%); + box-shadow: 0rpx 15rpx 30rpx -6rpx rgba(74, 172, 219, 0.4); + border-radius: 16rpx 16rpx 16rpx 16rpx; + } + } +} + .close { margin: 32rpx auto 0; display: block; diff --git a/src/components/popup/index.ts b/src/components/popup/index.ts index 1e69b34..303945b 100644 --- a/src/components/popup/index.ts +++ b/src/components/popup/index.ts @@ -21,145 +21,20 @@ Component({ observers: { show(val) { if (val) { - if (this.data.type === 'TCenter') { - this.setData({ - TCenterId: this.data.params.hospitalId, - }) - } - if (this.data.type === 'inhibitors') { - this.setData({ - inhibitorsId: this.data.params.drugId || '', - inhibitorsName: this.data.params.drugName || '', - inhibitorsContent: this.data.params.content || '', - }) - } - if (this.data.type === 'publicCard') { - this.getCodeImg() - } } }, }, data: { - popup1Check1: false, - - TCenterId: '', - - inhibitorsId: '', - inhibitorsName: '', - inhibitorsContent: '', - - selectDoctorId: '', - - codeImg: '', - imageUrl: app.globalData.imageUrl, Timestamp: app.globalData.Timestamp, }, methods: { handleOk() { - const { type, inhibitorsId, inhibitorsName, inhibitorsContent } = this.data - if (type === 'argument' && !this.data.popup1Check1) { - wx.showToast({ - title: '请同意隐私政策', - icon: 'none', - }) - return - } - if (type === 'TCenter') { - if (!this.data.TCenterId) { - wx.showToast({ - title: '请选择治疗中心', - icon: 'none', - }) - return - } - this.triggerEvent('ok', { id: this.data.TCenterId }) - return - } - - if (type === 'inhibitors') { - if (!inhibitorsId) { - wx.showToast({ - title: '请选择抑制剂', - icon: 'none', - }) - return - } - if (inhibitorsName === '其他' && !inhibitorsContent) { - wx.showToast({ - title: '请填写其他抑制剂', - icon: 'none', - }) - return - } - - this.triggerEvent('ok', { id: inhibitorsId, name: inhibitorsName, content: inhibitorsContent }) - return - } - - if (type === 'selectDoctor') { - if (!this.data.selectDoctorId) { - wx.showToast({ - title: '请选择医生', - icon: 'none', - }) - return - } - this.triggerEvent('ok', { id: this.data.selectDoctorId }) - return - } this.triggerEvent('ok') }, handleCancel() { this.triggerEvent('cancel') }, - routerTo(e: any) { - const { url } = e.currentTarget.dataset - wx.navigateTo({ - url, - }) - }, - handlePopup1Check1() { - if (this.data.popup1Check1) { - app.mpBehavior({ PageName: 'BTN_PATIENTPRIVACY' }) - } - }, - handleSelectStatus(e) { - const { status } = e.currentTarget.dataset - this.triggerEvent('ok', { type: 'selectStatusComplete', status }) - }, - handleSelectTCenter(e) { - const { id } = e.currentTarget.dataset - this.setData({ - TCenterId: id, - }) - }, - handleSelectDoctor(e) { - const { id } = e.currentTarget.dataset - this.setData({ - selectDoctorId: id, - }) - }, - handleSelectInhibitors(e) { - const { id, name } = e.currentTarget.dataset - this.setData({ - inhibitorsId: id, - inhibitorsName: name, - }) - }, - getCodeImg() { - wx.ajax({ - method: 'GET', - url: '?r=wtx/common/get-channel-wx-code', - data: { - ChannelType: 2, - }, - }).then((res) => { - this.setData({ - codeImg: res, - }) - }) - }, }, }) diff --git a/src/components/popup/index.wxml b/src/components/popup/index.wxml index 7bcaea5..94bbf1c 100644 --- a/src/components/popup/index.wxml +++ b/src/components/popup/index.wxml @@ -16,6 +16,20 @@ 活动即将开始,请有序进场 + + + 提交成功 + 感谢您的反馈,我们会尽快处理 + + + + + 创建您专属智能体 + 请登陆电脑端创建您的专属智能体 + www.tencent.yuanqi.com + 复制 + + 0 + this.setData({ editId, isEdit }) + + // 设置导航栏标题 + wx.setNavigationBarTitle({ title: isEdit ? '编辑活动' : '创建活动' }) + try { await Promise.all([this.fetchLevelList(), this.fetchCategoryList(), this.fetchTagList()]) } catch (err) { console.error('初始化数据失败:', err) } - // 检查是否有本地草稿 + // 编辑模式:从接口回显数据,忽略本地草稿 + if (isEdit) { + await this.fetchActivityDetail(editId) + return + } + + // 新建模式:检查是否有本地草稿 try { const draft = wx.getStorageSync(DRAFT_KEY) as any if (draft && Object.keys(draft).length) { @@ -131,7 +150,6 @@ Page({ if (res.confirm) { this.restoreDraft(draft) } else { - // 用户选择重新开始,清除草稿 this.clearDraft() } }, @@ -142,6 +160,102 @@ Page({ } }, + // 获取活动详情并回显到表单 + async fetchActivityDetail(id: number) { + wx.showLoading({ title: '加载中...' }) + try { + const res = await wx.ajax({ + url: `/activity/detail?id=${id}`, + method: 'GET', + data: {}, + }) + if (!res) return + + // 签到方式映射 + const checkinWayMap: Record = { 1: 'dynamic', 2: 'fixed', 3: 'none' } + + // 封面图片转为本地上传格式 + const coverImageList = (res.mainImages || []).map((url: string, index: number) => ({ + uid: `cover_${index}`, + url, + type: 'image', + name: url.split('/').pop() || '', + size: 0, + status: 'success', + progress: 100, + })) + + // 议程数据 + const agendas = (res.agendas || []).map((item: any, index: number) => ({ + agendaTime: item.agendaTime || `${item.agendaDate || ''} ${item.agendaTime || ''}`, + title: item.title || '', + description: item.description || '', + sort: index, + })) + + // 如果没有议程,提供一个空行 + if (agendas.length === 0) { + agendas.push({ agendaTime: '', title: '', description: '', sort: 0 }) + } + + // 分类和标签 + const selectedCategoryIds = res.categoryIds || [] + const selectedTagIds = (res.tags || []).map((t: any) => typeof t === 'object' ? t.id : t) + + // 报名设置 + const needRegister = res.regType === 1 + const registerLimit = res.quota > 0 ? 'limited' : 'unlimited' + const registerLimitCount = res.quota > 0 ? String(res.quota) : '' + + this.setData({ + coverImageList, + title: res.name || '', + type: res.type || 1, + typeOther: res.typeOther || '', + summary: res.summary || '', + startTime: res.startAt || '', + endTime: res.endAt || '', + detail: res.description || '', + detailImages: res.detailImages || [], + location: res.location || '', + organizer: res.organizer || '', + contactName: res.contactName || '', + contactPhone: res.contactPhone || '', + levelId: res.levelId || 0, + selectedCategoryIds, + selectedTagIds, + needRegister, + registerStartTime: res.regStartAt || '', + registerEndTime: res.regEndAt || '', + registerLimit, + registerLimitCount, + registerCondition: res.regCondition || '', + checkinWay: checkinWayMap[res.checkinType] || 'dynamic', + checkinStartTime: res.checkinStartTime || '', + checkinEndTime: res.checkinEndTime || '', + agendas, + }) + + // 重建标签选中状态 + const categoryTags = (this.data.categoryList || []).map((item: ICategoryItem) => ({ + id: item.id, + name: item.name, + isSelected: selectedCategoryIds.includes(item.id), + })) + const tagTags = (this.data.tagList || []).map((item: ITagItem) => ({ + id: item.id, + name: item.name, + isSelected: selectedTagIds.includes(item.id), + })) + this.setData({ categoryTags, tagTags }) + } catch (err) { + console.error('获取活动详情失败:', err) + wx.showToast({ title: '加载失败', icon: 'none' }) + } finally { + wx.hideLoading() + } + }, + // ========== 草稿管理 ========== buildDraft(partial: Record = {}) { const keys = [ @@ -229,7 +343,10 @@ Page({ setAndSave(patch: Record) { this.setData(patch) - this.saveDraft(patch) + // 编辑模式下不保存本地草稿缓存 + if (!this.data.isEdit) { + this.saveDraft(patch) + } }, // 获取活动等级列表 @@ -662,53 +779,57 @@ Page({ if (submitting) return - // 校验必填字段 - if (!coverImageList.length) { - wx.showToast({ title: '请上传活动头图', icon: 'error' }) - return - } - if (!title.trim()) { - wx.showToast({ title: '请输入活动标题', icon: 'error' }) - return - } - if (!startTime) { - wx.showToast({ title: '请选择活动开始时间', icon: 'error' }) - return - } - if (!endTime) { - wx.showToast({ title: '请选择活动结束时间', icon: 'error' }) - return - } - if (!location.trim()) { - wx.showToast({ title: '请输入活动地点', icon: 'error' }) - return - } - - // 校验报名设置 - if (needRegister) { - if (!registerStartTime) { - wx.showToast({ title: '请选择报名开始时间', icon: 'error' }) + // 草稿模式不做严格校验,仅提交已填内容 + // 正式提交(activityStatus=2)才校验必填字段 + if (activityStatus === 2) { + // 校验必填字段 + if (!coverImageList.length) { + wx.showToast({ title: '请上传活动头图', icon: 'error' }) return } - if (!registerEndTime) { - wx.showToast({ title: '请选择报名截止时间', icon: 'error' }) + if (!title.trim()) { + wx.showToast({ title: '请输入活动标题', icon: 'error' }) return } - } - - // 校验签到设置 - if (checkinWay !== 'none') { - if (!checkinStartTime) { - wx.showToast({ title: '请选择签到开始时间', icon: 'error' }) + if (!startTime) { + wx.showToast({ title: '请选择活动开始时间', icon: 'error' }) return } - if (!checkinEndTime) { - wx.showToast({ title: '请选择签到结束时间', icon: 'error' }) + if (!endTime) { + wx.showToast({ title: '请选择活动结束时间', icon: 'error' }) return } - } + if (!location.trim()) { + wx.showToast({ title: '请输入活动地点', icon: 'error' }) + return + } + + // 校验报名设置 + if (needRegister) { + if (!registerStartTime) { + wx.showToast({ title: '请选择报名开始时间', icon: 'error' }) + return + } + if (!registerEndTime) { + wx.showToast({ title: '请选择报名截止时间', icon: 'error' }) + return + } + } - // 议程可选,不做必填验证 + // 校验签到设置 + if (checkinWay !== 'none') { + if (!checkinStartTime) { + wx.showToast({ title: '请选择签到开始时间', icon: 'error' }) + return + } + if (!checkinEndTime) { + wx.showToast({ title: '请选择签到结束时间', icon: 'error' }) + return + } + } + + // 议程可选,不做必填验证 + } this.setData({ submitting: true }) wx.showLoading({ title: activityStatus === 1 ? '保存中...' : '提交中...' }) @@ -757,6 +878,11 @@ Page({ activityStatus, } + // 编辑模式传入 id,统一使用 /activity/apply 接口 + if (this.data.isEdit) { + params.id = this.data.editId + } + const res = await wx.ajax({ url: '/activity/apply', method: 'POST', @@ -774,9 +900,10 @@ Page({ // 清理本地草稿 this.clearDraft() - // 跳转到结果页面 + // 跳转到结果页面(编辑模式使用 editId) + const activityId = this.data.isEdit ? this.data.editId : res.activityId wx.redirectTo({ - url: `/pages/actAddResult/index?id=${res.activityId}&status=${res.status}`, + url: `/pages/actAddResult/index?id=${activityId}&status=${res.status || ''}`, }) } } catch (err: any) { diff --git a/src/pages/actAdd/index.wxml b/src/pages/actAdd/index.wxml index 1638a81..7fc1990 100644 --- a/src/pages/actAdd/index.wxml +++ b/src/pages/actAdd/index.wxml @@ -409,7 +409,7 @@ - 存草搞 + 存草稿 上一步 下一步 @@ -490,7 +490,7 @@ - 存草搞 + 存草稿 上一步 提交 diff --git a/src/pages/actAddResult/index.ts b/src/pages/actAddResult/index.ts index 2a28e5a..35d8047 100644 --- a/src/pages/actAddResult/index.ts +++ b/src/pages/actAddResult/index.ts @@ -44,7 +44,7 @@ Page({ // 返回活动页 handleBack() { wx.redirectTo({ - url: `/pages/actDetail/index?id=${this.data.activityId}`, + url: `/pages/act/index`, }) }, }) diff --git a/src/pages/actDetail/index.ts b/src/pages/actDetail/index.ts index f20b939..032fc20 100644 --- a/src/pages/actDetail/index.ts +++ b/src/pages/actDetail/index.ts @@ -126,13 +126,14 @@ Page({ agendaGroups: [] as Array<{ date: string; items: IActivityDetail['agendas'] }>, }, - onLoad(options: { id?: string }) { + onLoad(options: { id?: string; anchor?: string }) { const activityId = options.id ? Number(options.id) : 0 if (!activityId) { wx.showToast({ title: '活动不存在', icon: 'error' }) setTimeout(() => wx.navigateBack(), 1500) return } + this._anchor = options.anchor || '' this.setData({ activityId }) @@ -159,6 +160,20 @@ Page({ loading: false, agendaGroups, }) + + // 锚点滚动:anchor=comment 时滚动到精彩评论区域 + if (this._anchor === 'comment') { + setTimeout(() => { + wx.createSelectorQuery() + .select('#comment-anchor') + .boundingClientRect((rect) => { + if (rect) { + wx.pageScrollTo({ scrollTop: rect.top, duration: 300 }) + } + }) + .exec() + }, 300) // 延迟等待渲染完成 + } } } catch (err) { console.error('获取活动详情失败:', err) diff --git a/src/pages/actDetail/index.wxml b/src/pages/actDetail/index.wxml index 3a189eb..e9f818b 100644 --- a/src/pages/actDetail/index.wxml +++ b/src/pages/actDetail/index.wxml @@ -82,14 +82,11 @@ - + 精彩评论 ({{detail.commentCount}}条) - + {{item.isAnonymous ? '匿名用户' : item.nickname}} @@ -122,7 +119,8 @@ - + + () + +Page({ + data: { + id: '', + qrcodeUrl: '', + detail: {}, + }, + onLoad(options) { + this.setData({ + id: options.id, + }) + app.waitLogin({ type: 1 }).then(() => { + this.getQrCode() + this.getDetail() + }) + }, + getDetail() { + wx.ajax({ + method: 'GET', + url: '/activity/detail', + data: { + id: this.data.id, + }, + }).then((res) => { + this.setData({ + detail: res, + }) + }) + }, + getQrCode() { + wx.ajax({ + method: 'GET', + url: '/activity/checkin-qrcode', + data: { + activityId: this.data.id, + }, + }).then((res) => { + this.setData({ + codeUrl: res.qrcodeUrl, + }) + }) + }, + handleBack() { + wx.navigateBack() + }, +}) + +export {} diff --git a/src/pages/actQrcode/index.wxml b/src/pages/actQrcode/index.wxml new file mode 100644 index 0000000..db26cb3 --- /dev/null +++ b/src/pages/actQrcode/index.wxml @@ -0,0 +1,19 @@ + + + + + + {{detail.name}} + 活动签到 + + 请使用 + 微信 + 扫一扫进行签到 + + + + + 长按保存二维码 + + 签到时间: {{detail.checkinStartTime}} + diff --git a/src/pages/agent/index.json b/src/pages/agent/index.json index c157960..9b9a99e 100644 --- a/src/pages/agent/index.json +++ b/src/pages/agent/index.json @@ -4,6 +4,7 @@ "usingComponents": { "van-icon": "@vant/weapp/icon/index", "van-tab": "@vant/weapp/tab/index", - "van-tabs": "@vant/weapp/tabs/index" + "van-tabs": "@vant/weapp/tabs/index", + "popup": "/components/popup/index" } } diff --git a/src/pages/agent/index.scss b/src/pages/agent/index.scss index c5df942..745c9cf 100644 --- a/src/pages/agent/index.scss +++ b/src/pages/agent/index.scss @@ -248,3 +248,21 @@ page { } } } + +.fixed-add { + position: fixed; + right: 16rpx; + bottom: 320rpx; + width: 110rpx; + height: 110rpx; + background: linear-gradient(90deg, #9ddffd 0%, #4ab8fd 100%); + box-shadow: 0rpx 15rpx 30rpx -6rpx rgba(74, 172, 219, 0.4); + display: flex; + align-items: center; + justify-content: center; + border-radius: 50%; + .icon{ + width: 54rpx; + height: 54rpx; + } +} diff --git a/src/pages/agent/index.ts b/src/pages/agent/index.ts index 19b20e2..112506c 100644 --- a/src/pages/agent/index.ts +++ b/src/pages/agent/index.ts @@ -1,13 +1,53 @@ const _app = getApp() Page({ - data: {}, + data: { + // 弹窗 + popupShow: true, + popupType: 'popup3', + popupParams: {} as any, + }, onLoad() {}, handleEva() { wx.navigateTo({ url: '/pages/agentEva/index', }) }, + handleAdd() { + this.setData({ + popupShow: true, + popupType: 'popup3', + }) + }, + // 弹窗确认 + handlePopupOk() { + this.setData({ + popupShow: false, + }) + wx.setClipboardData({ + data: 'www.tencent.yuanqi.com', + success: () => { + wx.showToast({ + title: '复制成功', + icon: 'success', + duration: 1500, + }) + }, + fail: () => { + wx.showToast({ + title: '复制失败', + icon: 'none', + }) + }, + }) + }, + + // 弹窗取消 + handlePopupCancel() { + this.setData({ + popupShow: false, + }) + }, }) export {} diff --git a/src/pages/agent/index.wxml b/src/pages/agent/index.wxml index 1ec8f75..1328aa0 100644 --- a/src/pages/agent/index.wxml +++ b/src/pages/agent/index.wxml @@ -110,3 +110,15 @@ + + + + + + diff --git a/src/pages/feedback/index.json b/src/pages/feedback/index.json index 4ac8ca2..e4583d2 100644 --- a/src/pages/feedback/index.json +++ b/src/pages/feedback/index.json @@ -1,5 +1,8 @@ { "navigationBarTitleText": "我要反馈", "navigationStyle": "default", - "usingComponents": {} + "usingComponents": { + "popup": "/components/popup/index", + "upload-file": "/components/uploadFile/index" + } } diff --git a/src/pages/feedback/index.scss b/src/pages/feedback/index.scss index f0719f4..10b4b21 100644 --- a/src/pages/feedback/index.scss +++ b/src/pages/feedback/index.scss @@ -12,6 +12,91 @@ page { background-color: rgba(247, 248, 250, 1); border-radius: 16rpx; } + .tex-count { + margin-top: 8rpx; + text-align: right; + font-size: 24rpx; + color: rgba(153, 153, 153, 1); + } + + // 图片上传区域 + .upload-area { + margin-top: 24rpx; + .upload-list { + display: flex; + flex-wrap: wrap; + gap: 16rpx; + .upload-item { + position: relative; + width: 160rpx; + height: 160rpx; + .upload-img { + width: 160rpx; + height: 160rpx; + border-radius: 12rpx; + } + .upload-del { + position: absolute; + top: -8rpx; + right: -8rpx; + width: 32rpx; + height: 32rpx; + background: rgba(0, 0, 0, 0.5); + border-radius: 50%; + display: flex; + align-items: center; + justify-content: center; + &::before, + &::after { + content: ''; + position: absolute; + width: 18rpx; + height: 2rpx; + background: #fff; + } + &::before { + transform: rotate(45deg); + } + &::after { + transform: rotate(-45deg); + } + } + } + .upload-trigger { + width: 160rpx; + height: 160rpx; + background-color: rgba(247, 248, 250, 1); + border-radius: 12rpx; + display: flex; + align-items: center; + justify-content: center; + .upload-trigger-icon { + width: 48rpx; + height: 48rpx; + position: relative; + &::before, + &::after { + content: ''; + position: absolute; + background: rgba(200, 200, 200, 1); + top: 50%; + left: 50%; + } + &::before { + width: 48rpx; + height: 2rpx; + transform: translate(-50%, -50%); + } + &::after { + width: 2rpx; + height: 48rpx; + transform: translate(-50%, -50%); + } + } + } + } + } + .btn { margin-top: 48rpx; font-size: 32rpx; @@ -21,6 +106,9 @@ page { align-items: center; justify-content: center; background: linear-gradient(90deg, #9ddffd 0%, #4ab8fd 100%); - border-radius: 16rpx 16rpx 16rpx 16rpx; + border-radius: 16rpx; + } + .btn-disabled { + opacity: 0.6; } } diff --git a/src/pages/feedback/index.ts b/src/pages/feedback/index.ts index 067b6bb..f2dd48b 100644 --- a/src/pages/feedback/index.ts +++ b/src/pages/feedback/index.ts @@ -1,8 +1,94 @@ -const _app = getApp(); +const app = getApp() Page({ - data: {}, - onLoad() {}, -}); + data: { + content: '', + imageList: [] as any[], + submitting: false, + // 弹窗 + popupShow: false, + popupType: 'popup2', + popupParams: {} as any, + }, + + onLoad() { + app.waitLogin({ type: 1 }) + }, + + onContentInput(e: any) { + this.setData({ content: e.detail.value }) + }, + + onUploadSuccess(e: any) { + const file = e.detail.file + const imageList = this.data.imageList.concat([file]) + this.setData({ imageList }) + }, + + onUploadError(e: any) { + wx.showToast({ title: '图片上传失败', icon: 'none' }) + }, + + deleteImage(e: any) { + const uid = e.currentTarget.dataset.uid + const imageList = this.data.imageList.filter((item: any) => item.uid !== uid) + this.setData({ imageList }) + }, + + previewImage(e: any) { + const url = e.currentTarget.dataset.url + const urls = this.data.imageList.map((item: any) => item.url) + wx.previewImage({ current: url, urls }) + }, + + handleSubmit() { + if (this.data.submitting) return + + const content = this.data.content.trim() + if (!content) { + wx.showToast({ title: '请输入反馈内容', icon: 'none' }) + return + } + if (content.length > 500) { + wx.showToast({ title: '反馈内容不能超过500字', icon: 'none' }) + return + } + + this.setData({ submitting: true }) + + const images = this.data.imageList.map((item: any) => item.url) + const imagesStr = images.length > 0 ? JSON.stringify(images) : '' + + wx.ajax({ + url: '/feedback/submit', + method: 'POST', + data: { + content, + images: imagesStr, + }, + loading: true, + loadingText: '提交中...', + }) + .then(() => { + this.setData({ popupShow: true }) + }) + .catch(() => { + wx.showToast({ title: '提交失败,请重试', icon: 'none' }) + }) + .finally(() => { + this.setData({ submitting: false }) + }) + }, + + handlePopupOk() { + this.setData({ popupShow: false }) + wx.navigateBack() + }, + + handlePopupCancel() { + this.setData({ popupShow: false }) + wx.navigateBack() + }, +}) export {} diff --git a/src/pages/feedback/index.wxml b/src/pages/feedback/index.wxml index 3b0ea10..4c6e03e 100644 --- a/src/pages/feedback/index.wxml +++ b/src/pages/feedback/index.wxml @@ -4,6 +4,49 @@ placeholder-class="place-tex" placeholder="请描述具体问题,有助于我们更好的服务" auto-height="{{true}}" + maxlength="{{500}}" + value="{{content}}" + bindinput="onContentInput" > - 提交 + {{content.length || 0}}/500 + + + + + + + + + + + + + + + + + + 提交 + + diff --git a/src/pages/index/index.ts b/src/pages/index/index.ts index 998eb65..3e970ce 100644 --- a/src/pages/index/index.ts +++ b/src/pages/index/index.ts @@ -56,58 +56,60 @@ Page({ wx.ajax({ url: '/home/index', method: 'GET', - }).then((res: any) => { - const data: any = {} - - // 搜索模块 - if (res.searchModule?.config?.placeholder) { - data.searchPlaceholder = res.searchModule.config.placeholder - } - - // Banner 模块 - if (res.bannerModule?.items?.length) { - data.bannerItems = res.bannerModule.items - data.currentBannerImage = res.bannerModule.items[0].imageUrl - this.startBannerRotation(res.bannerModule.items) - } - - // 快捷入口模块 - if (res.quickEntryModule?.items?.length) { - data.quickEntries = res.quickEntryModule.items - } - - // 通知栏模块 - if (res.notificationModule?.data?.length) { - data.notifications = res.notificationModule.data - } - - // 热门活动模块 - 处理mainImages JSON字符串解析 - if (res.hotActivityModule?.data?.length) { - const hotActivities = res.hotActivityModule.data.map((item: any) => { - let mainImages = item.mainImages - // 如果mainImages是字符串,解析为数组 - if (typeof mainImages === 'string') { - try { - mainImages = JSON.parse(mainImages) - } catch (e) { - console.error('解析mainImages失败', e) - mainImages = [] + }) + .then((res: any) => { + const data: any = {} + + // 搜索模块 + if (res.searchModule?.config?.placeholder) { + data.searchPlaceholder = res.searchModule.config.placeholder + } + + // Banner 模块 + if (res.bannerModule?.items?.length) { + data.bannerItems = res.bannerModule.items + data.currentBannerImage = res.bannerModule.items[0].imageUrl + this.startBannerRotation(res.bannerModule.items) + } + + // 快捷入口模块 + if (res.quickEntryModule?.items?.length) { + data.quickEntries = res.quickEntryModule.items + } + + // 通知栏模块 + if (res.notificationModule?.data?.length) { + data.notifications = res.notificationModule.data + } + + // 热门活动模块 - 处理mainImages JSON字符串解析 + if (res.hotActivityModule?.data?.length) { + const hotActivities = res.hotActivityModule.data.map((item: any) => { + let mainImages = item.mainImages + // 如果mainImages是字符串,解析为数组 + if (typeof mainImages === 'string') { + try { + mainImages = JSON.parse(mainImages) + } catch (e) { + console.error('解析mainImages失败', e) + mainImages = [] + } } - } - return { ...item, mainImages } - }) - data.hotActivities = hotActivities - } + return { ...item, mainImages } + }) + data.hotActivities = hotActivities + } - // 推荐智能体模块 - if (res.recommendAgentModule?.data?.length) { - data.recommendAgents = res.recommendAgentModule.data - } + // 推荐智能体模块 + if (res.recommendAgentModule?.data?.length) { + data.recommendAgents = res.recommendAgentModule.data + } - this.setData(data) - }).catch((err) => { - console.error('获取首页数据失败', err) - }) + this.setData(data) + }) + .catch((err) => { + console.error('获取首页数据失败', err) + }) }, fetchRecommendedActivities(page: number) { @@ -119,40 +121,42 @@ Page({ url: '/activity/list', method: 'GET', data: { getRecommended: 1, page, pageSize: 10 }, - }).then((res: any) => { - const list = res.list || [] - const pagination = res.pagination || {} - - // 处理mainImages JSON字符串解析 - const activities = list.map((item: any) => { - let mainImages = item.mainImages - if (typeof mainImages === 'string') { - try { - mainImages = JSON.parse(mainImages) - } catch (e) { - console.error('解析mainImages失败', e) - mainImages = [] - } - } - return { ...item, mainImages } - }) + }) + .then((res: any) => { + const list = res.list || [] + const pagination = res.pagination || {} - // 如果是第一页,直接替换;否则追加 - const latestActivities = page === 1 ? activities : [...this.data.latestActivities, ...activities] + // 处理mainImages JSON字符串解析 + const activities = list.map((item: any) => { + let mainImages = item.mainImages + if (typeof mainImages === 'string') { + try { + mainImages = JSON.parse(mainImages) + } catch (e) { + console.error('解析mainImages失败', e) + mainImages = [] + } + } + return { ...item, mainImages } + }) - this.setData({ - latestActivities, - activityPagination: { - page: pagination.page || page, - pages: pagination.totalPages || 1, - count: pagination.total || 0, - }, - activityLoading: false, + // 如果是第一页,直接替换;否则追加 + const latestActivities = page === 1 ? activities : [...this.data.latestActivities, ...activities] + + this.setData({ + latestActivities, + activityPagination: { + page: pagination.page || page, + pages: pagination.totalPages || 1, + count: pagination.total || 0, + }, + activityLoading: false, + }) + }) + .catch((err) => { + console.error('获取推荐活动失败', err) + this.setData({ activityLoading: false }) }) - }).catch((err) => { - console.error('获取推荐活动失败', err) - this.setData({ activityLoading: false }) - }) }, loadMoreActivities() { @@ -167,13 +171,15 @@ Page({ url: '/agent/list', method: 'GET', data: { page: 1, pageSize: 10 }, - }).then((res: any) => { - if (res.list?.length) { - this.setData({ agentList: res.list }) - } - }).catch((err) => { - console.error('获取智能体列表失败', err) }) + .then((res: any) => { + if (res.list?.length) { + this.setData({ agentList: res.list }) + } + }) + .catch((err) => { + console.error('获取智能体列表失败', err) + }) }, startBannerRotation(bannerItems: any[]) { @@ -186,7 +192,7 @@ Page({ currentBannerIndex: nextIndex, currentBannerImage: bannerItems[nextIndex].imageUrl, }) - }, 3000) + }, 6000) }, onSearchTap() { @@ -205,6 +211,11 @@ Page({ onMoreAgentsTap() { wx.showToast({ title: '更多智能体开发中', icon: 'none' }) }, + handleKkd(e) { + const { index } = e.currentTarget.dataset + const { quickEntries } = this.data + const { jumpType, jumpTarget } = quickEntries[index] + }, onAgentTap(e: WechatMiniprogram.TouchEvent) { const id = e.currentTarget.dataset.id diff --git a/src/pages/index/index.wxml b/src/pages/index/index.wxml index 6a48986..2e7d0f8 100644 --- a/src/pages/index/index.wxml +++ b/src/pages/index/index.wxml @@ -9,13 +9,7 @@ - + {{item.title}} @@ -24,7 +18,7 @@ - + {{item.name}} diff --git a/src/pages/my/index.scss b/src/pages/my/index.scss index 311b224..c9fb7fe 100644 --- a/src/pages/my/index.scss +++ b/src/pages/my/index.scss @@ -16,6 +16,7 @@ page { display: block; width: 100%; height: 100%; + border-radius: 50%; } } .wrap { diff --git a/src/pages/my/index.ts b/src/pages/my/index.ts index dcc8158..14130d6 100644 --- a/src/pages/my/index.ts +++ b/src/pages/my/index.ts @@ -2,31 +2,98 @@ const app = getApp() Page({ data: { - userInfo: {}, + imageUrl: app.globalData.imageUrl, + Timestamp: app.globalData.Timestamp, + profile: null as any, + activityCount: 0, + agentCount: 0, }, + onLoad() { - app.waitLogin() + app.waitLogin({ type: 1 }).then(() => { + this.fetchProfile() + }) }, + onShow() { - this.setData({ - userInfo: app.globalData.userInfo, - }) + // 每次展示时刷新统计数 + if (app.globalData.loginState) { + this.fetchActivityCount() + this.fetchAgentCount() + } }, + + // 获取个人信息 + async fetchProfile() { + try { + const res = await wx.ajax({ + url: '/me/profile', + method: 'GET', + }) + + if (res) { + this.setData({ profile: res }) + // 同时获取统计数 + this.fetchActivityCount() + this.fetchAgentCount() + } + } catch (err) { + console.error('获取个人信息失败:', err) + } + }, + + // 获取活动参与数 + async fetchActivityCount() { + try { + const res = await wx.ajax({ + url: '/me/my-activities', + method: 'GET', + data: { page: 1, pageSize: 1 }, + }) + + if (res) { + this.setData({ activityCount: res.pagination?.total || 0 }) + } + } catch (err) { + console.error('获取活动统计失败:', err) + } + }, + + // 获取智能体使用数 + async fetchAgentCount() { + try { + const res = await wx.ajax({ + url: '/me/my-agents', + method: 'GET', + data: { type: 'recent', page: 1, pageSize: 1 }, + }) + + if (res) { + this.setData({ agentCount: res.pagination?.total || 0 }) + } + } catch (err) { + console.error('获取智能体统计失败:', err) + } + }, + handleMyAct() { wx.navigateTo({ url: '/pages/myAct/index', }) }, + handleMyAgent() { wx.navigateTo({ url: '/pages/myAgent/index', }) }, + handleMyCommet() { wx.navigateTo({ url: '/pages/myComment/index', }) }, + handleFeedback() { wx.navigateTo({ url: '/pages/feedback/index', diff --git a/src/pages/my/index.wxml b/src/pages/my/index.wxml index 2e5bb38..43417ba 100644 --- a/src/pages/my/index.wxml +++ b/src/pages/my/index.wxml @@ -4,27 +4,27 @@ > - + - 奇妙的双子座 - 20989182 + {{profile.nickname || '未登录'}} + {{profile.studentNo || ''}} - 计算机科学学院软件工程3班 + {{profile.collegeName}}{{profile.majorName ? profile.majorName : ''}}{{profile.className ? profile.className : ''}} 我的活动 - 已参与10个活动 + 已参与{{activityCount}}个活动 我的智能体 - 已启用20个智能体 + 已启用{{agentCount}}个智能体 diff --git a/src/pages/myAct/index.scss b/src/pages/myAct/index.scss index e85110e..5275ffc 100644 --- a/src/pages/myAct/index.scss +++ b/src/pages/myAct/index.scss @@ -53,6 +53,7 @@ page { align-items: center; gap: 8rpx; .icon { + display: none; width: 24rpx; height: 24rpx; } @@ -63,10 +64,16 @@ page { &.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); @@ -89,6 +96,9 @@ page { background: rgba(233, 239, 245, 1); } &.status9 { + .icon { + display: block; + } color: rgba(255, 255, 255, 1); background: rgba(74, 184, 253, 1); } @@ -135,15 +145,34 @@ page { font-size: 28rpx; color: rgba(100, 116, 139, 1); display: flex; - align-items: center; gap: 8rpx; .icon { + margin-top: 8rpx; + flex-shrink: 0; width: 22rpx; height: 22rpx; } } } } + .reject { + padding: 16rpx; + background-color: rgba(253, 91, 89, 0.1); + border-radius: 16rpx; + display: flex; + gap: 12rpx; + .icon { + margin-top: 8rpx; + flex-shrink: 0; + width: 22rpx; + height: 22rpx; + } + .r-content{ + font-size: 28rpx; + color: rgba(253, 91, 89, 1); + line-height: 38rpx; + } + } .c-footer { padding-top: 24rpx; display: flex; diff --git a/src/pages/myAct/index.ts b/src/pages/myAct/index.ts index 46455a1..e7f8f72 100644 --- a/src/pages/myAct/index.ts +++ b/src/pages/myAct/index.ts @@ -157,13 +157,13 @@ Page({ // 编辑活动 handleEdit(e: WechatMiniprogram.TouchEvent) { const { id } = e.currentTarget.dataset - wx.navigateTo({ url: `/pages/actEdit/index?id=${id}` }) + wx.navigateTo({ url: `/pages/actAdd/index?id=${id}` }) }, // 查看详情 handleDetail(e: WechatMiniprogram.TouchEvent) { - const { id } = e.currentTarget.dataset - wx.navigateTo({ url: `/pages/actDetail/index?id=${id}` }) + const { id, anchor } = e.currentTarget.dataset + wx.navigateTo({ url: `/pages/actDetail/index?id=${id}&anchor=${anchor}` }) }, // 取消活动 diff --git a/src/pages/myAct/index.wxml b/src/pages/myAct/index.wxml index c52ac39..79a9765 100644 --- a/src/pages/myAct/index.wxml +++ b/src/pages/myAct/index.wxml @@ -6,6 +6,7 @@ title-active-color="rgba(74, 184, 253, 1)" active="{{ active }}" bind:change="onChange" + sticky > @@ -16,7 +17,11 @@ {{item.activityStatusName}} - + {{item.regCount}}人已报名 @@ -31,28 +36,56 @@ + + + 驳回原因:{{item.reviewReason}} + {{item.regCount}}人已报名 - - + + 删除 编辑 - - + + + 删除 + 编辑 + + + 签到二维码 - 取消 + 查看 + + + + 删除 编辑 - + + + 签到二维码 + 查看 + + 签到二维码 - 详情 + 查看 - + + 签到二维码 + 查看 + + + 删除 - 详情 + 查看 + + + + 签到二维码 + 查看 @@ -68,7 +101,11 @@ {{item.activityStatusName}} - + {{item.regCount}}人已报名 @@ -85,22 +122,9 @@ - 已签到 - 已评价 - 已报名 + {{item.regCount}}人已报名 - - - 去签到 - - - - 去评价 - - - - 详情 - + 查看 diff --git a/src/pages/myComment/index.json b/src/pages/myComment/index.json index fd56525..5e39e9a 100644 --- a/src/pages/myComment/index.json +++ b/src/pages/myComment/index.json @@ -5,6 +5,7 @@ "van-tab": "@vant/weapp/tab/index", "van-tabs": "@vant/weapp/tabs/index", "van-icon": "@vant/weapp/icon/index", - "van-rate": "@vant/weapp/rate/index" + "van-rate": "@vant/weapp/rate/index", + "pagination": "/components/pagination/index" } } diff --git a/src/pages/myComment/index.scss b/src/pages/myComment/index.scss index 33762b1..b51040e 100644 --- a/src/pages/myComment/index.scss +++ b/src/pages/myComment/index.scss @@ -14,6 +14,7 @@ page { .page0 { padding: 43rpx 30rpx; .card { + margin-bottom: 30rpx; padding: 32rpx; background-color: #fff; border-radius: 24rpx; @@ -48,10 +49,40 @@ page { color: rgba(148, 163, 184, 1); } .options { + position: relative; .icon { width: 32rpx; height: 32rpx; } + .options-wrap { + position: absolute; + z-index: 10; + bottom: -14rpx; + right: -24rpx; + background-color: #fff; + transform: translateY(100%); + border-radius: 8rpx; + filter: drop-shadow(10rpx 10rpx 10rpx rgba(148, 163, 184, 0.09)); + .o-item { + display: flex; + align-items: center; + flex-wrap: nowrap; + gap: 20rpx; + padding: 28rpx; + white-space: nowrap; + } + &::before { + position: absolute; + right: 24rpx; + top: -20rpx; + content: ''; + width: 0; + height: 0; + border-style: solid; + border-width: 0 24rpx 24rpx 24rpx; + border-color: transparent transparent #fff transparent; + } + } } } } diff --git a/src/pages/myComment/index.ts b/src/pages/myComment/index.ts index 067b6bb..80cbe3f 100644 --- a/src/pages/myComment/index.ts +++ b/src/pages/myComment/index.ts @@ -1,8 +1,171 @@ -const _app = getApp(); +const app = getApp() Page({ - data: {}, - onLoad() {}, -}); + data: { + active: 0, + + // 当前展开的操作菜单索引及类型 + showOptionsKey: '', + + // 活动评论列表 + activityList: [] as any[], + activityPagination: { count: 0, page: 1, pages: 0, pageSize: 20 }, + activityLoading: false, + + // 智能体评论列表 + agentList: [] as any[], + agentPagination: { count: 0, page: 1, pages: 0, pageSize: 20 }, + agentLoading: false, + }, + + onLoad() { + app.waitLogin({ type: 1 }).then(() => { + this.fetchList('activity', true) + }) + }, + + // Tab切换 + onChange(e: WechatMiniprogram.CustomEvent) { + const active = e.detail.index ?? e.detail.name + this.setData({ active }) + + const type = active === 0 ? 'activity' : 'agent' + const list = active === 0 ? this.data.activityList : this.data.agentList + // 只有列表为空时才加载 + if (!list.length) { + this.fetchList(type, true) + } + }, + + // 获取评论列表 + async fetchList(type: string, isRefresh = false) { + const key = type === 'activity' ? 'activity' : 'agent' + const loadingKey = `${key}Loading` + const paginationKey = `${key}Pagination` + + if (this.data[loadingKey]) return + + const pagination = this.data[paginationKey] + const page = isRefresh ? 1 : pagination.page + + this.setData({ [loadingKey]: true }) + + try { + const res = await wx.ajax({ + url: '/me/my-reviews', + method: 'GET', + data: { page, pageSize: pagination.pageSize, type }, + }) + + if (res) { + const newList = isRefresh ? res.list : [...this.data[`${key}List`], ...res.list] + this.setData({ + [`${key}List`]: newList, + [paginationKey]: { + count: res.pagination?.total || 0, + page: res.pagination?.page || page, + pages: res.pagination?.totalPages || 0, + pageSize: res.pagination?.pageSize || pagination.pageSize, + }, + }) + } + } catch (err) { + console.error('获取评论列表失败:', err) + } finally { + this.setData({ [loadingKey]: false }) + } + }, + + // 触底加载更多 + onReachBottom() { + const { active, activityPagination, agentPagination, activityLoading, agentLoading } = this.data + const type = active === 0 ? 'activity' : 'agent' + const pagination = active === 0 ? activityPagination : agentPagination + const loading = active === 0 ? activityLoading : agentLoading + + if (loading) return + if (pagination.page >= pagination.pages) return + + // 先递增page + const key = active === 0 ? 'activityPagination' : 'agentPagination' + this.setData({ [`${key}.page`]: pagination.page + 1 }) + this.fetchList(type) + }, + + // 点击options图标,显示/隐藏操作菜单 + handleToggleOptions(e: WechatMiniprogram.TouchEvent) { + const { key } = e.currentTarget.dataset + this.setData({ showOptionsKey: this.data.showOptionsKey === key ? '' : key }) + }, + + // 关闭操作菜单 + handleCloseOptions() { + this.setData({ showOptionsKey: '' }) + }, + + // 匿名→公开切换 + async handleSetPublic(e: WechatMiniprogram.TouchEvent) { + const { id, index, type } = e.currentTarget.dataset + const { active } = this.data + + try { + const res = await wx.ajax({ + url: `/me/set-comment-public`, + method: 'POST', + data: { id }, + }) + + if (res) { + wx.showToast({ title: '已公开', icon: 'success' }) + const listKey = active === 0 ? 'activityList' : 'agentList' + const list = this.data[listKey] as any[] + list[index].isAnonymous = false + this.setData({ [listKey]: list }) + } + } catch (err: any) { + const message = err?.message || '操作失败' + wx.showToast({ title: message, icon: 'error' }) + } + }, + + // 删除评价 + async handleDelete(e: WechatMiniprogram.TouchEvent) { + const { id, index } = e.currentTarget.dataset + const { active } = this.data + + const confirmRes = await wx.showModal({ + title: '确认删除', + content: '删除后不可恢复,是否确认删除?', + }) + if (!confirmRes.confirm) return + + try { + const res = await wx.ajax({ + url: `/me/delete-comment`, + method: 'POST', + data: { id }, + }) + + if (res) { + wx.showToast({ title: '已删除', icon: 'success' }) + const listKey = active === 0 ? 'activityList' : 'agentList' + const list = this.data[listKey] as any[] + list.splice(index, 1) + this.setData({ [listKey]: list }) + } + } catch (err: any) { + const message = err?.message || '删除失败' + wx.showToast({ title: message, icon: 'error' }) + } + }, + + // 跳转活动详情 + handleGoDetail(e: WechatMiniprogram.TouchEvent) { + const { targetid, anchor } = e.currentTarget.dataset + wx.navigateTo({ + url: `/pages/actDetail/index?id=${targetid}&anchor=${anchor || ''}`, + }) + }, +}) export {} diff --git a/src/pages/myComment/index.wxml b/src/pages/myComment/index.wxml index cc7d98a..c4c43ec 100644 --- a/src/pages/myComment/index.wxml +++ b/src/pages/myComment/index.wxml @@ -1,4 +1,4 @@ - + + - + - 待审核 + + {{item.auditStatusLabel}} - 匿名 - - + 匿名 + + + + + 公开 + + + + 删除 + + - 2026-01-01 13:00:09 + {{item.createdAt}} - - 4.5 + + {{item.rating}} - - 本次活动组织有序、流程顺畅,现场氛围良好。活 动内容丰富、安排合理,服务贴心到位,整体体验 良好。 + {{item.content}} + + + + + + + + + {{item.targetTitle}} + {{item.targetDate}} + + + + + + {{item.statusMessage}} + + + + + {{item.statusMessage}} + + + + + + + + + + + + + {{item.auditStatusLabel}} + + 匿名 + + + + + 公开 + + + + 删除 + + + + + + + {{item.createdAt}} + + + {{item.rating}} + - - - + {{item.content}} + + + - + - 深职大第十五届校园歌手大赛 - 2026年5月30日 19:00 + {{item.targetTitle}} + {{item.targetDate}} - + + - 内容已提交,正在审核中,预计1-2个工作日内完成审核。 + {{item.statusMessage}} - + + - 驳回原因:内容中包含不当言论,请修改后重新提交。 + {{item.statusMessage}} + + - 内容 2 diff --git a/src/pages/notice/index.scss b/src/pages/notice/index.scss index f883f8a..629dbad 100644 --- a/src/pages/notice/index.scss +++ b/src/pages/notice/index.scss @@ -3,6 +3,7 @@ page { } .page { + padding-bottom: calc(env(safe-area-inset-bottom) + 120rpx); .tabs { .van-tabs__line { width: 32rpx !important; @@ -49,7 +50,7 @@ page { border-top: 1px solid rgba(235, 235, 235, 1); display: flex; align-items: center; - justify-content: space-between; + justify-content: flex-end; .tag { font-size: 24rpx; color: rgba(74, 184, 253, 1); @@ -90,6 +91,7 @@ page { font-size: 28rpx; color: rgba(100, 116, 139, 1); line-height: 44rpx; + white-space: pre-line; } .c-footer { margin-top: 30rpx; @@ -100,23 +102,24 @@ page { font-size: 24rpx; padding: 4rpx 16rpx; border-radius: 6rpx; - &.tag1 { + &.approved { color: rgba(111, 220, 174, 1); background-color: rgba(111, 220, 174, 0.1); } - &.tag2 { + &.rejected { color: rgba(253, 91, 89, 1); background-color: rgba(253, 91, 89, 0.1); } - &.tag3 { + &.registered { color: rgba(74, 184, 253, 1); background-color: rgba(74, 184, 253, 0.1); } - &.tag4 { + &.checked_in { color: rgba(254, 181, 74, 1); background-color: rgba(254, 181, 74, 0.1); } - &.tag5 { + &.review_approved, + &.review_rejected { color: rgba(171, 89, 248, 1); background-color: rgba(171, 89, 248, 0.1); } diff --git a/src/pages/notice/index.ts b/src/pages/notice/index.ts index 58a6c9e..63c8d70 100644 --- a/src/pages/notice/index.ts +++ b/src/pages/notice/index.ts @@ -64,6 +64,7 @@ Page({ onLoad() { app.waitLogin({ type: 1 }).then(() => { + this.clearNotice('announcement') this.fetchAnnouncementList() }) }, @@ -76,16 +77,37 @@ Page({ } }, + // 自动清空当前tab类型的通知(进入列表时即清空) + async clearNotice(type: string) { + try { + await wx.ajax({ + url: '/notification/mark-read-by-type', + method: 'POST', + data: { type }, + }) + // 刷新 tabbar 红点 + const tabBar = this.getTabBar() + if (tabBar && typeof tabBar.fetchUnreadCount === 'function') { + tabBar.fetchUnreadCount() + } + } catch (err) { + console.error('清空通知失败:', err) + } + }, + // 切换 tab onChange(e: WechatMiniprogram.CustomEvent) { const active = e.detail.index ?? 0 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') } }, @@ -179,6 +201,14 @@ Page({ url: `/pages/noticeDetail/index?taskId=${taskId}&type=notice`, }) }, + handleActNotice(e) { + const { index } = e.currentTarget.dataset + const { activityList } = this.data + const { jumpTarget } = activityList[index] + wx.navigateTo({ + url: `/pages/actDetail/index?id=${jumpTarget}`, + }) + }, // 下拉刷新 onPullDownRefresh() { @@ -222,4 +252,4 @@ Page({ }, }) -export {} \ No newline at end of file +export {} diff --git a/src/pages/notice/index.wxml b/src/pages/notice/index.wxml index d94dc5b..b96dad2 100644 --- a/src/pages/notice/index.wxml +++ b/src/pages/notice/index.wxml @@ -6,6 +6,7 @@ title-active-color="rgba(74, 184, 253, 1)" active="{{ active }}" bind:change="onChange" + sticky > @@ -22,7 +23,6 @@ {{item.title}} - 公告 查看详情 @@ -49,7 +49,6 @@ {{item.title}} - 重要通知 查看详情 @@ -64,21 +63,13 @@ - + {{item.scheduleAt}} {{item.title}} {{item.subtitle}} - - {{item.subTypeName}} - + {{item.subTypeName}} 查看详情 diff --git a/src/pages/noticeDetail/index.scss b/src/pages/noticeDetail/index.scss index 6ff0d09..2bc5fe8 100644 --- a/src/pages/noticeDetail/index.scss +++ b/src/pages/noticeDetail/index.scss @@ -93,6 +93,7 @@ align-items: center; gap: 8rpx; .icon { + flex-shrink: 0; width: 30rpx; height: 30rpx; } diff --git a/src/pages/noticeDetail/index.ts b/src/pages/noticeDetail/index.ts index e97ebe0..7152d99 100644 --- a/src/pages/noticeDetail/index.ts +++ b/src/pages/noticeDetail/index.ts @@ -19,7 +19,7 @@ Page({ categoryName: '', }, - onLoad(options: { id?: string, taskId?: string, type?: string }) { + onLoad(options: { id?: string; taskId?: string; type?: string }) { const type = options.type || 'notice' const id = Number(options.id || 0) const taskId = Number(options.taskId || 0) @@ -96,13 +96,17 @@ Page({ 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 }) + wx.navigateTo({ + url: detail.jumpTarget, + fail() { + wx.switchTab({ url: detail.jumpTarget }) + }, + }) } else if (detail.jumpType === 4) { // 跳转H5链接 wx.navigateTo({ @@ -116,4 +120,4 @@ Page({ }, }) -export {} \ No newline at end of file +export {} diff --git a/src/pages/noticeDetail/index.wxml b/src/pages/noticeDetail/index.wxml index 4a01c52..3794a31 100644 --- a/src/pages/noticeDetail/index.wxml +++ b/src/pages/noticeDetail/index.wxml @@ -12,6 +12,10 @@ {{type === 'announcement' ? detail.createdAt : detail.scheduleAt}} + + + 浏览人数:{{detail.reviewCount}} + @@ -20,4 +24,4 @@ {{detail.buttonText}} - \ No newline at end of file + diff --git a/src/pages/search/index.json b/src/pages/search/index.json new file mode 100644 index 0000000..5db80a6 --- /dev/null +++ b/src/pages/search/index.json @@ -0,0 +1,5 @@ +{ + "navigationStyle": "default", + "navigationBarBackgroundColor": "#F7F8FA", + "usingComponents": {} +} diff --git a/src/pages/search/index.scss b/src/pages/search/index.scss new file mode 100644 index 0000000..01a9044 --- /dev/null +++ b/src/pages/search/index.scss @@ -0,0 +1,3 @@ +page { + background-color: #f7f8fa; +} diff --git a/src/pages/search/index.ts b/src/pages/search/index.ts new file mode 100644 index 0000000..067b6bb --- /dev/null +++ b/src/pages/search/index.ts @@ -0,0 +1,8 @@ +const _app = getApp(); + +Page({ + data: {}, + onLoad() {}, +}); + +export {} diff --git a/src/pages/search/index.wxml b/src/pages/search/index.wxml new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/webview/index.json b/src/pages/webview/index.json new file mode 100644 index 0000000..a97367d --- /dev/null +++ b/src/pages/webview/index.json @@ -0,0 +1,3 @@ +{ + "usingComponents": {} +} diff --git a/src/pages/webview/index.scss b/src/pages/webview/index.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/pages/webview/index.ts b/src/pages/webview/index.ts new file mode 100644 index 0000000..4fb4d72 --- /dev/null +++ b/src/pages/webview/index.ts @@ -0,0 +1,16 @@ +const app = getApp() + +Page({ + data: { + // url: "https://uat-open2.ehaoyao.com/wap/jointlogin/index?appid=vgcL5j9BIXEG0CdKXgsmpX3t1uQJufNa&mobile=YHHaNEJf/rCetEvRn5Iekw==&time=1661486102&username=YHHaNEJf/rCetEvRn5Iekw==&sign=97d9002ae18dc26885d983122a21c717&returnUrl=https%3A%2F%2Fuat-open2.ehaoyao.com%2Fm%2F%3Fappid%3D50%26channelgoodsid%3D728485%26nums%3D1%23%2ForderConfirm&threeSerialNumber=2022082611550200002&mark=", + url: '', + }, + onLoad(options) { + if (options.url) { + this.setData({ + url: decodeURIComponent(options.url), + }) + } + }, + getDetail() {}, +}) diff --git a/src/pages/webview/index.wxml b/src/pages/webview/index.wxml new file mode 100644 index 0000000..c165ac7 --- /dev/null +++ b/src/pages/webview/index.wxml @@ -0,0 +1 @@ +