diff --git a/app/index/controller/ContactUs.php b/app/index/controller/ContactUs.php new file mode 100644 index 00000000..56a3e8ec --- /dev/null +++ b/app/index/controller/ContactUs.php @@ -0,0 +1,99 @@ +isPost()) { + // 提交留言处理 + $form_data = request()->post([ + 'name', + 'email', + 'content' + ]); + + // 数据校验 + $validate = new ContactUsValidate; + if (!$validate->check($form_data)) { + return error($validate->getError()); + } + + // 保存留言 + $msg = LeaveMessageModel::create([ + 'language_id' => $this->lang_id, + 'name' => $form_data['name'], + 'email' => $form_data['email'], + 'content' => $form_data['content'], + 'ip' => request()->ip(), + 'user_agent' => request()->header('user-agent'), + ]); + if ($msg->isEmpty()) { + return error(lang('contact_message.send_fail')); + } + + return success(lang('contact_message.send_success')); + } + + $focus_image = []; + $our_information = []; + // 获取我的信息banner + $banner = SysBannerModel::with(['items' => function($query) { + $query->withoutField(['status', 'created_at', 'updated_at', 'deleted_at']) + ->where('status', '=', 1) + ->order(['sort' => 'asc', 'id' => 'desc']); + }]) + ->uniqueLabel([ + 'BANNER_6801be1e7d686', + 'BANNER_6801c053ce12e', + ]) + ->language($this->lang_id) + ->enabled(true) + ->select(); + if (!$banner->isEmpty()) { + $banner_map = []; + foreach ($banner as $v) { + $banner_map[$v->unique_label] = $v; + } + $focus_image = data_get($banner_map, 'BANNER_6801be1e7d686')?->items->first()?->toArray(); + $our_information = data_get($banner_map, 'BANNER_6801c053ce12e')?->items->toArray(); + } + View::assign('focus_image', $focus_image); + View::assign('our_information', $our_information); + + return View::fetch('message'); + } + + /** + * 留言成为分销商 + */ + public function distributor() + { + if (request()->isPost()) { + // 提交留言处理 + } + + return View::fetch('distributor'); + } +} diff --git a/app/index/lang/en-us.php b/app/index/lang/en-us.php index b4d3c7dd..1f212294 100644 --- a/app/index/lang/en-us.php +++ b/app/index/lang/en-us.php @@ -46,4 +46,28 @@ return [ 'events' => 'Brand Events', 'development' => 'Tech Development', ], + 'contact_message' => [ + 'title' => 'contact us', + 'our_information' => 'Our Information', + 'send_question' => 'Send Us Your Question', + 'form_name' => 'Yuor Name', + 'form_name_placeholder' => 'This is your placeholder text', + 'form_email' => 'Your Email', + 'form_email_placeholder' => 'This is your placeholder text', + 'form_question' => 'Your Message', + 'form_question_placeholder' => 'This is your placeholder text', + 'form_submit' => 'SEND', + 'become_a_distributor' => 'Become a Distributor', + // 验证器中文本 + 'validate_name_required' => 'Name is required', + 'validate_name_max' => 'Name cannot exceed 64 characters', + 'validate_email_required' => 'Email is required', + 'validate_email_email' => 'Email format is incorrect', + 'validate_email_max' => 'Email cannot exceed 128 characters', + 'validate_content_required' => 'Message is required', + 'validate_content_max' => 'Message cannot exceed 1024 characters', + // 返回文本 + 'send_success' => 'success', + 'send_fail' => 'fail', + ], ]; \ No newline at end of file diff --git a/app/index/lang/zh-cn.php b/app/index/lang/zh-cn.php index 7d05af86..646b714d 100644 --- a/app/index/lang/zh-cn.php +++ b/app/index/lang/zh-cn.php @@ -46,4 +46,28 @@ return [ 'events' => '品牌里程', 'development' => '品牌活动', ], + 'contact_message' => [ + 'title' => '联系我们', + 'our_information' => '我们的信息', + 'send_question' => '提交您的问题', + 'form_name' => '姓名', + 'form_name_placeholder' => '请输入你的姓名', + 'form_email' => '电子邮箱', + 'form_email_placeholder' => '请输入你的邮箱', + 'form_question' => '您的问题', + 'form_question_placeholder' => '请输入你的问题', + 'form_submit' => '发送', + 'become_a_distributor' => '成为经销商', + // 验证器中文本 + 'validate_name_required' => '姓名不能为空', + 'validate_name_max' => '姓名不能超过64个字符', + 'validate_email_required' => '邮箱不能为空', + 'validate_email_email' => '邮箱格式不正确', + 'validate_email_max' => '邮箱不能超过128个字符', + 'validate_content_required' => '问题不能为空', + 'validate_content_max' => '问题不能超过1024个字符', + // 返回文本 + 'send_success' => '提交成功', + 'send_fail' => '提交失败', + ], ]; \ No newline at end of file diff --git a/app/index/model/LeaveMessageModel.php b/app/index/model/LeaveMessageModel.php new file mode 100644 index 00000000..6077b52f --- /dev/null +++ b/app/index/model/LeaveMessageModel.php @@ -0,0 +1,15 @@ + ['规则1','规则2'...] + * + * @var array + */ + protected $rule = [ + 'name' => 'require|max:64', + 'email' => 'require|email|max:128', + 'content' => 'require|max:1024' + ]; + + /** + * 定义错误信息 + * 格式:'字段名.规则名' => '错误信息' + * + * @var array + */ + protected $message = [ + 'name.require' => 'contact_message.validate_name_required', + 'name.max' => 'contact_message.validate_name_max', + 'email.require' => 'contact_message.validate_email_required', + 'email.email' => 'contact_message.validate_email_email', + 'email.max' => 'contact_message.validate_email_max', + 'content.require' => 'contact_message.validate_content_required', + 'content.max' => 'contact_message.validate_content_max' + ]; +} diff --git a/app/index/view/contact_us/distributor.html b/app/index/view/contact_us/distributor.html new file mode 100644 index 00000000..e69de29b diff --git a/app/index/view/contact_us/index.html b/app/index/view/contact_us/index.html new file mode 100644 index 00000000..e69de29b diff --git a/app/index/view/contact_us/message.html b/app/index/view/contact_us/message.html new file mode 100644 index 00000000..ef7d48ff --- /dev/null +++ b/app/index/view/contact_us/message.html @@ -0,0 +1,108 @@ +{extend name="public/base" /} +{block name="title"}{:lang('contact_message.title')}{/block} +{block name="style"} + +{/block} +{block name="main"} +
+ +
+ {notempty name="focus_image"} + + + + {/notempty} +
+
+
+
{:lang('contact_message.our_information')}
+ {notempty name="our_information[0]"} +
+ {assign name="first_info" value="$our_information|array_shift" /} + {notempty name="first_info"} +
+ {notempty name="first_info.image"} +
+ {/notempty} +
+
{$first_info.title}:
+
{$first_info.desc|raw}
+
+
+ {/notempty} + {volist name="our_information|array_chunk=2" id="infos"} +
+ {volist name="infos" id="inf"} + {notempty name="inf.image"} +
+ {/notempty} +
+
{$inf.title}:
+
{$inf.desc|raw}
+
+ {/volist} +
+ {/volist} +
+ {/notempty} +
+
+
{:lang('contact_message.send_question')}
+
+
+
+
{:lang('contact_message.form_name')}*
+
+ +
+
+
+
{:lang('contact_message.form_email')} *
+
+ +
+
+
+
{:lang('contact_message.form_question')} *
+
+ +
+
+
+
{:lang('contact_message.form_submit')}
+
+
+
+
+
+ +
+
+
+{/block} +{block name="script"} + +{/block} \ No newline at end of file diff --git a/public/static/index/css/contact.css b/public/static/index/css/contact.css index 4319b927..8b139ce5 100755 --- a/public/static/index/css/contact.css +++ b/public/static/index/css/contact.css @@ -1,9 +1,10 @@ .orico_Page_contact { width: 100%; position: relative; - height: 100vh; + min-height: 100vh; overflow-y: auto; overflow-x: hidden; + padding-bottom: 3.75rem; background: #f1f1f1; } .orico_Page_contact .contactMain { @@ -25,7 +26,6 @@ border-radius: 1.5rem; display: flex; justify-content: flex-start; - width: 100%; padding: 4rem; margin-top: 3rem; } @@ -116,6 +116,7 @@ background: #f2f2f2; border: none; font-family: Montserrat-Regular, Montserrat; + resize: none; } .orico_Page_contact .contactMain .contact_c .all_contact .question .question_form .list .form_input input, .orico_Page_contact .contactMain .contact_c .all_contact .question .question_form .list .form_input textarea { diff --git a/public/static/index/images/ContactUs.png b/public/static/index/images/ContactUs.png new file mode 100755 index 00000000..1b0ea1b1 Binary files /dev/null and b/public/static/index/images/ContactUs.png differ diff --git a/public/static/index/images/contact_icon01.png b/public/static/index/images/contact_icon01.png new file mode 100755 index 00000000..5f686c07 Binary files /dev/null and b/public/static/index/images/contact_icon01.png differ diff --git a/public/static/index/images/contact_icon02.png b/public/static/index/images/contact_icon02.png new file mode 100755 index 00000000..24bc917f Binary files /dev/null and b/public/static/index/images/contact_icon02.png differ diff --git a/public/static/index/images/contact_icon03.png b/public/static/index/images/contact_icon03.png new file mode 100755 index 00000000..5971afa8 Binary files /dev/null and b/public/static/index/images/contact_icon03.png differ