关于javascript:99layui-图片上传下拉选择联级选择

40次阅读

共计 1487 个字符,预计需要花费 4 分钟才能阅读完成。

1. 图片上传:
html:

<div class="layui-col-xs12 layui-col-sm6 layui-col-md6" >
        <label class="layui-form-label"> 头像 </label>
        <div class="layui-input-block">
            <button type="button" class="layui-btn layui-btn-sm" id="portrait-upload"> 上传图片 </button>
            <img class="layui-upload-img" id="portrait-upload-img" style="width: 120px;" >
            <input type="hidden" name="portrait"/>
        </div>
    </div>

js:

var portrait = formData?formData.portrait:null;
        admin.picUpload(upload,"portrait",portrait)

2. 下拉列表:数据从后盾取:
html:

<div class="layui-col-xs12 layui-col-sm12 layui-col-sm12" >
        <label class="layui-form-label"> 办事人 <span style="color:red">*</span></label>
        <div class="layui-input-block">
            <div id="dealUserSel"></div>
            <input type="hidden" name="dealUserId" lay-verify="required"/>
            <input type="hidden" name="dealUserName"/>
            <input type="hidden" name="thingIds"/>
        </div>
    </div>

js:

var dealUserId = null;
        admin.renderXmSel(xmSelect,"dealUser",ctx+'/customer/customer/queryByAll',[dealUserId])

3、省市区联级抉择:

<div class="layui-col-xs12 layui-col-sm6 layui-col-md6" >
        <label class="layui-form-label"> 省市区 </label>
        <div class="layui-input-block">
            <div id="provinceSel" ></div>
            <input type="hidden" name="provinceId">
            <input type="hidden" name="provinceName">
            <input type="hidden" name="cityId">
            <input type="hidden" name="cityName">
            <input type="hidden" name="areaId">
            <input type="hidden" name="areaName">

        </div>
    </div>

js:

var areaId = formData?formData.areaId:null;//131002
        var cityId = formData?formData.cityId:null;//131000
        var provinceId = formData?formData.provinceId:null;
        admin.regionSel(xmSelect,"provinceSel",provinceId,cityId,areaId)

正文完
 0