Showing
1 changed file
with
33 additions
and
10 deletions
| 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-19 15:33:56 | 4 | + * @LastEditTime: 2022-10-19 16:07:06 |
| 5 | * @FilePath: /swx/src/pages/createActivity/index.vue | 5 | * @FilePath: /swx/src/pages/createActivity/index.vue |
| 6 | * @Description: 创建活动页面 | 6 | * @Description: 创建活动页面 |
| 7 | --> | 7 | --> |
| ... | @@ -73,7 +73,7 @@ | ... | @@ -73,7 +73,7 @@ |
| 73 | <!-- 人数限制 --> | 73 | <!-- 人数限制 --> |
| 74 | <van-field :value="reg_max" label-class="label-class-super" input-class="input-class" label="人数限制" | 74 | <van-field :value="reg_max" label-class="label-class-super" input-class="input-class" label="人数限制" |
| 75 | :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle="" | 75 | :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle="" |
| 76 | - maxlength="" type="" :border="true" @tap="show_popup=true" :required="false" :disabled="true" /> | 76 | + maxlength="" type="" :border="true" @tap="onShowRegMax" :required="false" :disabled="true" /> |
| 77 | <!-- 是否发布 --> | 77 | <!-- 是否发布 --> |
| 78 | <van-field :value="publish_status" label-class="label-class-super" input-class="input-class" label="是否发布" | 78 | <van-field :value="publish_status" label-class="label-class-super" input-class="input-class" label="是否发布" |
| 79 | :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle="" | 79 | :right-icon="icon_sel" input-align="right" placeholder="请选择" placeholder-style="color: #999;" customStyle="" |
| ... | @@ -500,23 +500,37 @@ const onEndTime = (arr) => { | ... | @@ -500,23 +500,37 @@ const onEndTime = (arr) => { |
| 500 | 500 | ||
| 501 | 501 | ||
| 502 | /********* 人数限制 *********/ | 502 | /********* 人数限制 *********/ |
| 503 | -const reg_max = ref('') | 503 | +const reg_max = ref(''); // 表单显示人数绑定 |
| 504 | -const temp_reg_max = ref('') | 504 | +const temp_reg_max = ref(''); // 弹框显示人数绑定 |
| 505 | const limit_number = ref(false); | 505 | const limit_number = ref(false); |
| 506 | + | ||
| 506 | const onRegMaxChange = ({ detail }) => { | 507 | const onRegMaxChange = ({ detail }) => { |
| 507 | - temp_reg_max.value = detail | 508 | + temp_reg_max.value = detail; |
| 508 | } | 509 | } |
| 509 | const onChangeLimit = ({ detail }) => { // 不限制开关回调 | 510 | const onChangeLimit = ({ detail }) => { // 不限制开关回调 |
| 510 | - if (detail) { | 511 | + limit_number.value = detail |
| 511 | - limit_number.value = detail | 512 | + if (detail) { // 无限制清空数据 |
| 513 | + temp_reg_max.value = ''; | ||
| 514 | + } | ||
| 515 | +} | ||
| 516 | + | ||
| 517 | +let show_popup = ref(false); | ||
| 518 | +const clone_limit_number = ref(false); // 保存原始开关数据 | ||
| 519 | +const clone_reg_max = ref(''); // 保存原始人数数据 | ||
| 520 | +const onShowRegMax = () => { // 打开弹框 | ||
| 521 | + show_popup.value = true; | ||
| 522 | + if (reg_max.value !== '无限制') { | ||
| 523 | + clone_reg_max.value = reg_max.value; | ||
| 512 | } else { | 524 | } else { |
| 513 | - limit_number.value = detail | 525 | + clone_limit_number.value = true; |
| 514 | - temp_reg_max.value = '' | 526 | + clone_reg_max.value = '无限制'; |
| 515 | } | 527 | } |
| 516 | } | 528 | } |
| 517 | -const show_popup = ref(false); | ||
| 518 | const closeEditLimit = () => { | 529 | const closeEditLimit = () => { |
| 519 | show_popup.value = false; | 530 | show_popup.value = false; |
| 531 | + // 还原数据 | ||
| 532 | + reg_max.value = clone_reg_max.value; | ||
| 533 | + limit_number.value = clone_limit_number.value; | ||
| 520 | } | 534 | } |
| 521 | const confirmEditLimit = () => { // 提交人数限制 | 535 | const confirmEditLimit = () => { // 提交人数限制 |
| 522 | if (limit_number.value) { | 536 | if (limit_number.value) { |
| ... | @@ -738,6 +752,15 @@ const updateActivityInfo = async ({ activity, host }) => { | ... | @@ -738,6 +752,15 @@ const updateActivityInfo = async ({ activity, host }) => { |
| 738 | defaultActivityTime = formatInfoDate(activity.activity_time); | 752 | defaultActivityTime = formatInfoDate(activity.activity_time); |
| 739 | defaultStartTime = formatInfoDate(activity.reg_begin_time); | 753 | defaultStartTime = formatInfoDate(activity.reg_begin_time); |
| 740 | defaultEndTime = formatInfoDate(activity.reg_end_time); | 754 | defaultEndTime = formatInfoDate(activity.reg_end_time); |
| 755 | + // 人数限制字段 | ||
| 756 | + if (activity.reg_max) { // 有人数 | ||
| 757 | + limit_number.value = false; | ||
| 758 | + temp_reg_max.value = activity.reg_max; | ||
| 759 | + reg_max.value = activity.reg_max; | ||
| 760 | + } else { // 无限制 | ||
| 761 | + limit_number.value = true; | ||
| 762 | + reg_max.value = '无限制'; | ||
| 763 | + } | ||
| 741 | } | 764 | } |
| 742 | } | 765 | } |
| 743 | </script> | 766 | </script> | ... | ... |
-
Please register or login to post a comment