123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905 |
- <script>
- // 获取联动地址
- function GetFieldRegionData_1671086814(t,type){
- var name = $(t).attr('data-name');
- var parent_id = parseInt($(t).val());
-
- if(!parent_id || 0 >= parent_id){
- if ('province' == type) {
- $('#city_'+name).hide();
- $('#area_'+name).hide();
- }else if ('city' == type){
- $('#area_'+name).hide();
- }
- return false;
- }
-
- var url = "{:url('home/Ajax/ajax_get_region_data')}";
- $.ajax({
- url: url,
- data: {parent_id:parent_id,_ajax:1},
- type:'post',
- dataType:'json',
- success:function(res){
- if (res.region_html) {
- // 输出下一级栏目选项
- if ('province' == type) {
- res = '<option value="-1">请选择</option>'+ res.region_html;
- $('#city_'+name).empty().html(res);
- $('#city_'+name).show();
- $('#area_'+name).hide();
- $('#area_'+name).empty();
- }else if ('city' == type){
- res = '<option value="-1">请选择</option>'+ res.region_html;
- $('#area_'+name).empty().html(res);
- $('#area_'+name).show();
- }
- }
- },
- error : function(e) {
- layer.closeAll();
- layer.alert(e.responseText, {icon: 5});
- }
- });
- }
- </script>
- {volist name="$addonFieldExtList" id="vo"}
- {if !isset($vo.ifeditable) || $vo.ifeditable}
- {switch name="vo.dtype"}
- {case value="hidden"}
- <!-- 隐藏域 start -->
- <div class="item-from-row" style="display: none;">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<em>*</em>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- <input type="hidden" class="el-input__inner w500" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}">
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 隐藏域 start -->
- {/case}
-
- {case value="region"}
- {empty name="$vo.set_type"}
- <!-- 区域选项 单个区域 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- {volist name="$vo.dfvalue" id="v2"}
- <label class="radio-label">
- <span>{$v2['name']}</span>
- <input type="radio" class="radio" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$v2['id']}" {if condition="isset($vo['trueValue']) AND in_array($v2['id'], $vo['trueValue'])"}checked="checked"{/if}>
- <span class="check-mark"></span>
- </label>
- {/volist}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 区域选项 end -->
- {else /}
- <!-- 区域选项 三级联动 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- <!--一级-->
- <select class="el-input_select_inner w200" name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="province_{$vo.fieldArr}_{$vo.name|default=''}" data-name="{$vo.fieldArr}_{$vo.name|default=''}" onchange="GetFieldRegionData_1671086814(this,'province');" {if condition="!empty($vo.region_level) && $vo.region_level > 1"}disabled{/if}>
- <option value="-1">请选择</option>
- <option {if condition="isset($vo['trueValue'][0]) && ($vo['trueValue'][0] === 0 || $vo['trueValue'][0] ==='0')"} selected {/if} value="0">全国</option>
- {volist name="$vo.dfvalue" id="v_p"}
- <option {if condition="isset($vo['trueValue'][0]) && $vo['trueValue'][0] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
- {/volist}
- </select>
- <!--二级-->
- <select class="el-input_select_inner w200" name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="city_{$vo.fieldArr}_{$vo.name|default=''}" data-name="{$vo.fieldArr}_{$vo.name|default=''}" onchange="GetFieldRegionData_1671086814(this,'city');" {empty name="$vo['city_list']"}style="display: none;"{/empty} {if condition="!empty($vo.region_level) && $vo.region_level > 2"}disabled{/if}>
- {notempty name="$vo.city_list"}
- {volist name="$vo.city_list" id="v_p"}
- <option {if condition="$vo['trueValue'][1] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
- {/volist}
- {/notempty}
- </select>
- <!--三级-->
- <select class="el-input_select_inner w200" name="{$vo.fieldArr}[{$vo.name|default=''}][]" id="area_{$vo.fieldArr}_{$vo.name|default=''}" {empty name="$vo['trueValue'][2]"}style="display: none;"{/empty}>
- {notempty name="$vo.area_list"}
- {volist name="$vo.area_list" id="v_p"}
- <option {if condition="$vo['trueValue'][2] == $v_p.id"} selected {/if} value="{$v_p.id}">{$v_p.name}</option>
- {/volist}
- {/notempty}
- </select>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 区域选项 end -->
- {/empty}
- {/case}
-
- {case value="text"}
- <!-- 单行文本框 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- <input type="text" class="el-input__inner w500 fs16" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}"> {$vo.dfvalue_unit|default=''}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 单行文本框 end -->
- {/case}
-
- {case value="multitext"}
- <!-- 多行1文本框 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- <textarea rows="5" cols="60" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" class="fs16" style="height:60px;">{$vo.dfvalue|default=''}</textarea>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 多行文本框 end -->
- {/case}
-
- {case value="checkbox"}
- <!-- 复选框 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- {volist name="$vo.dfvalue" id="v2"}
- <label class="checkbox-label">
- <span>{$v2}</span>
- <input type="checkbox" class="checkbox" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}checked="checked"{/if} onclick="func_{$vo.name}_eyempty();">
- <span class="check-mark"></span>
- </label>
- {/volist}
- <input type="hidden" name="{$vo.fieldArr}[{$vo.name}_eyempty]" value="{if condition="!empty($vo['trueValue'])"}1{else /}0{/if}">
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <script type="text/javascript">
- function func_{$vo.name}_eyempty()
- {
- var len = $("input[name='{$vo.fieldArr}[{$vo.name}][]']:checked").length;
- $("input[name='{$vo.fieldArr}[{$vo.name}_eyempty]']").val(len);
- }
- </script>
- <!-- 复选框 end -->
- {/case}
-
- {case value="radio"}
- <!-- 单选项 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- {volist name="$vo.dfvalue" id="v2"}
- <label class="radio-label">
- <span>{$v2}</span>
- <input type="radio" class="radio" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}checked="checked"{/if}>
- <span class="check-mark"></span>
- </label>
- {/volist}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 单选项 end -->
- {/case}
-
- {case value="switch"}
- <!-- 开关 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- <div class="on-off">
- <label for="{$vo.fieldArr}_{$vo.name|default=''}1" class="cb-enable {if condition="0 != $vo['dfvalue']"}selected{/if}">是</label>
- <label for="{$vo.fieldArr}_{$vo.name|default=''}0" class="cb-disable {if condition="0 == $vo['dfvalue']"}selected{/if}">否</label>
- <input id="{$vo.fieldArr}_{$vo.name|default=''}1" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="1" type="radio" {if condition="0 != $vo['dfvalue']"}checked="checked"{/if}>
- <input id="{$vo.fieldArr}_{$vo.name|default=''}0" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="0" type="radio" {if condition="0 == $vo['dfvalue']"}checked="checked"{/if}>
- </div>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <script type="text/javascript">
- $(function(){
- //自定义radio样式
- $(".cb-enable").on('click', function(){
- var parent = $(this).parents('.on-off');
- $('.cb-disable',parent).removeClass('selected');
- $(this).addClass('selected');
- $('.checkbox',parent).attr('checked', true);
- });
- $(".cb-disable").on('click', function(){
- var parent = $(this).parents('.on-off');
- $('.cb-enable',parent).removeClass('selected');
- $(this).addClass('selected');
- $('.checkbox',parent).attr('checked', false);
- });
- });
- </script>
- <!-- 开关 end -->
- {/case}
-
- {case value="select"}
- <!-- 下拉框 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:
- </div>
- <div class="from-row-r">
- <div class="w300 select">
- <select name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}">
- {volist name="$vo.dfvalue" id="v2"}
- <option value="{$v2}" {if condition="isset($vo['trueValue']) AND in_array($v2, $vo['trueValue'])"}selected{/if}>{$v2}</option>
- {/volist}
- </select>
- </div>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 下拉框 end -->
- {/case}
-
- {case value="img"}
- <style type="text/css">
- .input-file-show{
- position: relative;
- width: 120px;
- height: 120px;
- overflow: hidden;
- }
- .input-file-show img {
- position: absolute;
- width: 120px;
- height: 120px;
- }
- .input-file-show span {
- position: absolute;
- bottom: 0;
- width: 120px;
- height: 26px;
- line-height: 26px;
- text-align: center;
- background-color: rgba(0,0,0,0.6);
- color: #fff;
- z-index: 2;
- }
- </style>
- <div class="item-from-row">
- <div class="from-row-l">
- {$vo.title}:
- </div>
- <div class="from-row-r">
- <a href="javascript:void(0);" onclick="$('#singlePicFile_{$vo.id|default=0}').trigger('click');" class="img-upload">
- <div class="y-line" id="singlePicYline_{$vo.id|default=0}" {notempty name='$vo.dfvalue'} style="display: none;" {/notempty}></div>
- <div class="x-line" id="singlePicXline_{$vo.id|default=0}" {notempty name='$vo.dfvalue'} style="display: none;" {/notempty}></div>
- <img src="{$vo.dfvalue|default=''}" id="singlePicImgSrc_{$vo.id|default=0}" >
- </a>
- </div>
- <input type="file" id="singlePicFile_{$vo.id|default=0}" data-id="{$vo.id|default=0}" onchange="uploadSinglePicFile(this);" style="display: none;">
- <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="singlePicHidden_{$vo.id|default=0}" value="{$vo.dfvalue|default=''}">
- </div>
-
- <script type="text/javascript">
- // 单图上传
- function uploadSinglePicFile(obj) {
- var file = $(obj)[0].files[0];
- if (!file) return false;
- var formData = new FormData();
- formData.append('_ajax', 1);
- formData.append('file', file);
- formData.append('compress', '1000-1000');
- $.ajax({
- type: 'post',
- url: eyou_basefile + "?m=user&c=Uploadify&a=imageUp",
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- success: function (res) {
- layer.closeAll();
- if (res.state == 'SUCCESS') {
- var id = $(obj).data('id');
- $("#singlePicHidden_" + id).val(res.url);
- $("#singlePicImgSrc_" + id).show().attr('src', res.url);
- $('#singlePicYline_'+id+', #singlePicXline_' + id).hide();
- } else {
- showLayerAlert(res.state);
- }
- },
- error: function(e) {
- layer.closeAll();
- showLayerAlert(e.responseText);
- }
- })
- }
- </script>
- <!-- 单张图 end -->
- {/case}
-
- {case value="file"}
- {eyou:static file="/public/plugins/layui/css/layui.css" /}
- <!-- {eyou:static file="/public/plugins/layui/layui.js" /} -->
- <!-- 单个文件 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- {$vo.title}:
- </div>
- <div class="from-row-r" >
- <a id="download_file_{$vo.fieldArr}_{$vo.name|default=''}" style="margin-right: 30px;text-decoration: underline;{eyou:notempty name='$vo.dfvalue' /}display: '';{eyou:else /}display: none;{/eyou:notempty}"
- {eyou:notempty name='$vo.dfvalue' /} href="{$vo.dfvalue|default=''}" download="{$vo.dfvalue|get_filename=###}" {/eyou:notempty}>
- <img src="__STATIC__/common/images/file.png" alt="" style="width: 16px;height: 16px;">下载附件</a>
- <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}" style="display: none;">
- <button type="button" class="el-button el-button--primary is-plain el-button--small" id="upload_{$vo.fieldArr}_{$vo.name|default=''}" ><i class="el-icon-paperclip"></i>上传文件</button>
- </div>
- </div>
- <script>
- $(function(){
- layui.use('upload', function(){
- var upload = layui.upload;
-
- //执行实例
- upload.render({
- elem: "#upload_{$vo.fieldArr}_{$vo.name|default=''}" //绑定元素
- ,url: "{:url('user/Uploadify/DownloadUploadFileAjax')}"
- ,accept: 'file' //普通文件
- ,exts: '{$vo.ext}'
- ,size: {$vo.filesize} //限制文件大小,单位 KB
- ,done: function(res){
- //上传完毕回调
- if (res.state=="SUCCESS"){
- layer.msg('上传成功!')
- $("#{$vo.fieldArr}_{$vo.name|default=''}").val(res.url);
- $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").css('display','');
- $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',res.url);
- var arr = res.url.split("/");
- var download = arr[arr.length-1];
- $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").attr('download',download);
- $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").css('color','#000');
- $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").html('<img src="__STATIC__/common/images/file.png" alt="" style="width: 16px;height: 16px;">下载附件');
- }else {
- $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").css('display','');
- $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").css('color','red');
- $("#download_file_{$vo.fieldArr}_{$vo.name|default=''}").text(res.state);
- }
- }
- ,error: function(){
- //请求异常回调
- }
- });
- });
- })
- </script>
- <!-- 单个文件 end -->
- {/case}
-
- {case value="media"}
- {eyou:static file="/public/plugins/layui/css/layui.css" /}
- <!-- {eyou:static file="/public/plugins/layui/layui.js" /} -->
- <!-- 多媒体上传 -->
- <div class="item-from-row">
- <div class="from-row-l">
- {$vo.title}:
- </div>
- <div class="from-row-r" >
- <a id="media_a_{$vo.fieldArr}_{$vo.name|default=''}" style="margin-right: 30px;text-decoration: underline;{eyou:notempty name='$vo.dfvalue' /}display: '';{eyou:else /}display: none;{/eyou:notempty}"
- {eyou:notempty name='$vo.dfvalue' /} href="{$vo.dfvalue|default=''}" {/eyou:notempty}>
- <img src="__STATIC__/common/images/file.png" alt="" style="width: 16px;height: 16px;">点击查看</a>
- <input type="text" id="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" value="{$vo.dfvalue|default=''}" style="display: none;">
- <input type="file" id="{$vo.fieldArr}_{$vo.name|default=''}_upload_media" onchange="{$vo.fieldArr}_{$vo.name|default=''}_upload_media_20210506(this)" style="display: none;">
- <button type="button" class="el-button el-button--primary is-plain el-button--small" id="{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media" onclick="$('#{$vo.fieldArr}_{$vo.name|default=\'\'}_upload_media').attr('data-type', '{$vo.upload_flag}').trigger('click');">上传文件</button>
- </div>
- </div>
- <script>
- function {$vo.fieldArr}_{$vo.name|default=''}_upload_media_20210506(e){
- var data_type = $(e).attr('data-type');
- if ('qny' == data_type) {
- {$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media(e);
- } else if ('oss' == data_type) {
- {$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media(e);
- } else if ('cos' == data_type) {
- {$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media(e);
- } else {
- {$vo.fieldArr}_{$vo.name|default=''}_local_upload_media(e);
- }
- }
- function beforeUploadMedia(ext,file){
- var type = '{$vo.ext}';
- var extArr = [];
- extArr = type.split("|");
- var exts = ext.replace(".","");
- if (extArr.indexOf(exts) == -1) {
- showErrorMsg('仅支持{$vo.ext}格式');
- return false;
- }
- size = parseInt("{$vo.filesize}");
- if (file.size > size) {
- if (size >= 1048576) {
- limit = size/1024/1024;
- limit = limit + 'MB';
- }else {
- limit = size/1024 ;
- limit = limit + 'KB';
- }
- showErrorMsg('仅支持'+limit+'以内的文件');
- return false;
- }
- return true;
- }
- function {$vo.fieldArr}_{$vo.name|default=''}_qny_upload_media(e) {
- var file = $(e)[0].files[0];
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- ret = beforeUploadMedia(fileExt,file);
- if (ret){
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Qiniuyun&a=qiniu_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function(res1) {
- if (1 == res1.code) {
- var token = res1.data.token;
- var formData = new FormData();
- formData.append('file', file);
- formData.append('token', token);
-
- fileName = res1.data.filePath + fileExt;
- formData.append('key', fileName);
- $.ajax({
- url: res1.data.uphost,
- type: 'POST',
- dataType: 'JSON',
- data: formData,
- timeout: 1200000,
- cache: false,
- processData: false,
- contentType: false,
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function(e){
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传中...'+process+"%");
- });
- }
- return myXhr;
- },
- success: function(res2) {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传成功');
- setTimeout(function() {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').text('上传文件');
- }, 2000);
- var video_url = res1.data.domain + "/" + res2.key;
- $("#{$vo.fieldArr}_{$vo.name|default=''}").val(video_url);
- $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").show();
- $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href',video_url);
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- return false;
- }
- });
- } else {
- layer.closeAll();
- showErrorMsg(res1.msg);
- }
- },
- error: function(e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
- }
-
- function {$vo.fieldArr}_{$vo.name|default=''}_oss_upload_media(e) {
- var file = $(e)[0].files[0];
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- ret = beforeUploadMedia(fileExt,file);
- if (ret) {
- $.ajax({
- type: 'POST',
- url: '__ROOT_DIR__/index.php?m=plugins&c=AliyunOss&a=oss_upload',
- data: {_ajax: 1},
- dataType: "JSON",
- success: function (res1) {
- if (1 == res1.code) {
- fileName = res1.data.filePath + fileExt;
- //组装发送数据
- var request = new FormData();
- request.append("OSSAccessKeyId", res1.data.accessid);
- request.append("policy", res1.data.policy);
- request.append("Signature", res1.data.signature);
- request.append("key", fileName);
- request.append("success_action_status", 201);
- request.append('file', file);
- $.ajax({
- url: res1.data.host,
- data: request,
- processData: false,
- cache: false,
- contentType: false,
- dataType: 'xml',
- type: 'post',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function (e) {
- var curr = e.loaded;
- var total = e.total;
- var process = parseInt(curr / total * 100);
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传中...' + process + "%");
- });
- }
- return myXhr;
- },
- success: function (data) {
- var res = $(data).find('PostResponse');
- if (res) {
- var key = res.find('Key').text();
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传成功');
- setTimeout(function () {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').text('上传文件');
- }, 2000);
- var video_url = res1.data.domain + "/" + key;
- $("#{$vo.fieldArr}_{$vo.name|default=''}").val(video_url);
- $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").show();
- $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', video_url);
- } else {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传失败');
- setTimeout(function () {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').text('上传文件');
- }, 2000);
- }
- },
- error: function (e) {
- layer.closeAll();
- console.log(e.responseText);
- }
- });
- } else {
- layer.closeAll();
- showErrorMsg(res1.msg);
- }
- },
- error: function (e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
- }
- function {$vo.fieldArr}_{$vo.name|default=''}_cos_upload_media(e) {
- var file = $(e)[0].files[0];
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- ret = beforeUploadMedia(fileExt,file);
- if (ret) {
- var formData = new FormData();
- formData.append('file', file);
- formData.append('file_ext', fileExt);
- $.ajax({
- type: 'post',
- url: '__ROOT_DIR__/index.php?m=plugins&c=Cos&a=cos_upload&_ajax=1',
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function (e) {
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- if (100 == process) {
- process = 99;
- }
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传中...' + process + "%");
- });
- }
- return myXhr;
- },
- success: function (res) {
- if (1 == res.code) {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传成功');
- $("#{$vo.fieldArr}_{$vo.name|default=''}").val(res.data.url);
- $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").show();
- $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', res.data.url);
- } else {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").text('上传失败');
- }
- setTimeout(function () {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').text('上传文件');
- }, 2000);
- },
- error: function (e) {
- layer.closeAll();
- showErrorMsg(e.responseText);
- }
- });
- }
- }
- function {$vo.fieldArr}_{$vo.name|default=''}_local_upload_media(e){
- var file = $(e)[0].files[0];
- var fileName = file.name;
- var fileExt = fileName.substr(fileName.lastIndexOf('.')).toLowerCase();
- ret = beforeUploadMedia(fileExt,file);
- if (ret) {
- var formData = new FormData();
- formData.append('file', file);
- $.ajax({
- type: 'post',
- url: "{:url('user/Uploadify/AjaxUploadMedia', ['savepath'=>'media'])}",
- data: formData,
- contentType: false,
- processData: false,
- dataType: 'json',
- xhr: function () {
- myXhr = $.ajaxSettings.xhr();
- if (myXhr.upload) {
- myXhr.upload.addEventListener('progress', function (e) {
- var curr = e.loaded;
- var total = e.total;
- process = parseInt(curr / total * 100);
- $("#upload_video_litpic_local").html('上传中...' + process + "%");
- });
- }
- return myXhr;
- },
- success: function (res) {
- if ("SUCCESS" == res.state) {
- $("#{$vo.fieldArr}_{$vo.name|default=''}_title_upload_media").html('上传成功');
- setTimeout(function () {
- $('#{$vo.fieldArr}_{$vo.name|default=\'\'}_title_upload_media').html('上传文件');
- }, 2000);
- $("#{$vo.fieldArr}_{$vo.name|default=''}").val(res.url);
- $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").show();
- $("#media_a_{$vo.fieldArr}_{$vo.name|default=''}").attr('href', res.url);
- } else {
- showErrorMsg(res.msg);
- }
- }
- });
- }
- }
- </script>
- {/case}
-
- {case value="imgs"}
- <script type="text/javascript" src="__STATIC__/admin/js/jquery-ui/jquery-ui.min.js"></script>
- <!-- 多张图 start -->
- <div class="item-from-row" id="dl_{$vo.fieldArr}_{$vo.name|default=''}">
- <div class="from-row-l">
- <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
- </div>
- <div class="from-row-r">
-
- <div class="images_upload_main" id="tab_{$vo.fieldArr}_{$vo.name|default=''}">
- <!-- <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back', '', '{$vo.title}');" class="el-button el-button--primary is-plain el-button--small">
- <i class="el-icon-picture"></i>上传图片
- </a> -->
- <div class="sort-list-{$vo.fieldArr}_{$vo.name|default=''} mt10">
- {volist name="$vo[$vo['name'].'_eyou_imgupload_list']" id="v2" key="k2"}
- <div class="fieldext_upload mb10 fieldext_upload_html" >
- <div class="images_upload_item">
- <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="{$v2.image_url|default=''}">
- <a href="{$v2.image_url|default=''}" onclick="" class="pic">
- <img src="{$v2.image_url|default=''}" >
- </a>
- <a class="delete" title="删除" href="javascript:void(0)" onclick="{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'{$v2.image_url|default=''}')"></a>
- </div>
- </div>
- {/volist}
- <div class="fieldext_upload" style="display:none;"></div>
- </div>
- <a href="javascript:void(0);" onClick="GetUploadify(100,'','allimg','{$vo.fieldArr}_{$vo.name|default=''}_call_back', '', '{$vo.title}');" class="img-upload" title="上传图片">
- <div class="y-line"></div>
- <div class="x-line"></div>
- </a>
- </div>
- <!-- 上传图片显示的样板 start -->
- <div class="{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl" style="display: none;">
- <div class="fieldext_upload mb10 fieldext_upload_html">
- <div class="images_upload_item">
- <input type="hidden" name="{$vo.fieldArr}[{$vo.name|default=''}][]" value="" />
- <a href="javascript:void(0);" onClick="" class="pic">
- <img src="__STATIC__/admin/images/add-button.jpg"/>
- </a>
- <a class="delete" href="javascript:void(0)" title="删除"> </a>
- </div>
- </div>
- </div>
- <!-- 上传图片显示的样板 end -->
- </div>
- </div>
- <script type="text/javascript">
- // 上传多图回调函数
- function {$vo.fieldArr}_{$vo.name|default=''}_call_back(paths){
- var last_div = $(".{$vo.fieldArr}_{$vo.name|default=''}_upload_tpl").html();
- for (var i=0;i<paths.length ;i++ )
- {
- if ($(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html").length > 0) {
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").after(last_div); // 插入一个 新图片
- } else {
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload:last").before(last_div); // 插入一个 新图片
- }
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").find('a:eq(0)').attr('href',paths[i]).attr('onclick','').attr('target', "_blank");// 修改他的链接地址
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").find('img').attr('src',paths[i]);// 修改他的图片路径
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").find('a:eq(1)').attr('onclick',"{$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(this,'"+paths[i]+"')").text('');
- $(".sort-list-{$vo.fieldArr}_{$vo.name|default=''} .fieldext_upload_html:last").find('input').val(paths[i]); // 设置隐藏域 要提交的值
- }
- }
- /*
- * 上传之后删除组图input
- * @access public
- * @val string 删除的图片input
- */
- function {$vo.fieldArr}_{$vo.name|default=''}_ClearPicArr2(obj,path)
- {
- // 删除数据库记录
- $.ajax({
- type:'POST',
- url:"{:url('user/UsersRelease/del_channelimgs', ['_ajax'=>1])}",
- data:{filename:path,channel:"{$channel_id|default='0'}",fieldid:"{$vo.id}",aid:"{$aid|default='0'}"},
- success:function(){
- $(obj).parent().remove(); // 删除完服务器的, 再删除 html上的图片
- $.ajax({
- type:'POST',
- url:"{:url('user/Uploadify/delupload', ['_ajax'=>1])}",
- data:{action:"del", filename:path},
- success:function(){}
- });
- }
- });
- }
-
- /** 以下 图集相册的拖动排序相关 js*/
-
- $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).sortable({
- start: function( event, ui) {
-
- }
- ,stop: function( event, ui ) {
- }
- });
- //因为他们要拖动,所以尽量设置他们的文字不能选择。
- $( ".sort-list-{$vo.fieldArr}_{$vo.name|default=''}" ).disableSelection();
- </script>
- <!-- 多张图 end -->
- {/case}
-
- {case value="int"}
- <!-- 整数类型 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
- </div>
- <div class="from-row-r">
- <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="只允许纯数字" class="el-input__inner w500" onkeyup="this.value=this.value.replace(/[^0-9]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9]/g,''));"> {$vo.dfvalue_unit|default=''}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 整数类型 end -->
- {/case}
-
- {case value="float"}
- <!-- 小数类型 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
- </div>
- <div class="from-row-r">
- <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="" class="el-input__inner w500" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]/g,''));"> {$vo.dfvalue_unit|default=''}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 小数类型 end -->
- {/case}
-
- {case value="decimal"}
- <!-- 金额类型 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
- </div>
- <div class="from-row-r">
- <input type="text" value="{$vo.dfvalue|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" placeholder="" class="el-input__inner w500" onkeyup="this.value=this.value.replace(/[^0-9\.]/g,'');" onbeforepaste="clipboardData.setData('text',clipboardData.getData('text').replace(/[^0-9\.]/g,''));"> {$vo.dfvalue_unit|default=''}
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <!-- 金额类型 end -->
- {/case}
-
- {case value="datetime"}
- <!-- 日期和时间 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
- </div>
- <div class="from-row-r">
- <input type="text" class="el-input__inner w500" name="{$vo.fieldArr}[{$vo.name|default=''}]" id="{$vo.fieldArr}_{$vo.name|default=''}" value="{$vo['dfvalue']}">
- <i class="el-icon-date"></i>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <script type="text/javascript">
- $(function () {
- $('#{$vo.fieldArr}_{$vo.name|default=''}').layDate();
- });
- </script>
- <!-- 日期和时间 end -->
- {/case}
-
- {case value="htmltext"}
- <!-- HTML文本 start -->
- <div class="item-from-row">
- <div class="from-row-l">
- <label for="title">{if condition="isset($vo['ifrequire']) AND !empty($vo['ifrequire'])"}<span class="red">*</span>{/if}{$vo.title|default=''}:</label>
- </div>
- <div class="from-row-r">
- <textarea class="wb100" id="{$vo.fieldArr}_{$vo.name|default=''}" data-func="{$vo.fieldArr}_{$vo.name|default=''}" name="{$vo.fieldArr}[{$vo.name|default=''}]" title="">{$vo.dfvalue|default=''}</textarea>
- <span class="err"></span>
- <p class="notic">{$vo.remark|default=''}</p>
- </div>
- </div>
- <script type="text/javascript">
- var ue_{$vo.fieldArr}_{$vo.name|default=''} = UE.getEditor('{$vo.fieldArr}_{$vo.name|default=''}',{
- serverUrl :"{:url('Uploadify/index',array('savepath'=>'allimg'))}",
- zIndex: 999,
- initialFrameWidth: "100%", //初化宽度
- initialFrameHeight: 350, //初化高度
- focus: false, //初始化时,是否让编辑器获得焦点true或false
- maximumWords: 99999,
- removeFormatAttributes: 'class,style,lang,width,height,align,hspace,valign',//允许的最大字符数 'fullscreen',
- pasteplain:false, //是否默认为纯文本粘贴。false为不使用纯文本粘贴,true为使用纯文本粘贴
- autoHeightEnabled: false,
- toolbars: [['fullscreen', 'forecolor', 'backcolor', 'removeformat', '|', 'simpleupload', 'unlink', '|', 'paragraph', 'fontfamily', 'fontsize']],
- // xss 过滤是否开启,inserthtml等操作
- xssFilterRules: true,
- //input xss过滤
- inputXssFilter: true,
- //output xss过滤
- outputXssFilter: true
- });
-
- //必须在提交前渲染编辑器;
- function {$vo.fieldArr}_{$vo.name|default=''}() {
- //判断编辑模式状态:0表示【源代码】HTML视图;1是【设计】视图,即可见即所得;-1表示不可用
- if(UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").queryCommandState('source') != 0) {
- UE.getEditor("{$vo.fieldArr}_{$vo.name|default=''}").execCommand('source'); //切换到【设计】视图
- }
- }
- </script>
- <!-- HTML文本 end -->
- {/case}
- {/switch}
- {/if}
- {/volist}
|