12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182 |
- {include file="public/header" /}
- <body class="gray-bg">
- <div class="layui-fluid layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-body layui-form">
- <div class="layui-row layui-col-space10 layui-form-item ">
- <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
- <label class="layui-form-label">轮播图片</label>
- <input type="hidden" name="image" id="image" value="{$data.image}">
- <button type="button" class="layui-btn" id="test5">
- 选择文件
- </button>
- <div class="layui-input-block">
- <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
- 预览图:
- <div class="layui-upload-list" >
- <img src="{$data.image}" id="images" style="width:100px;height:100px;">
- </div>
- </blockquote>
- </div>
- </div>
- <input type="hidden" name="cid" value="{$data.cid}">
- <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
- <label class="layui-form-label">url(可为空)</label>
- <div class="layui-input-block">
- <textarea name="url" placeholder="图片地址(为空请填0)" lay-verify="required" class="layui-textarea" maxlength="200">{$data.url}</textarea>
- </div>
- </div>
- <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
- <div class="layui-input-block">
- <button class="layui-btn" lay-submit="" lay-filter="component-form-element">保存
- </button>
- <button class="layui-btn layui-btn-primary" onclick="wk.layer_close('close')">关闭</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- {include file="public/footer" /}
- <script>
- layui.use(['form'], function() {
- var form = layui.form;
- form.on('submit(component-form-element)', function (data) {
- $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
- $.ajax({
- url:"{:url('edit')}",
- type:'post',
- dataType:'json',
- data:data.field,
- success:function(res){
- if (res.code == 200) {
- wk.success(res.msg,'wk.layer_close()');
- } else {
- wk.error(res.msg,'$(".layui-btn").removeClass(\'layui-disabled\').removeAttr(\'disabled\')');
- }
- }
- })
- });
- });
- </script>
- <script>
- layui.use('upload', function(){
- var upload = layui.upload;
- var uploadInst = upload.render({
- elem: '#test5'
- ,url: "{:url('admin/upload/uploadLocality')}"
- ,accept: 'images'
- ,multiple:false
- ,done: function(res){
- $('#images').attr("src",res.url);
- $('#image').val(res.url);
- }
- ,error: function(){
- }
- });
- });
- </script>
- </body>
- </html>
|