123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167 |
- {include file="public/header" /}
- <body class="gray-bg">
- <div class="layui-fluid layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-header">添加识别图</div>
- <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>
- <div class="layui-input-block">
- <input type="text" class="layui-input " name="pruduct_name" lay-verify="required" placeholder="课程标题">
- </div>
- </div>
- <!--<div class="layui-form-item layui-col-md-offset1 layui-col-md8">-->
- <!-- <label class="layui-form-label">参数图</label>-->
- <!-- <input type="hidden" name="product_parameter" id="product_parameter">-->
- <!-- <button type="button" class="layui-btn" id="test2">-->
- <!-- 选择文件-->
- <!-- </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="" id="lay-img-list2" style="width:100px;height:100px;">-->
- <!-- </div>-->
- <!-- </blockquote>-->
- <!-- </div>-->
- <!--</div>-->
- <div class="layui-form-item layui-col-md-offset1 layui-col-md8">
- <label class="layui-form-label">产品图片</label>
- <input type="hidden" name="product_image" id="product_image">
- <button type="button" class="layui-btn" id="test1">
- 选择文件
- </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="" id="lay-img-list1" style="width:100px;height:100px;">
- </div>
- </blockquote>
- </div>
- </div>
- <!--<div class="layui-form-item layui-col-md-offset1 layui-col-md8">-->
- <!-- <label class="layui-form-label">富文本1 (图片规则 宽小于375,高小于500)</label>-->
- <!-- <div class="layui-input-block">-->
- <!-- <textarea id="demo" style="display: none;"></textarea>-->
- <!-- </div>-->
- <!--</div>-->
- <!--<div class="layui-form-item layui-col-md-offset1 layui-col-md8">-->
- <!-- <label class="layui-form-label">产品优势 (图片规则 宽小于375,高小于500)</label>-->
- <!-- <div class="layui-input-block">-->
- <!-- <textarea id="demo2" style="display: none;"></textarea>-->
- <!-- </div>-->
- <!--</div>-->
- <!--<div class="layui-form-item layui-col-md-offset1 layui-col-md8">-->
- <!-- <label class="layui-form-label">产品实拍 (图片规则 宽小于375,高小于500)</label>-->
- <!-- <div class="layui-input-block">-->
- <!-- <textarea id="demo3" style="display: none;"></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="history.back()">关闭</button>
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
- {include file="public/footer" /}
- <script>
- layui.use(['form','upload','element','layedit'], function() {
- var form = layui.form
- , upload = layui.upload
- , element = layui.element
- //富文本
- var layedit = layui.layedit;
-
- layedit.set({
- uploadImage: {
- url: '/admin/Aipimagesearch/Upload',
- type: 'post'
- }
- });
- var index =layedit.build('demo'); //建立编辑器
- var index2 =layedit.build('demo2'); //建立编辑器
- var index3 =layedit.build('demo3'); //建立编辑器
- form.on('submit(component-form-element)', function (data) {
- $('.layui-btn').addClass('layui-disabled').attr('disabled','disabled');
- var layeditcontent=layedit.getContent(index);
- var layeditcontent2=layedit.getContent(index2);
- var layeditcontent3=layedit.getContent(index3);
- //alert(layeditcontent);
- data.field.product_fuwenben=layeditcontent;
- data.field.product_youshi=layeditcontent2;
- data.field.product_shipai=layeditcontent3
- // console.log(data.field);
- $.ajax({
- url:"{:url('add')}",
- type:'post',
- dataType:'json',
- data:data.field,
- success:function(res){
- if (res.code == 200) {
- layer.msg(res.msg,{icon:1,time:1500,shade:0.1},function(index){
- wk.layer_close();
- setTimeout(function () {
- location.reload();
- },1000);
- })
- } else {
- $(".layui-btn").removeClass('layui-disabled').removeAttr('disabled');
- wk.error(res.msg);
- return false;
- }
- }
- })
- });
- });
- </script>
- <script>
- layui.use('upload', function(){
- var upload = layui.upload;
- var uploadInst = upload.render({
- elem: '#test1'
- ,url: "{:url('admin/upload/uploadLocality')}"
- ,accept: 'images'
- ,multiple:false
- ,done: function(res){
- $('#lay-img-list1').attr("src",res.url);
- $('#product_image').val(res.url);
- }
- ,error: function(){
- }
- });
- });
- </script>
- <script>
- layui.use('upload', function(){
- var upload = layui.upload;
- var uploadInst = upload.render({
- elem: '#test2'
- ,url: "{:url('admin/upload/uploadLocality')}"
- ,accept: 'images'
- ,multiple:false
- ,done: function(res){
- $('#lay-img-list2').attr("src",res.url);
- $('#product_parameter').val(res.url);
- }
- ,error: function(){
- }
- });
- });
- </script>
- </body>
- </html>
|