jyqin7

jyqin7 VIP4

120飞吻 2018-8-6 加入 来自上海

(这个人懒得留下签名)

jyqin7 最近的提问

jyqin7 最近的回答

  • 2天前让 layuiAdmin 单页版开发起来像 Vue 一样体验中回答:

    内容属于 layuiadmin 会员专区,此处不予展示
  • 2天前在单页版中,弹出编辑框,laydate无法渲染中回答:

    @HiTerry 眼对准了可以了 [衰]
    lay-done="layui.data.done(d);
    我以为把这个放在最后一个template里就是在同类lay-done最后执行的

    看来我理解错了 得写N个lay-done才能加载
  • 3天前在单页版中,弹出编辑框,laydate无法渲染中回答:

    @HiTerry 我没贴出来 因为不止一个 template

    <div class="layui-form" lay-filter="app-meeting-edit-form" id="app-meeting-edit-form"
    style="padding: 20px 30px 0 0;">
    <div class="layui-form-item">
    <label class="layui-form-label">活动标题</label>
    <div class="layui-input-block">
    <script type="text/html" template>
    <input type="text" name="meetingTitle" value="{{ d.params.meetingTitle || '' }}"
    placeholder="活动标题" autocomplete="off" class="layui-input"/>
    </script>
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label">活动缩略图</label>
    <div class="layui-input-block">
    <button type="button" class="layui-btn" id="meetingIconUpload">
    <i class="layui-icon"></i>开始上传
    </button>
    <div class="layui-inline">
    图片尺寸:207*87
    </div>
    <input type="hidden" name="meetingIcon" id="meetingIcon">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label"></label>
    <div class="layui-input-block">
    <script type="text/html" template>
    <img height="87" width="207" id="meetingIconShow" src="{{ d.params.meetingIconDisplay }}"/>
    </script>
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label">活动内容</label>
    <div class="layui-input-block">
    <script type="text/html" template>
    <textarea id="meetingContent" name="meetingContent"
    style="display: none;">{{ d.params.meetingContent || '' }}</textarea>
    </script>
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label">活动省市</label>
    <div class="layui-input-block">
    <script type="text/html" template>
    <input type="text" name="meetingCity" id="meetingCity" placeholder="请输入" autocomplete="off"
    class="layui-input" value="{{ d.params.meetingCity || '' }}">
    </script>
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label">详细地址</label>
    <div class="layui-input-block">
    <script type="text/html" template>
    <input type="text" name="meetingAddress" id="meetingAddress" placeholder="请输入" autocomplete="off"
    class="layui-input" value="{{ d.params.meetingAddress || '' }}">
    </script>
    </div>
    </div>
    <div class="layui-inline">
    <label class="layui-form-label">开始日期</label>
    <div class="layui-input-inline">
    <script type="text/html" template>
    <input type="text" name="meetingStartDateDisplay" id="meeting-start-date" placeholder="请输入"
    autocomplete="off"
    class="layui-input" value="{{ d.params.meetingStartDateDisplay || '' }}">
    </script>
    </div>
    </div>
    <div class="layui-inline">
    <label class="layui-form-label">结束日期</label>
    <div class="layui-input-inline">
    <script type="text/html" template>
    <input type="hidden" id="meetingEndDate" value="{{ d.params.meetingEndDate || '' }}">
    <input type="text" name="meetingEndDateDisplay" id="meeting-end-date" placeholder="请输入"
    autocomplete="off"
    class="layui-input" value="{{ d.params.meetingEndDateDisplay || '' }}">
    </script>
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">活动状态</label>
    <div class="layui-input-block">
    <script type="text/html" template>
    <input type="checkbox" lay-verify="required" lay-filter="switch-app-meeting-status" lay-skin="switch"
    lay-text="正常|取消"
    {{ d.params.meetingStatus|| d.params.meetingStatus== 1?'checked=checked':''}} >
    </script>
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label"></label>
    <div class="layui-input-block">
    <input type="button" lay-submit lay-filter="app-meeting-edit-form-submit" value="确认"
    class="layui-btn" align="center">
    </div>
    </div>
    <script type="text/html" template lay-done="layui.data.done(d);">
    <input type="hidden" name="id" value="{{ d.params.id || '' }}">
    <input type="hidden" name="meetingStatus" id="app-meeting-Status" value="{{ d.params.meetingStatus || 0 }}">
    </script>
    </div>
    <script>
    layui.data.done = function (d) {
    layui.use(['form', 'laydate', 'upload'], function () {
    var $ = layui.jquery,
    form = layui.form,
    upload = layui.upload,
    laydate = layui.laydate;

    upload.render({
    elem: '#meetingIconUpload' //绑定元素
    , url: '/sys/file/uploadImage?module=meeting&access_token=' + layui.data('layuiAdmin').access_token //接口url
    , done: function (res) {
    console.log(res.data.path)
    $("#meetingIconShow").attr('src', res.data.path)
    $("#meetingIcon").val(res.data.path)
    }
    });
    console.log(document.getElementById('meeting-end-date'));
    console.log(document.getElementById('meetingEndDate'));
    var ins1 = laydate.render({
    elem: '#meeting-start-date'
    , type: 'date'
    , trigger: 'click'
    });
    var ins2 = laydate.render({
    elem: '#meeting-end-date'
    , type: 'date'
    , trigger: 'click'
    });

    form.on('switch(switch-app-meeting-status)', function (data) {
    if (data.elem.checked) {
    $('#app-meeting-Status').val(1);
    } else {
    $('#app-meeting-Status').val(0);
    }
    });

    });
    };
    </script>
  • 3天前在单页版中,弹出编辑框,laydate无法渲染中回答:

    @安迪 我设置的就是在渲染后执行的

    让我感到比较困惑的是
    console.log(document.getElementById('meeting-end-date'));
    第一个打开的时候 是有东西的,第二次打开就是null了

  • 3天前在单页版中,弹出编辑框,laydate无法渲染中回答:

    @HiTerry 我现在本身就是这么做的,调试的时候还是不行,请问还有更细化的思路吗?
  • 4天前在单页版中,弹出编辑框,laydate无法渲染中回答:

    @谷粒多 我现在已经是这么做的
  • 4天前在单页版中,弹出编辑框,laydate无法渲染中回答:

    我现在就是这么用的 [汗]

    弹出的js
    <script>
    layui.data.done = function (d) {
    layui.use(['form', 'laydate', 'upload'], function () {
    var $ = layui.jquery,
    form = layui.form,
    upload = layui.upload,
    laydate = layui.laydate;

    upload.render({
    elem: '#meetingIconUpload' //绑定元素
    , url: '/sys/file/uploadImage?module=meeting&access_token=' + layui.data('layuiAdmin').access_token //接口url
    , done: function (res) {
    console.log(res.data.path)
    $("#meetingIconShow").attr('src', res.data.path)
    $("#meetingIcon").val(res.data.path)
    }
    });
    var ins1 = laydate.render({
    elem: '#meeting-start-date'
    , type: 'date'
    , trigger: 'click'
    });
    var ins2 = laydate.render({
    elem: '#meeting-end-date'
    , type: 'date'
    , trigger: 'click'
    });

    form.on('switch(switch-app-meeting-status)', function (data) {
    if (data.elem.checked) {
    $('#app-meeting-Status').val(1);
    } else {
    $('#app-meeting-Status').val(0);
    }
    });

    });
    };
    列表页的js
    admin.popup({
    title: '编辑会议'
    , area: ['800px', '900px']
    , id: 'LAY-popup-app-meeting-edit'
    , success: function (layero, index) {
    view(this.id).render('app/meeting/meeting_edit', data).done(function () {
    layedit.set({
    uploadImage: {
    url: '/sys/file/uploadImage?module=meeting&access_token=' + layui.data('layuiAdmin').access_token //接口url
    , type: 'POST'
    }
    });
    var editIndex = layedit.build('meetingContent');
    admin.req({
    url: '/app/meeting/getMeetingContent'
    , data: data
    , done: function (res) {
    console.log(res.data);
    if (res.code == 0) {
    layedit.setContent(editIndex, res.data.meetingContent)
    }
    }
    });

    form.render(null, 'app-meeting-edit-form');
    //监听提交
    form.on('submit(app-meeting-edit-form-submit)', function (data) {
    var field = data.field; //获取提交的字段
    field.meetingContent = layedit.getContent(editIndex);

    admin.req({
    url: '/app/meeting/editAppMeeting' //实际使用请改成服务端真实接口
    , data: field
    , done: function (res) {
    layui.table.reload('app-meeting-table'); //重载表格
    }
    });
    layer.close(index); //执行关闭
    });
    });
    }
    });