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-19 17:15:26 4 + * @LastEditTime: 2022-10-19 17:52:40
5 * @FilePath: /swx/src/pages/createActivity/index.vue 5 * @FilePath: /swx/src/pages/createActivity/index.vue
6 * @Description: 创建活动页面 6 * @Description: 创建活动页面
7 --> 7 -->
...@@ -40,7 +40,7 @@ ...@@ -40,7 +40,7 @@
40 </view> 40 </view>
41 <view class="sign-box"> 41 <view class="sign-box">
42 <view @tap="onTapSign(item)" @longpress="onLongPressSign(item)" v-for="(item, index) in signInfo" :key="index" 42 <view @tap="onTapSign(item)" @longpress="onLongPressSign(item)" v-for="(item, index) in signInfo" :key="index"
43 - class="sign-item" :class="{ 'checked': item.checked }"><text :class="{ 'required': item.required }">{{ item.label }}</text></view> 43 + class="sign-item" :class="{ 'checked': item.checked }"><text :class="{ 'required': item.is_require }">{{ item.label }}</text></view>
44 <view class="sign-item" @tap="addSign"> 44 <view class="sign-item" @tap="addSign">
45 <van-icon name="plus" color="" /> 45 <van-icon name="plus" color="" />
46 </view> 46 </view>
...@@ -384,25 +384,25 @@ const signInfo = ref([{ ...@@ -384,25 +384,25 @@ const signInfo = ref([{
384 key: 'name', 384 key: 'name',
385 label: '姓名', 385 label: '姓名',
386 checked: 1, 386 checked: 1,
387 - required: 1, 387 + is_require: 1,
388 nop: true 388 nop: true
389 }, { 389 }, {
390 key: 'phone', 390 key: 'phone',
391 label: '手机号', 391 label: '手机号',
392 checked: 1, 392 checked: 1,
393 - required: 1, 393 + is_require: 1,
394 nop: true 394 nop: true
395 }, { 395 }, {
396 key: 'gender', 396 key: 'gender',
397 label: '性别', 397 label: '性别',
398 checked: 1, 398 checked: 1,
399 - required: 1, 399 + is_require: 1,
400 nop: true 400 nop: true
401 }, { 401 }, {
402 key: 'age_group', 402 key: 'age_group',
403 label: '年龄段', 403 label: '年龄段',
404 checked: 1, 404 checked: 1,
405 - required: 1, 405 + is_require: 1,
406 nop: true 406 nop: true
407 }]); 407 }]);
408 408
...@@ -416,7 +416,7 @@ const onLongPressSign = (item) => { // 长按编辑 ...@@ -416,7 +416,7 @@ const onLongPressSign = (item) => { // 长按编辑
416 // console.warn(item); 416 // console.warn(item);
417 sign_filed.value.key = item.key; 417 sign_filed.value.key = item.key;
418 sign_filed.value.name = item.label; 418 sign_filed.value.name = item.label;
419 - sign_filed.value.required = item.required; 419 + sign_filed.value.is_require = item.is_require;
420 show_edit_sign.value = true; 420 show_edit_sign.value = true;
421 } 421 }
422 422
...@@ -443,7 +443,7 @@ const confirmEditSign = () => { // 确认报名信息回调 ...@@ -443,7 +443,7 @@ const confirmEditSign = () => { // 确认报名信息回调
443 signInfo.value.forEach(item => { 443 signInfo.value.forEach(item => {
444 if (item.key === sign_filed.value.key) { // key值相同 444 if (item.key === sign_filed.value.key) { // key值相同
445 item.label = sign_filed.value.name; 445 item.label = sign_filed.value.name;
446 - item.required = sign_filed.value.checked; 446 + item.is_require = sign_filed.value.checked;
447 } 447 }
448 }) 448 })
449 } else { 449 } else {
...@@ -451,7 +451,7 @@ const confirmEditSign = () => { // 确认报名信息回调 ...@@ -451,7 +451,7 @@ const confirmEditSign = () => { // 确认报名信息回调
451 key: randomId(5), 451 key: randomId(5),
452 label: sign_filed.value.name, 452 label: sign_filed.value.name,
453 checked: 1, 453 checked: 1,
454 - required: sign_filed.value.checked ? 1 : 0, 454 + is_require: sign_filed.value.checked ? 1 : 0,
455 nop: false, 455 nop: false,
456 type: 'player', 456 type: 'player',
457 field: sign_filed.value.name 457 field: sign_filed.value.name
...@@ -750,8 +750,16 @@ const updateActivityInfo = async ({ activity, host }) => { ...@@ -750,8 +750,16 @@ const updateActivityInfo = async ({ activity, host }) => {
750 } 750 }
751 // 活动详情 751 // 活动详情
752 html_content.value = activity.note; 752 html_content.value = activity.note;
753 + activity_note.value = activity.note;
753 // 报名信息 754 // 报名信息
754 - signInfo.value = signInfo.value.concat(activity.fields); 755 + if (activity.fields.length) {
756 + activity.fields.forEach(item => {
757 + item.label = item.field;
758 + item.checked = 1;
759 + item.nop = false;
760 + })
761 + signInfo.value = signInfo.value.concat(activity.fields);
762 + }
755 // 活动时间 763 // 活动时间
756 activity_time.value = dayjs(activity.activity_time).format('YYYY-MM-DD HH:mm'); 764 activity_time.value = dayjs(activity.activity_time).format('YYYY-MM-DD HH:mm');
757 // 开始时间 765 // 开始时间
...@@ -773,17 +781,20 @@ const updateActivityInfo = async ({ activity, host }) => { ...@@ -773,17 +781,20 @@ const updateActivityInfo = async ({ activity, host }) => {
773 } 781 }
774 // 是否发布 782 // 是否发布
775 publish_status.value = activity.status === 'disable' ? '暂不发布' : '立即发布'; 783 publish_status.value = activity.status === 'disable' ? '暂不发布' : '立即发布';
784 + status.value = activity.status;
776 // 活动方法 785 // 活动方法
777 activity_type.value = activity.status === 'offline' ? '现场活动' : '线上活动'; 786 activity_type.value = activity.status === 'offline' ? '现场活动' : '线上活动';
778 // 活动地址 787 // 活动地址
779 address.value = activity.address; 788 address.value = activity.address;
780 // 是否公开显示 789 // 是否公开显示
781 public_type.value = activity.is_public === 0 ? '不公开' : '公开'; 790 public_type.value = activity.is_public === 0 ? '不公开' : '公开';
791 + is_public.value = activity.is_public;
782 // 792 //
783 is_inner.value = activity.is_inner ? true : false; 793 is_inner.value = activity.is_inner ? true : false;
784 is_black.value = activity.is_black ? true : false; 794 is_black.value = activity.is_black ? true : false;
785 // 义工岗位 795 // 义工岗位
786 job_post.value = activity.extend.length ? activity.extend.join(',') : ''; 796 job_post.value = activity.extend.length ? activity.extend.join(',') : '';
797 + extend.value = activity.extend;
787 } 798 }
788 } 799 }
789 </script> 800 </script>
......