hookehuyr

fix 修复修改活动逻辑问题

<!--
* @Date: 2022-09-21 16:04:10
* @LastEditors: hookehuyr hookehuyr@gmail.com
* @LastEditTime: 2022-10-19 17:15:26
* @LastEditTime: 2022-10-19 17:52:40
* @FilePath: /swx/src/pages/createActivity/index.vue
* @Description: 创建活动页面
-->
......@@ -40,7 +40,7 @@
</view>
<view class="sign-box">
<view @tap="onTapSign(item)" @longpress="onLongPressSign(item)" v-for="(item, index) in signInfo" :key="index"
class="sign-item" :class="{ 'checked': item.checked }"><text :class="{ 'required': item.required }">{{ item.label }}</text></view>
class="sign-item" :class="{ 'checked': item.checked }"><text :class="{ 'required': item.is_require }">{{ item.label }}</text></view>
<view class="sign-item" @tap="addSign">
<van-icon name="plus" color="" />
</view>
......@@ -384,25 +384,25 @@ const signInfo = ref([{
key: 'name',
label: '姓名',
checked: 1,
required: 1,
is_require: 1,
nop: true
}, {
key: 'phone',
label: '手机号',
checked: 1,
required: 1,
is_require: 1,
nop: true
}, {
key: 'gender',
label: '性别',
checked: 1,
required: 1,
is_require: 1,
nop: true
}, {
key: 'age_group',
label: '年龄段',
checked: 1,
required: 1,
is_require: 1,
nop: true
}]);
......@@ -416,7 +416,7 @@ const onLongPressSign = (item) => { // 长按编辑
// console.warn(item);
sign_filed.value.key = item.key;
sign_filed.value.name = item.label;
sign_filed.value.required = item.required;
sign_filed.value.is_require = item.is_require;
show_edit_sign.value = true;
}
......@@ -443,7 +443,7 @@ const confirmEditSign = () => { // 确认报名信息回调
signInfo.value.forEach(item => {
if (item.key === sign_filed.value.key) { // key值相同
item.label = sign_filed.value.name;
item.required = sign_filed.value.checked;
item.is_require = sign_filed.value.checked;
}
})
} else {
......@@ -451,7 +451,7 @@ const confirmEditSign = () => { // 确认报名信息回调
key: randomId(5),
label: sign_filed.value.name,
checked: 1,
required: sign_filed.value.checked ? 1 : 0,
is_require: sign_filed.value.checked ? 1 : 0,
nop: false,
type: 'player',
field: sign_filed.value.name
......@@ -750,8 +750,16 @@ const updateActivityInfo = async ({ activity, host }) => {
}
// 活动详情
html_content.value = activity.note;
activity_note.value = activity.note;
// 报名信息
signInfo.value = signInfo.value.concat(activity.fields);
if (activity.fields.length) {
activity.fields.forEach(item => {
item.label = item.field;
item.checked = 1;
item.nop = false;
})
signInfo.value = signInfo.value.concat(activity.fields);
}
// 活动时间
activity_time.value = dayjs(activity.activity_time).format('YYYY-MM-DD HH:mm');
// 开始时间
......@@ -773,17 +781,20 @@ const updateActivityInfo = async ({ activity, host }) => {
}
// 是否发布
publish_status.value = activity.status === 'disable' ? '暂不发布' : '立即发布';
status.value = activity.status;
// 活动方法
activity_type.value = activity.status === 'offline' ? '现场活动' : '线上活动';
// 活动地址
address.value = activity.address;
// 是否公开显示
public_type.value = activity.is_public === 0 ? '不公开' : '公开';
is_public.value = activity.is_public;
//
is_inner.value = activity.is_inner ? true : false;
is_black.value = activity.is_black ? true : false;
// 义工岗位
job_post.value = activity.extend.length ? activity.extend.join(',') : '';
extend.value = activity.extend;
}
}
</script>
......