Browse Source

信息表单收集提交表单优化

master
wanghongjun 2 years ago
parent
commit
83807f2869
  1. 3
      addons/weliam_smartcity/api/Enroll.php
  2. 10
      addons/weliam_smartcity/core/class/FormTemplate.class.php
  3. 21
      addons/weliam_smartcity/core/model/MemberEnrollData.mod.php
  4. 1
      addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php
  5. 22
      addons/weliam_smartcity/sys/view/default/member/campus_activities/enroll_list.html

3
addons/weliam_smartcity/api/Enroll.php

@ -67,7 +67,8 @@ class EnrollModuleUniapp extends Uniapp
$info['data'] = FormTemplate::serializeTitle($info['data'],$info['id']);
$enroll_data[] = [
'name' => $info['title'],
'value' => $info['data']
'value' => $info['data'],
'filed_id' => $info['id']
];
}

10
addons/weliam_smartcity/core/class/FormTemplate.class.php

@ -99,11 +99,13 @@ class FormTemplate
*/
public static function unserializeTitle($value,$title)
{
$array = '';
if (in_array($title,self::$template_id_arr)) {
$value = unserialize($value);
} elseif (is_array($value)) {
$value = serialize($value);
$array = unserialize($value);
} elseif (is_string($value)) {
$array = unserialize($value);
}
return $value;
if (!is_array($array)) return $value;
return $array;
}
}

21
addons/weliam_smartcity/core/model/MemberEnrollData.mod.php

@ -14,6 +14,7 @@ class MemberEnrollData
foreach ($data as $value) {
$insert = [
'enroll_id' => $enroll_id,
'filed_id' => $value['filed_id'],
'filed_key' => $value['name'],
'field_value' => $value['value'],
];
@ -24,5 +25,25 @@ class MemberEnrollData
return true;
}
/**
* 返回数据
* @param $enroll_id
* @return array|false|mixed
*/
public static function getAll($enroll_id)
{
$list = pdo_getall(PDO_NAME . 'member_enroll_data',['enroll_id' => $enroll_id],['filed_key','field_value','filed_id']);
foreach ($list as &$item) {
$item['field_value'] = FormTemplate::unserializeTitle($item['field_value'],$item['filed_id']);
if (is_array($item['field_value'])) {
if ($item['filed_id'] != 'img') {
$item['field_value'] = implode("-",$item['field_value']);
}
}
}
return $list;
}
}

1
addons/weliam_smartcity/sys/controller/member/campusActivities.ctrl.php

@ -227,6 +227,7 @@ class campusActivities_WeliamController {
$item['temp_type_str'] = FormTemplate::$template_type[$item['template_type']];
$diyForm = FormTemplate::getDiyFormData($item['diyformid'],$item['template_type']);
$item['template_title'] = $diyForm ? $diyForm['title'] : '';
$item['enroll_data'] = MemberEnrollData::getAll($item['id']);
}
include wl_template('member/campus_activities/enroll_list');

22
addons/weliam_smartcity/sys/view/default/member/campus_activities/enroll_list.html

@ -62,11 +62,11 @@
<table class="table table-responsive">
<thead>
<tr>
<th style="width: 10%;">活动id</th>
<th style="width: 15%;">参与用户</th>
<th style="width: 15%;">模板标题</th>
<th style="width: 40%;">填写内容</th>
<th style="width: 20%;">报名时间</th>
<th style="width: 5%;">活动id</th>
<th style="width: 10%;">参与用户</th>
<th style="width: 10%;">模板标题</th>
<th style="width: 10%;">报名时间</th>
<th style="width: 65%;" colspan="20">填写内容</th>
</tr>
</thead>
<tbody>
@ -80,8 +80,18 @@
{$row['nickname']}
</td>
<td style="overflow: visible"><span style="word-break: break-word;">{php echo $row['template_title'];}</span></td>
<td style="overflow: visible"><span style="word-break: break-word;">{php echo $row['form_data'];}</span></td>
<td style="overflow: visible"><span style="word-break: break-word;">{php echo $row['create_time'];}</span></td>
{loop $row['enroll_data'] $enroll_data_row}
<td style="overflow: visible">
{if $enroll_data_row['filed_id'] == 'img'}
{loop $enroll_data_row['field_value'] $form_image}
<img class="scrollLoading" src="{$form_image}" data-url="{php echo $form_image" height="50" width="50"/>
{/loop}
{else}
{$enroll_data_row['filed_key']}:{$enroll_data_row['field_value']}
{/if}
</td>
{/loop}
</tr>
{/loop}
</tbody>

Loading…
Cancel
Save