hookehuyr

🐞 fix: 活动时间创建时,需要落在报名时间之间

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-10-21 17:53:26 4 + * @LastEditTime: 2022-10-25 14:31:54
5 * @FilePath: /swx/src/pages/createActivity/index.vue 5 * @FilePath: /swx/src/pages/createActivity/index.vue
6 * @Description: 创建活动页面 6 * @Description: 创建活动页面
7 --> 7 -->
...@@ -277,6 +277,8 @@ import Toast from '@/components/vant-weapp/toast/toast'; ...@@ -277,6 +277,8 @@ import Toast from '@/components/vant-weapp/toast/toast';
277 import { randomId } from '@/utils/tools' 277 import { randomId } from '@/utils/tools'
278 import * as dayjs from 'dayjs' 278 import * as dayjs from 'dayjs'
279 import { activityInfoAPI } from '@/api/Host/index'; 279 import { activityInfoAPI } from '@/api/Host/index';
280 +var isBetween = require('dayjs/plugin/isBetween')
281 +dayjs.extend(isBetween);
280 282
281 const activity_name = ref(''); 283 const activity_name = ref('');
282 const onChange = ({ detail }) => { 284 const onChange = ({ detail }) => {
...@@ -695,6 +697,10 @@ const validForm = () => { // 校验表单 ...@@ -695,6 +697,10 @@ const validForm = () => { // 校验表单
695 Toast('报名开始时间不能晚于报名截止时间'); 697 Toast('报名开始时间不能晚于报名截止时间');
696 return false; 698 return false;
697 } 699 }
700 + if (!dayjs(activity_time.value).isBetween(dayjs(reg_begin_time.value), dayjs(reg_end_time.value), null, '[]')) {
701 + Toast('活动时间请在报名时间之间');
702 + return false;
703 + }
698 if (reg_max.value === '') { 704 if (reg_max.value === '') {
699 Toast('报名人数不能为空'); 705 Toast('报名人数不能为空');
700 return false; 706 return false;
......