Browse Source

落地页

Silent 6 năm trước cách đây
mục cha
commit
38b3ff0821

+ 65 - 0
app/Http/Controllers/Admin/FormDataController.php

xqd
@@ -0,0 +1,65 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Models\FormData;
+use Illuminate\Http\Request;
+
+class FormDataController extends Controller
+{
+    protected $redirect_index = '/admin/FormData/index';
+
+    protected $view_path = 'admin.form-data.';
+
+    protected $pre_uri = '/admin/FormData/';
+
+    protected $model_name = '表单数据';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new FormData();
+    }
+
+    public function index(Request $request)
+    {
+        $list = $this->model->where('id', '>', 0)->orderBy('created_at', 'desc');
+
+        if(!empty($request->input('keyword')) && !empty(trim($request->input('keyword')))) {
+            $keyword = '%' . trim($request->input('keyword')) . '%';
+            $list = $list->where('name', 'like', $keyword);
+        }
+
+        $list = $list->paginate()->withPath($this->getPaginateUrl());
+
+        list($pre_uri, $model_name) = array($this->pre_uri, $this->model_name);
+        return view($this->view_path . 'index', compact('list', 'pre_uri', 'model_name'));
+    }
+
+    public function show(Request $request)
+    {
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('参数错误');
+        }
+        list($pre_uri, $model_name) = array($this->pre_uri, $this->model_name);
+        return view($this->view_path . 'show', compact('list', 'pre_uri', 'model_name'));
+    }
+
+    public function delete(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id')))) {
+            return $this->showWarning('访问错误');
+        }
+
+        $res = $item->delete();
+        if(!$res) {
+            return $this->showWarning('数据库删除失败');
+        }
+        return $this->showMessage('操作成功');
+    }
+}

+ 59 - 0
app/Http/Controllers/Admin/FormSetController.php

xqd
@@ -0,0 +1,59 @@
+<?php
+
+namespace App\Http\Controllers\Admin;
+
+use App\Models\FormSet;
+use Illuminate\Http\Request;
+
+class FormSetController extends Controller
+{
+    protected $redirect_index = '/admin/FormSet/index';
+
+    protected $view_path = 'admin.form-sets.';
+
+    protected $pre_uri = '/admin/FormSet/';
+
+    protected $model_name = '表单设置';
+
+    protected $model;
+
+    public function __construct()
+    {
+        parent::__construct();
+        $this->model = new FormSet();
+    }
+
+    public function index()
+    {
+        $item = $this->model->first();
+        if(empty($item)) {
+            $item = $this->model->createDefault();
+        }
+
+        list($pre_uri, $model, $model_name) = array($this->pre_uri, $this->model, $this->model_name);
+
+        return view($this->view_path . 'index', compact('pre_uri', 'model', 'model_name', 'item'));
+    }
+
+    public function update(Request $request)
+    {
+        if(!$request->isMethod('POST')) {
+            return $this->showWarning('访问错误');
+        }
+        if(empty($request->input('id')) || empty($item = $this->model->find($request->input('id'))) || !is_array($request->input('data'))) {
+            return $this->showWarning('参数错误');
+        }
+        $data = $request->input('data');
+
+        $values = collect(['show_below_index', 'text_1_status', 'text_1_need',  'text_2_status', 'text_2_need', 'text_3_status', 'text_3_need', 'text_4_status', 'text_4_need', 'multi_text_status', 'multi_text_need', 'radio_status', 'radio_need', 'checkbox_status', 'checkbox_need']);
+
+        foreach($values as $value) {
+            $data[$value] = isset($data[$value]) ? $data[$value] : 2;
+        }
+
+        if(!$item->update($data)) {
+            return $this->showWarning('数据库保存失败');
+        }
+        return $this->showMessage('操作成功');
+    }
+}

+ 2 - 0
app/Http/Controllers/TestController.php

xqd xqd
@@ -2,6 +2,7 @@
 
 namespace App\Http\Controllers;
 
+use App\Models\Student;
 use App\Models\StudentCourse;
 use App\Services\Admin\AdminUser;
 use Carbon\Carbon;
@@ -11,6 +12,7 @@ class TestController extends Controller
 {
     public function index(Request $request)
     {
+        dd(Student::first());
         dd(bcrypt(123456));
         $items = collect([
             collect(['key' => 1, 'value' => 1, 'show_value' => '公告']),

+ 20 - 0
app/Models/FormData.php

xqd
@@ -0,0 +1,20 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class FormData extends Model
+{
+    protected $table = 'form_data';
+
+    protected $guarded = [];
+
+    public function getStatusLabel()
+    {
+        if($this['status'] == 1) {
+            return '<span class="label label-danger">未读</span>';
+        }
+        return '<span class="label label-success">已读</span>';
+    }
+}

+ 47 - 0
app/Models/FormSet.php

xqd
@@ -0,0 +1,47 @@
+<?php
+
+namespace App\Models;
+
+use Illuminate\Database\Eloquent\Model;
+
+class FormSet extends Model
+{
+    protected $table = 'form_sets';
+
+    protected $guarded = [];
+
+    public function createDefault()
+    {
+        return self::create([
+            'mode' => 1,
+            'show_below_index' => 1,
+            'top_title' => '产品咨询',
+            'top_desp' => '如果对我们的产品感兴趣,请填写下面的表单',
+            'interval' => 1,
+            'success_info' => '提交成功',
+            'text_1' => '姓名',
+            'text_1_status' => 1,
+            'text_1_need' => 1,
+            'text_2' => '联系方式',
+            'text_2_status' => 1,
+            'text_2_need' => 1,
+            'text_3' => '邮箱',
+            'text_3_status' => 1,
+            'text_3_need' => 1,
+            'text_4' => '其他',
+            'text_4_status' => 1,
+            'text_4_need' => 1,
+            'multi_text' => '请输入您的意见',
+            'multi_text_status' => 1,
+            'multi_text_need' => 1,
+            'radio' => '',
+            'radio_value' => '',
+            'radio_status' => 1,
+            'radio_need' => 1,
+            'checkbox' => '',
+            'checkbox_value' => '',
+            'checkbox_status' => 1,
+            'checkbox_need' => 1
+        ]);
+    }
+}

+ 40 - 0
database/migrations/2018_07_09_194216_create_form_datas_table.php

xqd
@@ -0,0 +1,40 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateFormDatasTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('form_data', function (Blueprint $table) {
+            $table->increments('id');
+            $table->tinyInteger('status')->nullable()->default(1)->comment('状态:1未读;2已读');
+            $table->unsignedInteger('student_id')->nullable()->comment('学员ID');
+            $table->string('text_1', 200)->nullable()->comment('第一行文本框');
+            $table->string('text_2', 200)->nullable()->comment('第二行文本框');
+            $table->string('text_3', 200)->nullable()->comment('第三行文本框');
+            $table->string('text_4', 200)->nullable()->comment('第四行文本框');
+            $table->text('multi_text')->nullable()->comment('多行的文本框');
+            $table->string('radio', 200)->nullable()->comment('单选');
+            $table->string('checkbox', 200)->nullable()->comment('多选');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('form_datas');
+    }
+}

+ 61 - 0
database/migrations/2018_07_09_195704_create_form_sets_table.php

xqd
@@ -0,0 +1,61 @@
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateFormSetsTable extends Migration
+{
+    /**
+     * Run the migrations.
+     *
+     * @return void
+     */
+    public function up()
+    {
+        Schema::create('form_sets', function (Blueprint $table) {
+            $table->increments('id');
+            $table->tinyInteger('mode')->nullable()->default(1)->comment('模板样式:1样式1;2样式2');
+            $table->tinyInteger('show_below_index')->nullable()->default(1)->comment('是否显示在首页下方:1是;2否');
+            $table->string('top_title', 200)->nullable()->comment('表单上方标题');
+            $table->string('top_image', 200)->nullable()->comment('表单上方图片');
+            $table->string('top_desp', 200)->nullable()->comment('表单上方文字说明');
+            $table->string('interval', 200)->nullable()->default(1)->comment('表单提交时间间隔');
+            $table->string('success_info', 200)->nullable()->comment('提交成功后的提示');
+            $table->string('text_1', 200)->nullable()->comment('第一行文本框');
+            $table->tinyInteger('text_1_status')->nullable()->default(1)->comment('是否使用:1使用;2禁用');
+            $table->tinyInteger('text_1_need')->nullable()->default(1)->comment('是否必填:1必填;2选填');
+            $table->string('text_2', 200)->nullable()->comment('第二行文本框');
+            $table->tinyInteger('text_2_status')->nullable()->default(1)->comment('是否使用:1使用;2禁用');
+            $table->tinyInteger('text_2_need')->nullable()->default(1)->comment('是否必填:1必填;2选填');
+            $table->string('text_3', 200)->nullable()->comment('第三行文本框');
+            $table->tinyInteger('text_3_status')->nullable()->default(1)->comment('是否使用:1使用;2禁用');
+            $table->tinyInteger('text_3_need')->nullable()->default(1)->comment('是否必填:1必填;2选填');
+            $table->string('text_4', 200)->nullable()->comment('第四行文本框');
+            $table->tinyInteger('text_4_status')->nullable()->default(1)->comment('是否使用:1使用;2禁用');
+            $table->tinyInteger('text_4_need')->nullable()->default(1)->comment('是否必填:1必填;2选填');
+            $table->text('multi_text')->nullable()->comment('多行文本框');
+            $table->tinyInteger('multi_text_status')->nullable()->default(1)->comment('是否使用:1使用;2禁用');
+            $table->tinyInteger('multi_text_need')->nullable()->default(1)->comment('是否必填:1必填;2选填');
+            $table->string('radio', 200)->nullable()->comment('单选框标题');
+            $table->string('radio_value', 200)->nullable()->comment('单选框值');
+            $table->tinyInteger('radio_status')->nullable()->default(1)->comment('是否使用:1使用;2禁用');
+            $table->tinyInteger('radio_need')->nullable()->default(1)->comment('是否必填:1必填;2选填');
+            $table->string('checkbox', 200)->nullable()->comment('复选框标题');
+            $table->string('checkbox_value', 200)->nullable()->comment('复选框值');
+            $table->tinyInteger('checkbox_status')->nullable()->default(1)->comment('是否使用:1使用;2禁用');
+            $table->tinyInteger('checkbox_need')->nullable()->default(1)->comment('是否必填:1必填;2选填');
+            $table->timestamps();
+        });
+    }
+
+    /**
+     * Reverse the migrations.
+     *
+     * @return void
+     */
+    public function down()
+    {
+        Schema::dropIfExists('form_sets');
+    }
+}

BIN
public/images/form_template_1.jpg


BIN
public/images/form_template_2.jpg


+ 1 - 1
resources/views/admin/auth/login.blade.php

xqd
@@ -19,7 +19,7 @@
         <div>
             <div>
                 <div>
-                    <h1 class="logo-name">A+</h1>
+                    <h1 class="logo-name" style="font-size: 50px; letter-spacing: 5px; margin: 50px 0">钢琴时间</h1>
                 </div>
                 <h3>管理后台</h3>
             </div>

+ 93 - 0
resources/views/admin/form-data/index.blade.php

xqd
@@ -0,0 +1,93 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $model_name }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <table class="table table-striped table-bordered table-hover dataTables-example dataTable" id="sg-main-table">
+                            <thead>
+                                <tr>
+                                    <th>ID</th>
+                                    <th>状态</th>
+                                    <th>时间</th>
+                                    <th>操作</th>
+                                </tr>
+                            </thead>
+                            <tbody>
+                                @if($list->count() <= 0)
+                                    <tr>
+                                        <td colspan="4" style="text-align: center;">暂无{{ $model_name }}</td>
+                                    </tr>
+                                @else
+                                    @foreach($list as $item)
+                                        <tr>
+                                            <td>{{ $item->id }}</td>
+                                            <td>{!! $item->getStatusLabel() !!}</td>
+                                            <td>{{ $item->created_at }}</td>
+                                            <td>
+                                                <div class="btn-group">
+                                                    <a class="btn btn-sm btn-info btn-edit" href="{{ $pre_uri . 'show?id=' . $item->id }}">查看</a>
+                                                    <div class="btn btn-sm btn-danger btn-delete" data-id="{{ $item->id }}">删除</div>
+                                                </div>
+                                            </td>
+                                        </tr>
+                                    @endforeach
+                                @endif
+                            </tbody>
+                        </table>
+                        <div class="row">
+                            <div class="col-sm-12">{{ $list->links() }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+<div class="modal fade" id="delete-modal" tabindex="-1" role="dialog" aria-labelledby="delete-label" aria-hidden="true">
+    <div class="modal-dialog">
+        <form id="delete-form" method="POST" action="{{ $pre_uri . 'delete' }}">
+            {{ csrf_field() }}
+
+            <input type="hidden" name="id" id="delete-input-id">
+            <div class="modal-content">
+                <div class="modal-header">
+                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
+                    <h4 class="modal-title" id="delete-label">确定要删除吗?</h4>
+                </div>
+                <div class="modal-footer">
+                    <button type="button" class="btn btn-default" data-dismiss="modal">取消</button>
+                    <button type="submit" class="btn btn-danger">删除</button>
+                </div>
+            </div>
+        </form>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+    $('#sg-main-table').on('click', '.btn-delete', function () {
+        $('#delete-input-id').val($(this).attr('data-id'));
+        $('#delete-modal').modal('show');
+    });
+})
+</script>
+@endsection

+ 46 - 0
resources/views/admin/form-data/show.blade.php

xqd
@@ -0,0 +1,46 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>{{ $model_name . '详情' }}</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <div class="sg-detail-container">
+                            <div class="row sg-item">{{ $item->text_1 }}</div>
+                            <div class="row sg-item">{{ $item->text_2 }}</div>
+                            <div class="row sg-item">{{ $item->text_3 }}</div>
+                            <div class="row sg-item">{{ $item->text_4 }}</div>
+                            <div class="row sg-item">{{ $item->multi_text }}</div>
+                            <div class="row sg-item">{{ $item->radio }}</div>
+                            <div class="row sg-item">{{ $item->checkbox }}</div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 228 - 0
resources/views/admin/form-sets/index.blade.php

xqd
@@ -0,0 +1,228 @@
+@extends('admin.layout')
+<style type="text/css">
+
+</style>
+@section('header')
+
+@endsection
+
+@section('content')
+<div id="sg-main-container-sg">
+    <div class="wrapper wrapper-content animated fadeInRight">
+        <div class="row">
+            <div class="col-sm-12">
+                <div class="ibox float-e-margins">
+                    <div class="ibox-title">
+                        <h5>表单设置</h5>
+                        <div class="ibox-tools">
+                            <a class="collapse-link"> <i class="fa fa-chevron-up"></i>
+                            </a>
+                        </div>
+                    </div>
+                    <div class="ibox-content">
+                        <form class="form-horizontal" method="POST" action="{{ $pre_uri . 'update' }}">
+                            {{ csrf_field() }}
+
+                            <input type="hidden" name="id" value="{{ $item->id }}">
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">模板样式选择</label>
+                                <div class="col-sm-4">
+                                    <img src="/images/form_template_1.jpg">
+                                    <label class="radio">
+                                        <input style="margin-left: 120px" type="radio" name="data[mode]" value="1" {{ $item->mode == 1 ? 'checked' : '' }}>
+                                    </label>
+                                </div>
+                                <div class="col-sm-4">
+                                    <img src="/images/form_template_2.jpg">
+                                    <label class="radio">
+                                        <input style="margin-left: 120px" type="radio" name="data[mode]" value="2" {{ $item->mode == 2 ? 'checked' : '' }}>
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">是否显示在首页下方</label>
+                                <div class="col-sm-8">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[show_below_index]" value="1" {{ $item->show_below_index == 1 ? 'checked' : '' }}>
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">表单上方标题</label>
+                                <div class="col-sm-8">
+                                    <input class="form-control" type="text" name="data[top_title]" value="{{ $item->top_title }}">
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">表单上方图片</label>
+                                <div class="col-sm-8">
+                                    {!!  widget('Tools.ImgUpload')->single('top-image', 'data[top_image]', $item->top_image) !!}
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">表单上方的说明文字</label>
+                                <div class="col-sm-8">
+                                    <input class="form-control" type="text" name="data[top_desp]" value="{{ $item->top_desp }}">
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">表单提交时间间隔</label>
+                                <div class="col-sm-4">
+                                    <input class="form-control" type="text" name="data[interval]" value="{{ $item->interval }}">
+                                </div>
+                                <div class="col-sm-4">为防止恶意重复提交,这里设置同一个客户两次提交数据的间隔时间,单位是分钟。如不需要此功能,填写0即可</div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">提交成功后的提示</label>
+                                <div class="col-sm-4">
+                                    <input class="form-control" type="text" name="data[success_info]" value="{{ $item->success_info }}">
+                                </div>
+                                <div class="col-sm-4">客户提交表单成功后,弹出的提示。例如:感谢提交的信息,我们会及时与您联系!</div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">一行的文本框</label>
+                                <div class="col-sm-4">
+                                    <input class="form-control" type="text" name="data[text_1]" value="{{ $item->text_1 }}">
+                                </div>
+                                <div class="col-sm-4">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[text_1_status]" value="1" {{ $item->text_1_status == 1 ? 'checked' : '' }}>是否使用
+                                    </label>
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[text_1_need]" value="1" {{ $item->text_1_need == 1 ? 'checked' : '' }}>是否必填
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">一行的文本框</label>
+                                <div class="col-sm-4">
+                                    <input class="form-control" type="text" name="data[text_2]" value="{{ $item->text_2 }}">
+                                </div>
+                                <div class="col-sm-4">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[text_2_status]" value="1" {{ $item->text_2_status == 1 ? 'checked' : '' }}>是否使用
+                                    </label>
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[text_2_need]" value="1" {{ $item->text_2_need == 1 ? 'checked' : '' }}>是否必填
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">一行的文本框</label>
+                                <div class="col-sm-4">
+                                    <input class="form-control" type="text" name="data[text_3]" value="{{ $item->text_3 }}">
+                                </div>
+                                <div class="col-sm-4">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[text_3_status]" value="1" {{ $item->text_3_status == 1 ? 'checked' : '' }}>是否使用
+                                    </label>
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[text_3_need]" value="1" {{ $item->text_3_need == 1 ? 'checked' : '' }}>是否必填
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">一行的文本框</label>
+                                <div class="col-sm-4">
+                                    <input class="form-control" type="text" name="data[text_4]" value="{{ $item->text_4 }}">
+                                </div>
+                                <div class="col-sm-4">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[text_4_status]" value="1" {{ $item->text_4_status == 1 ? 'checked' : '' }}>是否使用
+                                    </label>
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[text_4_need]" value="1" {{ $item->text_4_need == 1 ? 'checked' : '' }}>是否必填
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">多行的文本框</label>
+                                <div class="col-sm-4">
+                                    <textarea class="form-control" rows="3" name="data[multi_text]">{{ $item->multi_text }}</textarea>
+                                </div>
+                                <div class="col-sm-4">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[multi_text_status]" value="1" {{ $item->multi_text_status == 1 ? 'checked' : '' }}>是否使用
+                                    </label>
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[multi_text_need]" value="1" {{ $item->multi_text_need == 1 ? 'checked' : '' }}>是否必填
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">单选框</label>
+                                <div class="col-sm-4">
+                                    <input class="form-control" type="text" name="data[radio]" value="{{ $item->radio }}" placeholder="在这里输入单选框标题">
+                                </div>
+                                <div class="col-sm-4">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[radio_status]" value="1" {{ $item->radio_status == 1 ? 'checked' : '' }}>是否使用
+                                    </label>
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[radio_need]" value="1" {{ $item->radio_need == 1 ? 'checked' : '' }}>是否必填
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">单选框的值</label>
+                                <div class="col-sm-8">
+                                    <input class="form-control" type="text" name="data[radio_value]" value="{{ $item->radio_value }}" placeholder="每个值用英文逗号隔开,例如:高中,本科,硕士">
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">复选框</label>
+                                <div class="col-sm-4">
+                                    <input class="form-control" type="text" name="data[checkbox]" value="{{ $item->checkbox }}" placeholder="在这里输入复选框标题">
+                                </div>
+                                <div class="col-sm-4">
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[checkbox_status]" value="1" {{ $item->checkbox_status == 1 ? 'checked' : '' }}>是否使用
+                                    </label>
+                                    <label class="checkbox-inline">
+                                        <input type="checkbox" name="data[checkbox_need]" value="1" {{ $item->checkbox_need == 1 ? 'checked' : '' }}>是否必填
+                                    </label>
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <label class="col-sm-2 col-sm-offset-1 control-label">复选框的值</label>
+                                <div class="col-sm-8">
+                                    <input class="form-control" type="text" name="data[checkbox_value]" value="{{ $item->checkbox_value }}" placeholder="每个值用英文逗号隔开,例如:篮球,游泳,羽毛球">
+                                </div>
+                            </div>
+
+                            <div class="form-group row">
+                                <div class="col-sm-8 col-sm-offset-3">
+                                    <button type="submit" class="btn btn-sm btn-primary">保存设置</button>
+                                </div>
+                            </div>
+                        </form>
+                    </div>
+                </div>
+            </div>
+        </div>
+    </div>
+</div>
+@endsection
+
+@section('footer')
+<script type="text/javascript">
+$(function () {
+
+})
+</script>
+@endsection

+ 1 - 1
resources/views/teacher/auth/login.blade.php

xqd
@@ -19,7 +19,7 @@
         <div>
             <div>
                 <div>
-                    <h1 class="logo-name">A+</h1>
+                    <h1 class="logo-name" style="font-size: 50px; letter-spacing: 5px; margin: 50px 0">钢琴时间</h1>
                 </div>
                 <h3>讲师后台</h3>
             </div>

+ 18 - 0
wechat/app.js

xqd xqd
@@ -1,4 +1,5 @@
 //app.js
+var api = require('utils/api.js');
 App({
   onLaunch: function() {
     //调用API从本地缓存中获取数据
@@ -25,5 +26,22 @@ App({
 
   globalData: {
     userInfo: null
+  },
+  login: function () {
+    wx.login({
+      success: res => {
+        wx.request({
+          url: api.headUrl + res.code,
+          header: {
+            'content-type': 'json'
+          },
+          success: info => {
+            if (info.data.status == 'success') {
+              wx.setStorageSync('pt_student_id', info.data.id);
+            }
+          }
+        });
+      }
+    });
   }
 })

+ 5 - 0
wechat/utils/api.js

xqd
@@ -0,0 +1,5 @@
+const headUrl = 'http://t20.9026.com/api/';
+
+module.exports = {
+  headUrl: headUrl
+}