mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-11-30 10:59:47 +08:00
问答字节优化
This commit is contained in:
parent
395c5cb1b8
commit
0d7ad4e712
@ -116,6 +116,19 @@ class Answer extends Common
|
||||
'field' => '*',
|
||||
);
|
||||
$ret = AnswerService::AnswerList($data_params);
|
||||
|
||||
// 内容
|
||||
if(!empty($ret['data'][0]['content']))
|
||||
{
|
||||
$ret['data'][0]['content'] = str_replace('<br />', "\n", $ret['data'][0]['content']);
|
||||
}
|
||||
|
||||
// 回复内容
|
||||
if(!empty($ret['data'][0]['reply']))
|
||||
{
|
||||
$ret['data'][0]['reply'] = str_replace('<br />', "\n", $ret['data'][0]['reply']);
|
||||
}
|
||||
|
||||
$data = empty($ret['data'][0]) ? [] : $ret['data'][0];
|
||||
}
|
||||
$this->assign('data', $data);
|
||||
|
@ -97,10 +97,16 @@
|
||||
{{/if}}
|
||||
</td>
|
||||
<td>{{$v.title}}</td>
|
||||
<td class="am-hide-sm-only reply-content">{{$v.content}}</td>
|
||||
<td class="am-hide-sm-only reply-content">
|
||||
<td class="am-hide-sm-only">
|
||||
<div class="reply-content">
|
||||
{{$v.content|raw}}
|
||||
</div>
|
||||
</td>
|
||||
<td class="am-hide-sm-only">
|
||||
{{if !empty($v['reply'])}}
|
||||
{{$v.reply}}
|
||||
<div class="reply-content">
|
||||
{{$v.reply|raw}}
|
||||
</div>
|
||||
{{else /}}
|
||||
<span class="cr-ddd">未回复</span>
|
||||
{{/if}}
|
||||
@ -160,7 +166,7 @@
|
||||
<dd>{{if empty($v['title'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.title}}{{/if}}</dd>
|
||||
|
||||
<dt>内容</dt>
|
||||
<dd>{{$v.content}}</dd>
|
||||
<dd>{{$v.content|raw}}</dd>
|
||||
|
||||
<dt>是否显示</dt>
|
||||
<dd>{{if empty($v['is_show_text'])}}<span class="cr-ddd">未填写</span>{{else /}}{{$v.is_show_text}}{{/if}}</dd>
|
||||
@ -168,7 +174,7 @@
|
||||
<dt>回复内容</dt>
|
||||
<dd>
|
||||
{{if !empty($v['reply'])}}
|
||||
{{$v.reply}}
|
||||
{{$v.reply|raw}}
|
||||
{{else /}}
|
||||
<span class="cr-ddd">未回复</span>
|
||||
{{/if}}
|
||||
|
@ -33,11 +33,11 @@
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label>内容<span class="am-form-group-label-tips-must">必填</span></label>
|
||||
<textarea class="am-radius am-validate" name="content" rows="5" minlength="5" maxlength="230" placeholder="5~230个字符之间" data-validation-message="内容格式 5~230 个字符之间" required>{{if !empty($data['content'])}}{{$data.content}}{{/if}}</textarea>
|
||||
<textarea class="am-radius am-validate" name="content" rows="5" minlength="5" maxlength="1000" placeholder="5~1000个字符之间" data-validation-message="内容格式 5~1000 个字符之间" required>{{if !empty($data['content'])}}{{$data.content}}{{/if}}</textarea>
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label>回复内容</label>
|
||||
<textarea class="am-radius am-validate" name="reply" rows="5" maxlength="230" placeholder="最多 230 个字符" data-validation-message="内容格式最多 230 个字符">{{if !empty($data['reply'])}}{{$data.reply}}{{/if}}</textarea>
|
||||
<textarea class="am-radius am-validate" name="reply" rows="5" maxlength="1000" placeholder="最多 1000 个字符" data-validation-message="内容格式最多 1000 个字符">{{if !empty($data['reply'])}}{{$data.reply}}{{/if}}</textarea>
|
||||
</div>
|
||||
|
||||
<div class="am-form-group">
|
||||
|
@ -24,7 +24,7 @@
|
||||
{{/if}}
|
||||
<p class="gray-text">阅读数:<span class="highlighted">{{$plugins_answers_detail.data.access_count}}</span></p>
|
||||
</div>
|
||||
<div class="base-content">{{$plugins_answers_detail.data.content}}</div>
|
||||
<div class="base-content">{{$plugins_answers_detail.data.content|raw}}</div>
|
||||
<div class="base-footer gray-text">
|
||||
留言时间:{{$plugins_answers_detail.data.add_time_date}}
|
||||
{{if !empty($plugins_answers_detail['data']['name'])}}
|
||||
@ -36,7 +36,7 @@
|
||||
{{if isset($plugins_answers_detail['data']['is_reply']) and $plugins_answers_detail['data']['is_reply'] eq 1}}
|
||||
<div class="am-panel-bd">
|
||||
<span class="am-badge am-radius am-badge-success">管理员已回答</span>
|
||||
<p class="reply-content">{{$plugins_answers_detail.data.reply}}</p>
|
||||
<p class="reply-content">{{$plugins_answers_detail.data.reply|raw}}</p>
|
||||
</div>
|
||||
<div class="base-footer gray-text reply-footer">
|
||||
回复时间:{{$plugins_answers_detail.data.reply_time_date}}
|
||||
|
@ -20,7 +20,7 @@
|
||||
</div>
|
||||
<div class="am-form-group">
|
||||
<label>内容<span class="am-form-group-label-tips-must">必填</span></label>
|
||||
<textarea class="am-radius am-validate" name="content" rows="5" minlength="5" maxlength="230" placeholder="内容至少5个字" data-validation-message="内容格式 5~230 个字符之间" required></textarea>
|
||||
<textarea class="am-radius am-validate" name="content" rows="5" minlength="5" maxlength="1000" placeholder="内容至少5个字" data-validation-message="内容格式 5~1000 个字符之间" required></textarea>
|
||||
</div>
|
||||
<div class="am-form-group am-form-group-refreshing">
|
||||
<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">提交</button>
|
||||
|
@ -77,6 +77,18 @@ class AnswerService
|
||||
$v['is_show_text'] = $common_is_show_list[$v['is_show']]['name'];
|
||||
}
|
||||
|
||||
// 内容
|
||||
if(!empty($v['content']))
|
||||
{
|
||||
$v['content'] = str_replace("\n", '<br />', $v['content']);
|
||||
}
|
||||
|
||||
// 回复内容
|
||||
if(!empty($v['reply']))
|
||||
{
|
||||
$v['reply'] = str_replace("\n", '<br />', $v['reply']);
|
||||
}
|
||||
|
||||
// 回复时间
|
||||
if(isset($v['reply_time']))
|
||||
{
|
||||
@ -196,8 +208,14 @@ class AnswerService
|
||||
[
|
||||
'checked_type' => 'empty',
|
||||
'key_name' => 'content',
|
||||
'error_msg' => '详细内容有误',
|
||||
]
|
||||
'error_msg' => '详细内容不能为空',
|
||||
],
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'key_name' => 'content',
|
||||
'checked_data' => '1000',
|
||||
'error_msg' => '详细内容格式 2~1000 个字符',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
if($ret !== true)
|
||||
@ -330,8 +348,8 @@ class AnswerService
|
||||
[
|
||||
'checked_type' => 'length',
|
||||
'key_name' => 'reply',
|
||||
'checked_data' => '2,230',
|
||||
'error_msg' => '回复内容格式 2~230 个字符',
|
||||
'checked_data' => '2,1000',
|
||||
'error_msg' => '回复内容格式 2~1000 个字符',
|
||||
],
|
||||
];
|
||||
$ret = ParamsChecked($params, $p);
|
||||
|
@ -23,4 +23,4 @@
|
||||
/**
|
||||
* 列表
|
||||
*/
|
||||
table.am-table .reply-content { max-width: 200px; }
|
||||
table.am-table .reply-content { max-width: 200px; max-height: 200px; overflow-y: scroll; overflow-x: hidden; }
|
Loading…
Reference in New Issue
Block a user