diff --git a/project.private.config.json b/project.private.config.json index 22ecfe3..52fc110 100644 --- a/project.private.config.json +++ b/project.private.config.json @@ -4,13 +4,27 @@ "miniprogram": { "list": [ { - "name": "创建活动", - "pathName": "pages/actAdd/index", + "name": "活动报名结果页", + "pathName": "pages/actResult/index", "query": "", "scene": null, "launchMode": "default" }, { + "name": "创建活动结果页", + "pathName": "pages/actAddResult/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { + "name": "创建活动", + "pathName": "pages/actAdd/index", + "query": "", + "launchMode": "default", + "scene": null + }, + { "name": "活动报名结果", "pathName": "pages/actResult/index", "query": "", diff --git a/src/app.json b/src/app.json index 2105a3c..bde6e89 100644 --- a/src/app.json +++ b/src/app.json @@ -7,6 +7,7 @@ "pages/actDetail/index", "pages/actResult/index", "pages/actAdd/index", + "pages/actAddResult/index", "pages/noticeDetail/index", "pages/login/index", "pages/my/index" diff --git a/src/app.ts b/src/app.ts index b0d0b4c..6b0f5c9 100644 --- a/src/app.ts +++ b/src/app.ts @@ -1,9 +1,9 @@ import page from '@/utils/page' - import { request } from './api/request' - import { parseScene } from './utils/util' + const dayjs = require('dayjs') + const licia = require('miniprogram-licia') require('/utils/dayjs/day-zh-cn.js') const relativeTime = require('/utils/dayjs/relativeTime.js') diff --git a/src/components/popup/index.json b/src/components/popup/index.json new file mode 100644 index 0000000..074f50b --- /dev/null +++ b/src/components/popup/index.json @@ -0,0 +1,6 @@ +{ + "component": true, + "usingComponents": { + "van-popup": "@vant/weapp/popup/index" + } +} diff --git a/src/components/popup/index.scss b/src/components/popup/index.scss new file mode 100644 index 0000000..9da7845 --- /dev/null +++ b/src/components/popup/index.scss @@ -0,0 +1,36 @@ +.popup1 { + .icon { + position: relative; + display: block; + margin: 0 auto -84rpx; + width: 315rpx; + height: 226rpx; + } + .container { + padding: 101rpx 55rpx 55rpx; + background: linear-gradient(180deg, #e9f6ff 0%, #ffffff 32.53%, #ffffff 100%); + border-radius: 32rpx; + width: 600rpx; + height: 270rpx; + 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(100, 116, 139, 1); + text-align: center; + } + } +} + +.close { + margin: 32rpx auto 0; + display: block; + width: 64rpx; + height: 64rpx; +} diff --git a/src/components/popup/index.ts b/src/components/popup/index.ts new file mode 100644 index 0000000..1e69b34 --- /dev/null +++ b/src/components/popup/index.ts @@ -0,0 +1,165 @@ +const app = getApp() + +Component({ + properties: { + show: { + type: Boolean, + value: false, + }, + type: String, + params: { + type: Object, + value() { + return {} + }, + }, + top: { + type: Number, + value: 50, + }, + }, + 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 new file mode 100644 index 0000000..0a4e384 --- /dev/null +++ b/src/components/popup/index.wxml @@ -0,0 +1,26 @@ + + + + + 签到成功 + 活动即将开始,请有序进场 + + + + + diff --git a/src/images/bg2.png b/src/images/bg2.png new file mode 100644 index 0000000..679d9d7 Binary files /dev/null and b/src/images/bg2.png differ diff --git a/src/images/icon33.png b/src/images/icon33.png new file mode 100644 index 0000000..3ca6a59 Binary files /dev/null and b/src/images/icon33.png differ diff --git a/src/images/icon34.png b/src/images/icon34.png new file mode 100644 index 0000000..d74fa7f Binary files /dev/null and b/src/images/icon34.png differ diff --git a/src/images/icon35.png b/src/images/icon35.png new file mode 100644 index 0000000..ec89e4e Binary files /dev/null and b/src/images/icon35.png differ diff --git a/src/images/icon36.png b/src/images/icon36.png new file mode 100644 index 0000000..e597bd4 Binary files /dev/null and b/src/images/icon36.png differ diff --git a/src/images/icon37.png b/src/images/icon37.png new file mode 100644 index 0000000..0b7c40d Binary files /dev/null and b/src/images/icon37.png differ diff --git a/src/images/icon38.png b/src/images/icon38.png new file mode 100644 index 0000000..1c659f8 Binary files /dev/null and b/src/images/icon38.png differ diff --git a/src/images/icon39.png b/src/images/icon39.png new file mode 100644 index 0000000..1634a42 Binary files /dev/null and b/src/images/icon39.png differ diff --git a/src/images/icon40.png b/src/images/icon40.png new file mode 100644 index 0000000..775e19e Binary files /dev/null and b/src/images/icon40.png differ diff --git a/src/images/icon41.png b/src/images/icon41.png new file mode 100644 index 0000000..820adcb Binary files /dev/null and b/src/images/icon41.png differ diff --git a/src/images/icon42.png b/src/images/icon42.png new file mode 100644 index 0000000..0ed72a1 Binary files /dev/null and b/src/images/icon42.png differ diff --git a/src/images/icon_calendar_blue.png b/src/images/icon_calendar_blue.png new file mode 100644 index 0000000..cfdbf4b Binary files /dev/null and b/src/images/icon_calendar_blue.png differ diff --git a/src/images/icon_delete_red.png b/src/images/icon_delete_red.png new file mode 100644 index 0000000..5cc079b Binary files /dev/null and b/src/images/icon_delete_red.png differ diff --git a/src/images/icon_plus_blue.png b/src/images/icon_plus_blue.png new file mode 100644 index 0000000..e9b2ab4 Binary files /dev/null and b/src/images/icon_plus_blue.png differ diff --git a/src/images/icon_register.png b/src/images/icon_register.png new file mode 100644 index 0000000..94f2351 Binary files /dev/null and b/src/images/icon_register.png differ diff --git a/src/images/icon_upload.png b/src/images/icon_upload.png new file mode 100644 index 0000000..23c3f32 Binary files /dev/null and b/src/images/icon_upload.png differ diff --git a/src/pages/act/index.wxml b/src/pages/act/index.wxml index 73e420f..0ee4220 100644 --- a/src/pages/act/index.wxml +++ b/src/pages/act/index.wxml @@ -59,7 +59,7 @@ - 时间筛选 + 活动开始时间 全部时间 今天 diff --git a/src/pages/actAdd/index.json b/src/pages/actAdd/index.json index a97367d..bce0229 100644 --- a/src/pages/actAdd/index.json +++ b/src/pages/actAdd/index.json @@ -1,3 +1,5 @@ { + "navigationBarTitleText": "创建活动", + "navigationStyle": "default", "usingComponents": {} } diff --git a/src/pages/actAdd/index.scss b/src/pages/actAdd/index.scss index e69de29..f70eac8 100644 --- a/src/pages/actAdd/index.scss +++ b/src/pages/actAdd/index.scss @@ -0,0 +1,722 @@ +page { + background-color: #f5f7fa; +} + +.page { + display: flex; + flex-direction: column; + height: 100vh; + background: #f5f7fa; +} + +/* ========== 步骤条 ========== */ +.step-bar { + flex-shrink: 0; + padding: 30rpx 60rpx 24rpx; + background: #fff; + + .step-list { + display: flex; + align-items: flex-start; + } + + .step-item { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + position: relative; + + &:not(:last-child)::after { + content: ''; + position: absolute; + top: 32rpx; + left: 50%; + right: -50%; + height: 2rpx; + background: rgba(247, 248, 250, 1); + z-index: 0; + } + + &.is-done:not(:last-child)::after { + background: #3b82f6; + } + + .step-circle { + width: 62rpx; + height: 62rpx; + border-radius: 50%; + background: rgba(247, 248, 250, 1); + display: flex; + align-items: center; + justify-content: center; + position: relative; + z-index: 1; + } + + .step-num { + font-size: 26rpx; + color: rgba(148, 163, 184, 1); + font-weight: 500; + } + + .step-check { + font-size: 22rpx; + color: rgba(148, 163, 184, 0.5); + font-weight: 700; + } + + &.is-active, + &.is-done { + .step-circle { + background: linear-gradient(90deg, #9ddffd 0%, #4ab8fd 100%); + box-shadow: 0rpx 19rpx 28rpx -4rpx rgba(20, 164, 255, 0.2); + } + + .step-num, + .step-check { + color: #fff; + } + + .step-label { + color: rgba(74, 184, 253, 1); + } + } + + .step-label { + margin-top: 10rpx; + font-size: 20rpx; + color: rgba(148, 163, 184, 1); + text-align: center; + line-height: 1.3; + } + } +} + +/* ========== 表单滚动区 ========== */ +.form-scroll { + flex: 1; + padding: 24rpx 32rpx; + box-sizing: border-box; + overflow: hidden; +} + +/* ========== 表单卡片 ========== */ +.form-card { + background: #fff; + border-radius: 24rpx; + padding: 32rpx; + margin-bottom: 24rpx; +} + +/* ========== 表单字段 ========== */ +.form-field { + margin-bottom: 38rpx; + + &:last-child { + margin-bottom: 0; + } +} + +.form-label { + font-size: 32rpx; + color: rgba(25, 28, 30, 1); + font-weight: bold; + margin-bottom: 20rpx; + display: flex; + align-items: center; + + .required { + color: rgba(253, 91, 89, 1); + margin-left: 6rpx; + font-size: 28rpx; + } +} + +.input-wrap { + position: relative; + .form-input { + width: 100%; + height: 88rpx; + background: #f7f8fa; + border-radius: 16rpx; + padding: 0 140rpx 0 24rpx; + font-size: 32rpx; + color: rgba(71, 85, 105, 1); + box-sizing: border-box; + } + .form-input-place { + color: rgba(148, 163, 184, 0.5); + } + .char-count--inline { + position: absolute; + right: 24rpx; + top: 50%; + transform: translateY(-50%); + font-size: 28rpx; + color: rgba(148, 163, 184, 0.5); + } +} + +.textarea-wrap { + position: relative; + + .form-textarea { + width: 100%; + height: 327rpx; + background: #f7f8fa; + border-radius: 16rpx; + padding: 20rpx 24rpx 40rpx; + font-size: 32rpx; + color: #1f2937; + box-sizing: border-box; + } + .form-textarea-place { + color: rgba(148, 163, 184, 0.5); + } + + .char-count { + position: absolute; + right: 24rpx; + bottom: 12rpx; + font-size: 24rpx; + color: rgba(148, 163, 184, 0.5); + } +} + +.form-picker { + width: 100%; + height: 88rpx; + background: #f7f8fa; + border-radius: 16rpx; + padding: 0 24rpx; + display: flex; + align-items: center; + justify-content: space-between; + box-sizing: border-box; + margin-bottom: 24rpx; + + .picker-value { + font-size: 32rpx; + color: rgba(71, 85, 105, 1); + + &.is-placeholder { + color: rgba(148, 163, 184, 0.5); + } + } +} + +.picker-icon { + width: 40rpx; + height: 40rpx; + display: flex; + align-items: center; + justify-content: center; +} + +.icon-calendar { + width: 32rpx; + height: 32rpx; + border: 2rpx solid rgba(148, 163, 184, 0.5); + border-radius: 6rpx; + position: relative; + + &::before { + content: ''; + position: absolute; + top: 6rpx; + left: 4rpx; + right: 4rpx; + height: 2rpx; + background: rgba(148, 163, 184, 0.5); + } + + &::after { + content: ''; + position: absolute; + top: -6rpx; + left: 6rpx; + width: 4rpx; + height: 8rpx; + background: rgba(148, 163, 184, 0.5); + border-radius: 2rpx; + } +} + +/* ========== 上传 ========== */ +.upload-box { + height: 220rpx; + height: 350rpx; + border: 2rpx dashed #d1d5db; + border-radius: 16rpx; + display: flex; + align-items: center; + justify-content: center; + overflow: hidden; + background-color: rgba(247, 249, 251, 1); + + &.has-image { + border-style: solid; + border-color: transparent; + } + + .upload-inner { + display: flex; + flex-direction: column; + align-items: center; + .upload-camera { + width: 45rpx; + height: 45rpx; + margin-bottom: 12rpx; + } + .upload-text { + font-size: 24rpx; + color: rgba(148, 163, 184, 0.5); + } + } + + .upload-img { + width: 100%; + height: 100%; + border-radius: 16rpx; + } +} + +/* ========== 标签选择 ========== */ +.tag-list { + display: grid; + grid-template-columns: repeat(3, 1fr); + gap: 24rpx 22rpx; + .tag { + padding: 20rpx; + border-radius: 16rpx; + text-align: center; + font-size: 32rpx; + color: rgba(100, 116, 139, 1); + background: rgba(247, 248, 250, 1); + transition: all 0.2s; + + &.is-active { + background: rgba(74, 184, 253, 1); + color: #fff; + } + } +} + +/* ========== 议程列表头部 ========== */ +.section-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 28rpx 0; + border-radius: 24rpx; + margin-bottom: 16rpx; + + .section-title-wrap { + display: flex; + align-items: center; + } + + .section-title { + font-size: 36rpx; + font-weight: bold; + color: rgba(31, 41, 55, 1); + } + + .section-info { + margin-left: 8rpx; + width: 24rpx; + height: 24rpx; + } + + .add-btn { + padding: 18rpx 26rpx; + display: flex; + align-items: center; + gap: 8rpx; + color: rgba(74, 184, 253, 1); + font-size: 28rpx; + border: 1px solid rgba(74, 184, 253, 0.26); + border-radius: 16rpx; + + .add-icon { + width: 32rpx; + height: 32rpx; + } + + .add-text { + font-size: 26rpx; + } + } +} + +/* ========== 议程卡片 ========== */ +.agenda-card { + background: #fff; + border-radius: 24rpx; + overflow: hidden; + margin-bottom: 30rpx; + + .agenda-header { + display: flex; + align-items: center; + justify-content: space-between; + padding: 24rpx 32rpx; + } + + .agenda-name { + font-size: 30rpx; + font-weight: 600; + color: #1f2937; + } + + .agenda-del { + font-size: 26rpx; + color: #ef4444; + font-weight: 500; + display: flex; + align-items: center; + gap: 8rpx; + .icon { + width: 32rpx; + height: 32rpx; + } + } + + .agenda-body { + padding: 24rpx 32rpx; + } + + .agenda-group { + margin-bottom: 16rpx; + padding: 0; + background: transparent; + + &:last-child { + margin-bottom: 0; + } + } +} + +/* ========== 切换按钮 ========== */ +.toggle-group { + display: flex; + gap: 20rpx; + margin-bottom: 24rpx; + .toggle-btn { + flex: 1; + height: 76rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 16rpx; + font-size: 32rpx; + color: rgba(100, 116, 139, 1); + background: rgba(247, 248, 250, 1); + transition: all 0.2s; + + &.is-active { + background: rgba(74, 184, 253, 1); + color: #fff; + } + } +} + +/* ========== 子区块标题 ========== */ +.sub-section { + display: flex; + align-items: center; + margin-bottom: 24rpx; + + .sub-icon-wrap { + width: 86rpx; + height: 86rpx; + border-radius: 16rpx; + background: rgba(239, 249, 255, 1); + display: flex; + align-items: center; + justify-content: center; + margin-right: 23rpx; + flex-shrink: 0; + .icon { + width: 46rpx; + height: 46rpx; + } + } + + .sub-icon { + width: 36rpx; + height: 36rpx; + background: #3b82f6; + border-radius: 8rpx; + + &--checkin { + width: 32rpx; + height: 32rpx; + border-radius: 50%; + border: 4rpx solid #3b82f6; + background: transparent; + position: relative; + + &::after { + content: ''; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 12rpx; + height: 12rpx; + background: #3b82f6; + border-radius: 50%; + } + } + } + + .sub-text-wrap { + .sub-title { + font-size: 32rpx; + font-weight: 600; + color: rgba(17, 24, 39, 1); + display: block; + } + + .sub-desc { + font-size: 24rpx; + color: rgba(148, 163, 184, 1); + margin-top: 8rpx; + display: block; + } + } +} + +/* ========== 签到方式 ========== */ +.checkin-list { + display: flex; + gap: 20rpx; +} + +.checkin-item { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + padding: 28rpx 12rpx; + border-radius: 16rpx; + border: 2rpx solid #e5e7eb; + background: #fff; + transition: all 0.2s; + + &.is-active { + border-color: #3b82f6; + background: #eff6ff; + } + + .checkin-icon-wrap { + width: 72rpx; + height: 72rpx; + border-radius: 16rpx; + background: #f3f4f6; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 12rpx; + } + + .checkin-icon { + width: 40rpx; + height: 40rpx; + border-radius: 8rpx; + position: relative; + + &--dynamic { + background: #d1d5db; + + &::before { + content: ''; + position: absolute; + top: 6rpx; + left: 6rpx; + width: 12rpx; + height: 12rpx; + background: rgba(148, 163, 184, 0.5); + border-radius: 2rpx; + } + + &::after { + content: ''; + position: absolute; + bottom: 6rpx; + right: 6rpx; + width: 16rpx; + height: 16rpx; + border: 2rpx solid rgba(148, 163, 184, 0.5); + border-radius: 2rpx; + } + } + + &--fixed { + background: #d1d5db; + + &::before { + content: ''; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%); + width: 24rpx; + height: 24rpx; + border: 2rpx solid rgba(148, 163, 184, 0.5); + border-radius: 2rpx; + } + } + + &--none { + background: transparent; + border: 2rpx solid #d1d5db; + + &::before { + content: ''; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) rotate(45deg); + width: 2rpx; + height: 24rpx; + background: rgba(148, 163, 184, 0.5); + } + + &::after { + content: ''; + position: absolute; + top: 50%; + left: 50%; + transform: translate(-50%, -50%) rotate(-45deg); + width: 2rpx; + height: 24rpx; + background: rgba(148, 163, 184, 0.5); + } + } + } + + .checkin-name { + font-size: 24rpx; + color: #6b7280; + } +} + +/* ========== 提示文字 ========== */ +.form-tip { + display: flex; + align-items: flex-start; + padding: 18rpx 26rpx; + background-color: rgba(241, 249, 255, 1); + border: 1px solid rgba(74, 184, 253, 0.25); + border-radius: 16rpx; + + .form-tip-icon { + font-size: 24rpx; + color: #3b82f6; + margin-right: 8rpx; + margin-top: 2rpx; + flex-shrink: 0; + } + + .form-tip-text { + font-size: 26rpx; + color: rgba(148, 163, 184, 1); + line-height: 32rpx; + } +} + +/* ========== 底部按钮 ========== */ +.action-bar { + flex-shrink: 0; + padding: 24rpx 32rpx; + padding-bottom: calc(24rpx + env(safe-area-inset-bottom)); + background: #fff; + display: flex; + gap: 20rpx; + .btn { + height: 94rpx; + display: flex; + align-items: center; + justify-content: center; + border-radius: 12rpx; + font-size: 32rpx; + box-sizing: border-box; + + &.btn-primary { + flex: 1; + background: linear-gradient(90deg, #9ddffd 0%, #4ab8fd 100%); + box-shadow: 0rpx 15rpx 30rpx -6rpx rgba(74, 172, 219, 0.4); + color: #fff; + + &:active { + opacity: 0.9; + } + } + + &.btn-default { + flex: 1; + background: #fff; + color: rgba(74, 184, 253, 1); + border: 1px solid rgba(74, 184, 253, 1); + + &:active { + background: #eff6ff; + } + } + + &.btn--large { + width: 80%; + margin: 0 auto; + flex: none; + } + } +} + +/* ========== 结果页 ========== */ +.result-page { + flex: 1; + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + padding: 60rpx; + background: #f5f7fa; + + .result-circle { + width: 160rpx; + height: 160rpx; + border-radius: 50%; + background: #3b82f6; + display: flex; + align-items: center; + justify-content: center; + margin-bottom: 40rpx; + box-shadow: 0 8rpx 32rpx rgba(59, 130, 246, 0.3); + } + + .result-check { + font-size: 80rpx; + color: #fff; + font-weight: 700; + } + + .result-title { + font-size: 40rpx; + font-weight: 600; + color: #1f2937; + margin-bottom: 16rpx; + } + + .result-desc { + font-size: 28rpx; + color: #6b7280; + margin-bottom: 60rpx; + } +} + +.bottom-safe { + height: 40rpx; +} diff --git a/src/pages/actAdd/index.ts b/src/pages/actAdd/index.ts index 067b6bb..b5b8791 100644 --- a/src/pages/actAdd/index.ts +++ b/src/pages/actAdd/index.ts @@ -1,8 +1,185 @@ -const _app = getApp(); +const app = getApp() + +interface AgendaItem { + id: number + time: string + title: string + desc: string +} Page({ - data: {}, - onLoad() {}, -}); + data: { + currentStep: 1, + steps: [ + { label: '基本信息', field: 'basic' }, + { label: '报名签到设置', field: 'signup' }, + { label: '活动议程', field: 'agenda' }, + ], + + // 步骤1 基本信息 + coverImage: '', + title: '', + startTime: '', + endTime: '', + detail: '', + level: '', + levels: ['校级', '院级', '系级', '班级', '其他'], + category: '', + categories: ['讲座', '比赛', '社团活动', '志愿服务', '文体活动', '学术交流', '其他'], + location: '', + organizer: '', + contactName: '', + contactPhone: '', + + // 步骤2 活动议程 + agendas: [{ id: 1, time: '', title: '', desc: '' }] as AgendaItem[], + nextAgendaId: 2, + + // 步骤3 报名签到设置 + needRegister: true, + registerStartTime: '', + registerEndTime: '', + registerLimit: 'unlimited', + registerLimitCount: '', + registerCondition: '', + + checkinWay: 'dynamic', + checkinStartTime: '', + checkinEndTime: '', + }, + + onLoad() { + app.waitLogin() + }, + + // ========== 步骤切换 ========== + goStep(step: number) { + if (step < 1 || step > 4) return + this.setData({ currentStep: step }) + }, + + onNextStep() { + const next = this.data.currentStep + 1 + if (next <= 4) this.setData({ currentStep: next }) + }, + + onPrevStep() { + const prev = this.data.currentStep - 1 + if (prev >= 1) this.setData({ currentStep: prev }) + }, + + // ========== 图片上传 ========== + onChooseImage() { + wx.chooseMedia({ + count: 1, + mediaType: ['image'], + sourceType: ['album', 'camera'], + success: (res) => { + const tempFile = res.tempFiles[0]?.tempFilePath + if (tempFile) this.setData({ coverImage: tempFile }) + }, + }) + }, + + // ========== 输入绑定 ========== + onInputChange(e: WechatMiniprogram.Input) { + const { field } = e.currentTarget.dataset + this.setData({ [field]: e.detail.value }) + }, + + onTextareaChange(e: WechatMiniprogram.TextareaInput) { + const { field } = e.currentTarget.dataset + this.setData({ [field]: e.detail.value }) + }, + + // ========== 时间选择 ========== + onPickTime(e: WechatMiniprogram.PickerChange) { + const { field } = e.currentTarget.dataset + this.setData({ [field]: e.detail.value }) + }, + + // ========== 标签选择 ========== + onSelectLevel(e: WechatMiniprogram.TouchEvent) { + const { value } = e.currentTarget.dataset + this.setData({ level: value }) + }, + + onSelectCategory(e: WechatMiniprogram.TouchEvent) { + const { value } = e.currentTarget.dataset + this.setData({ category: value }) + }, + + // ========== 议程管理 ========== + onAddAgenda() { + const agendas = this.data.agendas + agendas.push({ + id: this.data.nextAgendaId, + time: '', + title: '', + desc: '', + }) + this.setData({ + agendas, + nextAgendaId: this.data.nextAgendaId + 1, + }) + }, + + onRemoveAgenda(e: WechatMiniprogram.TouchEvent) { + const { index } = e.currentTarget.dataset + const agendas = this.data.agendas.filter((_, i) => i !== index) + this.setData({ agendas }) + }, + + onAgendaInput(e: WechatMiniprogram.Input | WechatMiniprogram.TextareaInput) { + const { index, field } = e.currentTarget.dataset + const agendas = this.data.agendas + agendas[index][field] = e.detail.value + this.setData({ agendas }) + }, + + onAgendaTime(e: WechatMiniprogram.PickerChange) { + const { index } = e.currentTarget.dataset + const agendas = this.data.agendas + agendas[index].time = e.detail.value as string + this.setData({ agendas }) + }, + + // ========== 报名签到设置 ========== + onToggleRegister(e: WechatMiniprogram.TouchEvent) { + const { value } = e.currentTarget.dataset + this.setData({ needRegister: value === 'yes' }) + }, + + onToggleRegisterLimit(e: WechatMiniprogram.TouchEvent) { + const { value } = e.currentTarget.dataset + this.setData({ registerLimit: value }) + }, + + onSelectCheckinWay(e: WechatMiniprogram.TouchEvent) { + const { value } = e.currentTarget.dataset + this.setData({ checkinWay: value }) + }, + + // ========== 底部操作 ========== + onSaveDraft() { + wx.showToast({ title: '已保存草稿', icon: 'success' }) + }, + + onSubmit() { + wx.showModal({ + title: '确认提交', + content: '提交后将进入审核流程,是否继续?', + success: (res) => { + if (res.confirm) { + this.setData({ currentStep: 4 }) + } + }, + }) + }, + + onGoHome() { + wx.switchTab({ url: '/pages/index/index' }) + }, +}) export {} diff --git a/src/pages/actAdd/index.wxml b/src/pages/actAdd/index.wxml index e69de29..6120811 100644 --- a/src/pages/actAdd/index.wxml +++ b/src/pages/actAdd/index.wxml @@ -0,0 +1,487 @@ + + + + + + + + {{index + 1}} + + {{item.label}} + + + + + + + + + + + + 活动头图 + * + + + + + + + 点击上传 + + + + + + + + 活动标题 + * + + + + {{title.length || 0}}/50 + + + + + + 活动时间 + * + + + + {{startTime || '请选择开始时间'}} + + + + + + {{endTime || '请选择结束时间'}} + + + + + + + + 活动详情 + * + + +