refactor(页面配置): 更新应用名称并优化日期选择器初始化逻辑
将应用名称从"静待花开-活动小助手"统一更新为"智院三仟" 修复日期选择器初始化问题,确保时间戳有效并设置默认值
Showing
4 changed files
with
34 additions
and
15 deletions
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-28 13:02:23 | 4 | + * @LastEditTime: 2025-08-18 22:03:46 |
| 5 | * @FilePath: /swx/src/pages/_index/index.config.js | 5 | * @FilePath: /swx/src/pages/_index/index.config.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| 8 | export default { | 8 | export default { |
| 9 | - navigationBarTitleText: '静待花开-活动小助手', | 9 | + navigationBarTitleText: '智院三仟', |
| 10 | usingComponents: { | 10 | usingComponents: { |
| 11 | }, | 11 | }, |
| 12 | } | 12 | } | ... | ... |
| 1 | <!-- | 1 | <!-- |
| 2 | * @Date: 2022-09-21 16:04:10 | 2 | * @Date: 2022-09-21 16:04:10 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-12-08 10:21:46 | 4 | + * @LastEditTime: 2025-08-18 22:11:06 |
| 5 | * @FilePath: /swx/src/pages/createActivity/index.vue | 5 | * @FilePath: /swx/src/pages/createActivity/index.vue |
| 6 | * @Description: 创建活动页面 | 6 | * @Description: 创建活动页面 |
| 7 | --> | 7 | --> |
| ... | @@ -432,9 +432,14 @@ onMounted(async () => { | ... | @@ -432,9 +432,14 @@ onMounted(async () => { |
| 432 | updateActivityInfo(data); | 432 | updateActivityInfo(data); |
| 433 | } | 433 | } |
| 434 | } else { | 434 | } else { |
| 435 | + // 新建活动时设置默认时间 | ||
| 435 | defaultActivityTime = getTime("min", 1); | 436 | defaultActivityTime = getTime("min", 1); |
| 436 | defaultStartTime = getTime("min", 1); | 437 | defaultStartTime = getTime("min", 1); |
| 437 | defaultEndTime = getTime("min", 1); | 438 | defaultEndTime = getTime("min", 1); |
| 439 | + // 初始化日期选择器的值 | ||
| 440 | + currentActivityDate.value = getTime("min", 1).getTime(); | ||
| 441 | + currentBeginDate.value = getTime("min", 1).getTime(); | ||
| 442 | + currentEndDate.value = getTime("min", 1).getTime(); | ||
| 438 | } | 443 | } |
| 439 | nextTick(() => { | 444 | nextTick(() => { |
| 440 | setTimeout(() => { | 445 | setTimeout(() => { |
| ... | @@ -568,13 +573,17 @@ const reg_end_time = ref(''); | ... | @@ -568,13 +573,17 @@ const reg_end_time = ref(''); |
| 568 | const show_activity_time = ref(false); | 573 | const show_activity_time = ref(false); |
| 569 | const show_reg_begin_time = ref(false); | 574 | const show_reg_begin_time = ref(false); |
| 570 | const show_reg_end_time = ref(false); | 575 | const show_reg_end_time = ref(false); |
| 571 | -let currentActivityDate = new Date().getTime() | 576 | +// 确保传入的是有效的时间戳 |
| 572 | -let currentBeginDate = new Date().getTime() | 577 | +let currentActivityDate = ref(new Date().getTime()) |
| 573 | -let currentEndDate = new Date().getTime() | 578 | +let currentBeginDate = ref(new Date().getTime()) |
| 579 | +let currentEndDate = ref(new Date().getTime()) | ||
| 574 | 580 | ||
| 575 | const onActivityConfirm = ({ detail }) => { | 581 | const onActivityConfirm = ({ detail }) => { |
| 576 | - currentActivityDate = detail; | 582 | + // 确保 detail 是有效的时间戳 |
| 577 | - activity_time.value = moment(detail).format('YYYY-MM-DD HH:mm') | 583 | + if (detail && !isNaN(detail)) { |
| 584 | + currentActivityDate.value = detail; | ||
| 585 | + activity_time.value = moment(detail).format('YYYY-MM-DD HH:mm') | ||
| 586 | + } | ||
| 578 | show_activity_time.value = false; | 587 | show_activity_time.value = false; |
| 579 | } | 588 | } |
| 580 | const onActivityCancel = () => { | 589 | const onActivityCancel = () => { |
| ... | @@ -582,8 +591,11 @@ const onActivityCancel = () => { | ... | @@ -582,8 +591,11 @@ const onActivityCancel = () => { |
| 582 | } | 591 | } |
| 583 | 592 | ||
| 584 | const onBeginConfirm = ({ detail }) => { | 593 | const onBeginConfirm = ({ detail }) => { |
| 585 | - currentBeginDate = detail; | 594 | + // 确保 detail 是有效的时间戳 |
| 586 | - reg_begin_time.value = moment(detail).format('YYYY-MM-DD HH:mm') | 595 | + if (detail && !isNaN(detail)) { |
| 596 | + currentBeginDate.value = detail; | ||
| 597 | + reg_begin_time.value = moment(detail).format('YYYY-MM-DD HH:mm') | ||
| 598 | + } | ||
| 587 | show_reg_begin_time.value = false; | 599 | show_reg_begin_time.value = false; |
| 588 | } | 600 | } |
| 589 | const onBeginCancel = () => { | 601 | const onBeginCancel = () => { |
| ... | @@ -591,8 +603,11 @@ const onBeginCancel = () => { | ... | @@ -591,8 +603,11 @@ const onBeginCancel = () => { |
| 591 | } | 603 | } |
| 592 | 604 | ||
| 593 | const onEndConfirm = ({ detail }) => { | 605 | const onEndConfirm = ({ detail }) => { |
| 594 | - currentEndDate = detail; | 606 | + // 确保 detail 是有效的时间戳 |
| 595 | - reg_end_time.value = moment(detail).format('YYYY-MM-DD HH:mm') | 607 | + if (detail && !isNaN(detail)) { |
| 608 | + currentEndDate.value = detail; | ||
| 609 | + reg_end_time.value = moment(detail).format('YYYY-MM-DD HH:mm') | ||
| 610 | + } | ||
| 596 | show_reg_end_time.value = false; | 611 | show_reg_end_time.value = false; |
| 597 | } | 612 | } |
| 598 | const onEndCancel = () => { | 613 | const onEndCancel = () => { |
| ... | @@ -916,6 +931,10 @@ const updateActivityInfo = async ({ activity, host }) => { | ... | @@ -916,6 +931,10 @@ const updateActivityInfo = async ({ activity, host }) => { |
| 916 | reg_begin_time.value = moment(activity.reg_begin_time).format('YYYY-MM-DD HH:mm'); | 931 | reg_begin_time.value = moment(activity.reg_begin_time).format('YYYY-MM-DD HH:mm'); |
| 917 | // 结束时间 | 932 | // 结束时间 |
| 918 | reg_end_time.value = moment(activity.reg_end_time).format('YYYY-MM-DD HH:mm'); | 933 | reg_end_time.value = moment(activity.reg_end_time).format('YYYY-MM-DD HH:mm'); |
| 934 | + // 设置日期选择器的当前值 | ||
| 935 | + currentActivityDate.value = new Date(activity.activity_time).getTime(); | ||
| 936 | + currentBeginDate.value = new Date(activity.reg_begin_time).getTime(); | ||
| 937 | + currentEndDate.value = new Date(activity.reg_end_time).getTime(); | ||
| 919 | // 默认弹框活动时间 | 938 | // 默认弹框活动时间 |
| 920 | defaultActivityTime = formatInfoDate(activity.activity_time); | 939 | defaultActivityTime = formatInfoDate(activity.activity_time); |
| 921 | defaultStartTime = formatInfoDate(activity.reg_begin_time); | 940 | defaultStartTime = formatInfoDate(activity.reg_begin_time); | ... | ... |
| 1 | /* | 1 | /* |
| 2 | * @Date: 2022-09-19 14:11:06 | 2 | * @Date: 2022-09-19 14:11:06 |
| 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com | 3 | * @LastEditors: hookehuyr hookehuyr@gmail.com |
| 4 | - * @LastEditTime: 2022-10-28 13:02:27 | 4 | + * @LastEditTime: 2025-08-18 22:03:38 |
| 5 | * @FilePath: /swx/src/pages/index/index.config.js | 5 | * @FilePath: /swx/src/pages/index/index.config.js |
| 6 | * @Description: 文件描述 | 6 | * @Description: 文件描述 |
| 7 | */ | 7 | */ |
| 8 | export default { | 8 | export default { |
| 9 | - navigationBarTitleText: '静待花开-活动小助手', | 9 | + navigationBarTitleText: '智院三仟', |
| 10 | usingComponents: { | 10 | usingComponents: { |
| 11 | }, | 11 | }, |
| 12 | enableShareAppMessage: true | 12 | enableShareAppMessage: true | ... | ... |
| ... | @@ -197,7 +197,7 @@ export default { | ... | @@ -197,7 +197,7 @@ export default { |
| 197 | onShareAppMessage(options) { | 197 | onShareAppMessage(options) { |
| 198 | // 设置菜单中的转发按钮触发转发事件时的转发内容 | 198 | // 设置菜单中的转发按钮触发转发事件时的转发内容 |
| 199 | var shareObj = { | 199 | var shareObj = { |
| 200 | - title: "静待花开-活动小助手", // 默认是小程序的名称(可以写slogan等) | 200 | + title: "智院三仟", // 默认是小程序的名称(可以写slogan等) |
| 201 | path: 'pages/index/index', // 默认是当前页面,必须是以‘/'开头的完整路径 | 201 | path: 'pages/index/index', // 默认是当前页面,必须是以‘/'开头的完整路径 |
| 202 | imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 | 202 | imageUrl: '', //自定义图片路径,可以是本地文件路径、代码包文件路径或者网络图片路径,支持PNG及JPG,不传入 imageUrl 则使用默认截图。显示图片长宽比是 5:4 |
| 203 | success: function (res) { | 203 | success: function (res) { | ... | ... |
-
Please register or login to post a comment